1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/gtk/fontpicker.h
3 // Purpose:     wxFontButton header
4 // Author:      Francesco Montorsi
5 // Modified by:
6 // Created:     14/4/2006
7 // Copyright:   (c) Francesco Montorsi
8 // Licence:     wxWindows Licence
9 /////////////////////////////////////////////////////////////////////////////
10 
11 #ifndef _WX_GTK_FONTPICKER_H_
12 #define _WX_GTK_FONTPICKER_H_
13 
14 #include "wx/button.h"
15 
16 //-----------------------------------------------------------------------------
17 // wxFontButton
18 //-----------------------------------------------------------------------------
19 
20 class WXDLLIMPEXP_CORE wxFontButton : public wxButton,
21                                       public wxFontPickerWidgetBase
22 {
23 public:
wxFontButton()24     wxFontButton() { Init(); }
25     wxFontButton(wxWindow *parent,
26                  wxWindowID id,
27                  const wxFont& initial = wxNullFont,
28                  const wxPoint& pos = wxDefaultPosition,
29                  const wxSize& size = wxDefaultSize,
30                  long style = wxFONTBTN_DEFAULT_STYLE,
31                  const wxValidator& validator = wxDefaultValidator,
32                  const wxString& name = wxASCII_STR(wxFontPickerWidgetNameStr))
33     {
34         Init();
35 
36         Create(parent, id, initial, pos, size, style, validator, name);
37     }
38 
39     bool Create(wxWindow *parent,
40                 wxWindowID id,
41                 const wxFont& initial = wxNullFont,
42                 const wxPoint& pos = wxDefaultPosition,
43                 const wxSize& size = wxDefaultSize,
44                 long style = wxFONTBTN_DEFAULT_STYLE,
45                 const wxValidator& validator = wxDefaultValidator,
46                 const wxString& name = wxASCII_STR(wxFontPickerWidgetNameStr));
47 
GetSelectedColour()48     virtual wxColour GetSelectedColour() const wxOVERRIDE
49         { return m_selectedColour; }
50 
SetSelectedColour(const wxColour & colour)51     void SetSelectedColour(const wxColour &colour) wxOVERRIDE
52         { m_selectedColour = colour; }
53 
54     virtual ~wxFontButton();
55 
56 protected:
57     void UpdateFont() wxOVERRIDE;
58 
59 
60 public:     // used by the GTK callback only
61     void SetNativeFontInfo(const char* gtkdescription);
62 
63 private:
64     // Common part of both ctors.
Init()65     void Init()
66     {
67         m_selectedColour = *wxBLACK;
68     }
69 
70     // This can't be changed by the user, but is provided to
71     // satisfy the wxFontPickerWidgetBase interface.
72     wxColour m_selectedColour;
73 
74     wxDECLARE_DYNAMIC_CLASS(wxFontButton);
75 };
76 
77 #endif // _WX_GTK_FONTPICKER_H_
78 
79