1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/generic/fontpickerg.h
3 // Purpose:     wxGenericFontButton 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_FONTPICKER_H_
12 #define _WX_FONTPICKER_H_
13 
14 #include "wx/button.h"
15 #include "wx/fontdata.h"
16 
17 //-----------------------------------------------------------------------------
18 // wxGenericFontButton: a button which brings up a wxFontDialog
19 //-----------------------------------------------------------------------------
20 
21 class WXDLLIMPEXP_CORE wxGenericFontButton : public wxButton,
22                                              public wxFontPickerWidgetBase
23 {
24 public:
wxGenericFontButton()25     wxGenericFontButton() {}
26     wxGenericFontButton(wxWindow *parent,
27                         wxWindowID id,
28                         const wxFont &initial = wxNullFont,
29                         const wxPoint& pos = wxDefaultPosition,
30                         const wxSize& size = wxDefaultSize,
31                         long style = wxFONTBTN_DEFAULT_STYLE,
32                         const wxValidator& validator = wxDefaultValidator,
33                         const wxString& name = wxFontPickerWidgetNameStr)
34     {
35         Create(parent, id, initial, pos, size, style, validator, name);
36     }
37 
~wxGenericFontButton()38     virtual ~wxGenericFontButton() {}
39 
40 
41 public:     // API extensions specific for wxGenericFontButton
42 
43     // user can override this to init font data in a different way
44     virtual void InitFontData();
45 
46     // returns the font data shown in wxFontDialog
GetFontData()47     wxFontData *GetFontData() { return &m_data; }
48 
49 
50 public:
51 
52     bool Create(wxWindow *parent,
53                 wxWindowID id,
54                 const wxFont &initial = *wxNORMAL_FONT,
55                 const wxPoint& pos = wxDefaultPosition,
56                 const wxSize& size = wxDefaultSize,
57                 long style = wxFONTBTN_DEFAULT_STYLE,
58                 const wxValidator& validator = wxDefaultValidator,
59                 const wxString& name = wxFontPickerWidgetNameStr);
60 
61     void OnButtonClick(wxCommandEvent &);
62 
63 
64 protected:
65 
66     void UpdateFont();
67 
68     wxFontData m_data;
69 
70 private:
71    DECLARE_DYNAMIC_CLASS(wxGenericFontButton)
72 };
73 
74 
75 #endif // _WX_FONTPICKER_H_
76