X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/489468feaa08b8f504735eecca522fb8d0f825d2..f8d0234d39c66f3d1d7fc2346562cb96c8c7be20:/src/osx/carbon/fontdlg.cpp diff --git a/src/osx/carbon/fontdlg.cpp b/src/osx/carbon/fontdlg.cpp index e7892ad542..221f769ed8 100644 --- a/src/osx/carbon/fontdlg.cpp +++ b/src/osx/carbon/fontdlg.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/mac/carbon/fontdlg.cpp +// Name: src/osx/carbon/fontdlg.cpp // Purpose: wxFontDialog class for carbon 10.2+. // Author: Ryan Norton // Modified by: @@ -42,16 +42,18 @@ #include "wx/fontdlg.h" -#if wxMAC_USE_EXPERIMENTAL_FONTDIALOG +#if wxOSX_USE_EXPERIMENTAL_FONTDIALOG IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog) -#include "wx/mac/uma.h" +#include "wx/osx/private.h" // --------------------------------------------------------------------------- // wxFontDialog // --------------------------------------------------------------------------- +#if wxOSX_USE_CARBON + static const EventTypeSpec eventList[] = { { kEventClassFont, kEventFontSelection } , @@ -73,7 +75,7 @@ wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler), case kEventFontSelection : { bool setup = false ; -#if wxMAC_USE_CORE_TEXT +#if wxOSX_USE_CORE_TEXT if ( UMAGetSystemVersion() >= 0x1050 ) { CTFontDescriptorRef descr; @@ -86,7 +88,7 @@ wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler), } } #endif -#if wxMAC_USE_ATSU_TEXT +#if wxOSX_USE_ATSU_TEXT ATSUFontID fontId = 0 ; if ( !setup && (cEvent.GetParameter(kEventParamATSUFontID, &fontId) == noErr) ) { @@ -142,7 +144,7 @@ wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler), fontdata.m_chosenFont.SetWeight(fontStyle & bold ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL); } } -#endif // wxMAC_USE_ATSU_TEXT +#endif // wxOSX_USE_ATSU_TEXT // retrieving the color RGBColor fontColor ; @@ -191,6 +193,7 @@ wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler), } DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacCarbonFontPanelHandler ) +#endif wxFontDialog::wxFontDialog() { @@ -213,6 +216,8 @@ bool wxFontDialog::Create(wxWindow *WXUNUSED(parent), const wxFontData& data) int wxFontDialog::ShowModal() { +#if wxOSX_USE_CARBON + OSStatus err ; wxFont font = *wxNORMAL_FONT ; if ( m_fontData.m_initialFont.Ok() ) @@ -221,15 +226,16 @@ int wxFontDialog::ShowModal() } bool setup = false; -#if wxMAC_USE_CORE_TEXT +#if wxOSX_USE_CORE_TEXT if ( UMAGetSystemVersion() >= 0x1050 ) { - CTFontDescriptorRef descr = (CTFontDescriptorRef)font.MacGetCTFontDescriptor(); + CTFontDescriptorRef descr = (CTFontDescriptorRef) CTFontCopyFontDescriptor( (CTFontRef) font.MacGetCTFont() ); err = SetFontInfoForSelection (kFontSelectionCoreTextType,1, &descr , NULL); + CFRelease( descr ); setup = true; } #endif -#if wxMAC_USE_ATSU_TEXT +#if wxOSX_USE_ATSU_TEXT if ( !setup ) { ATSUStyle style = (ATSUStyle)font.MacGetATSUStyle(); @@ -247,10 +253,12 @@ int wxFontDialog::ShowModal() if ( !FPIsFontPanelVisible() ) FPShowHideFontPanel(); - +#endif int retval = RunMixedFontDialog(this); +#if wxOSX_USE_CARBON ::RemoveEventHandler(handler); +#endif return retval ; } @@ -261,7 +269,7 @@ int wxFontDialog::ShowModal() #undef wxFontDialog -#include "wx/mac/fontdlg.h" +#include "wx/osx/fontdlg.h" #include "wx/fontenum.h" #include "wx/colordlg.h" @@ -823,6 +831,6 @@ int FontFamilyStringToInt(const wxChar *family) #endif // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX -#endif // wxMAC_USE_EXPERIMENTAL_FONTDIALOG +#endif // wxOSX_USE_EXPERIMENTAL_FONTDIALOG #endif // wxUSE_FONTDLG