1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/fontdlg.h
3 // Purpose: wxFontDialog class using fonts window services (10.2+).
7 // Copyright: (c) Ryan Norton
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_FONTDLG_H_
12 #define _WX_FONTDLG_H_
14 #include "wx/dialog.h"
21 * support old notation
23 #ifdef wxMAC_USE_EXPERIMENTAL_FONTDIALOG
24 #define wxOSX_USE_EXPERIMENTAL_FONTDIALOG wxMAC_USE_EXPERIMENTAL_FONTDIALOG
27 #ifndef wxOSX_USE_EXPERIMENTAL_FONTDIALOG
28 #define wxOSX_USE_EXPERIMENTAL_FONTDIALOG 1
31 #if wxOSX_USE_EXPERIMENTAL_FONTDIALOG
33 class WXDLLIMPEXP_CORE wxFontDialog
: public wxDialog
37 wxFontDialog(wxWindow
*parent
);
38 wxFontDialog(wxWindow
*parent
, const wxFontData
& data
);
39 virtual ~wxFontDialog();
41 bool Create(wxWindow
*parent
);
42 bool Create(wxWindow
*parent
, const wxFontData
& data
);
45 wxFontData
& GetFontData() { return m_fontData
; }
48 wxFontData m_fontData
;
50 DECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog
)
53 extern "C" int RunMixedFontDialog(wxFontDialog
* dialog
) ;
55 #else // wxOSX_USE_EXPERIMENTAL_FONTDIALOG
57 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
60 * Forward declarations
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
;
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
86 // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
88 class WXDLLIMPEXP_CORE wxFontDialog
: public wxDialog
90 DECLARE_DYNAMIC_CLASS(wxFontDialog
)
92 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
98 wxFontDialog(wxWindow
*parent
, const wxFontData
& data
);
99 virtual ~wxFontDialog();
101 bool Create(wxWindow
*parent
, const wxFontData
& data
);
104 wxFontData
& GetFontData() { return m_fontData
; }
105 bool IsShown() const;
107 void SetData(const wxFontData
& data
);
109 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
111 /// Creates the controls and sizers
112 void CreateControls();
115 void InitializeFont();
117 /// Set controls according to current font
118 void InitializeControls();
120 /// Respond to font change
123 /// Respond to colour change
124 void OnColourChanged(wxCommandEvent
& event
);
126 /// wxEVT_LISTBOX event handler for wxID_FONTDIALOG_FACENAME
127 void OnFontdialogFacenameSelected( wxCommandEvent
& event
);
129 /// wxEVT_SPINCTRL event handler for wxID_FONTDIALOG_FONTSIZE
130 void OnFontdialogFontsizeUpdated( wxSpinEvent
& event
);
132 /// wxEVT_TEXT event handler for wxID_FONTDIALOG_FONTSIZE
133 void OnFontdialogFontsizeTextUpdated( wxCommandEvent
& event
);
135 /// wxEVT_CHECKBOX event handler for wxID_FONTDIALOG_BOLD
136 void OnFontdialogBoldClick( wxCommandEvent
& event
);
138 /// wxEVT_CHECKBOX event handler for wxID_FONTDIALOG_ITALIC
139 void OnFontdialogItalicClick( wxCommandEvent
& event
);
141 /// wxEVT_CHECKBOX event handler for wxID_FONTDIALOG_UNDERLINED
142 void OnFontdialogUnderlinedClick( wxCommandEvent
& event
);
144 /// wxEVT_BUTTON event handler for wxID_OK
145 void OnOkClick( wxCommandEvent
& event
);
147 /// Should we show tooltips?
148 static bool ShowToolTips();
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
;
159 bool m_suppressUpdates
;
162 // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
165 wxWindow
* m_dialogParent
;
166 wxFontData m_fontData
;
167 void* m_pEventHandlerRef
;