1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/generic/fontdlgg.h
3 // Purpose:     wxGenericFontDialog
4 // Author:      Julian Smart
5 // Modified by:
6 // Created:     01/02/97
7 // Copyright:   (c) Julian Smart
8 // Licence:     wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10 
11 #ifndef _WX_GENERIC_FONTDLGG_H
12 #define _WX_GENERIC_FONTDLGG_H
13 
14 #include "wx/gdicmn.h"
15 #include "wx/font.h"
16 
17 #define USE_SPINCTRL_FOR_POINT_SIZE 0
18 
19 /*
20  * FONT DIALOG
21  */
22 
23 class WXDLLIMPEXP_FWD_CORE wxChoice;
24 class WXDLLIMPEXP_FWD_CORE wxText;
25 class WXDLLIMPEXP_FWD_CORE wxCheckBox;
26 class WXDLLIMPEXP_FWD_CORE wxFontPreviewer;
27 
28 enum
29 {
30     wxID_FONT_UNDERLINE = 3000,
31     wxID_FONT_STYLE,
32     wxID_FONT_WEIGHT,
33     wxID_FONT_FAMILY,
34     wxID_FONT_COLOUR,
35     wxID_FONT_SIZE
36 };
37 
38 class WXDLLIMPEXP_CORE wxGenericFontDialog : public wxFontDialogBase
39 {
40 public:
wxGenericFontDialog()41     wxGenericFontDialog() { Init(); }
wxGenericFontDialog(wxWindow * parent)42     wxGenericFontDialog(wxWindow *parent)
43         : wxFontDialogBase(parent) { Init(); }
wxGenericFontDialog(wxWindow * parent,const wxFontData & data)44     wxGenericFontDialog(wxWindow *parent, const wxFontData& data)
45         : wxFontDialogBase(parent, data) { Init(); }
46     virtual ~wxGenericFontDialog();
47 
48     virtual int ShowModal() wxOVERRIDE;
49 
50     // Internal functions
51     void OnCloseWindow(wxCloseEvent& event);
52 
53     virtual void CreateWidgets();
54     virtual void InitializeFont();
55 
56     void OnChangeFont(wxCommandEvent& event);
57 
58 #if USE_SPINCTRL_FOR_POINT_SIZE
59     void OnChangeSize(wxSpinEvent& event);
60 #endif
61 
62 protected:
63 
64     virtual bool DoCreate(wxWindow *parent) wxOVERRIDE;
65 
66 private:
67 
68     // common part of all ctors
69     void Init();
70 
71     void DoChangeFont();
72 
73     wxFont m_dialogFont;
74 
75     wxChoice *m_familyChoice;
76     wxChoice *m_styleChoice;
77     wxChoice *m_weightChoice;
78     wxChoice *m_colourChoice;
79     wxCheckBox *m_underLineCheckBox;
80 
81 #if USE_SPINCTRL_FOR_POINT_SIZE
82     wxSpinCtrl *m_pointSizeSpin;
83 #else
84     wxChoice   *m_pointSizeChoice;
85 #endif
86 
87     wxFontPreviewer *m_previewer;
88     bool       m_useEvents;
89 
90     //  static bool fontDialogCancelled;
91     wxDECLARE_EVENT_TABLE();
92     wxDECLARE_DYNAMIC_CLASS(wxGenericFontDialog);
93 };
94 
95 #endif // _WX_GENERIC_FONTDLGG_H
96