]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: fontdlg.h | |
3 | // Purpose: wxFontDialog class using fonts window services (10.2+). | |
4 | // Author: Ryan Norton | |
5 | // Modified by: | |
6 | // Created: 2004-09-25 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Ryan Norton | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_FONTDLG_H_ | |
13 | #define _WX_FONTDLG_H_ | |
14 | ||
15 | #include "wx/dialog.h" | |
16 | #include "wx/cmndata.h" | |
17 | ||
18 | /* | |
19 | * Font dialog | |
20 | */ | |
21 | ||
22 | #ifndef wxMAC_USE_EXPERIMENTAL_FONTDIALOG | |
23 | #define wxMAC_USE_EXPERIMENTAL_FONTDIALOG 0 | |
24 | #endif | |
25 | ||
26 | #if wxMAC_USE_EXPERIMENTAL_FONTDIALOG | |
27 | ||
28 | class WXDLLEXPORT wxFontDialog : public wxDialog | |
29 | { | |
30 | public: | |
31 | wxFontDialog(); | |
32 | wxFontDialog(wxWindow *parent, const wxFontData& data); | |
33 | ~wxFontDialog(); | |
34 | ||
35 | bool Create(wxWindow *parent, const wxFontData& data); | |
36 | ||
37 | int ShowModal(); | |
38 | wxFontData& GetFontData() { return m_fontData; } | |
39 | ||
40 | protected: | |
41 | wxFontData m_fontData; | |
42 | ||
43 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog) | |
44 | }; | |
45 | ||
46 | extern "C" int RunMixedFontDialog(wxFontDialog* dialog) ; | |
47 | ||
48 | #else // wxMAC_USE_EXPERIMENTAL_FONTDIALOG | |
49 | ||
50 | #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX | |
51 | ||
52 | /*! | |
53 | * Forward declarations | |
54 | */ | |
55 | ||
56 | class wxFontColourSwatchCtrl; | |
57 | class wxFontPreviewCtrl; | |
58 | class WXDLLEXPORT wxSpinCtrl; | |
59 | class WXDLLEXPORT wxSpinEvent; | |
60 | class WXDLLEXPORT wxListBox; | |
61 | class WXDLLEXPORT wxChoice; | |
62 | class WXDLLEXPORT wxButton; | |
63 | class WXDLLEXPORT wxStaticText; | |
64 | class WXDLLEXPORT wxCheckBox; | |
65 | ||
66 | /*! | |
67 | * Control identifiers | |
68 | */ | |
69 | ||
70 | #define wxID_FONTDIALOG_FACENAME 20001 | |
71 | #define wxID_FONTDIALOG_FONTSIZE 20002 | |
72 | #define wxID_FONTDIALOG_BOLD 20003 | |
73 | #define wxID_FONTDIALOG_ITALIC 20004 | |
74 | #define wxID_FONTDIALOG_UNDERLINED 20005 | |
75 | #define wxID_FONTDIALOG_COLOUR 20006 | |
76 | #define wxID_FONTDIALOG_PREVIEW 20007 | |
77 | ||
78 | #endif | |
79 | // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX | |
80 | ||
81 | class WXDLLEXPORT wxFontDialog: public wxDialog | |
82 | { | |
83 | DECLARE_DYNAMIC_CLASS(wxFontDialog) | |
84 | ||
85 | #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX | |
86 | DECLARE_EVENT_TABLE() | |
87 | #endif | |
88 | ||
89 | public: | |
90 | wxFontDialog(); | |
91 | wxFontDialog(wxWindow *parent, const wxFontData& data); | |
92 | ~wxFontDialog(); | |
93 | ||
94 | bool Create(wxWindow *parent, const wxFontData& data); | |
95 | ||
96 | int ShowModal(); | |
97 | wxFontData& GetFontData() { return m_fontData; } | |
98 | bool IsShown() const; | |
99 | void OnPanelClose(); | |
100 | void SetData(const wxFontData& data); | |
101 | ||
102 | #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX | |
103 | ||
104 | /// Creates the controls and sizers | |
105 | void CreateControls(); | |
106 | ||
107 | /// Initialize font | |
108 | void InitializeFont(); | |
109 | ||
110 | /// Set controls according to current font | |
111 | void InitializeControls(); | |
112 | ||
113 | /// Respond to font change | |
114 | void ChangeFont(); | |
115 | ||
116 | /// Respond to colour change | |
117 | void OnColourChanged(wxCommandEvent& event); | |
118 | ||
119 | /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for wxID_FONTDIALOG_FACENAME | |
120 | void OnFontdialogFacenameSelected( wxCommandEvent& event ); | |
121 | ||
122 | /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE | |
123 | void OnFontdialogFontsizeUpdated( wxSpinEvent& event ); | |
124 | ||
125 | /// wxEVT_COMMAND_TEXT_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE | |
126 | void OnFontdialogFontsizeTextUpdated( wxCommandEvent& event ); | |
127 | ||
128 | /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_BOLD | |
129 | void OnFontdialogBoldClick( wxCommandEvent& event ); | |
130 | ||
131 | /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_ITALIC | |
132 | void OnFontdialogItalicClick( wxCommandEvent& event ); | |
133 | ||
134 | /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_UNDERLINED | |
135 | void OnFontdialogUnderlinedClick( wxCommandEvent& event ); | |
136 | ||
137 | /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK | |
138 | void OnOkClick( wxCommandEvent& event ); | |
139 | ||
140 | /// Should we show tooltips? | |
141 | static bool ShowToolTips(); | |
142 | ||
143 | wxListBox* m_facenameCtrl; | |
144 | wxSpinCtrl* m_sizeCtrl; | |
145 | wxCheckBox* m_boldCtrl; | |
146 | wxCheckBox* m_italicCtrl; | |
147 | wxCheckBox* m_underlinedCtrl; | |
148 | wxFontColourSwatchCtrl* m_colourCtrl; | |
149 | wxFontPreviewCtrl* m_previewCtrl; | |
150 | ||
151 | wxFont m_dialogFont; | |
152 | bool m_suppressUpdates; | |
153 | ||
154 | #endif | |
155 | // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX | |
156 | ||
157 | protected: | |
158 | wxWindow* m_dialogParent; | |
159 | wxFontData m_fontData; | |
160 | void* m_pEventHandlerRef; | |
161 | }; | |
162 | ||
163 | #endif | |
164 | ||
165 | #endif | |
166 | // _WX_FONTDLG_H_ | |
167 |