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 #define wxMAC_USE_EXPERIMENTAL_FONTDIALOG 1
26 #if wxMAC_USE_EXPERIMENTAL_FONTDIALOG
28 class WXDLLIMPEXP_CORE wxFontDialog
: public wxDialog
32 wxFontDialog(wxWindow
*parent
, const wxFontData
& data
);
33 virtual ~wxFontDialog();
35 bool Create(wxWindow
*parent
, const wxFontData
& data
);
38 wxFontData
& GetFontData() { return m_fontData
; }
41 wxFontData m_fontData
;
43 DECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog
)
46 extern "C" int RunMixedFontDialog(wxFontDialog
* dialog
) ;
48 #else // wxMAC_USE_EXPERIMENTAL_FONTDIALOG
50 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
53 * Forward declarations
56 class wxFontColourSwatchCtrl
;
57 class wxFontPreviewCtrl
;
58 class WXDLLIMPEXP_FWD_CORE wxSpinCtrl
;
59 class WXDLLIMPEXP_FWD_CORE wxSpinEvent
;
60 class WXDLLIMPEXP_FWD_CORE wxListBox
;
61 class WXDLLIMPEXP_FWD_CORE wxChoice
;
62 class WXDLLIMPEXP_FWD_CORE wxButton
;
63 class WXDLLIMPEXP_FWD_CORE wxStaticText
;
64 class WXDLLIMPEXP_FWD_CORE wxCheckBox
;
70 #define wxID_FONTDIALOG_FACENAME 20001
71 #define wxID_FONTDIALOG_FONTSIZE 20002
72 #define wxID_FONTDIALOG_BOLD 20003
73 #define wxID_FONTDIALOG_ITALIC 20004
74 #define wxID_FONTDIALOG_UNDERLINED 20005
75 #define wxID_FONTDIALOG_COLOUR 20006
76 #define wxID_FONTDIALOG_PREVIEW 20007
79 // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
81 class WXDLLIMPEXP_CORE wxFontDialog
: public wxDialog
83 DECLARE_DYNAMIC_CLASS(wxFontDialog
)
85 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
91 wxFontDialog(wxWindow
*parent
, const wxFontData
& data
);
92 virtual ~wxFontDialog();
94 bool Create(wxWindow
*parent
, const wxFontData
& data
);
97 wxFontData
& GetFontData() { return m_fontData
; }
100 void SetData(const wxFontData
& data
);
102 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
104 /// Creates the controls and sizers
105 void CreateControls();
108 void InitializeFont();
110 /// Set controls according to current font
111 void InitializeControls();
113 /// Respond to font change
116 /// Respond to colour change
117 void OnColourChanged(wxCommandEvent
& event
);
119 /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for wxID_FONTDIALOG_FACENAME
120 void OnFontdialogFacenameSelected( wxCommandEvent
& event
);
122 /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE
123 void OnFontdialogFontsizeUpdated( wxSpinEvent
& event
);
125 /// wxEVT_COMMAND_TEXT_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE
126 void OnFontdialogFontsizeTextUpdated( wxCommandEvent
& event
);
128 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_BOLD
129 void OnFontdialogBoldClick( wxCommandEvent
& event
);
131 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_ITALIC
132 void OnFontdialogItalicClick( wxCommandEvent
& event
);
134 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_UNDERLINED
135 void OnFontdialogUnderlinedClick( wxCommandEvent
& event
);
137 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
138 void OnOkClick( wxCommandEvent
& event
);
140 /// Should we show tooltips?
141 static bool ShowToolTips();
143 wxListBox
* m_facenameCtrl
;
144 wxSpinCtrl
* m_sizeCtrl
;
145 wxCheckBox
* m_boldCtrl
;
146 wxCheckBox
* m_italicCtrl
;
147 wxCheckBox
* m_underlinedCtrl
;
148 wxFontColourSwatchCtrl
* m_colourCtrl
;
149 wxFontPreviewCtrl
* m_previewCtrl
;
152 bool m_suppressUpdates
;
155 // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
158 wxWindow
* m_dialogParent
;
159 wxFontData m_fontData
;
160 void* m_pEventHandlerRef
;