+ 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, 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, 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, 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())
+ {
+ m_underlinedCtrl = new wxCheckBox( itemDialog1, wxID_FONTDIALOG_UNDERLINED, _("Underlined"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
+ m_underlinedCtrl->SetValue(false);
+ m_underlinedCtrl->SetHelpText(_("Check to make the font underlined."));
+ if (ShowToolTips())
+ m_underlinedCtrl->SetToolTip(_("Check to make the font underlined."));
+ itemBoxSizer11->Add(m_underlinedCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+ }
+
+ if (m_fontData.GetEnableEffects())
+ {
+ wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("Colour:"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemFlexGridSizer4->Add(itemStaticText15, 0, wxALIGN_RIGHT|wxALIGN_TOP|wxALL, 5);
+
+ m_colourCtrl = new wxFontColourSwatchCtrl( itemDialog1, wxID_FONTDIALOG_COLOUR, wxDefaultPosition, wxSize(-1, 30), wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
+ m_colourCtrl->SetHelpText(_("Click to change the font colour."));
+ if (ShowToolTips())
+ m_colourCtrl->SetToolTip(_("Click to change the font colour."));
+ itemFlexGridSizer4->Add(m_colourCtrl, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
+ }
+
+ wxStaticText* itemStaticText17 = new wxStaticText( itemDialog1, wxID_STATIC, _("Preview:"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemFlexGridSizer4->Add(itemStaticText17, 0, wxALIGN_RIGHT|wxALIGN_TOP|wxALL, 5);
+
+ m_previewCtrl = new wxFontPreviewCtrl( itemDialog1, wxID_FONTDIALOG_PREVIEW, wxDefaultPosition, wxSize(-1, 70), wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
+ m_previewCtrl->SetHelpText(_("Shows a preview of the font."));
+ if (ShowToolTips())
+ m_previewCtrl->SetToolTip(_("Shows a preview of the font."));
+ itemFlexGridSizer4->Add(m_previewCtrl, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ wxBoxSizer* itemBoxSizer19 = new wxBoxSizer(wxHORIZONTAL);
+ itemBoxSizer3->Add(itemBoxSizer19, 0, wxALIGN_RIGHT|wxALL, 5);
+
+ wxButton* itemButton20 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemButton20->SetHelpText(_("Click to cancel changes to the font."));
+ if (ShowToolTips())
+ itemButton20->SetToolTip(_("Click to cancel changes to the font."));
+ itemBoxSizer19->Add(itemButton20, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ wxButton* itemButton21 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
+ itemButton21->SetDefault();
+ itemButton21->SetHelpText(_("Click to confirm changes to the font."));
+ if (ShowToolTips())
+ itemButton21->SetToolTip(_("Click to confirm changes to the font."));
+ itemBoxSizer19->Add(itemButton21, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ wxFontEnumerator enumerator;
+ enumerator.EnumerateFacenames();
+ wxArrayString facenames = enumerator.GetFacenames();
+ if (facenames)
+ {
+ facenames.Add(_("<Any>"));
+ facenames.Add(_("<Any Roman>"));
+ facenames.Add(_("<Any Decorative>"));
+ facenames.Add(_("<Any Modern>"));
+ facenames.Add(_("<Any Script>"));
+ facenames.Add(_("<Any Swiss>"));
+ facenames.Add(_("<Any Teletype>"));
+ facenames.Sort();
+ m_facenameCtrl->Append(facenames);
+ }
+
+ InitializeControls();
+ m_previewCtrl->SetFont(m_dialogFont);
+ if (m_fontData.GetColour().Ok())
+ {
+ m_previewCtrl->SetForegroundColour(m_fontData.GetColour());
+ }
+ m_previewCtrl->Refresh();
+}
+
+/*!
+ * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE
+ */
+
+void wxFontDialog::OnFontdialogFontsizeUpdated( wxSpinEvent& WXUNUSED(event) )
+{
+ ChangeFont();
+}
+
+/*!
+ * wxEVT_COMMAND_TEXT_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE
+ */
+
+void wxFontDialog::OnFontdialogFontsizeTextUpdated( wxCommandEvent& WXUNUSED(event) )
+{
+ ChangeFont();
+}
+
+/*!
+ * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_BOLD
+ */
+
+void wxFontDialog::OnFontdialogBoldClick( wxCommandEvent& WXUNUSED(event) )
+{
+ ChangeFont();
+}
+
+/*!
+ * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_ITALIC
+ */
+
+void wxFontDialog::OnFontdialogItalicClick( wxCommandEvent& WXUNUSED(event) )
+{
+ ChangeFont();
+}
+
+/*!
+ * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_UNDERLINED
+ */
+
+void wxFontDialog::OnFontdialogUnderlinedClick( wxCommandEvent& WXUNUSED(event) )
+{
+ ChangeFont();
+}
+
+/*!
+ * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
+ */
+
+void wxFontDialog::OnOkClick( wxCommandEvent& event )
+{
+ event.Skip();
+}
+
+
+/*!
+ * wxEVT_COMMAND_LISTBOX_SELECTED event handler for wxID_FONTDIALOG_FACENAME
+ */
+
+void wxFontDialog::OnFontdialogFacenameSelected( wxCommandEvent& WXUNUSED(event) )
+{
+ ChangeFont();
+}
+
+void wxFontDialog::OnColourChanged(wxCommandEvent & WXUNUSED(event))
+{
+ m_fontData.SetColour(m_colourCtrl->GetColour());
+ m_previewCtrl->SetForegroundColour(m_colourCtrl->GetColour());
+ m_previewCtrl->Refresh();
+}
+
+/*!
+ * Should we show tooltips?
+ */
+
+bool wxFontDialog::ShowToolTips()
+{
+ return true;
+}
+
+void wxFontDialog::InitializeFont()
+{
+ int fontFamily = wxSWISS;
+ int fontWeight = wxNORMAL;
+ int fontStyle = wxNORMAL;
+ int fontSize = 12;
+ bool fontUnderline = false;
+ wxString fontName;
+
+ if (m_fontData.m_initialFont.Ok())
+ {
+ fontFamily = m_fontData.m_initialFont.GetFamily();
+ fontWeight = m_fontData.m_initialFont.GetWeight();
+ fontStyle = m_fontData.m_initialFont.GetStyle();
+ fontSize = m_fontData.m_initialFont.GetPointSize();
+ fontUnderline = m_fontData.m_initialFont.GetUnderlined();
+ fontName = m_fontData.m_initialFont.GetFaceName();
+ }
+
+ m_dialogFont = wxFont(fontSize, fontFamily, fontStyle,
+ fontWeight, fontUnderline, fontName);
+
+ if (m_previewCtrl)
+ m_previewCtrl->SetFont(m_dialogFont);
+
+ m_fontData.SetChosenFont(m_dialogFont);
+}
+
+/// Set controls according to current font
+void wxFontDialog::InitializeControls()
+{
+ m_suppressUpdates = true;
+
+ if (m_underlinedCtrl)
+ m_underlinedCtrl->SetValue(m_dialogFont.GetUnderlined());
+
+ m_boldCtrl->SetValue(m_dialogFont.GetWeight() == wxBOLD);
+ m_italicCtrl->SetValue(m_dialogFont.GetStyle() == wxITALIC);
+ m_sizeCtrl->SetValue(m_dialogFont.GetPointSize());
+
+ wxString facename = m_dialogFont.GetFaceName();
+ if (facename.empty() || m_facenameCtrl->FindString(facename) == wxNOT_FOUND)
+ {
+ facename = FontFamilyIntToString(m_dialogFont.GetFamily());
+ }
+ m_facenameCtrl->SetStringSelection(facename);
+
+ if (m_colourCtrl && m_fontData.GetColour().Ok())
+ {
+ m_colourCtrl->SetColour(m_fontData.GetColour());
+ m_colourCtrl->Refresh();
+ }
+
+ m_suppressUpdates = false;
+}
+
+/// Respond to font change
+void wxFontDialog::ChangeFont()
+{
+ if (m_suppressUpdates)
+ return;
+
+ bool underlined = m_underlinedCtrl ? m_underlinedCtrl->GetValue() : false;
+ bool italic = m_italicCtrl->GetValue();
+ bool bold = m_boldCtrl->GetValue();
+ int size = m_sizeCtrl->GetValue();
+ wxString facename = m_facenameCtrl->GetStringSelection();
+
+ int family = FontFamilyStringToInt(facename);
+ if (family == -1)
+ family = wxDEFAULT;
+ else
+ facename = wxEmptyString;
+
+ m_dialogFont = wxFont(size, family, italic ? wxITALIC : wxNORMAL, bold ? wxBOLD : wxNORMAL,
+ underlined, facename);
+
+ m_fontData.SetChosenFont(m_dialogFont);
+
+ m_previewCtrl->SetFont(m_dialogFont);
+ m_previewCtrl->Refresh();
+}
+
+void wxFontDialog::SetData(const wxFontData& fontdata)
+{
+ m_fontData = fontdata;
+}
+
+bool wxFontDialog::IsShown() const
+{
+ return false;