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