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"
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
26 #define wxMAC_USE_EXPERIMENTAL_FONTDIALOG 1
30 #if wxMAC_USE_EXPERIMENTAL_FONTDIALOG
32 class WXDLLEXPORT wxFontDialog
: public wxDialog
36 wxFontDialog(wxWindow
*parent
, const wxFontData
& data
);
37 virtual ~wxFontDialog();
39 bool Create(wxWindow
*parent
, const wxFontData
& data
);
42 wxFontData
& GetFontData() { return m_fontData
; }
45 wxFontData m_fontData
;
47 DECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog
)
50 extern "C" int RunMixedFontDialog(wxFontDialog
* dialog
) ;
52 #else // wxMAC_USE_EXPERIMENTAL_FONTDIALOG
54 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
57 * Forward declarations
60 class wxFontColourSwatchCtrl
;
61 class wxFontPreviewCtrl
;
62 class WXDLLIMPEXP_FWD_CORE wxSpinCtrl
;
63 class WXDLLIMPEXP_FWD_CORE wxSpinEvent
;
64 class WXDLLIMPEXP_FWD_CORE wxListBox
;
65 class WXDLLIMPEXP_FWD_CORE wxChoice
;
66 class WXDLLIMPEXP_FWD_CORE wxButton
;
67 class WXDLLIMPEXP_FWD_CORE wxStaticText
;
68 class WXDLLIMPEXP_FWD_CORE wxCheckBox
;
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
83 // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
85 class WXDLLEXPORT wxFontDialog
: public wxDialog
87 DECLARE_DYNAMIC_CLASS(wxFontDialog
)
89 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
95 wxFontDialog(wxWindow
*parent
, const wxFontData
& data
);
96 virtual ~wxFontDialog();
98 bool Create(wxWindow
*parent
, const wxFontData
& data
);
101 wxFontData
& GetFontData() { return m_fontData
; }
102 bool IsShown() const;
104 void SetData(const wxFontData
& data
);
106 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
108 /// Creates the controls and sizers
109 void CreateControls();
112 void InitializeFont();
114 /// Set controls according to current font
115 void InitializeControls();
117 /// Respond to font change
120 /// Respond to colour change
121 void OnColourChanged(wxCommandEvent
& event
);
123 /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for wxID_FONTDIALOG_FACENAME
124 void OnFontdialogFacenameSelected( wxCommandEvent
& event
);
126 /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE
127 void OnFontdialogFontsizeUpdated( wxSpinEvent
& event
);
129 /// wxEVT_COMMAND_TEXT_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE
130 void OnFontdialogFontsizeTextUpdated( wxCommandEvent
& event
);
132 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_BOLD
133 void OnFontdialogBoldClick( wxCommandEvent
& event
);
135 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_ITALIC
136 void OnFontdialogItalicClick( wxCommandEvent
& event
);
138 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_UNDERLINED
139 void OnFontdialogUnderlinedClick( wxCommandEvent
& event
);
141 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
142 void OnOkClick( wxCommandEvent
& event
);
144 /// Should we show tooltips?
145 static bool ShowToolTips();
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
;
156 bool m_suppressUpdates
;
159 // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
162 wxWindow
* m_dialogParent
;
163 wxFontData m_fontData
;
164 void* m_pEventHandlerRef
;