Added slightly better font dialog for Mac
[wxWidgets.git] / include / wx / mac / carbon / fontdlg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: fontdlg.h
3 // Purpose: wxFontDialog class using fonts window services (10.2+).
4 // Author: Ryan Norton
5 // Modified by:
6 // Created: 2004-09-25
7 // RCS-ID: $Id$
8 // Copyright: (c) Ryan Norton
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_FONTDLG_H_
13 #define _WX_FONTDLG_H_
14
15 #include "wx/dialog.h"
16 #include "wx/cmndata.h"
17
18 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
19
20 /*!
21 * Forward declarations
22 */
23
24 class wxFontColourSwatchCtrl;
25 class wxFontPreviewCtrl;
26 class WXDLLEXPORT wxSpinCtrl;
27 class WXDLLEXPORT wxSpinEvent;
28 class WXDLLEXPORT wxListBox;
29 class WXDLLEXPORT wxChoice;
30 class WXDLLEXPORT wxButton;
31 class WXDLLEXPORT wxStaticText;
32 class WXDLLEXPORT wxCheckBox;
33
34 /*!
35 * Control identifiers
36 */
37
38 #define wxID_FONTDIALOG_FACENAME 20001
39 #define wxID_FONTDIALOG_FONTSIZE 20002
40 #define wxID_FONTDIALOG_BOLD 20003
41 #define wxID_FONTDIALOG_ITALIC 20004
42 #define wxID_FONTDIALOG_UNDERLINED 20005
43 #define wxID_FONTDIALOG_COLOUR 20006
44 #define wxID_FONTDIALOG_PREVIEW 20007
45
46 #endif
47 // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
48
49 /*
50 * Font dialog
51 */
52
53 class WXDLLEXPORT wxFontDialog: public wxDialog
54 {
55 DECLARE_DYNAMIC_CLASS(wxFontDialog)
56
57 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
58 DECLARE_EVENT_TABLE()
59 #endif
60
61 public:
62 wxFontDialog();
63 wxFontDialog(wxWindow *parent, const wxFontData& data);
64 ~wxFontDialog();
65
66 bool Create(wxWindow *parent, const wxFontData& data);
67
68 int ShowModal();
69 wxFontData& GetFontData() { return m_fontData; }
70 bool IsShown() const;
71 void OnPanelClose();
72 void SetData(const wxFontData& data);
73
74 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
75
76 /// Creates the controls and sizers
77 void CreateControls();
78
79 /// Initialize font
80 void InitializeFont();
81
82 /// Set controls according to current font
83 void InitializeControls();
84
85 /// Respond to font change
86 void ChangeFont();
87
88 /// Respond to colour change
89 void OnColourChanged(wxCommandEvent& event);
90
91 /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for wxID_FONTDIALOG_FACENAME
92 void OnFontdialogFacenameSelected( wxCommandEvent& event );
93
94 /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE
95 void OnFontdialogFontsizeUpdated( wxSpinEvent& event );
96
97 /// wxEVT_COMMAND_TEXT_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE
98 void OnFontdialogFontsizeTextUpdated( wxCommandEvent& event );
99
100 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_BOLD
101 void OnFontdialogBoldClick( wxCommandEvent& event );
102
103 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_ITALIC
104 void OnFontdialogItalicClick( wxCommandEvent& event );
105
106 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_UNDERLINED
107 void OnFontdialogUnderlinedClick( wxCommandEvent& event );
108
109 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
110 void OnOkClick( wxCommandEvent& event );
111
112 /// Should we show tooltips?
113 static bool ShowToolTips();
114
115 wxListBox* m_facenameCtrl;
116 wxSpinCtrl* m_sizeCtrl;
117 wxCheckBox* m_boldCtrl;
118 wxCheckBox* m_italicCtrl;
119 wxCheckBox* m_underlinedCtrl;
120 wxFontColourSwatchCtrl* m_colourCtrl;
121 wxFontPreviewCtrl* m_previewCtrl;
122
123 wxFont m_dialogFont;
124 bool m_suppressUpdates;
125
126 #endif
127 // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
128
129 protected:
130 wxWindow* m_dialogParent;
131 wxFontData m_fontData;
132 void* m_pEventHandlerRef;
133 };
134
135 #endif
136 // _WX_FONTDLG_H_
137