]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/osx/fontdlg.h
removing NSWindow based mouse tracking in favour of 10.5+ trackingArea implementation
[wxWidgets.git] / include / wx / osx / fontdlg.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/osx/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
17/*
18 * Font dialog
19 */
20
21/*
22 * support old notation
23 */
24#ifdef wxMAC_USE_EXPERIMENTAL_FONTDIALOG
25#define wxOSX_USE_EXPERIMENTAL_FONTDIALOG wxMAC_USE_EXPERIMENTAL_FONTDIALOG
26#endif
27
28#ifndef wxOSX_USE_EXPERIMENTAL_FONTDIALOG
29#define wxOSX_USE_EXPERIMENTAL_FONTDIALOG 1
30#endif
31
32#if wxOSX_USE_EXPERIMENTAL_FONTDIALOG
33
34class WXDLLIMPEXP_CORE wxFontDialog : public wxDialog
35{
36public:
37 wxFontDialog();
38 wxFontDialog(wxWindow *parent);
39 wxFontDialog(wxWindow *parent, const wxFontData& data);
40 virtual ~wxFontDialog();
41
42 bool Create(wxWindow *parent);
43 bool Create(wxWindow *parent, const wxFontData& data);
44
45 int ShowModal();
46 wxFontData& GetFontData() { return m_fontData; }
47
48protected:
49 wxFontData m_fontData;
50
51 DECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog)
52};
53
54extern "C" int RunMixedFontDialog(wxFontDialog* dialog) ;
55
56#else // wxOSX_USE_EXPERIMENTAL_FONTDIALOG
57
58#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
59
60/*!
61 * Forward declarations
62 */
63
64class wxFontColourSwatchCtrl;
65class wxFontPreviewCtrl;
66class WXDLLIMPEXP_FWD_CORE wxSpinCtrl;
67class WXDLLIMPEXP_FWD_CORE wxSpinEvent;
68class WXDLLIMPEXP_FWD_CORE wxListBox;
69class WXDLLIMPEXP_FWD_CORE wxChoice;
70class WXDLLIMPEXP_FWD_CORE wxButton;
71class WXDLLIMPEXP_FWD_CORE wxStaticText;
72class WXDLLIMPEXP_FWD_CORE wxCheckBox;
73
74/*!
75 * Control identifiers
76 */
77
78#define wxID_FONTDIALOG_FACENAME 20001
79#define wxID_FONTDIALOG_FONTSIZE 20002
80#define wxID_FONTDIALOG_BOLD 20003
81#define wxID_FONTDIALOG_ITALIC 20004
82#define wxID_FONTDIALOG_UNDERLINED 20005
83#define wxID_FONTDIALOG_COLOUR 20006
84#define wxID_FONTDIALOG_PREVIEW 20007
85
86#endif
87 // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
88
89class WXDLLIMPEXP_CORE wxFontDialog: public wxDialog
90{
91DECLARE_DYNAMIC_CLASS(wxFontDialog)
92
93#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
94DECLARE_EVENT_TABLE()
95#endif
96
97public:
98 wxFontDialog();
99 wxFontDialog(wxWindow *parent, const wxFontData& data);
100 virtual ~wxFontDialog();
101
102 bool Create(wxWindow *parent, const wxFontData& data);
103
104 int ShowModal();
105 wxFontData& GetFontData() { return m_fontData; }
106 bool IsShown() const;
107 void OnPanelClose();
108 void SetData(const wxFontData& data);
109
110#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
111
112 /// Creates the controls and sizers
113 void CreateControls();
114
115 /// Initialize font
116 void InitializeFont();
117
118 /// Set controls according to current font
119 void InitializeControls();
120
121 /// Respond to font change
122 void ChangeFont();
123
124 /// Respond to colour change
125 void OnColourChanged(wxCommandEvent& event);
126
127 /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for wxID_FONTDIALOG_FACENAME
128 void OnFontdialogFacenameSelected( wxCommandEvent& event );
129
130 /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE
131 void OnFontdialogFontsizeUpdated( wxSpinEvent& event );
132
133 /// wxEVT_COMMAND_TEXT_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE
134 void OnFontdialogFontsizeTextUpdated( wxCommandEvent& event );
135
136 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_BOLD
137 void OnFontdialogBoldClick( wxCommandEvent& event );
138
139 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_ITALIC
140 void OnFontdialogItalicClick( wxCommandEvent& event );
141
142 /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_UNDERLINED
143 void OnFontdialogUnderlinedClick( wxCommandEvent& event );
144
145 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
146 void OnOkClick( wxCommandEvent& event );
147
148 /// Should we show tooltips?
149 static bool ShowToolTips();
150
151 wxListBox* m_facenameCtrl;
152 wxSpinCtrl* m_sizeCtrl;
153 wxCheckBox* m_boldCtrl;
154 wxCheckBox* m_italicCtrl;
155 wxCheckBox* m_underlinedCtrl;
156 wxFontColourSwatchCtrl* m_colourCtrl;
157 wxFontPreviewCtrl* m_previewCtrl;
158
159 wxFont m_dialogFont;
160 bool m_suppressUpdates;
161
162#endif
163 // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
164
165protected:
166 wxWindow* m_dialogParent;
167 wxFontData m_fontData;
168 void* m_pEventHandlerRef;
169};
170
171#endif
172
173#endif
174 // _WX_FONTDLG_H_