]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/fontdlg.h
put refdata virtuals in the right class this time
[wxWidgets.git] / include / wx / mac / carbon / 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 #ifndef wxMAC_USE_EXPERIMENTAL_FONTDIALOG
23 #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2
24 #define wxMAC_USE_EXPERIMENTAL_FONTDIALOG 0
25 #else
26 #define wxMAC_USE_EXPERIMENTAL_FONTDIALOG 1
27 #endif
28 #endif
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);
37 virtual ~wxFontDialog();
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
54 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
55
56 /*!
57 * Forward declarations
58 */
59
60 class wxFontColourSwatchCtrl;
61 class wxFontPreviewCtrl;
62 class WXDLLEXPORT wxSpinCtrl;
63 class WXDLLEXPORT wxSpinEvent;
64 class WXDLLEXPORT wxListBox;
65 class WXDLLEXPORT wxChoice;
66 class WXDLLEXPORT wxButton;
67 class WXDLLEXPORT wxStaticText;
68 class WXDLLEXPORT wxCheckBox;
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
85 class WXDLLEXPORT wxFontDialog: public wxDialog
86 {
87 DECLARE_DYNAMIC_CLASS(wxFontDialog)
88
89 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
90 DECLARE_EVENT_TABLE()
91 #endif
92
93 public:
94 wxFontDialog();
95 wxFontDialog(wxWindow *parent, const wxFontData& data);
96 virtual ~wxFontDialog();
97
98 bool Create(wxWindow *parent, const wxFontData& data);
99
100 int ShowModal();
101 wxFontData& GetFontData() { return m_fontData; }
102 bool IsShown() const;
103 void OnPanelClose();
104 void SetData(const wxFontData& data);
105
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
161 protected:
162 wxWindow* m_dialogParent;
163 wxFontData m_fontData;
164 void* m_pEventHandlerRef;
165 };
166
167 #endif
168
169 #endif
170 // _WX_FONTDLG_H_