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:
@@ -133,7 +133,7 @@ public: // public API
|
|||||||
|
|
||||||
// get the font chosen
|
// get the font chosen
|
||||||
wxFont GetSelectedFont() const
|
wxFont GetSelectedFont() const
|
||||||
{ return ((wxFontPickerWidget *)m_picker)->GetSelectedFont(); }
|
{ return GetPickerWidget()->GetSelectedFont(); }
|
||||||
|
|
||||||
// sets currently displayed font
|
// sets currently displayed font
|
||||||
void SetSelectedFont(const wxFont& f);
|
void SetSelectedFont(const wxFont& f);
|
||||||
@@ -166,6 +166,9 @@ protected:
|
|||||||
unsigned int m_nMaxPointSize;
|
unsigned int m_nMaxPointSize;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
wxFontPickerWidget* GetPickerWidget() const
|
||||||
|
{ return static_cast<wxFontPickerWidget*>(m_picker); }
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxFontPickerCtrl)
|
DECLARE_DYNAMIC_CLASS(wxFontPickerCtrl)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -49,8 +49,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxFontPickerEvent, wxCommandEvent)
|
|||||||
// wxFontPickerCtrl
|
// wxFontPickerCtrl
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#define M_PICKER ((wxFontPickerWidget*)m_picker)
|
|
||||||
|
|
||||||
bool wxFontPickerCtrl::Create( wxWindow *parent, wxWindowID id,
|
bool wxFontPickerCtrl::Create( wxWindow *parent, wxWindowID id,
|
||||||
const wxFont &initial,
|
const wxFont &initial,
|
||||||
const wxPoint &pos, const wxSize &size,
|
const wxPoint &pos, const wxSize &size,
|
||||||
@@ -116,7 +114,7 @@ wxFont wxFontPickerCtrl::String2Font(const wxString &s)
|
|||||||
|
|
||||||
void wxFontPickerCtrl::SetSelectedFont(const wxFont &f)
|
void wxFontPickerCtrl::SetSelectedFont(const wxFont &f)
|
||||||
{
|
{
|
||||||
M_PICKER->SetSelectedFont(f);
|
GetPickerWidget()->SetSelectedFont(f);
|
||||||
UpdateTextCtrlFromPicker();
|
UpdateTextCtrlFromPicker();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,9 +130,9 @@ void wxFontPickerCtrl::UpdatePickerFromTextCtrl()
|
|||||||
if (!f.IsOk())
|
if (!f.IsOk())
|
||||||
return; // invalid user input
|
return; // invalid user input
|
||||||
|
|
||||||
if (M_PICKER->GetSelectedFont() != f)
|
if (GetPickerWidget()->GetSelectedFont() != f)
|
||||||
{
|
{
|
||||||
M_PICKER->SetSelectedFont(f);
|
GetPickerWidget()->SetSelectedFont(f);
|
||||||
|
|
||||||
// fire an event
|
// fire an event
|
||||||
wxFontPickerEvent event(this, GetId(), f);
|
wxFontPickerEvent event(this, GetId(), f);
|
||||||
@@ -149,7 +147,7 @@ void wxFontPickerCtrl::UpdateTextCtrlFromPicker()
|
|||||||
|
|
||||||
// Take care to use ChangeValue() here and not SetValue() to avoid
|
// Take care to use ChangeValue() here and not SetValue() to avoid
|
||||||
// infinite recursion.
|
// infinite recursion.
|
||||||
m_text->ChangeValue(Font2String(M_PICKER->GetSelectedFont()));
|
m_text->ChangeValue(Font2String(GetPickerWidget()->GetSelectedFont()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user