1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/generic/fontdlgg.h
3 // Purpose:     wxGenericFontDialog
4 // Author:      Julian Smart
5 // Modified by:
6 // Created:     01/02/97
7 // RCS-ID:      $Id: fontdlgg.h 39286 2006-05-23 11:16:47Z JS $
8 // Copyright:   (c) Julian Smart
9 // Licence:     wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11 
12 #ifndef _WX_GENERIC_FONTDLGG_H
13 #define _WX_GENERIC_FONTDLGG_H
14 
15 #include "wx/defs.h"
16 #include "wx/gdicmn.h"
17 #include "wx/font.h"
18 #include "wx/dialog.h"
19 #include "wx/cmndata.h"
20 
21 #ifdef __WXWINCE__
22 #define USE_SPINCTRL_FOR_POINT_SIZE 1
23 class WXDLLEXPORT wxSpinEvent;
24 #else
25 #define USE_SPINCTRL_FOR_POINT_SIZE 0
26 #endif
27 
28 /*
29  * FONT DIALOG
30  */
31 
32 class WXDLLEXPORT wxChoice;
33 class WXDLLEXPORT wxText;
34 class WXDLLEXPORT wxCheckBox;
35 class WXDLLEXPORT wxFontPreviewer;
36 
37 enum
38 {
39     wxID_FONT_UNDERLINE = 3000,
40     wxID_FONT_STYLE,
41     wxID_FONT_WEIGHT,
42     wxID_FONT_FAMILY,
43     wxID_FONT_COLOUR,
44     wxID_FONT_SIZE
45 };
46 
47 class WXDLLEXPORT wxGenericFontDialog : public wxFontDialogBase
48 {
49 public:
wxGenericFontDialog()50     wxGenericFontDialog() { Init(); }
wxGenericFontDialog(wxWindow * parent)51     wxGenericFontDialog(wxWindow *parent)
52         : wxFontDialogBase(parent) { Init(); }
wxGenericFontDialog(wxWindow * parent,const wxFontData & data)53     wxGenericFontDialog(wxWindow *parent, const wxFontData& data)
54         : wxFontDialogBase(parent, data) { Init(); }
55     virtual ~wxGenericFontDialog();
56 
57     virtual int ShowModal();
58 
59 #if WXWIN_COMPATIBILITY_2_6
60     // deprecated, for backwards compatibility only
61     wxDEPRECATED( wxGenericFontDialog(wxWindow *parent, const wxFontData *data) );
62 #endif // WXWIN_COMPATIBILITY_2_6
63 
64     // Internal functions
65     void OnCloseWindow(wxCloseEvent& event);
66 
67     virtual void CreateWidgets();
68     virtual void InitializeFont();
69 
70     void OnChangeFont(wxCommandEvent& event);
71 
72 #if USE_SPINCTRL_FOR_POINT_SIZE
73     void OnChangeSize(wxSpinEvent& event);
74 #endif
75 
76 protected:
77 
78     virtual bool DoCreate(wxWindow *parent);
79 
80 private:
81 
82     // common part of all ctors
83     void Init();
84 
85     void DoChangeFont();
86 
87     wxFont m_dialogFont;
88 
89     wxChoice *m_familyChoice;
90     wxChoice *m_styleChoice;
91     wxChoice *m_weightChoice;
92     wxChoice *m_colourChoice;
93     wxCheckBox *m_underLineCheckBox;
94 
95 #if !USE_SPINCTRL_FOR_POINT_SIZE
96     wxChoice   *m_pointSizeChoice;
97 #endif
98 
99     wxFontPreviewer *m_previewer;
100     bool       m_useEvents;
101 
102     //  static bool fontDialogCancelled;
103     DECLARE_EVENT_TABLE()
104     DECLARE_DYNAMIC_CLASS(wxGenericFontDialog)
105 };
106 
107 WXDLLEXPORT const wxChar *wxFontFamilyIntToString(int family);
108 WXDLLEXPORT const wxChar *wxFontWeightIntToString(int weight);
109 WXDLLEXPORT const wxChar *wxFontStyleIntToString(int style);
110 WXDLLEXPORT int wxFontFamilyStringToInt(wxChar *family);
111 WXDLLEXPORT int wxFontWeightStringToInt(wxChar *weight);
112 WXDLLEXPORT int wxFontStyleStringToInt(wxChar *style);
113 
114 #if WXWIN_COMPATIBILITY_2_6
115     // deprecated, for backwards compatibility only
wxGenericFontDialog(wxWindow * parent,const wxFontData * data)116 inline wxGenericFontDialog::wxGenericFontDialog(wxWindow *parent, const wxFontData *data)
117                            :wxFontDialogBase(parent) { Init(); InitFontData(data); Create(parent); }
118 #endif // WXWIN_COMPATIBILITY_2_6
119 
120 #endif // _WX_GENERIC_FONTDLGG_H
121