unifying CFTypes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50577 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2007-12-08 17:48:58 +00:00
parent 504f8052fd
commit dbe4a80c57
29 changed files with 170 additions and 264 deletions

View File

@@ -48,7 +48,7 @@ public:
void Set(CFStringRef key, const wxString& value) void Set(CFStringRef key, const wxString& value)
{ {
CFDictionarySetValue(*this, key, wxMacCFStringHolder(value)); CFDictionarySetValue(*this, key, wxCFStringRef(value));
} }
}; };

View File

@@ -822,7 +822,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
CFRelease( url ) ; CFRelease( url ) ;
CFStringRef path = CFURLCopyFileSystemPath ( urlParent , kCFURLPOSIXPathStyle ) ; CFStringRef path = CFURLCopyFileSystemPath ( urlParent , kCFURLPOSIXPathStyle ) ;
CFRelease( urlParent ) ; CFRelease( urlParent ) ;
wxString cwd = wxMacCFStringHolder(path).AsString(wxLocale::GetSystemEncoding()); wxString cwd = wxCFStringRef(path).AsString(wxLocale::GetSystemEncoding());
wxSetWorkingDirectory( cwd ) ; wxSetWorkingDirectory( cwd ) ;
} }

View File

@@ -152,7 +152,7 @@ wxSize wxButton::DoGetBestSize() const
OSStatus err = m_peer->GetData<ControlFontStyleRec>( kControlEntireControl, kControlFontStyleTag, &controlFont ); OSStatus err = m_peer->GetData<ControlFontStyleRec>( kControlEntireControl, kControlFontStyleTag, &controlFont );
verify_noerr( err ); verify_noerr( err );
wxMacCFStringHolder str( m_label, m_font.GetEncoding() ); wxCFStringRef str( m_label, m_font.GetEncoding() );
#if wxMAC_USE_ATSU_TEXT #if wxMAC_USE_ATSU_TEXT
SInt16 baseline; SInt16 baseline;

View File

@@ -56,7 +56,7 @@ wxColour& wxColour::operator=(CGColorRef col)
bool wxColour::IsOk() const bool wxColour::IsOk() const
{ {
return m_cgColour.get() != NULL; return m_cgColour;
} }
void wxColour::InitRGBA (ChannelType r, ChannelType g, ChannelType b, ChannelType a) void wxColour::InitRGBA (ChannelType r, ChannelType g, ChannelType b, ChannelType a)

View File

@@ -720,7 +720,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
if (errorStatus == noErr) if (errorStatus == noErr)
{ {
// variable definitions and initializations: // variable definitions and initializations:
wxMacCFStringHolder modifiedString(stringReference); wxCFStringRef modifiedString(stringReference);
wxVariant modifiedData(modifiedString.AsString()); wxVariant modifiedData(modifiedString.AsString());
if (dataViewCtrlPtr->GetModel()->SetValue(modifiedData,wxDataViewItem(reinterpret_cast<void*>(itemID)),static_cast<unsigned int>(columnIndex))) if (dataViewCtrlPtr->GetModel()->SetValue(modifiedData,wxDataViewItem(reinterpret_cast<void*>(itemID)),static_cast<unsigned int>(columnIndex)))

View File

@@ -184,7 +184,7 @@ void wxDataFormat::SetId( NativeFormat format )
else else
{ {
m_type = wxDF_PRIVATE; m_type = wxDF_PRIVATE;
m_id = wxMacCFStringHolder( (CFStringRef) CFRetain((CFStringRef) format )).AsString(); m_id = wxCFStringRef( (CFStringRef) CFRetain((CFStringRef) format )).AsString();
} }
} }
@@ -198,7 +198,7 @@ void wxDataFormat::SetId( const wxString& zId )
m_format = 0; m_format = 0;
} }
// since it is private, no need to conform to anything ... // since it is private, no need to conform to anything ...
m_format = (long) wxMacCFStringHolder(m_id).Detach(); m_format = (long) wxCFRetain( (CFStringRef) wxCFStringRef(m_id) );
} }
bool wxDataFormat::operator==(const wxDataFormat& format) const bool wxDataFormat::operator==(const wxDataFormat& format) const
@@ -423,7 +423,7 @@ bool wxDataObject::GetFromPasteboard( void * pb )
CFMutableStringRef cfMutableString = CFStringCreateMutableCopy(NULL, 0, cfString); CFMutableStringRef cfMutableString = CFStringCreateMutableCopy(NULL, 0, cfString);
CFRelease( cfString ); CFRelease( cfString );
CFStringNormalize(cfMutableString,kCFStringNormalizationFormC); CFStringNormalize(cfMutableString,kCFStringNormalizationFormC);
wxString path = wxMacCFStringHolder(cfMutableString).AsString(); wxString path = wxCFStringRef(cfMutableString).AsString();
if (!path.empty()) if (!path.empty())
filenamesPassed += path + wxT("\n"); filenamesPassed += path + wxT("\n");
} }

View File

@@ -113,7 +113,7 @@ static DataBrowserItemID* CreateDataBrowserItemIDArray(size_t& noOfEntries, wxDa
return itemIDs; return itemIDs;
} /* CreateDataBrowserItemIDArray(size_t&, wxDataViewItemArray const&) */ } /* CreateDataBrowserItemIDArray(size_t&, wxDataViewItemArray const&) */
static bool InitializeColumnDescription(DataBrowserListViewColumnDesc& columnDescription, wxDataViewColumn const* columnPtr, DataBrowserPropertyID columnPropertyID, wxMacCFStringHolder const& title) static bool InitializeColumnDescription(DataBrowserListViewColumnDesc& columnDescription, wxDataViewColumn const* columnPtr, DataBrowserPropertyID columnPropertyID, wxCFStringRef const& title)
{ {
// set properties for the column: // set properties for the column:
columnDescription.propertyDesc.propertyID = columnPropertyID; columnDescription.propertyDesc.propertyID = columnPropertyID;
@@ -172,7 +172,7 @@ static bool InitializeColumnDescription(DataBrowserListViewColumnDesc& columnDes
columnDescription.headerBtnDesc.btnContentInfo.u.iconRef = columnPtr->GetBitmap().GetIconRef(); columnDescription.headerBtnDesc.btnContentInfo.u.iconRef = columnPtr->GetBitmap().GetIconRef();
// done: // done:
return true; return true;
} /* InitializeColumnDescription(DataBrowserListViewColumnDesc&, wxDataViewColumn const*, DataBrowserPropertyID, wxMacCFStringHolder const&) */ } /* InitializeColumnDescription(DataBrowserListViewColumnDesc&, wxDataViewColumn const*, DataBrowserPropertyID, wxCFStringRef const&) */
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// local function pointers // local function pointers
@@ -493,7 +493,7 @@ bool wxDataViewTextRenderer::Render(void)
if (this->GetValue().GetType() == this->GetVariantType()) if (this->GetValue().GetType() == this->GetVariantType())
{ {
// variable definition: // variable definition:
wxMacCFStringHolder cfString(this->GetValue().GetString(),(this->GetView()->GetFont().Ok() ? this->GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding())); wxCFStringRef cfString(this->GetValue().GetString(),(this->GetView()->GetFont().Ok() ? this->GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
return (::SetDataBrowserItemDataText(this->GetDataReference(),cfString) == noErr); return (::SetDataBrowserItemDataText(this->GetDataReference(),cfString) == noErr);
} /* if */ } /* if */
@@ -570,7 +570,7 @@ bool wxDataViewIconTextRenderer::Render(void)
iconText << this->GetValue(); iconText << this->GetValue();
// variable definition: // variable definition:
wxMacCFStringHolder cfString(iconText.GetText(),(this->GetView()->GetFont().Ok() ? this->GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding())); wxCFStringRef cfString(iconText.GetText(),(this->GetView()->GetFont().Ok() ? this->GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
if (iconText.GetIcon().IsOk()) if (iconText.GetIcon().IsOk())
{ {
@@ -877,7 +877,7 @@ void wxDataViewColumn::SetTitle(wxString const& title)
{ {
// variable definition and initialization: // variable definition and initialization:
DataBrowserListViewHeaderDesc headerDescription; DataBrowserListViewHeaderDesc headerDescription;
wxMacCFStringHolder cfTitle(title,(dataViewCtrlPtr->GetFont().Ok() ? dataViewCtrlPtr->GetFont().GetEncoding() : wxLocale::GetSystemEncoding())); wxCFStringRef cfTitle(title,(dataViewCtrlPtr->GetFont().Ok() ? dataViewCtrlPtr->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()));
wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description.")); wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description."));
headerDescription.titleString = cfTitle; headerDescription.titleString = cfTitle;
@@ -956,7 +956,7 @@ bool wxDataViewCtrl::AppendColumn(wxDataViewColumn* columnPtr)
wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer)); wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
wxMacCFStringHolder title(columnPtr->GetTitle(),this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding()); wxCFStringRef title(columnPtr->GetTitle(),this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding());
// first, some error checking: // first, some error checking:
@@ -1072,7 +1072,7 @@ bool wxDataViewCtrl::PrependColumn(wxDataViewColumn* columnPtr)
wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer)); wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(this->m_peer));
wxMacCFStringHolder title(columnPtr->GetTitle(),this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding()); wxCFStringRef title(columnPtr->GetTitle(),this->m_font.Ok() ? this->m_font.GetEncoding() : wxLocale::GetSystemEncoding());
// first, some error checking: // first, some error checking:

View File

@@ -87,7 +87,7 @@ int wxDirDialog::ShowModal()
options.optionFlags &= ~kNavAllowMultipleFiles; options.optionFlags &= ~kNavAllowMultipleFiles;
if (err == noErr) if (err == noErr)
{ {
wxMacCFStringHolder message(m_message, m_font.GetEncoding()); wxCFStringRef message(m_message, m_font.GetEncoding());
options.message = message; options.message = message;
err = NavCreateChooseFolderDialog(&options, sStandardNavEventFilter , NULL, this , &dialog); err = NavCreateChooseFolderDialog(&options, sStandardNavEventFilter , NULL, this , &dialog);
if (err == noErr) if (err == noErr)

View File

@@ -110,14 +110,14 @@ static pascal void NavEventProc(
wxString extension = firstExtension.AfterLast('.') ; wxString extension = firstExtension.AfterLast('.') ;
wxString sfilename ; wxString sfilename ;
wxMacCFStringHolder cfString( NavDialogGetSaveFileName( ioParams->context ) , false ); wxCFStringRef cfString( wxCFRetain( NavDialogGetSaveFileName( ioParams->context ) ) );
sfilename = cfString.AsString() ; sfilename = cfString.AsString() ;
int pos = sfilename.Find('.', true) ; int pos = sfilename.Find('.', true) ;
if ( pos != wxNOT_FOUND && extension != wxT("*") ) if ( pos != wxNOT_FOUND && extension != wxT("*") )
{ {
sfilename = sfilename.Left(pos+1)+extension ; sfilename = sfilename.Left(pos+1)+extension ;
cfString.Assign( sfilename , wxFONTENCODING_DEFAULT ) ; cfString = wxCFStringRef( sfilename , wxFONTENCODING_DEFAULT ) ;
NavDialogSetSaveFileName( ioParams->context , cfString ) ; NavDialogSetSaveFileName( ioParams->context , cfString ) ;
} }
} }
@@ -301,10 +301,10 @@ int wxFileDialog::ShowModal()
// this was always unset in the old code // this was always unset in the old code
dialogCreateOptions.optionFlags &= ~kNavSelectDefaultLocation; dialogCreateOptions.optionFlags &= ~kNavSelectDefaultLocation;
wxMacCFStringHolder message(m_message, m_font.GetEncoding()); wxCFStringRef message(m_message, m_font.GetEncoding());
dialogCreateOptions.windowTitle = message; dialogCreateOptions.windowTitle = message;
wxMacCFStringHolder defaultFileName(m_fileName, m_font.GetEncoding()); wxCFStringRef defaultFileName(m_fileName, m_font.GetEncoding());
dialogCreateOptions.saveFileName = defaultFileName; dialogCreateOptions.saveFileName = defaultFileName;
@@ -324,7 +324,7 @@ int wxFileDialog::ShowModal()
myData.menuitems = dialogCreateOptions.popupExtension ; myData.menuitems = dialogCreateOptions.popupExtension ;
for ( size_t i = 0 ; i < numFilters ; ++i ) for ( size_t i = 0 ; i < numFilters ; ++i )
{ {
CFArrayAppendValue( popup , (CFStringRef) wxMacCFStringHolder( myData.name[i] , m_font.GetEncoding() ) ) ; CFArrayAppendValue( popup , (CFStringRef) wxCFStringRef( myData.name[i] , m_font.GetEncoding() ) ) ;
} }
} }

View File

@@ -362,9 +362,9 @@ void wxFontRefData::MacFindFont()
m_ctFont.reset(CTFontCreateUIFontForLanguage( kCTFontSystemFontType, 0.0, NULL )); m_ctFont.reset(CTFontCreateUIFontForLanguage( kCTFontSystemFontType, 0.0, NULL ));
} }
if ( m_ctFont.get() ) if ( m_ctFont )
{ {
wxMacCFStringHolder name( CTFontCopyFamilyName( m_ctFont ) ); wxCFStringRef name( CTFontCopyFamilyName( m_ctFont ) );
m_faceName = name.AsString(); m_faceName = name.AsString();
m_pointSize = CTFontGetSize(m_ctFont) ; m_pointSize = CTFontGetSize(m_ctFont) ;
CTFontSymbolicTraits traits = CTFontGetSymbolicTraits( m_ctFont ); CTFontSymbolicTraits traits = CTFontGetSymbolicTraits( m_ctFont );
@@ -402,7 +402,7 @@ void wxFontRefData::MacFindFont()
} }
} }
wxMacCFStringHolder cf( m_faceName, wxLocale::GetSystemEncoding() ); wxCFStringRef cf( m_faceName, wxLocale::GetSystemEncoding() );
CTFontSymbolicTraits traits = 0; CTFontSymbolicTraits traits = 0;
if (m_weight == wxBOLD) if (m_weight == wxBOLD)
@@ -539,7 +539,7 @@ void wxFontRefData::MacFindFont()
m_macFontFamily = GetAppFont(); m_macFontFamily = GetAppFont();
else else
{ {
wxMacCFStringHolder cf( m_faceName, wxLocale::GetSystemEncoding() ); wxCFStringRef cf( m_faceName, wxLocale::GetSystemEncoding() );
ATSFontFamilyRef atsfamily = ATSFontFamilyFindFromName( cf , kATSOptionFlagsDefault ); ATSFontFamilyRef atsfamily = ATSFontFamilyFindFromName( cf , kATSOptionFlagsDefault );
if ( atsfamily == (ATSFontFamilyRef) -1 ) if ( atsfamily == (ATSFontFamilyRef) -1 )
{ {

View File

@@ -132,7 +132,7 @@ wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler),
#endif #endif
if ( cfName!=NULL ) if ( cfName!=NULL )
{ {
fontdata.m_chosenFont.SetFaceName(wxMacCFStringHolder(cfName).AsString(wxLocale::GetSystemEncoding())); fontdata.m_chosenFont.SetFaceName(wxCFStringRef(cfName).AsString(wxLocale::GetSystemEncoding()));
fontdata.m_chosenFont.SetPointSize(fontSize); fontdata.m_chosenFont.SetPointSize(fontSize);
fontdata.m_chosenFont.SetStyle(fontStyle & italic ? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL); fontdata.m_chosenFont.SetStyle(fontStyle & italic ? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL);
fontdata.m_chosenFont.SetUnderlined((fontStyle & underline)!=0); fontdata.m_chosenFont.SetUnderlined((fontStyle & underline)!=0);

View File

@@ -65,14 +65,14 @@
{ {
[super initWithFrame:rectBox]; [super initWithFrame:rectBox];
wxMacCFStringHolder cfOkString( wxT("OK"), wxLocale::GetSystemEncoding() ); wxCFStringRef cfOkString( wxT("OK"), wxLocale::GetSystemEncoding() );
wxMacCFStringHolder cfCancelString( wxT("Cancel"), wxLocale::GetSystemEncoding() ); wxCFStringRef cfCancelString( wxT("Cancel"), wxLocale::GetSystemEncoding() );
NSRect rectCancel = NSMakeRect( 10.0 , 10.0 , 82 , 24 ); NSRect rectCancel = NSMakeRect( 10.0 , 10.0 , 82 , 24 );
NSRect rectOK = NSMakeRect( 100.0 , 10.0 , 82 , 24 ); NSRect rectOK = NSMakeRect( 100.0 , 10.0 , 82 , 24 );
NSButton* cancelButton = [[NSButton alloc] initWithFrame:rectCancel]; NSButton* cancelButton = [[NSButton alloc] initWithFrame:rectCancel];
[cancelButton setTitle:(NSString*)cfCancelString.Detach()]; [cancelButton setTitle:(NSString*)wxCFRetain((CFStringRef)cfCancelString)];
[cancelButton setBezelStyle:NSRoundedBezelStyle]; [cancelButton setBezelStyle:NSRoundedBezelStyle];
[cancelButton setButtonType:NSMomentaryPushInButton]; [cancelButton setButtonType:NSMomentaryPushInButton];
[cancelButton setAction:@selector(cancelPressed:)]; [cancelButton setAction:@selector(cancelPressed:)];
@@ -80,7 +80,7 @@
m_cancelButton = cancelButton ; m_cancelButton = cancelButton ;
NSButton* okButton = [[NSButton alloc] initWithFrame:rectOK]; NSButton* okButton = [[NSButton alloc] initWithFrame:rectOK];
[okButton setTitle:(NSString*)cfOkString.Detach()]; [okButton setTitle:(NSString*)wxCFRetain((CFStringRef)cfOkString)];
[okButton setBezelStyle:NSRoundedBezelStyle]; [okButton setBezelStyle:NSRoundedBezelStyle];
[okButton setButtonType:NSMomentaryPushInButton]; [okButton setButtonType:NSMomentaryPushInButton];
[okButton setAction:@selector(okPressed:)]; [okButton setAction:@selector(okPressed:)];

View File

@@ -87,7 +87,7 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
CFStringRef theName = NULL; CFStringRef theName = NULL;
ATSFontFamilyGetName(theATSFontFamilyRef, kATSOptionFlagsDefault, &theName); ATSFontFamilyGetName(theATSFontFamilyRef, kATSOptionFlagsDefault, &theName);
wxMacCFStringHolder cfName(theName) ; wxCFStringRef cfName(theName) ;
fontFamilies.Add(cfName.AsString(wxLocale::GetSystemEncoding())); fontFamilies.Add(cfName.AsString(wxLocale::GetSystemEncoding()));
} }
else if (status == kATSIterationScopeModified) // Make sure the font database hasn<73>t changed. else if (status == kATSIterationScopeModified) // Make sure the font database hasn<73>t changed.

View File

@@ -1443,22 +1443,53 @@ bool wxMacCoreGraphicsContext::SetLogicalFunction( int function )
EnsureIsValid(); EnsureIsValid();
bool retval = false; bool retval = false;
bool shouldAntiAlias = true;
CGBlendMode mode = kCGBlendModeNormal;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
if ( UMAGetSystemVersion() >= 0x1050 )
{
retval = true;
switch ( function )
{
// TODO find best corresponding porter duff modes
case wxCOPY :
mode = kCGBlendModeCopy;
break;
case wxCLEAR :
mode = kCGBlendModeClear;
break;
case wxXOR :
mode = kCGBlendModeXOR;
shouldAntiAlias = false;
break;
default :
retval = false;
break;
}
}
else
#endif
{
if ( function == wxCOPY ) if ( function == wxCOPY )
{ {
retval = true; retval = true;
CGContextSetBlendMode( m_cgContext, kCGBlendModeNormal );
} }
else if ( function == wxINVERT || function == wxXOR ) else if ( function == wxINVERT || function == wxXOR )
{ {
// change color to white // change color to white
CGContextSetBlendMode( m_cgContext, kCGBlendModeExclusion ); mode = kCGBlendModeExclusion;
CGContextSetShouldAntialias( m_cgContext, false ); shouldAntiAlias = false;
retval = true; retval = true;
} }
}
if (retval) if (retval)
{
m_logicalFunction = function; m_logicalFunction = function;
CGContextSetBlendMode( m_cgContext, mode );
CGContextSetShouldAntialias(m_cgContext, shouldAntiAlias);
}
return retval ; return retval ;
} }
@@ -1745,7 +1776,7 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub
if ( UMAGetSystemVersion() >= 0x1050 ) if ( UMAGetSystemVersion() >= 0x1050 )
{ {
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData(); wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
wxMacCFStringHolder text(str, wxLocale::GetSystemEncoding() ); wxCFStringRef text(str, wxLocale::GetSystemEncoding() );
CTFontRef font = fref->GetCTFont(); CTFontRef font = fref->GetCTFont();
CGColorRef col = fref->GetColour().GetPixel(); CGColorRef col = fref->GetColour().GetPixel();
CTUnderlineStyle ustyle = fref->GetUnderlined() ? kCTUnderlineStyleSingle : kCTUnderlineStyleNone ; CTUnderlineStyle ustyle = fref->GetUnderlined() ? kCTUnderlineStyleSingle : kCTUnderlineStyleNone ;
@@ -1797,34 +1828,11 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub
{ {
OSStatus status = noErr; OSStatus status = noErr;
ATSUTextLayout atsuLayout; ATSUTextLayout atsuLayout;
UniCharCount chars = str.length(); wxMacUniCharBuffer unibuf( str );
UniChar* ubuf = NULL; UniCharCount chars = unibuf.GetChars();
#if SIZEOF_WCHAR_T == 4
wxMBConvUTF16 converter;
#if wxUSE_UNICODE
size_t unicharlen = converter.WC2MB( NULL , str.wc_str() , 0 );
ubuf = (UniChar*) malloc( unicharlen + 2 );
converter.WC2MB( (char*) ubuf , str.wc_str(), unicharlen + 2 );
#else
const wxWCharBuffer wchar = str.wc_str( wxConvLocal );
size_t unicharlen = converter.WC2MB( NULL , wchar.data() , 0 );
ubuf = (UniChar*) malloc( unicharlen + 2 );
converter.WC2MB( (char*) ubuf , wchar.data() , unicharlen + 2 );
#endif
chars = unicharlen / 2;
#else
#if wxUSE_UNICODE
ubuf = (UniChar*) str.wc_str();
#else
wxWCharBuffer wchar = str.wc_str( wxConvLocal );
chars = wxWcslen( wchar.data() );
ubuf = (UniChar*) wchar.data();
#endif
#endif
ATSUStyle style = (((wxMacCoreGraphicsFontData*)m_font.GetRefData())->GetATSUStyle()); ATSUStyle style = (((wxMacCoreGraphicsFontData*)m_font.GetRefData())->GetATSUStyle());
status = ::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) ubuf , 0 , chars , chars , 1 , status = ::ATSUCreateTextLayoutWithTextPtr( unibuf.GetBuffer() , 0 , chars , chars , 1 ,
&chars , &style , &atsuLayout ); &chars , &style , &atsuLayout );
wxASSERT_MSG( status == noErr , wxT("couldn't create the layout of the rotated text") ); wxASSERT_MSG( status == noErr , wxT("couldn't create the layout of the rotated text") );
@@ -1897,9 +1905,6 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub
::ATSUDisposeTextLayout(atsuLayout); ::ATSUDisposeTextLayout(atsuLayout);
#if SIZEOF_WCHAR_T == 4
free( ubuf );
#endif
return; return;
} }
#endif #endif
@@ -1932,7 +1937,7 @@ void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *wid
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData(); wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
CTFontRef font = fref->GetCTFont(); CTFontRef font = fref->GetCTFont();
wxMacCFStringHolder text(str, wxLocale::GetSystemEncoding() ); wxCFStringRef text(str, wxLocale::GetSystemEncoding() );
CFStringRef keys[] = { kCTFontAttributeName }; CFStringRef keys[] = { kCTFontAttributeName };
CFTypeRef values[] = { font }; CFTypeRef values[] = { font };
wxCFRef<CFDictionaryRef> attributes( CFDictionaryCreate(kCFAllocatorDefault, (const void**) &keys, (const void**) &values, wxCFRef<CFDictionaryRef> attributes( CFDictionaryCreate(kCFAllocatorDefault, (const void**) &keys, (const void**) &values,
@@ -1960,34 +1965,11 @@ void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *wid
OSStatus status = noErr; OSStatus status = noErr;
ATSUTextLayout atsuLayout; ATSUTextLayout atsuLayout;
UniCharCount chars = str.length(); wxMacUniCharBuffer unibuf( str );
UniChar* ubuf = NULL; UniCharCount chars = unibuf.GetChars();
#if SIZEOF_WCHAR_T == 4
wxMBConvUTF16 converter;
#if wxUSE_UNICODE
size_t unicharlen = converter.WC2MB( NULL , str.wc_str() , 0 );
ubuf = (UniChar*) malloc( unicharlen + 2 );
converter.WC2MB( (char*) ubuf , str.wc_str(), unicharlen + 2 );
#else
const wxWCharBuffer wchar = str.wc_str( wxConvLocal );
size_t unicharlen = converter.WC2MB( NULL , wchar.data() , 0 );
ubuf = (UniChar*) malloc( unicharlen + 2 );
converter.WC2MB( (char*) ubuf , wchar.data() , unicharlen + 2 );
#endif
chars = unicharlen / 2;
#else
#if wxUSE_UNICODE
ubuf = (UniChar*) str.wc_str();
#else
wxWCharBuffer wchar = str.wc_str( wxConvLocal );
chars = wxWcslen( wchar.data() );
ubuf = (UniChar*) wchar.data();
#endif
#endif
ATSUStyle style = (((wxMacCoreGraphicsFontData*)m_font.GetRefData())->GetATSUStyle()); ATSUStyle style = (((wxMacCoreGraphicsFontData*)m_font.GetRefData())->GetATSUStyle());
status = ::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) ubuf , 0 , chars , chars , 1 , status = ::ATSUCreateTextLayoutWithTextPtr( unibuf.GetBuffer() , 0 , chars , chars , 1 ,
&chars , &style , &atsuLayout ); &chars , &style , &atsuLayout );
wxASSERT_MSG( status == noErr , wxT("couldn't create the layout of the text") ); wxASSERT_MSG( status == noErr , wxT("couldn't create the layout of the text") );
@@ -2008,9 +1990,7 @@ void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *wid
*width = FixedToInt(textAfter - textBefore); *width = FixedToInt(textAfter - textBefore);
::ATSUDisposeTextLayout(atsuLayout); ::ATSUDisposeTextLayout(atsuLayout);
#if SIZEOF_WCHAR_T == 4
free( ubuf ) ;
#endif
return; return;
} }
#endif #endif
@@ -2032,7 +2012,7 @@ void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArr
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData(); wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
CTFontRef font = fref->GetCTFont(); CTFontRef font = fref->GetCTFont();
wxMacCFStringHolder t(text, wxLocale::GetSystemEncoding() ); wxCFStringRef t(text, wxLocale::GetSystemEncoding() );
CFStringRef keys[] = { kCTFontAttributeName }; CFStringRef keys[] = { kCTFontAttributeName };
CFTypeRef values[] = { font }; CFTypeRef values[] = { font };
wxCFRef<CFDictionaryRef> attributes( CFDictionaryCreate(kCFAllocatorDefault, (const void**) &keys, (const void**) &values, wxCFRef<CFDictionaryRef> attributes( CFDictionaryCreate(kCFAllocatorDefault, (const void**) &keys, (const void**) &values,
@@ -2052,34 +2032,11 @@ void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArr
#if wxMAC_USE_ATSU_TEXT #if wxMAC_USE_ATSU_TEXT
{ {
ATSUTextLayout atsuLayout; ATSUTextLayout atsuLayout;
UniCharCount chars = text.length(); wxMacUniCharBuffer unibuf( text );
UniChar* ubuf = NULL; UniCharCount chars = unibuf.GetChars();
#if SIZEOF_WCHAR_T == 4
wxMBConvUTF16 converter;
#if wxUSE_UNICODE
size_t unicharlen = converter.WC2MB( NULL , text.wc_str() , 0 );
ubuf = (UniChar*) malloc( unicharlen + 2 );
converter.WC2MB( (char*) ubuf , text.wc_str(), unicharlen + 2 );
#else
const wxWCharBuffer wchar = text.wc_str( wxConvLocal );
size_t unicharlen = converter.WC2MB( NULL , wchar.data() , 0 );
ubuf = (UniChar*) malloc( unicharlen + 2 );
converter.WC2MB( (char*) ubuf , wchar.data() , unicharlen + 2 );
#endif
chars = unicharlen / 2;
#else
#if wxUSE_UNICODE
ubuf = (UniChar*) text.wc_str();
#else
wxWCharBuffer wchar = text.wc_str( wxConvLocal );
chars = wxWcslen( wchar.data() );
ubuf = (UniChar*) wchar.data();
#endif
#endif
ATSUStyle style = (((wxMacCoreGraphicsFontData*)m_font.GetRefData())->GetATSUStyle()); ATSUStyle style = (((wxMacCoreGraphicsFontData*)m_font.GetRefData())->GetATSUStyle());
::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) ubuf , 0 , chars , chars , 1 , ::ATSUCreateTextLayoutWithTextPtr( unibuf.GetBuffer() , 0 , chars , chars , 1 ,
&chars , &style , &atsuLayout ); &chars , &style , &atsuLayout );
for ( int pos = 0; pos < (int)chars; pos ++ ) for ( int pos = 0; pos < (int)chars; pos ++ )
@@ -2099,9 +2056,6 @@ void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArr
} }
::ATSUDisposeTextLayout(atsuLayout); ::ATSUDisposeTextLayout(atsuLayout);
#if SIZEOF_WCHAR_T == 4
free( ubuf ) ;
#endif
} }
#endif #endif
#if wxMAC_USE_CG_TEXT #if wxMAC_USE_CG_TEXT

View File

@@ -970,7 +970,7 @@ bool wxListCtrl::SetColumn(int col, wxListItem& item)
enc = m_font.GetEncoding(); enc = m_font.GetEncoding();
else else
enc = wxLocale::GetSystemEncoding(); enc = wxLocale::GetSystemEncoding();
wxMacCFStringHolder cfTitle; wxCFStringRef cfTitle;
cfTitle.Assign( item.GetText() , enc ); cfTitle.Assign( item.GetText() , enc );
if(columnDesc.titleString) if(columnDesc.titleString)
CFRelease(columnDesc.titleString); CFRelease(columnDesc.titleString);
@@ -2666,8 +2666,7 @@ void wxMacDataBrowserListCtrlControl::DrawItem(
if (font == wxNullFont) if (font == wxNullFont)
font = listFont; font = listFont;
wxMacCFStringHolder cfString; wxCFStringRef cfString( text, wxLocale::GetSystemEncoding() );
cfString.Assign( text, wxLocale::GetSystemEncoding() );
Rect enclosingRect; Rect enclosingRect;
CGRect enclosingCGRect, iconCGRect, textCGRect; CGRect enclosingCGRect, iconCGRect, textCGRect;
@@ -2888,10 +2887,8 @@ OSStatus wxMacDataBrowserListCtrlControl::GetSetItemData(DataBrowserItemID itemI
default : default :
if ( property >= kMinColumnId ) if ( property >= kMinColumnId )
{ {
wxMacCFStringHolder cfStr;
if (!text.IsEmpty()){ if (!text.IsEmpty()){
cfStr.Assign( text, wxLocale::GetSystemEncoding() ); wxCFStringRef cfStr( text, wxLocale::GetSystemEncoding() );
err = ::SetDataBrowserItemDataText( itemData, cfStr ); err = ::SetDataBrowserItemDataText( itemData, cfStr );
err = noErr; err = noErr;
} }
@@ -2926,7 +2923,7 @@ OSStatus wxMacDataBrowserListCtrlControl::GetSetItemData(DataBrowserItemID itemI
// can then deal with the veto // can then deal with the veto
CFStringRef sr ; CFStringRef sr ;
verify_noerr( GetDataBrowserItemDataText( itemData , &sr ) ) ; verify_noerr( GetDataBrowserItemDataText( itemData , &sr ) ) ;
wxMacCFStringHolder cfStr(sr) ;; wxCFStringRef cfStr(sr) ;;
if (m_isVirtual) if (m_isVirtual)
list->SetItem( (long)itemData-1 , listColumn, cfStr.AsString() ) ; list->SetItem( (long)itemData-1 , listColumn, cfStr.AsString() ) ;
else else

View File

@@ -83,7 +83,7 @@ wxMetafileRefData::wxMetafileRefData( const wxString& filename )
if ( !filename.empty() ) if ( !filename.empty() )
{ {
wxCFRef<CFMutableStringRef> cfMutableString(CFStringCreateMutableCopy(NULL, 0, wxMacCFStringHolder(filename))); wxCFRef<CFMutableStringRef> cfMutableString(CFStringCreateMutableCopy(NULL, 0, wxCFStringRef(filename)));
CFStringNormalize(cfMutableString,kCFStringNormalizationFormD); CFStringNormalize(cfMutableString,kCFStringNormalizationFormD);
wxCFRef<CFURLRef> url(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfMutableString , kCFURLPOSIXPathStyle, false)); wxCFRef<CFURLRef> url(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfMutableString , kCFURLPOSIXPathStyle, false));
m_pdfDoc.reset(CGPDFDocumentCreateWithURL(url)); m_pdfDoc.reset(CGPDFDocumentCreateWithURL(url));

View File

@@ -420,7 +420,7 @@ wxString wxFileTypeImpl::GetCommand(const wxString& verb) const
CFURLRef cfurlAppPath; CFURLRef cfurlAppPath;
OSStatus status = LSGetApplicationForInfo( kLSUnknownType, OSStatus status = LSGetApplicationForInfo( kLSUnknownType,
kLSUnknownCreator, kLSUnknownCreator,
wxMacCFStringHolder(sCurrentExtension, wxLocale::GetSystemEncoding()), wxCFStringRef(sCurrentExtension, wxLocale::GetSystemEncoding()),
kLSRolesAll, kLSRolesAll,
NULL, NULL,
&cfurlAppPath ); &cfurlAppPath );
@@ -438,7 +438,7 @@ wxString wxFileTypeImpl::GetCommand(const wxString& verb) const
resultStr = resultStr =
wxString(wxT("'")) wxString(wxT("'"))
+ wxMacCFStringHolder(cfsUnixPath).AsString(wxLocale::GetSystemEncoding()) + wxCFStringRef(cfsUnixPath).AsString(wxLocale::GetSystemEncoding())
+ wxString(wxT("'")); + wxString(wxT("'"));
return resultStr; return resultStr;
@@ -764,11 +764,9 @@ pascal OSStatus MoreProcGetProcessTypeSignature(
class wxCFDictionary class wxCFDictionary
{ {
public: public:
wxCFDictionary(CFTypeRef ref, bool bRetain = wxCF_RELEASE) wxCFDictionary(CFTypeRef ref)
{ {
m_cfmdRef = (CFMutableDictionaryRef) ref; m_cfmdRef = (CFMutableDictionaryRef) ref;
if (bRetain == wxCF_RETAIN && ref)
CFRetain(ref);
} }
wxCFDictionary(CFIndex cfiSize = 0) wxCFDictionary(CFIndex cfiSize = 0)
@@ -895,8 +893,8 @@ public:
for (CFIndex i = 0; i < cfiCount; ++i) for (CFIndex i = 0; i < cfiCount; ++i)
{ {
wxString sKey = wxMacCFStringHolder(CFCopyTypeIDDescription(CFGetTypeID(pKeys[i]))).AsString(); wxString sKey = wxCFStringRef(CFCopyTypeIDDescription(CFGetTypeID(pKeys[i]))).AsString();
wxString sValue = wxMacCFStringHolder(CFCopyTypeIDDescription(CFGetTypeID(pValues[i]))).AsString(); wxString sValue = wxCFStringRef(CFCopyTypeIDDescription(CFGetTypeID(pValues[i]))).AsString();
sMessage << sMessage <<
wxString::Format(wxT("[{#%d} Key : %s]"), (int) i, wxString::Format(wxT("[{#%d} Key : %s]"), (int) i,
@@ -921,7 +919,7 @@ public:
{ {
for (CFIndex i = 0; i < CFArrayGetCount(cfaRef); ++i) for (CFIndex i = 0; i < CFArrayGetCount(cfaRef); ++i)
{ {
wxString sValue = wxMacCFStringHolder(CFCopyTypeIDDescription(CFGetTypeID( wxString sValue = wxCFStringRef(CFCopyTypeIDDescription(CFGetTypeID(
CFArrayGetValueAtIndex(cfaRef, i) CFArrayGetValueAtIndex(cfaRef, i)
))).AsString(); ))).AsString();
@@ -939,7 +937,7 @@ public:
if (sValue == wxT("CFString")) if (sValue == wxT("CFString"))
{ {
sMessage << wxMacCFStringHolder((CFStringRef)cfRef, false).AsString(); sMessage << wxCFStringRef(wxCFRetain((CFStringRef)cfRef)).AsString();
} }
else if (sValue == wxT("CFNumber")) else if (sValue == wxT("CFNumber"))
{ {
@@ -961,7 +959,7 @@ public:
} }
else if (sValue == wxT("CFURL")) else if (sValue == wxT("CFURL"))
{ {
sMessage << wxMacCFStringHolder(CFURLCopyPath((CFURLRef) cfRef)).AsString(); sMessage << wxCFStringRef(CFURLCopyPath((CFURLRef) cfRef)).AsString();
} }
else else
{ {
@@ -992,7 +990,7 @@ public:
if (cfsError) if (cfsError)
{ {
if (pErrorMsg) if (pErrorMsg)
*pErrorMsg = wxMacCFStringHolder(cfsError).AsString(); *pErrorMsg = wxCFStringRef(cfsError).AsString();
else else
CFRelease(cfsError); CFRelease(cfsError);
} }
@@ -1011,11 +1009,9 @@ private:
class wxCFArray class wxCFArray
{ {
public: public:
wxCFArray(CFTypeRef ref, bool bRetain = wxCF_RELEASE) wxCFArray(CFTypeRef ref)
{ {
m_cfmaRef = (CFMutableArrayRef)ref; m_cfmaRef = (CFMutableArrayRef)ref;
if (bRetain == wxCF_RETAIN && ref)
CFRetain(ref);
} }
wxCFArray(CFIndex cfiSize = 0) : m_cfmaRef(NULL) wxCFArray(CFIndex cfiSize = 0) : m_cfmaRef(NULL)
@@ -1120,37 +1116,6 @@ private:
CFMutableArrayRef m_cfmaRef; CFMutableArrayRef m_cfmaRef;
}; };
// ----------------------------------------------------------------------------
// wxCFString
// ----------------------------------------------------------------------------
class wxCFString
{
public:
wxCFString(CFTypeRef ref, bool bRetain = wxCF_RELEASE) : m_Holder((CFStringRef)ref, bRetain == wxCF_RELEASE)
{}
wxCFString(const wxChar* szString) : m_Holder(wxString(szString), wxLocale::GetSystemEncoding())
{}
wxCFString(const wxString& sString) : m_Holder(sString, wxLocale::GetSystemEncoding())
{}
virtual ~wxCFString() {}
operator CFTypeRef() const
{ return (CFTypeRef) ((CFStringRef) m_Holder); }
bool IsOk()
{ return ((CFTypeRef)(*this)) != NULL; }
wxString BuildWXString()
{ return m_Holder.AsString(); }
private:
wxMacCFStringHolder m_Holder;
};
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxCFNumber // wxCFNumber
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -1163,10 +1128,8 @@ public:
m_cfnRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &nValue); m_cfnRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &nValue);
} }
wxCFNumber(CFTypeRef ref, bool bRetain = wxCF_RELEASE) : m_cfnRef((CFNumberRef)ref) wxCFNumber(CFTypeRef ref) : m_cfnRef((CFNumberRef)ref)
{ {
if (bRetain == wxCF_RETAIN && ref)
CFRetain(ref);
} }
virtual ~wxCFNumber() virtual ~wxCFNumber()
@@ -1200,18 +1163,16 @@ private:
class wxCFURL class wxCFURL
{ {
public: public:
wxCFURL(CFTypeRef ref = NULL, bool bRetain = wxCF_RELEASE) : m_cfurlRef((CFURLRef)ref) wxCFURL(CFTypeRef ref = NULL) : m_cfurlRef((CFURLRef)ref)
{ {
if (bRetain == wxCF_RETAIN && ref)
CFRetain(ref);
} }
wxCFURL(const wxCFString& URLString, CFTypeRef BaseURL = NULL) wxCFURL(const wxCFStringRef& URLString, CFTypeRef BaseURL = NULL)
{ {
Create(URLString, BaseURL); Create(URLString, BaseURL);
} }
void Create(const wxCFString& URLString, CFTypeRef BaseURL = NULL) void Create(const wxCFStringRef& URLString, CFTypeRef BaseURL = NULL)
{ {
m_cfurlRef = CFURLCreateWithString( m_cfurlRef = CFURLCreateWithString(
kCFAllocatorDefault, kCFAllocatorDefault,
@@ -1227,7 +1188,7 @@ public:
wxString BuildWXString() wxString BuildWXString()
{ {
return wxCFString(CFURLCopyPath(m_cfurlRef)).BuildWXString(); return wxCFStringRef(CFURLCopyPath(m_cfurlRef)).AsString();
} }
operator CFTypeRef() const operator CFTypeRef() const
@@ -1249,10 +1210,8 @@ private:
class wxCFData class wxCFData
{ {
public: public:
wxCFData(CFTypeRef ref, bool bRetain = wxCF_RELEASE) : m_cfdaRef((CFDataRef)ref) wxCFData(CFTypeRef ref) : m_cfdaRef((CFDataRef)ref)
{ {
if (bRetain == wxCF_RETAIN && ref)
CFRetain(ref);
} }
wxCFData(const UInt8* pBytes, CFIndex len, bool bKeep = wxCFDATA_RELEASEBUFFER) wxCFData(const UInt8* pBytes, CFIndex len, bool bKeep = wxCFDATA_RELEASEBUFFER)
@@ -1453,7 +1412,7 @@ wxFileType* wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo)
{ {
cfdInfo.MakeMutable( cfdInfo.GetCount() + 1 ); cfdInfo.MakeMutable( cfdInfo.GetCount() + 1 );
wxCFArray cfaDocTypes( cfdInfo[ wxCFString(wxT("CFBundleDocumentTypes")) ], wxCF_RETAIN ); wxCFArray cfaDocTypes( wxCFRetain( cfdInfo[ wxCFStringRef(wxT("CFBundleDocumentTypes")) ] ) );
bool bAddDocTypesArrayToDictionary = !cfaDocTypes.IsOk(); bool bAddDocTypesArrayToDictionary = !cfaDocTypes.IsOk();
if (bAddDocTypesArrayToDictionary) if (bAddDocTypesArrayToDictionary)
@@ -1467,12 +1426,11 @@ wxFileType* wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo)
CFIndex i; CFIndex i;
for (i = 0; i < cfaDocTypes.GetCount(); ++i) for (i = 0; i < cfaDocTypes.GetCount(); ++i)
{ {
wxCFDictionary cfdDocTypeEntry( cfaDocTypes[i], wxCF_RETAIN ); wxCFDictionary cfdDocTypeEntry( wxCFRetain( cfaDocTypes[i] ) );
// A lot of apps don't support MIME types for some reason // A lot of apps don't support MIME types for some reason
// so we go by extensions only // so we go by extensions only
wxCFArray cfaExtensions( cfdDocTypeEntry[ wxCFString(wxT("CFBundleTypeExtensions")) ], wxCFArray cfaExtensions( wxCFRetain( cfdDocTypeEntry[ wxCFStringRef(wxT("CFBundleTypeExtensions")) ] ) );
wxCF_RETAIN );
if (!cfaExtensions.IsOk()) if (!cfaExtensions.IsOk())
continue; continue;
@@ -1482,7 +1440,7 @@ wxFileType* wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo)
for (size_t iWXExt = 0; iWXExt < asExtensions.GetCount(); ++iWXExt) for (size_t iWXExt = 0; iWXExt < asExtensions.GetCount(); ++iWXExt)
{ {
if (asExtensions[iWXExt] == if (asExtensions[iWXExt] ==
wxCFString(cfaExtensions[iExt], wxCF_RETAIN).BuildWXString()) wxCFStringRef( wxCFRetain( (CFStringRef) cfaExtensions[iExt] ) ).AsString())
{ {
bEntryFound = true; bEntryFound = true;
dwFoundIndex = iWXExt; dwFoundIndex = iWXExt;
@@ -1503,14 +1461,14 @@ wxFileType* wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo)
if (!ftInfo.GetDescription().empty()) if (!ftInfo.GetDescription().empty())
{ {
cfdNewEntry.Add( wxCFString(wxT("CFBundleTypeName")), cfdNewEntry.Add( wxCFStringRef(wxT("CFBundleTypeName")),
wxCFString(ftInfo.GetDescription()) ); wxCFStringRef(ftInfo.GetDescription()) );
} }
if (!ftInfo.GetIconFile().empty()) if (!ftInfo.GetIconFile().empty())
{ {
cfdNewEntry.Add( wxCFString(wxT("CFBundleTypeIconFile")), cfdNewEntry.Add( wxCFStringRef(wxT("CFBundleTypeIconFile")),
wxCFString(ftInfo.GetIconFile()) ); wxCFStringRef(ftInfo.GetIconFile()) );
} }
wxCFArray cfaOSTypes; wxCFArray cfaOSTypes;
@@ -1518,33 +1476,33 @@ wxFileType* wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo)
wxCFArray cfaMimeTypes; wxCFArray cfaMimeTypes;
//OSTypes is a cfarray of four-char-codes - '****' for unrestricted //OSTypes is a cfarray of four-char-codes - '****' for unrestricted
cfaOSTypes.Add( wxCFString(wxT("****")) ); cfaOSTypes.Add( wxCFStringRef(wxT("****")) );
cfdNewEntry.Add( wxCFString(wxT("CFBundleTypeOSTypes")), cfaOSTypes ); cfdNewEntry.Add( wxCFStringRef(wxT("CFBundleTypeOSTypes")), cfaOSTypes );
//'*' for unrestricted //'*' for unrestricted
if (ftInfo.GetExtensionsCount() != 0) if (ftInfo.GetExtensionsCount() != 0)
{ {
for (size_t iExtension = 0; iExtension < ftInfo.GetExtensionsCount(); ++iExtension) for (size_t iExtension = 0; iExtension < ftInfo.GetExtensionsCount(); ++iExtension)
{ {
cfaExtensions.Add( wxCFString( asExtensions[iExtension] ) ); cfaExtensions.Add( wxCFStringRef( asExtensions[iExtension] ) );
} }
cfdNewEntry.Add( wxCFString(wxT("CFBundleTypeExtensions")), cfaExtensions ); cfdNewEntry.Add( wxCFStringRef(wxT("CFBundleTypeExtensions")), cfaExtensions );
} }
if (!ftInfo.GetMimeType().empty()) if (!ftInfo.GetMimeType().empty())
{ {
cfaMimeTypes.Add( wxCFString(ftInfo.GetMimeType()) ); cfaMimeTypes.Add( wxCFStringRef(ftInfo.GetMimeType()) );
cfdNewEntry.Add( wxCFString(wxT("CFBundleTypeMIMETypes")), cfaMimeTypes ); cfdNewEntry.Add( wxCFStringRef(wxT("CFBundleTypeMIMETypes")), cfaMimeTypes );
} }
// Editor - can perform all actions // Editor - can perform all actions
// Viewer - all actions except manipulation/saving // Viewer - all actions except manipulation/saving
// None - can perform no actions // None - can perform no actions
cfdNewEntry.Add( wxCFString(wxT("CFBundleTypeRole")), wxCFString(wxT("Editor")) ); cfdNewEntry.Add( wxCFStringRef(wxT("CFBundleTypeRole")), wxCFStringRef(wxT("Editor")) );
// Is application bundled? // Is application bundled?
cfdNewEntry.Add( wxCFString(wxT("LSTypeIsPackage")), kCFBooleanTrue ); cfdNewEntry.Add( wxCFStringRef(wxT("LSTypeIsPackage")), kCFBooleanTrue );
if (bEntryFound) if (bEntryFound)
cfaDocTypes.Set(i, cfdNewEntry); cfaDocTypes.Set(i, cfdNewEntry);
@@ -1553,9 +1511,9 @@ wxFileType* wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo)
// set the doc types array in the muted dictionary // set the doc types array in the muted dictionary
if (bAddDocTypesArrayToDictionary) if (bAddDocTypesArrayToDictionary)
cfdInfo.Add(wxCFString(wxT("CFBundleDocumentTypes")), cfaDocTypes); cfdInfo.Add(wxCFStringRef(wxT("CFBundleDocumentTypes")), cfaDocTypes);
else else
cfdInfo.Set(wxCFString(wxT("CFBundleDocumentTypes")), cfaDocTypes); cfdInfo.Set(wxCFStringRef(wxT("CFBundleDocumentTypes")), cfaDocTypes);
cfdInfo.MakeValidXML(); cfdInfo.MakeValidXML();
@@ -1802,7 +1760,7 @@ wxMimeTypesManagerImpl::Unassociate(wxFileType *pFileType)
{ {
cfdInfo.MakeMutable( cfdInfo.GetCount() + 1 ); cfdInfo.MakeMutable( cfdInfo.GetCount() + 1 );
wxCFArray cfaDocTypes( cfdInfo[ wxCFString(wxT("CFBundleDocumentTypes")) ], wxCF_RETAIN ); wxCFArray cfaDocTypes( wxCFRetain( cfdInfo[ wxCFStringRef(wxT("CFBundleDocumentTypes")) ] ) );
if (cfaDocTypes.IsOk()) if (cfaDocTypes.IsOk())
{ {
@@ -1812,12 +1770,11 @@ wxMimeTypesManagerImpl::Unassociate(wxFileType *pFileType)
CFIndex i; CFIndex i;
for (i = 0; i < cfaDocTypes.GetCount(); ++i) for (i = 0; i < cfaDocTypes.GetCount(); ++i)
{ {
wxCFDictionary cfdDocTypeEntry( cfaDocTypes[i], wxCF_RETAIN ); wxCFDictionary cfdDocTypeEntry( wxCFRetain( cfaDocTypes[i] ) );
//A lot of apps dont do to mime types for some reason //A lot of apps dont do to mime types for some reason
//so we go by extensions only //so we go by extensions only
wxCFArray cfaExtensions( cfdDocTypeEntry[ wxCFString(wxT("CFBundleTypeExtensions")) ], wxCFArray cfaExtensions( wxCFRetain( cfdDocTypeEntry[ wxCFStringRef(wxT("CFBundleTypeExtensions")) ]) );
wxCF_RETAIN );
if (!cfaExtensions.IsOk()) if (!cfaExtensions.IsOk())
continue; continue;
@@ -1827,11 +1784,11 @@ wxMimeTypesManagerImpl::Unassociate(wxFileType *pFileType)
for (size_t iWXExt = 0; iWXExt < asExtensions.GetCount(); ++iWXExt) for (size_t iWXExt = 0; iWXExt < asExtensions.GetCount(); ++iWXExt)
{ {
if (asExtensions[iWXExt] == if (asExtensions[iWXExt] ==
wxCFString(cfaExtensions[iExt], wxCF_RETAIN).BuildWXString()) wxCFStringRef( wxCFRetain( (CFStringRef) cfaExtensions[iExt] ) ).AsString())
{ {
bEntryFound = true; bEntryFound = true;
cfaDocTypes.Remove(i); cfaDocTypes.Remove(i);
cfdInfo.Set( wxCFString(wxT("CFBundleDocumentTypes")) , cfaDocTypes ); cfdInfo.Set( wxCFStringRef(wxT("CFBundleDocumentTypes")) , cfaDocTypes );
break; break;
} }
} //end of wxstring array } //end of wxstring array
@@ -1972,7 +1929,7 @@ wxMimeTypesManagerImpl::Unassociate(wxFileType *pFileType)
&cfsError); &cfsError);
if (cfsError && cfiWritten == 0) if (cfsError && cfiWritten == 0)
{ {
wxLogDebug(wxCFString(cfsError).BuildWXString()); wxLogDebug(wxCFStringRef(cfsError).BuildWXString());
wxString sMessage; wxString sMessage;
cfdInfo.PrintOut(sMessage); cfdInfo.PrintOut(sMessage);
wxLogDebug(sMessage); wxLogDebug(sMessage);

View File

@@ -110,13 +110,13 @@ int wxMessageDialog::ShowModal()
CFStringRef alternateButtonTitle = NULL; CFStringRef alternateButtonTitle = NULL;
CFStringRef otherButtonTitle = NULL; CFStringRef otherButtonTitle = NULL;
wxMacCFStringHolder cfTitle( msgtitle, m_font.GetEncoding() ); wxCFStringRef cfTitle( msgtitle, m_font.GetEncoding() );
wxMacCFStringHolder cfText( msgtext, m_font.GetEncoding() ); wxCFStringRef cfText( msgtext, m_font.GetEncoding() );
wxMacCFStringHolder cfNoString( m_no.c_str(), m_font.GetEncoding() ); wxCFStringRef cfNoString( m_no.c_str(), m_font.GetEncoding() );
wxMacCFStringHolder cfYesString( m_yes.c_str(), m_font.GetEncoding() ); wxCFStringRef cfYesString( m_yes.c_str(), m_font.GetEncoding() );
wxMacCFStringHolder cfOKString( m_ok.c_str() , m_font.GetEncoding()) ; wxCFStringRef cfOKString( m_ok.c_str() , m_font.GetEncoding()) ;
wxMacCFStringHolder cfCancelString( m_cancel.c_str(), m_font.GetEncoding() ); wxCFStringRef cfCancelString( m_cancel.c_str(), m_font.GetEncoding() );
int buttonId[4] = { 0, 0, 0, wxID_CANCEL /* time-out */ }; int buttonId[4] = { 0, 0, 0, wxID_CANCEL /* time-out */ };
@@ -167,13 +167,13 @@ int wxMessageDialog::ShowModal()
short result; short result;
AlertStdCFStringAlertParamRec param; AlertStdCFStringAlertParamRec param;
wxMacCFStringHolder cfNoString( m_no.c_str(), m_font.GetEncoding() ); wxCFStringRef cfNoString( m_no.c_str(), m_font.GetEncoding() );
wxMacCFStringHolder cfYesString( m_yes.c_str(), m_font.GetEncoding() ); wxCFStringRef cfYesString( m_yes.c_str(), m_font.GetEncoding() );
wxMacCFStringHolder cfOKString( m_ok.c_str(), m_font.GetEncoding() ); wxCFStringRef cfOKString( m_ok.c_str(), m_font.GetEncoding() );
wxMacCFStringHolder cfCancelString( m_cancel.c_str(), m_font.GetEncoding() ); wxCFStringRef cfCancelString( m_cancel.c_str(), m_font.GetEncoding() );
wxMacCFStringHolder cfTitle( msgtitle, m_font.GetEncoding() ); wxCFStringRef cfTitle( msgtitle, m_font.GetEncoding() );
wxMacCFStringHolder cfText( msgtext, m_font.GetEncoding() ); wxCFStringRef cfText( msgtext, m_font.GetEncoding() );
param.movable = true; param.movable = true;
param.flags = 0; param.flags = 0;

View File

@@ -399,7 +399,7 @@ void wxNotebook::MacSetupTabs()
page = m_pages[ii]; page = m_pages[ii];
info.version = kControlTabInfoVersionOne; info.version = kControlTabInfoVersionOne;
info.iconSuiteID = 0; info.iconSuiteID = 0;
wxMacCFStringHolder cflabel( page->GetLabel(), m_font.GetEncoding() ) ; wxCFStringRef cflabel( page->GetLabel(), m_font.GetEncoding() ) ;
info.name = cflabel ; info.name = cflabel ;
m_peer->SetData<ControlTabInfoRecV1>( ii + 1, kControlTabInfoTag, &info ) ; m_peer->SetData<ControlTabInfoRecV1>( ii + 1, kControlTabInfoTag, &info ) ;

View File

@@ -140,7 +140,7 @@ bool wxMacCarbonPrintData::TransferFrom( const wxPrintData &data )
// collate cannot be set // collate cannot be set
#if 0 // not yet tested #if 0 // not yet tested
if ( !m_printerName.empty() ) if ( !m_printerName.empty() )
PMSessionSetCurrentPrinter( (PMPrintSession) m_macPrintSession , wxMacCFStringHolder( m_printerName , wxFont::GetDefaultEncoding() ) ) ; PMSessionSetCurrentPrinter( (PMPrintSession) m_macPrintSession , wxCFStringRef( m_printerName , wxFont::GetDefaultEncoding() ) ) ;
#endif #endif
#ifndef __LP64__ #ifndef __LP64__
PMColorMode color ; PMColorMode color ;
@@ -222,7 +222,7 @@ bool wxMacCarbonPrintData::TransferTo( wxPrintData &data )
// collate cannot be set // collate cannot be set
#if 0 #if 0
{ {
wxMacCFStringHolder name ; wxCFStringRef name ;
PMPrinter printer ; PMPrinter printer ;
PMSessionGetCurrentPrinter( m_macPrintSession , PMSessionGetCurrentPrinter( m_macPrintSession ,
&printer ) ; &printer ) ;

View File

@@ -393,7 +393,7 @@ bool wxSound::DoPlay(unsigned flags) const
Handle dataRef = NULL; Handle dataRef = NULL;
OSType dataRefType; OSType dataRefType;
err = QTNewDataReferenceFromFullPathCFString(wxMacCFStringHolder(m_sndname,wxLocale::GetSystemEncoding()), err = QTNewDataReferenceFromFullPathCFString(wxCFStringRef(m_sndname,wxLocale::GetSystemEncoding()),
(UInt32)kQTNativeDefaultPathStyle, 0, &dataRef, &dataRefType); (UInt32)kQTNativeDefaultPathStyle, 0, &dataRef, &dataRefType);
wxASSERT(err == noErr); wxASSERT(err == noErr);

View File

@@ -159,7 +159,7 @@ void wxMacSearchFieldControl::SetDescriptiveText(const wxString& text)
{ {
verify_noerr( HISearchFieldSetDescriptiveText( verify_noerr( HISearchFieldSetDescriptiveText(
m_controlRef, m_controlRef,
wxMacCFStringHolder( text, wxFont::GetDefaultEncoding() ))); wxCFStringRef( text, wxFont::GetDefaultEncoding() )));
} }
wxString wxMacSearchFieldControl::GetDescriptiveText() const wxString wxMacSearchFieldControl::GetDescriptiveText() const
@@ -168,7 +168,7 @@ wxString wxMacSearchFieldControl::GetDescriptiveText() const
verify_noerr( HISearchFieldCopyDescriptiveText( m_controlRef, &cfStr )); verify_noerr( HISearchFieldCopyDescriptiveText( m_controlRef, &cfStr ));
if ( cfStr ) if ( cfStr )
{ {
return wxMacCFStringHolder(cfStr).AsString(); return wxCFStringRef(cfStr).AsString();
} }
else else
{ {

View File

@@ -92,7 +92,7 @@ wxSize wxStaticText::DoGetBestSize() const
OSStatus err = m_peer->GetData<ControlFontStyleRec>( kControlEntireControl, kControlFontStyleTag, &controlFont ); OSStatus err = m_peer->GetData<ControlFontStyleRec>( kControlEntireControl, kControlFontStyleTag, &controlFont );
verify_noerr( err ); verify_noerr( err );
wxMacCFStringHolder str( m_label, m_font.GetEncoding() ); wxCFStringRef str( m_label, m_font.GetEncoding() );
#if wxMAC_USE_ATSU_TEXT #if wxMAC_USE_ATSU_TEXT
SInt16 baseline; SInt16 baseline;
@@ -179,7 +179,7 @@ void wxStaticText::DoSetLabel(const wxString& label)
m_labelOrig = label; m_labelOrig = label;
m_label = RemoveMnemonics(label); m_label = RemoveMnemonics(label);
wxMacCFStringHolder str( m_label, m_font.GetEncoding() ); wxCFStringRef str( m_label, m_font.GetEncoding() );
OSStatus err = m_peer->SetData<CFStringRef>(kControlEntireControl, kControlStaticTextCFStringTag, str); OSStatus err = m_peer->SetData<CFStringRef>(kControlEntireControl, kControlStaticTextCFStringTag, str);
verify_noerr( err ); verify_noerr( err );
} }

View File

@@ -1339,7 +1339,7 @@ bool wxMacUnicodeTextControl::Create( wxTextCtrl *wxPeer,
Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ; Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ;
wxString st = str ; wxString st = str ;
wxMacConvertNewlines10To13( &st ) ; wxMacConvertNewlines10To13( &st ) ;
wxMacCFStringHolder cf(st , m_font.GetEncoding()) ; wxCFStringRef cf(st , m_font.GetEncoding()) ;
CFStringRef cfr = cf ; CFStringRef cfr = cf ;
m_valueTag = kControlEditTextCFStringTag ; m_valueTag = kControlEditTextCFStringTag ;
@@ -1383,7 +1383,7 @@ wxString wxMacUnicodeTextControl::GetStringValue() const
CFStringRef value = GetData<CFStringRef>(0, m_valueTag) ; CFStringRef value = GetData<CFStringRef>(0, m_valueTag) ;
if ( value ) if ( value )
{ {
wxMacCFStringHolder cf(value) ; wxCFStringRef cf(value) ;
result = cf.AsString() ; result = cf.AsString() ;
} }
@@ -1400,7 +1400,7 @@ void wxMacUnicodeTextControl::SetStringValue( const wxString &str )
{ {
wxString st = str ; wxString st = str ;
wxMacConvertNewlines10To13( &st ) ; wxMacConvertNewlines10To13( &st ) ;
wxMacCFStringHolder cf( st , m_font.GetEncoding() ) ; wxCFStringRef cf( st , m_font.GetEncoding() ) ;
verify_noerr( SetData<CFStringRef>( 0, m_valueTag , cf ) ) ; verify_noerr( SetData<CFStringRef>( 0, m_valueTag , cf ) ) ;
} }
@@ -1466,7 +1466,7 @@ void wxMacUnicodeTextControl::SetSelection( long from , long to )
CFStringRef value = GetData<CFStringRef>(0, m_valueTag) ; CFStringRef value = GetData<CFStringRef>(0, m_valueTag) ;
if ( value ) if ( value )
{ {
wxMacCFStringHolder cf(value) ; wxCFStringRef cf(value) ;
textLength = cf.AsString().length() ; textLength = cf.AsString().length() ;
} }
@@ -1499,7 +1499,7 @@ void wxMacUnicodeTextControl::WriteText( const wxString& str )
if ( HasFocus() ) if ( HasFocus() )
{ {
wxMacCFStringHolder cf(st , m_font.GetEncoding() ) ; wxCFStringRef cf(st , m_font.GetEncoding() ) ;
CFStringRef value = cf ; CFStringRef value = cf ;
SetData<CFStringRef>( 0, kControlEditTextInsertCFStringRefTag, &value ); SetData<CFStringRef>( 0, kControlEditTextInsertCFStringRefTag, &value );
} }

View File

@@ -187,8 +187,8 @@ public:
HIToolbarItemSetHelpText( HIToolbarItemSetHelpText(
m_toolbarItemRef, m_toolbarItemRef,
wxMacCFStringHolder( GetShortHelp(), enc ), wxCFStringRef( GetShortHelp(), enc ),
wxMacCFStringHolder( GetLongHelp(), enc ) ); wxCFStringRef( GetLongHelp(), enc ) );
} }
} }
@@ -831,7 +831,7 @@ bool wxToolBar::Create(
{ {
wxString labelStr = wxString::Format( wxT("%p"), this ); wxString labelStr = wxString::Format( wxT("%p"), this );
err = HIToolbarCreate( err = HIToolbarCreate(
wxMacCFStringHolder( labelStr, wxFont::GetDefaultEncoding() ), 0, wxCFStringRef( labelStr, wxFont::GetDefaultEncoding() ), 0,
(HIToolbarRef*) &m_macHIToolbarRef ); (HIToolbarRef*) &m_macHIToolbarRef );
if (m_macHIToolbarRef != NULL) if (m_macHIToolbarRef != NULL)
@@ -1516,7 +1516,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
HIToolbarItemRef item; HIToolbarItemRef item;
wxString labelStr = wxString::Format(wxT("%p"), tool); wxString labelStr = wxString::Format(wxT("%p"), tool);
err = HIToolbarItemCreate( err = HIToolbarItemCreate(
wxMacCFStringHolder(labelStr, wxFont::GetDefaultEncoding()), wxCFStringRef(labelStr, wxFont::GetDefaultEncoding()),
kHIToolbarItemCantBeRemoved | kHIToolbarItemAnchoredLeft | kHIToolbarItemAllowDuplicates, &item ); kHIToolbarItemCantBeRemoved | kHIToolbarItemAnchoredLeft | kHIToolbarItemAllowDuplicates, &item );
if (err == noErr) if (err == noErr)
{ {
@@ -1526,7 +1526,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
InstallEventHandler( InstallEventHandler(
HIObjectGetEventTarget(item), GetwxMacToolBarEventHandlerUPP(), HIObjectGetEventTarget(item), GetwxMacToolBarEventHandlerUPP(),
GetEventTypeCount(toolBarEventList), toolBarEventList, tool, NULL ); GetEventTypeCount(toolBarEventList), toolBarEventList, tool, NULL );
HIToolbarItemSetLabel( item, wxMacCFStringHolder(label, m_font.GetEncoding()) ); HIToolbarItemSetLabel( item, wxCFStringRef(label, m_font.GetEncoding()) );
HIToolbarItemSetImage( item, info2.u.imageRef ); HIToolbarItemSetImage( item, info2.u.imageRef );
HIToolbarItemSetCommandID( item, kHIToolbarCommandPressAction ); HIToolbarItemSetCommandID( item, kHIToolbarCommandPressAction );
tool->SetToolbarItemRef( item ); tool->SetToolbarItemRef( item );
@@ -1542,7 +1542,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
#if 0 #if 0
SetBevelButtonTextPlacement( m_controlHandle, kControlBevelButtonPlaceBelowGraphic ); SetBevelButtonTextPlacement( m_controlHandle, kControlBevelButtonPlaceBelowGraphic );
SetControlTitleWithCFString( m_controlHandle , wxMacCFStringHolder( label, wxFont::GetDefaultEncoding() ); SetControlTitleWithCFString( m_controlHandle , wxCFStringRef( label, wxFont::GetDefaultEncoding() );
#endif #endif
InstallControlEventHandler( InstallControlEventHandler(

View File

@@ -228,7 +228,7 @@ void wxMacToolTip::Draw()
wxMacLocalToGlobal( m_window , &p ) ; wxMacLocalToGlobal( m_window , &p ) ;
SetRect( &tag.absHotRect , p.h - 2 , p.v - 2 , p.h + 2 , p.v + 2 ); SetRect( &tag.absHotRect , p.h - 2 , p.v - 2 , p.h + 2 , p.v + 2 );
m_helpTextRef.Assign( m_label , wxFONTENCODING_DEFAULT ) ; m_helpTextRef = wxCFStringRef( m_label , wxFONTENCODING_DEFAULT ) ;
tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ; tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ;
tag.content[kHMMinimumContentIndex].u.tagCFString = m_helpTextRef ; tag.content[kHMMinimumContentIndex].u.tagCFString = m_helpTextRef ;
tag.content[kHMMaximumContentIndex].contentType = kHMCFStringContent ; tag.content[kHMMaximumContentIndex].contentType = kHMCFStringContent ;
@@ -258,7 +258,6 @@ void wxMacToolTip::Clear()
return ; return ;
HMHideTag() ; HMHideTag() ;
m_helpTextRef.Release() ;
} }
#endif // wxUSE_TOOLTIPS #endif // wxUSE_TOOLTIPS

View File

@@ -1204,7 +1204,7 @@ void wxTopLevelWindowMac::DoMacCreateRealWindow(
SetWindowBounds( (WindowRef) m_macWindow , kWindowStructureRgn , &theBoundsRect ) ; SetWindowBounds( (WindowRef) m_macWindow , kWindowStructureRgn , &theBoundsRect ) ;
wxAssociateWinWithMacWindow( (WindowRef) m_macWindow , this ) ; wxAssociateWinWithMacWindow( (WindowRef) m_macWindow , this ) ;
SetWindowTitleWithCFString( (WindowRef) m_macWindow , wxMacCFStringHolder( title , m_font.GetEncoding() ) ); SetWindowTitleWithCFString( (WindowRef) m_macWindow , wxCFStringRef( title , m_font.GetEncoding() ) );
m_peer = new wxMacControl(this , true /*isRootControl*/) ; m_peer = new wxMacControl(this , true /*isRootControl*/) ;
// There is a bug in 10.2.X for ::GetRootControl returning the window view instead of // There is a bug in 10.2.X for ::GetRootControl returning the window view instead of
@@ -1301,7 +1301,7 @@ void wxTopLevelWindowMac::MacActivate( long timestamp , bool WXUNUSED(inIsActiva
void wxTopLevelWindowMac::SetTitle(const wxString& title) void wxTopLevelWindowMac::SetTitle(const wxString& title)
{ {
wxWindow::SetLabel( title ) ; wxWindow::SetLabel( title ) ;
SetWindowTitleWithCFString( (WindowRef) m_macWindow , wxMacCFStringHolder( title , m_font.GetEncoding() ) ) ; SetWindowTitleWithCFString( (WindowRef) m_macWindow , wxCFStringRef( title , m_font.GetEncoding() ) ) ;
} }
wxString wxTopLevelWindowMac::GetTitle() const wxString wxTopLevelWindowMac::GetTitle() const

View File

@@ -67,7 +67,7 @@ MenuRef UMANewMenu( SInt16 id , const wxString& title , wxFontEncoding encoding
MenuRef menu ; MenuRef menu ;
CreateNewMenu( id , 0 , &menu ) ; CreateNewMenu( id , 0 , &menu ) ;
SetMenuTitleWithCFString( menu , wxMacCFStringHolder(str , encoding ) ) ; SetMenuTitleWithCFString( menu , wxCFStringRef(str , encoding ) ) ;
return menu ; return menu ;
} }
@@ -76,7 +76,7 @@ void UMASetMenuTitle( MenuRef menu , const wxString& title , wxFontEncoding enco
{ {
wxString str = wxStripMenuCodes( title ) ; wxString str = wxStripMenuCodes( title ) ;
SetMenuTitleWithCFString( menu , wxMacCFStringHolder(str , encoding) ) ; SetMenuTitleWithCFString( menu , wxCFStringRef(str , encoding) ) ;
} }
void UMASetMenuItemText( MenuRef menu, MenuItemIndex item, const wxString& title, wxFontEncoding encoding ) void UMASetMenuItemText( MenuRef menu, MenuItemIndex item, const wxString& title, wxFontEncoding encoding )
@@ -84,7 +84,7 @@ void UMASetMenuItemText( MenuRef menu, MenuItemIndex item, const wxString& titl
// we don't strip the accels here anymore, must be done before // we don't strip the accels here anymore, must be done before
wxString str = title ; wxString str = title ;
SetMenuItemTextWithCFString( menu , item , wxMacCFStringHolder(str , encoding) ) ; SetMenuItemTextWithCFString( menu , item , wxCFStringRef(str , encoding) ) ;
} }
void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex inItem , bool enable) void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex inItem , bool enable)

View File

@@ -874,7 +874,7 @@ void wxMacControl::SetLabel( const wxString &title )
else else
encoding = wxFont::GetDefaultEncoding(); encoding = wxFont::GetDefaultEncoding();
SetControlTitleWithCFString( m_controlRef , wxMacCFStringHolder( title , encoding ) ); SetControlTitleWithCFString( m_controlRef , wxCFStringRef( title , encoding ) );
} }
void wxMacControl::GetFeatures( UInt32 * features ) void wxMacControl::GetFeatures( UInt32 * features )
@@ -1340,7 +1340,7 @@ void wxMacDataItem::SetColumn( short col )
void wxMacDataItem::SetLabel( const wxString& str) void wxMacDataItem::SetLabel( const wxString& str)
{ {
m_label = str; m_label = str;
m_cfLabel.Assign( str , wxLocale::GetSystemEncoding()); m_cfLabel = wxCFStringRef( str , wxLocale::GetSystemEncoding());
} }
const wxString& wxMacDataItem::GetLabel() const const wxString& wxMacDataItem::GetLabel() const
@@ -1601,8 +1601,7 @@ void wxMacDataItemBrowserControl::InsertColumn(int colId, DataBrowserPropertyTyp
enc = m_font.GetEncoding(); enc = m_font.GetEncoding();
else else
enc = wxLocale::GetSystemEncoding(); enc = wxLocale::GetSystemEncoding();
wxMacCFStringHolder cfTitle; wxCFStringRef cfTitle( title, enc );
cfTitle.Assign( title, enc );
columnDesc.headerBtnDesc.titleString = cfTitle; columnDesc.headerBtnDesc.titleString = cfTitle;
columnDesc.headerBtnDesc.minimumWidth = 0; columnDesc.headerBtnDesc.minimumWidth = 0;