X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ec376c8fd9ff813392030426acd2317c6fa6527e..07fb285c521527e383f2d1090f7f41f561bcd8fd:/src/generic/fontpickerg.cpp diff --git a/src/generic/fontpickerg.cpp b/src/generic/fontpickerg.cpp index 1a67f07b85..62599b7892 100644 --- a/src/generic/fontpickerg.cpp +++ b/src/generic/fontpickerg.cpp @@ -4,7 +4,6 @@ // Author: Francesco Montorsi // Modified by: // Created: 15/04/2006 -// RCS-ID: $Id$ // Copyright: (c) Francesco Montorsi // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -24,11 +23,10 @@ #pragma hdrstop #endif -#ifndef WX_PRECOMP - #include "wx/window.h" -#endif //WX_PRECOMP +#if wxUSE_FONTPICKERCTRL #include "wx/fontpicker.h" + #include "wx/fontdlg.h" @@ -36,9 +34,6 @@ // implementation // ============================================================================ -#if wxUSE_FONTPICKERCTRL - -wxFontData wxGenericFontButton::ms_data; IMPLEMENT_DYNAMIC_CLASS(wxGenericFontButton, wxButton) // ---------------------------------------------------------------------------- @@ -51,8 +46,8 @@ bool wxGenericFontButton::Create( wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString &name) { wxString label = (style & wxFNTP_FONTDESC_AS_LABEL) ? - wxEmptyString : // label will be updated by UpdateFont - wxT("Choose font"); + wxString() : // label will be updated by UpdateFont + _("Choose font"); // create this button if (!wxButton::Create( parent, id, label, pos, @@ -63,11 +58,11 @@ bool wxGenericFontButton::Create( wxWindow *parent, wxWindowID id, } // and handle user clicks on it - Connect(wxEVT_COMMAND_BUTTON_CLICKED, + Connect(GetId(), wxEVT_BUTTON, wxCommandEventHandler(wxGenericFontButton::OnButtonClick), NULL, this); - m_selectedFont = initial; + m_selectedFont = initial.IsOk() ? initial : *wxNORMAL_FONT; UpdateFont(); InitFontData(); @@ -76,22 +71,22 @@ bool wxGenericFontButton::Create( wxWindow *parent, wxWindowID id, void wxGenericFontButton::InitFontData() { - ms_data.SetAllowSymbols(true); - ms_data.SetColour(*wxBLACK); - ms_data.EnableEffects(true); + m_data.SetAllowSymbols(true); + m_data.SetColour(*wxBLACK); + m_data.EnableEffects(true); } void wxGenericFontButton::OnButtonClick(wxCommandEvent& WXUNUSED(ev)) { - // update the wxFontData to be shown in the the dialog - ms_data.SetInitialFont(m_selectedFont); + // update the wxFontData to be shown in the dialog + m_data.SetInitialFont(m_selectedFont); // create the font dialog and display it - wxFontDialog dlg(this, ms_data); + wxFontDialog dlg(this, m_data); if (dlg.ShowModal() == wxID_OK) { - ms_data = dlg.GetFontData(); - SetSelectedFont(ms_data.GetChosenFont()); + m_data = dlg.GetFontData(); + SetSelectedFont(m_data.GetChosenFont()); // fire an event wxFontPickerEvent event(this, GetId(), m_selectedFont); @@ -101,10 +96,10 @@ void wxGenericFontButton::OnButtonClick(wxCommandEvent& WXUNUSED(ev)) void wxGenericFontButton::UpdateFont() { - if ( !m_selectedFont.Ok() ) + if ( !m_selectedFont.IsOk() ) return; - SetForegroundColour(ms_data.GetColour()); + SetForegroundColour(m_data.GetColour()); if (HasFlag(wxFNTP_USEFONT_FOR_LABEL)) {