1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mac/carbon/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"
16 #include "wx/cmndata.h"
23 * support old notation
25 #ifdef wxMAC_USE_EXPERIMENTAL_FONTDIALOG
26 #define wxOSX_USE_EXPERIMENTAL_FONTDIALOG wxMAC_USE_EXPERIMENTAL_FONTDIALOG
29 #ifndef wxOSX_USE_EXPERIMENTAL_FONTDIALOG
30 #define wxOSX_USE_EXPERIMENTAL_FONTDIALOG 1
33 #if wxOSX_USE_EXPERIMENTAL_FONTDIALOG
35 class WXDLLIMPEXP_CORE wxFontDialog
: public wxDialog
39 wxFontDialog(wxWindow
*parent
, const wxFontData
& data
);
40 virtual ~wxFontDialog();
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_COMMAND_LISTBOX_SELECTED event handler for wxID_FONTDIALOG_FACENAME
127 void OnFontdialogFacenameSelected( wxCommandEvent
& event
);
129 /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE
130 void OnFontdialogFontsizeUpdated( wxSpinEvent
& event
);
132 /// wxEVT_COMMAND_TEXT_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE
133 void OnFontdialogFontsizeTextUpdated( wxCommandEvent
& event
);
135 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_BOLD
136 void OnFontdialogBoldClick( wxCommandEvent
& event
);
138 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_ITALIC
139 void OnFontdialogItalicClick( wxCommandEvent
& event
);
141 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_UNDERLINED
142 void OnFontdialogUnderlinedClick( wxCommandEvent
& event
);
144 /// wxEVT_COMMAND_BUTTON_CLICKED 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
;