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)
{
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 ) ;
CFStringRef path = CFURLCopyFileSystemPath ( urlParent , kCFURLPOSIXPathStyle ) ;
CFRelease( urlParent ) ;
wxString cwd = wxMacCFStringHolder(path).AsString(wxLocale::GetSystemEncoding());
wxString cwd = wxCFStringRef(path).AsString(wxLocale::GetSystemEncoding());
wxSetWorkingDirectory( cwd ) ;
}

View File

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

View File

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

View File

@ -720,7 +720,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
if (errorStatus == noErr)
{
// variable definitions and initializations:
wxMacCFStringHolder modifiedString(stringReference);
wxCFStringRef modifiedString(stringReference);
wxVariant modifiedData(modifiedString.AsString());
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
{
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;
}
// 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
@ -423,7 +423,7 @@ bool wxDataObject::GetFromPasteboard( void * pb )
CFMutableStringRef cfMutableString = CFStringCreateMutableCopy(NULL, 0, cfString);
CFRelease( cfString );
CFStringNormalize(cfMutableString,kCFStringNormalizationFormC);
wxString path = wxMacCFStringHolder(cfMutableString).AsString();
wxString path = wxCFStringRef(cfMutableString).AsString();
if (!path.empty())
filenamesPassed += path + wxT("\n");
}

View File

@ -113,7 +113,7 @@ static DataBrowserItemID* CreateDataBrowserItemIDArray(size_t& noOfEntries, wxDa
return itemIDs;
} /* 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:
columnDescription.propertyDesc.propertyID = columnPropertyID;
@ -172,7 +172,7 @@ static bool InitializeColumnDescription(DataBrowserListViewColumnDesc& columnDes
columnDescription.headerBtnDesc.btnContentInfo.u.iconRef = columnPtr->GetBitmap().GetIconRef();
// done:
return true;
} /* InitializeColumnDescription(DataBrowserListViewColumnDesc&, wxDataViewColumn const*, DataBrowserPropertyID, wxMacCFStringHolder const&) */
} /* InitializeColumnDescription(DataBrowserListViewColumnDesc&, wxDataViewColumn const*, DataBrowserPropertyID, wxCFStringRef const&) */
//-----------------------------------------------------------------------------
// local function pointers
@ -493,7 +493,7 @@ bool wxDataViewTextRenderer::Render(void)
if (this->GetValue().GetType() == this->GetVariantType())
{
// 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);
} /* if */
@ -570,7 +570,7 @@ bool wxDataViewIconTextRenderer::Render(void)
iconText << this->GetValue();
// 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())
{
@ -877,7 +877,7 @@ void wxDataViewColumn::SetTitle(wxString const& title)
{
// variable definition and initialization:
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."));
headerDescription.titleString = cfTitle;
@ -956,7 +956,7 @@ bool wxDataViewCtrl::AppendColumn(wxDataViewColumn* columnPtr)
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:
@ -1072,7 +1072,7 @@ bool wxDataViewCtrl::PrependColumn(wxDataViewColumn* columnPtr)
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:

View File

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

View File

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

@ -361,10 +361,10 @@ void wxFontRefData::MacFindFont()
{
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_pointSize = CTFontGetSize(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;
if (m_weight == wxBOLD)
@ -539,7 +539,7 @@ void wxFontRefData::MacFindFont()
m_macFontFamily = GetAppFont();
else
{
wxMacCFStringHolder cf( m_faceName, wxLocale::GetSystemEncoding() );
wxCFStringRef cf( m_faceName, wxLocale::GetSystemEncoding() );
ATSFontFamilyRef atsfamily = ATSFontFamilyFindFromName( cf , kATSOptionFlagsDefault );
if ( atsfamily == (ATSFontFamilyRef) -1 )
{

View File

@ -132,7 +132,7 @@ wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler),
#endif
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.SetStyle(fontStyle & italic ? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL);
fontdata.m_chosenFont.SetUnderlined((fontStyle & underline)!=0);

View File

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

View File

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

View File

@ -1443,22 +1443,53 @@ bool wxMacCoreGraphicsContext::SetLogicalFunction( int function )
EnsureIsValid();
bool retval = false;
if ( function == wxCOPY )
bool shouldAntiAlias = true;
CGBlendMode mode = kCGBlendModeNormal;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
if ( UMAGetSystemVersion() >= 0x1050 )
{
retval = true;
CGContextSetBlendMode( m_cgContext, kCGBlendModeNormal );
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 if ( function == wxINVERT || function == wxXOR )
else
#endif
{
// change color to white
CGContextSetBlendMode( m_cgContext, kCGBlendModeExclusion );
CGContextSetShouldAntialias( m_cgContext, false );
retval = true;
if ( function == wxCOPY )
{
retval = true;
}
else if ( function == wxINVERT || function == wxXOR )
{
// change color to white
mode = kCGBlendModeExclusion;
shouldAntiAlias = false;
retval = true;
}
}
if (retval)
{
m_logicalFunction = function;
CGContextSetBlendMode( m_cgContext, mode );
CGContextSetShouldAntialias(m_cgContext, shouldAntiAlias);
}
return retval ;
}
@ -1745,7 +1776,7 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub
if ( UMAGetSystemVersion() >= 0x1050 )
{
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
wxMacCFStringHolder text(str, wxLocale::GetSystemEncoding() );
wxCFStringRef text(str, wxLocale::GetSystemEncoding() );
CTFontRef font = fref->GetCTFont();
CGColorRef col = fref->GetColour().GetPixel();
CTUnderlineStyle ustyle = fref->GetUnderlined() ? kCTUnderlineStyleSingle : kCTUnderlineStyleNone ;
@ -1797,34 +1828,11 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub
{
OSStatus status = noErr;
ATSUTextLayout atsuLayout;
UniCharCount chars = str.length();
UniChar* ubuf = NULL;
#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
wxMacUniCharBuffer unibuf( str );
UniCharCount chars = unibuf.GetChars();
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 );
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);
#if SIZEOF_WCHAR_T == 4
free( ubuf );
#endif
return;
}
#endif
@ -1932,7 +1937,7 @@ void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *wid
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
CTFontRef font = fref->GetCTFont();
wxMacCFStringHolder text(str, wxLocale::GetSystemEncoding() );
wxCFStringRef text(str, wxLocale::GetSystemEncoding() );
CFStringRef keys[] = { kCTFontAttributeName };
CFTypeRef values[] = { font };
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;
ATSUTextLayout atsuLayout;
UniCharCount chars = str.length();
UniChar* ubuf = NULL;
#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
wxMacUniCharBuffer unibuf( str );
UniCharCount chars = unibuf.GetChars();
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 );
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);
::ATSUDisposeTextLayout(atsuLayout);
#if SIZEOF_WCHAR_T == 4
free( ubuf ) ;
#endif
return;
}
#endif
@ -2032,7 +2012,7 @@ void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArr
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
CTFontRef font = fref->GetCTFont();
wxMacCFStringHolder t(text, wxLocale::GetSystemEncoding() );
wxCFStringRef t(text, wxLocale::GetSystemEncoding() );
CFStringRef keys[] = { kCTFontAttributeName };
CFTypeRef values[] = { font };
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
{
ATSUTextLayout atsuLayout;
UniCharCount chars = text.length();
UniChar* ubuf = NULL;
#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
wxMacUniCharBuffer unibuf( text );
UniCharCount chars = unibuf.GetChars();
ATSUStyle style = (((wxMacCoreGraphicsFontData*)m_font.GetRefData())->GetATSUStyle());
::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) ubuf , 0 , chars , chars , 1 ,
::ATSUCreateTextLayoutWithTextPtr( unibuf.GetBuffer() , 0 , chars , chars , 1 ,
&chars , &style , &atsuLayout );
for ( int pos = 0; pos < (int)chars; pos ++ )
@ -2099,9 +2056,6 @@ void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArr
}
::ATSUDisposeTextLayout(atsuLayout);
#if SIZEOF_WCHAR_T == 4
free( ubuf ) ;
#endif
}
#endif
#if wxMAC_USE_CG_TEXT

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -228,7 +228,7 @@ void wxMacToolTip::Draw()
wxMacLocalToGlobal( m_window , &p ) ;
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].u.tagCFString = m_helpTextRef ;
tag.content[kHMMaximumContentIndex].contentType = kHMCFStringContent ;
@ -258,7 +258,6 @@ void wxMacToolTip::Clear()
return ;
HMHideTag() ;
m_helpTextRef.Release() ;
}
#endif // wxUSE_TOOLTIPS

View File

@ -1204,7 +1204,7 @@ void wxTopLevelWindowMac::DoMacCreateRealWindow(
SetWindowBounds( (WindowRef) m_macWindow , kWindowStructureRgn , &theBoundsRect ) ;
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*/) ;
// 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)
{
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

View File

@ -67,7 +67,7 @@ MenuRef UMANewMenu( SInt16 id , const wxString& title , wxFontEncoding encoding
MenuRef menu ;
CreateNewMenu( id , 0 , &menu ) ;
SetMenuTitleWithCFString( menu , wxMacCFStringHolder(str , encoding ) ) ;
SetMenuTitleWithCFString( menu , wxCFStringRef(str , encoding ) ) ;
return menu ;
}
@ -76,7 +76,7 @@ void UMASetMenuTitle( MenuRef menu , const wxString& title , wxFontEncoding enco
{
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 )
@ -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
wxString str = title ;
SetMenuItemTextWithCFString( menu , item , wxMacCFStringHolder(str , encoding) ) ;
SetMenuItemTextWithCFString( menu , item , wxCFStringRef(str , encoding) ) ;
}
void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex inItem , bool enable)

View File

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