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 #ifdef __WXWINCE__
18 #define USE_SPINCTRL_FOR_POINT_SIZE 1
19 class WXDLLIMPEXP_FWD_CORE wxSpinEvent;
20 #else
21 #define USE_SPINCTRL_FOR_POINT_SIZE 0
22 #endif
23 
24 /*
25  * FONT DIALOG
26  */
27 
28 class WXDLLIMPEXP_FWD_CORE wxChoice;
29 class WXDLLIMPEXP_FWD_CORE wxText;
30 class WXDLLIMPEXP_FWD_CORE wxCheckBox;
31 class WXDLLIMPEXP_FWD_CORE wxFontPreviewer;
32 
33 enum
34 {
35     wxID_FONT_UNDERLINE = 3000,
36     wxID_FONT_STYLE,
37     wxID_FONT_WEIGHT,
38     wxID_FONT_FAMILY,
39     wxID_FONT_COLOUR,
40     wxID_FONT_SIZE
41 };
42 
43 class WXDLLIMPEXP_CORE wxGenericFontDialog : public wxFontDialogBase
44 {
45 public:
wxGenericFontDialog()46     wxGenericFontDialog() { Init(); }
wxGenericFontDialog(wxWindow * parent)47     wxGenericFontDialog(wxWindow *parent)
48         : wxFontDialogBase(parent) { Init(); }
wxGenericFontDialog(wxWindow * parent,const wxFontData & data)49     wxGenericFontDialog(wxWindow *parent, const wxFontData& data)
50         : wxFontDialogBase(parent, data) { Init(); }
51     virtual ~wxGenericFontDialog();
52 
53     virtual int ShowModal();
54 
55 #if WXWIN_COMPATIBILITY_2_6
56     // deprecated, for backwards compatibility only
57     wxDEPRECATED( wxGenericFontDialog(wxWindow *parent, const wxFontData *data) );
58 #endif // WXWIN_COMPATIBILITY_2_6
59 
60     // Internal functions
61     void OnCloseWindow(wxCloseEvent& event);
62 
63     virtual void CreateWidgets();
64     virtual void InitializeFont();
65 
66     void OnChangeFont(wxCommandEvent& event);
67 
68 #if USE_SPINCTRL_FOR_POINT_SIZE
69     void OnChangeSize(wxSpinEvent& event);
70 #endif
71 
72 protected:
73 
74     virtual bool DoCreate(wxWindow *parent);
75 
76 private:
77 
78     // common part of all ctors
79     void Init();
80 
81     void DoChangeFont();
82 
83     wxFont m_dialogFont;
84 
85     wxChoice *m_familyChoice;
86     wxChoice *m_styleChoice;
87     wxChoice *m_weightChoice;
88     wxChoice *m_colourChoice;
89     wxCheckBox *m_underLineCheckBox;
90 
91 #if !USE_SPINCTRL_FOR_POINT_SIZE
92     wxChoice   *m_pointSizeChoice;
93 #endif
94 
95     wxFontPreviewer *m_previewer;
96     bool       m_useEvents;
97 
98     //  static bool fontDialogCancelled;
99     DECLARE_EVENT_TABLE()
100     DECLARE_DYNAMIC_CLASS(wxGenericFontDialog)
101 };
102 
103 #if WXWIN_COMPATIBILITY_2_6
104     // deprecated, for backwards compatibility only
wxGenericFontDialog(wxWindow * parent,const wxFontData * data)105 inline wxGenericFontDialog::wxGenericFontDialog(wxWindow *parent, const wxFontData *data)
106                            :wxFontDialogBase(parent) { Init(); InitFontData(data); Create(parent); }
107 #endif // WXWIN_COMPATIBILITY_2_6
108 
109 #endif // _WX_GENERIC_FONTDLGG_H
110