X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c757b5fee093bbc3686f1e474316396b742fb888..8946ede10c2702c7acbb194fe8bd2793d7fb8358:/src/generic/fontpickerg.cpp diff --git a/src/generic/fontpickerg.cpp b/src/generic/fontpickerg.cpp index 06a5c5c539..5696313079 100644 --- a/src/generic/fontpickerg.cpp +++ b/src/generic/fontpickerg.cpp @@ -35,7 +35,6 @@ // implementation // ============================================================================ -wxFontData wxGenericFontButton::ms_data; IMPLEMENT_DYNAMIC_CLASS(wxGenericFontButton, wxButton) // ---------------------------------------------------------------------------- @@ -60,11 +59,11 @@ bool wxGenericFontButton::Create( wxWindow *parent, wxWindowID id, } // and handle user clicks on it - Connect(wxEVT_COMMAND_BUTTON_CLICKED, + Connect(GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(wxGenericFontButton::OnButtonClick), NULL, this); - m_selectedFont = initial; + m_selectedFont = initial.IsOk() ? initial : *wxNORMAL_FONT; UpdateFont(); InitFontData(); @@ -73,22 +72,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); + 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,7 +100,7 @@ void wxGenericFontButton::UpdateFont() if ( !m_selectedFont.Ok() ) return; - SetForegroundColour(ms_data.GetColour()); + SetForegroundColour(m_data.GetColour()); if (HasFlag(wxFNTP_USEFONT_FOR_LABEL)) {