]>
Commit | Line | Data |
---|---|---|
ec376c8f VZ |
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 | |
ec376c8f VZ |
8 | // Licence: wxWindows Licence |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_FONTPICKER_H_ | |
12 | #define _WX_FONTPICKER_H_ | |
13 | ||
45f9b662 | 14 | #include "wx/button.h" |
081d8d96 | 15 | #include "wx/fontdata.h" |
ec376c8f VZ |
16 | |
17 | //----------------------------------------------------------------------------- | |
3fc69ebc | 18 | // wxGenericFontButton: a button which brings up a wxFontDialog |
ec376c8f VZ |
19 | //----------------------------------------------------------------------------- |
20 | ||
ec376c8f VZ |
21 | class WXDLLIMPEXP_CORE wxGenericFontButton : public wxButton, |
22 | public wxFontPickerWidgetBase | |
23 | { | |
24 | public: | |
25 | wxGenericFontButton() {} | |
26 | wxGenericFontButton(wxWindow *parent, | |
27 | wxWindowID id, | |
305329c2 | 28 | const wxFont &initial = wxNullFont, |
ec376c8f VZ |
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 | ||
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 | ||
3fc69ebc VZ |
46 | // returns the font data shown in wxFontDialog |
47 | wxFontData *GetFontData() { return &m_data; } | |
ec376c8f VZ |
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 | ||
3fc69ebc | 68 | wxFontData m_data; |
ec376c8f VZ |
69 | |
70 | private: | |
71 | DECLARE_DYNAMIC_CLASS(wxGenericFontButton) | |
72 | }; | |
73 | ||
74 | ||
75 | #endif // _WX_FONTPICKER_H_ |