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