Add font colour support to wxFontPickerCtrl.

Currently this is only really implemented under Windows, just as the colour
support in wxFontDialog, but make the API available under all platforms for
consistency.

Closes #11614.

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

View File

@@ -21,7 +21,7 @@ class WXDLLIMPEXP_CORE wxFontButton : public wxButton,
public wxFontPickerWidgetBase
{
public:
wxFontButton() {}
wxFontButton() { Init(); }
wxFontButton(wxWindow *parent,
wxWindowID id,
const wxFont& initial = wxNullFont,
@@ -31,7 +31,9 @@ public:
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxFontPickerWidgetNameStr)
{
Create(parent, id, initial, pos, size, style, validator, name);
Init();
Create(parent, id, initial, pos, size, style, validator, name);
}
bool Create(wxWindow *parent,
@@ -43,6 +45,12 @@ public:
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxFontPickerWidgetNameStr);
virtual wxColour GetSelectedColour() const
{ return m_selectedColour; }
void SetSelectedColour(const wxColour &colour)
{ m_selectedColour = colour; }
virtual ~wxFontButton();
protected:
@@ -55,6 +63,16 @@ public: // used by the GTK callback only
{ m_selectedFont.SetNativeFontInfo(wxString::FromAscii(gtkdescription)); }
private:
// Common part of both ctors.
void Init()
{
m_selectedColour = *wxBLACK;
}
// This can't be changed by the user, but is provided to
// satisfy the wxFontPickerWidgetBase interface.
wxColour m_selectedColour;
DECLARE_DYNAMIC_CLASS(wxFontButton)
};