1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/fontdlg.h
3 // Purpose: wxFontDialog class using fonts window services (10.2+).
8 // Copyright: (c) Ryan Norton
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_FONTDLG_H_
13 #define _WX_FONTDLG_H_
15 #include "wx/dialog.h"
22 * support old notation
24 #ifdef wxMAC_USE_EXPERIMENTAL_FONTDIALOG
25 #define wxOSX_USE_EXPERIMENTAL_FONTDIALOG wxMAC_USE_EXPERIMENTAL_FONTDIALOG
28 #ifndef wxOSX_USE_EXPERIMENTAL_FONTDIALOG
29 #define wxOSX_USE_EXPERIMENTAL_FONTDIALOG 1
32 #if wxOSX_USE_EXPERIMENTAL_FONTDIALOG
34 class WXDLLIMPEXP_CORE wxFontDialog
: public wxDialog
38 wxFontDialog(wxWindow
*parent
);
39 wxFontDialog(wxWindow
*parent
, const wxFontData
& data
);
40 virtual ~wxFontDialog();
42 bool Create(wxWindow
*parent
);
43 bool Create(wxWindow
*parent
, const wxFontData
& data
);
46 wxFontData
& GetFontData() { return m_fontData
; }
49 wxFontData m_fontData
;
51 DECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog
)
54 extern "C" int RunMixedFontDialog(wxFontDialog
* dialog
) ;
56 #else // wxOSX_USE_EXPERIMENTAL_FONTDIALOG
58 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
61 * Forward declarations
64 class wxFontColourSwatchCtrl
;
65 class wxFontPreviewCtrl
;
66 class WXDLLIMPEXP_FWD_CORE wxSpinCtrl
;
67 class WXDLLIMPEXP_FWD_CORE wxSpinEvent
;
68 class WXDLLIMPEXP_FWD_CORE wxListBox
;
69 class WXDLLIMPEXP_FWD_CORE wxChoice
;
70 class WXDLLIMPEXP_FWD_CORE wxButton
;
71 class WXDLLIMPEXP_FWD_CORE wxStaticText
;
72 class WXDLLIMPEXP_FWD_CORE wxCheckBox
;
78 #define wxID_FONTDIALOG_FACENAME 20001
79 #define wxID_FONTDIALOG_FONTSIZE 20002
80 #define wxID_FONTDIALOG_BOLD 20003
81 #define wxID_FONTDIALOG_ITALIC 20004
82 #define wxID_FONTDIALOG_UNDERLINED 20005
83 #define wxID_FONTDIALOG_COLOUR 20006
84 #define wxID_FONTDIALOG_PREVIEW 20007
87 // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
89 class WXDLLIMPEXP_CORE wxFontDialog
: public wxDialog
91 DECLARE_DYNAMIC_CLASS(wxFontDialog
)
93 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
99 wxFontDialog(wxWindow
*parent
, const wxFontData
& data
);
100 virtual ~wxFontDialog();
102 bool Create(wxWindow
*parent
, const wxFontData
& data
);
105 wxFontData
& GetFontData() { return m_fontData
; }
106 bool IsShown() const;
108 void SetData(const wxFontData
& data
);
110 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
112 /// Creates the controls and sizers
113 void CreateControls();
116 void InitializeFont();
118 /// Set controls according to current font
119 void InitializeControls();
121 /// Respond to font change
124 /// Respond to colour change
125 void OnColourChanged(wxCommandEvent
& event
);
127 /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for wxID_FONTDIALOG_FACENAME
128 void OnFontdialogFacenameSelected( wxCommandEvent
& event
);
130 /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE
131 void OnFontdialogFontsizeUpdated( wxSpinEvent
& event
);
133 /// wxEVT_COMMAND_TEXT_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE
134 void OnFontdialogFontsizeTextUpdated( wxCommandEvent
& event
);
136 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_BOLD
137 void OnFontdialogBoldClick( wxCommandEvent
& event
);
139 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_ITALIC
140 void OnFontdialogItalicClick( wxCommandEvent
& event
);
142 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_UNDERLINED
143 void OnFontdialogUnderlinedClick( wxCommandEvent
& event
);
145 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
146 void OnOkClick( wxCommandEvent
& event
);
148 /// Should we show tooltips?
149 static bool ShowToolTips();
151 wxListBox
* m_facenameCtrl
;
152 wxSpinCtrl
* m_sizeCtrl
;
153 wxCheckBox
* m_boldCtrl
;
154 wxCheckBox
* m_italicCtrl
;
155 wxCheckBox
* m_underlinedCtrl
;
156 wxFontColourSwatchCtrl
* m_colourCtrl
;
157 wxFontPreviewCtrl
* m_previewCtrl
;
160 bool m_suppressUpdates
;
163 // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
166 wxWindow
* m_dialogParent
;
167 wxFontData m_fontData
;
168 void* m_pEventHandlerRef
;