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