/////////////////////////////////////////////////////////////////////////////
-// 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 wxOSX_USE_EXPERIMENTAL_FONTDIALOG
IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
-#include "wx/osx/uma.h"
+#include "wx/osx/private.h"
// ---------------------------------------------------------------------------
// wxFontDialog
// ---------------------------------------------------------------------------
+#if wxOSX_USE_CARBON
+
static const EventTypeSpec eventList[] =
{
{ kEventClassFont, kEventFontSelection } ,
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;
}
FMFontFamily fontFamily = cEvent.GetParameter<FMFontFamily>(kEventParamFMFontFamily);
ATSFontFamilyRef atsfontfamilyref = FMGetATSFontFamilyRefFromFontFamily( fontFamily ) ;
OSStatus err = ATSFontFamilyGetName( atsfontfamilyref , kATSOptionFlagsDefault , &cfName ) ;
- if ( err == noErr )
+ if ( err != noErr )
{
wxFAIL_MSG("ATSFontFamilyGetName failed");
}
}
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() )
#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 ( !FPIsFontPanelVisible() )
FPShowHideFontPanel();
-
+#endif
int retval = RunMixedFontDialog(this);
+#if wxOSX_USE_CARBON
::RemoveEventHandler(handler);
+#endif
return retval ;
}
wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1, wxID_STATIC, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
itemFlexGridSizer4->Add(itemStaticText8, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
- m_sizeCtrl = new wxSpinCtrl( itemDialog1, wxID_FONTDIALOG_FONTSIZE, _T("12"), wxDefaultPosition, wxSize(60, -1), wxSP_ARROW_KEYS, 1, 300, 12 );
+ m_sizeCtrl = new wxSpinCtrl( itemDialog1, wxID_FONTDIALOG_FONTSIZE, wxT("12"), wxDefaultPosition, wxSize(60, -1), wxSP_ARROW_KEYS, 1, 300, 12 );
m_sizeCtrl->SetHelpText(_("The font size in points."));
if (ShowToolTips())
m_sizeCtrl->SetToolTip(_("The font size in points."));
wxFontEnumerator enumerator;
enumerator.EnumerateFacenames();
wxArrayString facenames = enumerator.GetFacenames();
- if (facenames)
+ if (!facenames.empty())
{
facenames.Add(_("<Any>"));
facenames.Add(_("<Any Roman>"));