/////////////////////////////////////////////////////////////////////////////
-// Name: src/mac/carbon/fontdlg.cpp
+// Name: src/osx/carbon/fontdlg.cpp
// Purpose: wxFontDialog class for carbon 10.2+.
// Author: Ryan Norton
// Modified by:
#endif
#include "wx/fontdlg.h"
+#include "wx/fontutil.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 } ,
case kEventFontSelection :
{
bool setup = false ;
-#if wxMAC_USE_CORE_TEXT
+#if wxOSX_USE_CORE_TEXT
if ( UMAGetSystemVersion() >= 0x1050 )
{
CTFontDescriptorRef descr;
if ( cEvent.GetParameter<CTFontDescriptorRef>( kEventParamCTFontDescriptor, typeCTFontDescriptorRef, &descr ) == noErr )
{
wxFont font;
- font.MacCreateFromCTFontDescriptor(descr);
+ wxNativeFontInfo fontinfo;
+ fontinfo.Init(descr);
+ font.Create(fontinfo);
fontdata.SetChosenFont( font ) ;
setup = true;
}
}
#endif
-#if wxMAC_USE_ATSU_TEXT
+#if wxOSX_USE_ATSU_TEXT
ATSUFontID fontId = 0 ;
if ( !setup && (cEvent.GetParameter<ATSUFontID>(kEventParamATSUFontID, &fontId) == noErr) )
{
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 ;
}
DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacCarbonFontPanelHandler )
+#endif
wxFontDialog::wxFontDialog()
{
int wxFontDialog::ShowModal()
{
+#if wxOSX_USE_CARBON
+
OSStatus err ;
wxFont font = *wxNORMAL_FONT ;
if ( m_fontData.m_initialFont.Ok() )
}
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.OSXGetCTFont() );
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();
if ( !FPIsFontPanelVisible() )
FPShowHideFontPanel();
-
+#endif
int retval = RunMixedFontDialog(this);
+#if wxOSX_USE_CARBON
::RemoveEventHandler(handler);
+#endif
return retval ;
}
#undef wxFontDialog
-#include "wx/mac/fontdlg.h"
+#include "wx/osx/fontdlg.h"
#include "wx/fontenum.h"
#include "wx/colordlg.h"
#endif // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
-#endif // wxMAC_USE_EXPERIMENTAL_FONTDIALOG
+#endif // wxOSX_USE_EXPERIMENTAL_FONTDIALOG
#endif // wxUSE_FONTDLG