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