- wxASSERT(!FPIsFontPanelVisible());
-
- //set up initial font
- wxFont theInitialFont = m_fontData.GetInitialFont();
-
- //create ATSU style
- ATSUStyle theStyle;
- OSStatus status = ATSUCreateStyle(&theStyle);
- check_noerr(status);
-
- //put stuff into the style - we don't need kATSUColorTag
- ATSUFontID fontid = theInitialFont.MacGetATSUFontID();
- Fixed fontsize = theInitialFont.MacGetFontSize() << 16;
- ATSUAttributeTag theTags[2] = { kATSUFontTag, kATSUSizeTag };
- ByteCount theSizes[2] = { sizeof(ATSUFontID), sizeof(Fixed) };
- ATSUAttributeValuePtr theValues[2] = { &fontid,
- &fontsize };
-
- //set the stuff for the ATSU style
- verify_noerr (ATSUSetAttributes (theStyle, 2, theTags, theSizes, theValues) );
-
- //they set us up the bomb! Set the initial font of the dialog
- SetFontInfoForSelection(kFontSelectionATSUIType,
- 1,
- &theStyle,
- (HIObjectRef)
- (m_dialogParent ?
- GetWindowEventTarget(MAC_WXHWND(m_dialogParent->GetHandle())) :
- GetApplicationEventTarget())
- );
-
- //dispose of the style
- status = ATSUDisposeStyle(theStyle);
- check_noerr(status);
-
- //in case the user doesn't choose anything -
- //if he doesn't we'll get a bad font with red text
- m_fontData.SetChosenFont(m_fontData.GetInitialFont());
- m_fontData.SetColour(wxColour(0,0,0));
-
- //finally, show the font dialog
- if( (status = FPShowHideFontPanel()) == noErr)
+ m_fontData = fontData;
+ m_suppressUpdates = false;
+
+ wxString caption = _("Font");
+
+ m_facenameCtrl = NULL;
+ m_sizeCtrl = NULL;
+ m_boldCtrl = NULL;
+ m_italicCtrl = NULL;
+ m_underlinedCtrl = NULL;
+ m_colourCtrl = NULL;
+ m_previewCtrl = NULL;
+
+ InitializeFont();
+
+ SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
+ wxDialog::Create( parent, wxID_ANY, caption, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
+
+ CreateControls();
+ GetSizer()->Fit(this);
+ GetSizer()->SetSizeHints(this);
+ Centre();
+
+ return true;
+}
+
+/*!
+ * Control creation for wxFontDialog
+ */
+
+void wxFontDialog::CreateControls()
+{
+ wxFontDialog* itemDialog1 = this;
+
+ wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
+ itemDialog1->SetSizer(itemBoxSizer2);
+
+ wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
+ itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5);
+
+ wxFlexGridSizer* itemFlexGridSizer4 = new wxFlexGridSizer(6, 2, 10, 0);
+ itemFlexGridSizer4->AddGrowableRow(4);
+ itemFlexGridSizer4->AddGrowableCol(1);
+ itemBoxSizer3->Add(itemFlexGridSizer4, 1, wxGROW|wxALL, 5);
+
+ wxStaticText* itemStaticText5 = new wxStaticText( itemDialog1, wxID_STATIC, _("Font:"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemFlexGridSizer4->Add(itemStaticText5, 0, wxALIGN_RIGHT|wxALIGN_TOP|wxALL|wxADJUST_MINSIZE, 5);
+
+ wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxVERTICAL);
+ itemFlexGridSizer4->Add(itemBoxSizer6, 0, wxGROW|wxGROW, 5);
+
+ wxString* m_facenameCtrlStrings = NULL;
+ m_facenameCtrl = new wxListBox( itemDialog1, wxID_FONTDIALOG_FACENAME, wxDefaultPosition, wxSize(320, 100), 0, m_facenameCtrlStrings, wxLB_SINGLE );
+ itemBoxSizer6->Add(m_facenameCtrl, 0, wxGROW|wxALL, 5);
+
+ wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1, wxID_STATIC, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemFlexGridSizer4->Add(itemStaticText8, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
+
+ m_sizeCtrl = new wxSpinCtrl( itemDialog1, wxID_FONTDIALOG_FONTSIZE, _T("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."));
+ itemFlexGridSizer4->Add(m_sizeCtrl, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ wxStaticText* itemStaticText10 = new wxStaticText( itemDialog1, wxID_STATIC, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemFlexGridSizer4->Add(itemStaticText10, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5);
+
+ wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxHORIZONTAL);
+ itemFlexGridSizer4->Add(itemBoxSizer11, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
+
+ m_boldCtrl = new wxCheckBox( itemDialog1, wxID_FONTDIALOG_BOLD, _("Bold"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
+ m_boldCtrl->SetValue(false);
+ m_boldCtrl->SetHelpText(_("Check to make the font bold."));
+ if (ShowToolTips())
+ m_boldCtrl->SetToolTip(_("Check to make the font bold."));
+ itemBoxSizer11->Add(m_boldCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ m_italicCtrl = new wxCheckBox( itemDialog1, wxID_FONTDIALOG_ITALIC, _("Italic"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
+ m_italicCtrl->SetValue(false);
+ m_italicCtrl->SetHelpText(_("Check to make the font italic."));
+ if (ShowToolTips())
+ m_italicCtrl->SetToolTip(_("Check to make the font italic."));
+ itemBoxSizer11->Add(m_italicCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ if (m_fontData.GetEnableEffects())