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