#endif
#include "wx/fontdlg.h"
+#include "wx/fontutil.h"
#if wxOSX_USE_EXPERIMENTAL_FONTDIALOG
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");
}
{
}
+wxFontDialog::wxFontDialog(wxWindow *parent)
+{
+ Create(parent);
+}
+
wxFontDialog::wxFontDialog(wxWindow *parent, const wxFontData& data)
{
Create(parent, data);
{
}
-bool wxFontDialog::Create(wxWindow *WXUNUSED(parent), const wxFontData& data)
+bool wxFontDialog::Create(wxWindow *WXUNUSED(parent))
{
- m_fontData = data;
return true ;
}
+bool wxFontDialog::Create(wxWindow *parent, const wxFontData& data)
+{
+ m_fontData = data;
+ return Create(parent) ;
+}
+
int wxFontDialog::ShowModal()
{
#if wxOSX_USE_CARBON
OSStatus err ;
wxFont font = *wxNORMAL_FONT ;
- if ( m_fontData.m_initialFont.Ok() )
+ if ( m_fontData.m_initialFont.IsOk() )
{
font = m_fontData.m_initialFont ;
}
#if wxOSX_USE_CORE_TEXT
if ( UMAGetSystemVersion() >= 0x1050 )
{
- CTFontDescriptorRef descr = (CTFontDescriptorRef) CTFontCopyFontDescriptor( (CTFontRef) font.MacGetCTFont() );
+ CTFontDescriptorRef descr = (CTFontDescriptorRef) CTFontCopyFontDescriptor( (CTFontRef) font.OSXGetCTFont() );
err = SetFontInfoForSelection (kFontSelectionCoreTextType,1, &descr , NULL);
CFRelease( descr );
setup = true;
if ( !FPIsFontPanelVisible() )
FPShowHideFontPanel();
#endif
+ wxDialog::OSXBeginModalDialog();
int retval = RunMixedFontDialog(this);
-
+ wxDialog::OSXEndModalDialog();
#if wxOSX_USE_CARBON
::RemoveEventHandler(handler);
#endif
wxSize size = GetSize();
wxFont font = GetFont();
- if ( font.Ok() )
+ if ( font.IsOk() )
{
dc.SetFont(font);
// Calculate vertical centre
itemFlexGridSizer4->Add(itemStaticText5, 0, wxALIGN_RIGHT|wxALIGN_TOP|wxALL, 5);
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxVERTICAL);
- itemFlexGridSizer4->Add(itemBoxSizer6, 0, wxGROW|wxGROW, 5);
+ itemFlexGridSizer4->Add(itemBoxSizer6, 0, wxGROW, 5);
wxString* m_facenameCtrlStrings = NULL;
m_facenameCtrl = new wxListBox( itemDialog1, wxID_FONTDIALOG_FACENAME, wxDefaultPosition, wxSize(320, 100), 0, m_facenameCtrlStrings, wxLB_SINGLE );
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>"));
InitializeControls();
m_previewCtrl->SetFont(m_dialogFont);
- if (m_fontData.GetColour().Ok())
+ if (m_fontData.GetColour().IsOk())
{
m_previewCtrl->SetForegroundColour(m_fontData.GetColour());
}
bool fontUnderline = false;
wxString fontName;
- if (m_fontData.m_initialFont.Ok())
+ if (m_fontData.m_initialFont.IsOk())
{
fontFamily = m_fontData.m_initialFont.GetFamily();
fontWeight = m_fontData.m_initialFont.GetWeight();
}
m_facenameCtrl->SetStringSelection(facename);
- if (m_colourCtrl && m_fontData.GetColour().Ok())
+ if (m_colourCtrl && m_fontData.GetColour().IsOk())
{
m_colourCtrl->SetColour(m_fontData.GetColour());
m_colourCtrl->Refresh();