]>
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 | |
8 | // RCS-ID: $Id$ | |
9 | // Licence: wxWindows Licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_FONTPICKER_H_ | |
13 | #define _WX_FONTPICKER_H_ | |
14 | ||
45f9b662 WS |
15 | #include "wx/button.h" |
16 | ||
ec376c8f VZ |
17 | class WXDLLIMPEXP_CORE wxFontData; |
18 | ||
19 | //----------------------------------------------------------------------------- | |
20 | // wxGenericFontButton: a button which brings up a wxColourDialog | |
21 | //----------------------------------------------------------------------------- | |
22 | ||
23 | #define wxFONTBTN_DEFAULT_STYLE \ | |
24 | (wxFNTP_FONTDESC_AS_LABEL | wxFNTP_USEFONT_FOR_LABEL) | |
25 | ||
26 | class WXDLLIMPEXP_CORE wxGenericFontButton : public wxButton, | |
27 | public wxFontPickerWidgetBase | |
28 | { | |
29 | public: | |
30 | wxGenericFontButton() {} | |
31 | wxGenericFontButton(wxWindow *parent, | |
32 | wxWindowID id, | |
33 | const wxFont &initial = *wxNORMAL_FONT, | |
34 | const wxPoint& pos = wxDefaultPosition, | |
35 | const wxSize& size = wxDefaultSize, | |
36 | long style = wxFONTBTN_DEFAULT_STYLE, | |
37 | const wxValidator& validator = wxDefaultValidator, | |
38 | const wxString& name = wxFontPickerWidgetNameStr) | |
39 | { | |
40 | Create(parent, id, initial, pos, size, style, validator, name); | |
41 | } | |
42 | ||
43 | virtual ~wxGenericFontButton() {} | |
44 | ||
45 | ||
46 | public: // API extensions specific for wxGenericFontButton | |
47 | ||
48 | // user can override this to init font data in a different way | |
49 | virtual void InitFontData(); | |
50 | ||
51 | // returns the font data shown in wxColourDialog | |
52 | wxFontData *GetFontData() { return &ms_data; } | |
53 | ||
54 | ||
55 | public: | |
56 | ||
57 | bool Create(wxWindow *parent, | |
58 | wxWindowID id, | |
59 | const wxFont &initial = *wxNORMAL_FONT, | |
60 | const wxPoint& pos = wxDefaultPosition, | |
61 | const wxSize& size = wxDefaultSize, | |
62 | long style = wxFONTBTN_DEFAULT_STYLE, | |
63 | const wxValidator& validator = wxDefaultValidator, | |
64 | const wxString& name = wxFontPickerWidgetNameStr); | |
65 | ||
66 | void OnButtonClick(wxCommandEvent &); | |
67 | ||
68 | ||
69 | protected: | |
70 | ||
71 | void UpdateFont(); | |
72 | ||
73 | // the colour data shown in wxColourPickerCtrlGeneric | |
74 | // controls. This member is static so that all colour pickers | |
75 | // in the program share the same set of custom colours. | |
76 | static wxFontData ms_data; | |
77 | ||
78 | private: | |
79 | DECLARE_DYNAMIC_CLASS(wxGenericFontButton) | |
80 | }; | |
81 | ||
82 | ||
83 | #endif // _WX_FONTPICKER_H_ |