Use helper GetPickerWidget() function in wxFontPickerCtrl.

No real changes, just use a helper function instead of an ugly M_PICKER macro.

See #11614.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76159 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-03-18 17:23:06 +00:00
parent 2d39af0bbe
commit 9e7dbef726
2 changed files with 8 additions and 7 deletions

View File

@@ -133,7 +133,7 @@ public: // public API
// get the font chosen
wxFont GetSelectedFont() const
{ return ((wxFontPickerWidget *)m_picker)->GetSelectedFont(); }
{ return GetPickerWidget()->GetSelectedFont(); }
// sets currently displayed font
void SetSelectedFont(const wxFont& f);
@@ -166,6 +166,9 @@ protected:
unsigned int m_nMaxPointSize;
private:
wxFontPickerWidget* GetPickerWidget() const
{ return static_cast<wxFontPickerWidget*>(m_picker); }
DECLARE_DYNAMIC_CLASS(wxFontPickerCtrl)
};

View File

@@ -49,8 +49,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxFontPickerEvent, wxCommandEvent)
// wxFontPickerCtrl
// ----------------------------------------------------------------------------
#define M_PICKER ((wxFontPickerWidget*)m_picker)
bool wxFontPickerCtrl::Create( wxWindow *parent, wxWindowID id,
const wxFont &initial,
const wxPoint &pos, const wxSize &size,
@@ -116,7 +114,7 @@ wxFont wxFontPickerCtrl::String2Font(const wxString &s)
void wxFontPickerCtrl::SetSelectedFont(const wxFont &f)
{
M_PICKER->SetSelectedFont(f);
GetPickerWidget()->SetSelectedFont(f);
UpdateTextCtrlFromPicker();
}
@@ -132,9 +130,9 @@ void wxFontPickerCtrl::UpdatePickerFromTextCtrl()
if (!f.IsOk())
return; // invalid user input
if (M_PICKER->GetSelectedFont() != f)
if (GetPickerWidget()->GetSelectedFont() != f)
{
M_PICKER->SetSelectedFont(f);
GetPickerWidget()->SetSelectedFont(f);
// fire an event
wxFontPickerEvent event(this, GetId(), f);
@@ -149,7 +147,7 @@ void wxFontPickerCtrl::UpdateTextCtrlFromPicker()
// Take care to use ChangeValue() here and not SetValue() to avoid
// infinite recursion.
m_text->ChangeValue(Font2String(M_PICKER->GetSelectedFont()));
m_text->ChangeValue(Font2String(GetPickerWidget()->GetSelectedFont()));
}