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
, const wxFontData
& data
);
39 virtual ~wxFontDialog();
41 bool Create(wxWindow
*parent
, const wxFontData
& data
);
44 wxFontData
& GetFontData() { return m_fontData
; }
47 wxFontData m_fontData
;
49 DECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog
)
52 extern "C" int RunMixedFontDialog(wxFontDialog
* dialog
) ;
54 #else // wxOSX_USE_EXPERIMENTAL_FONTDIALOG
56 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
59 * Forward declarations
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
;
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
85 // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
87 class WXDLLIMPEXP_CORE wxFontDialog
: public wxDialog
89 DECLARE_DYNAMIC_CLASS(wxFontDialog
)
91 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
97 wxFontDialog(wxWindow
*parent
, const wxFontData
& data
);
98 virtual ~wxFontDialog();
100 bool Create(wxWindow
*parent
, const wxFontData
& data
);
103 wxFontData
& GetFontData() { return m_fontData
; }
104 bool IsShown() const;
106 void SetData(const wxFontData
& data
);
108 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
110 /// Creates the controls and sizers
111 void CreateControls();
114 void InitializeFont();
116 /// Set controls according to current font
117 void InitializeControls();
119 /// Respond to font change
122 /// Respond to colour change
123 void OnColourChanged(wxCommandEvent
& event
);
125 /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for wxID_FONTDIALOG_FACENAME
126 void OnFontdialogFacenameSelected( wxCommandEvent
& event
);
128 /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE
129 void OnFontdialogFontsizeUpdated( wxSpinEvent
& event
);
131 /// wxEVT_COMMAND_TEXT_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE
132 void OnFontdialogFontsizeTextUpdated( wxCommandEvent
& event
);
134 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_BOLD
135 void OnFontdialogBoldClick( wxCommandEvent
& event
);
137 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_ITALIC
138 void OnFontdialogItalicClick( wxCommandEvent
& event
);
140 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_UNDERLINED
141 void OnFontdialogUnderlinedClick( wxCommandEvent
& event
);
143 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
144 void OnOkClick( wxCommandEvent
& event
);
146 /// Should we show tooltips?
147 static bool ShowToolTips();
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
;
158 bool m_suppressUpdates
;
161 // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
164 wxWindow
* m_dialogParent
;
165 wxFontData m_fontData
;
166 void* m_pEventHandlerRef
;