]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/fontdlg.h
Use FWD version of DLL export macro in forward declaration.
[wxWidgets.git] / include / wx / osx / fontdlg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mac/carbon/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 /*
23 * support old notation
24 */
25 #ifdef wxMAC_USE_EXPERIMENTAL_FONTDIALOG
26 #define wxOSX_USE_EXPERIMENTAL_FONTDIALOG wxMAC_USE_EXPERIMENTAL_FONTDIALOG
27 #endif
28
29 #ifndef wxOSX_USE_EXPERIMENTAL_FONTDIALOG
30 #define wxOSX_USE_EXPERIMENTAL_FONTDIALOG 1
31 #endif
32
33 #if wxOSX_USE_EXPERIMENTAL_FONTDIALOG
34
35 class WXDLLIMPEXP_CORE wxFontDialog : public wxDialog
36 {
37 public:
38 wxFontDialog();
39 wxFontDialog(wxWindow *parent, const wxFontData& data);
40 virtual ~wxFontDialog();
41
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
126 /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for wxID_FONTDIALOG_FACENAME
127 void OnFontdialogFacenameSelected( wxCommandEvent& event );
128
129 /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE
130 void OnFontdialogFontsizeUpdated( wxSpinEvent& event );
131
132 /// wxEVT_COMMAND_TEXT_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE
133 void OnFontdialogFontsizeTextUpdated( wxCommandEvent& event );
134
135 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_BOLD
136 void OnFontdialogBoldClick( wxCommandEvent& event );
137
138 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_ITALIC
139 void OnFontdialogItalicClick( wxCommandEvent& event );
140
141 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_UNDERLINED
142 void OnFontdialogUnderlinedClick( wxCommandEvent& event );
143
144 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
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_