]> git.saurik.com Git - wxWidgets.git/blob - include/wx/richtext/richtextstyledlg.h
add support for GtkFontChooserDialog, new in GTK 3.2
[wxWidgets.git] / include / wx / richtext / richtextstyledlg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/richtext/richtextstyledlg.h
3 // Purpose:
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 10/5/2006 12:05:31 PM
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _RICHTEXTSTYLEDLG_H_
13 #define _RICHTEXTSTYLEDLG_H_
14
15 /*!
16 * Includes
17 */
18
19 #include "wx/richtext/richtextuicustomization.h"
20
21 ////@begin includes
22 ////@end includes
23
24 #include "wx/richtext/richtextbuffer.h"
25 #include "wx/richtext/richtextstyles.h"
26 #include "wx/richtext/richtextctrl.h"
27
28 /*!
29 * Forward declarations
30 */
31
32 ////@begin forward declarations
33 class wxBoxSizer;
34 class wxRichTextStyleListCtrl;
35 class wxRichTextCtrl;
36 class wxStdDialogButtonSizer;
37 ////@end forward declarations
38
39 class WXDLLIMPEXP_FWD_CORE wxButton;
40 class WXDLLIMPEXP_FWD_CORE wxCheckBox;
41
42 /*!
43 * Control identifiers
44 */
45
46 ////@begin control identifiers
47 #define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
48 #define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE _("Style Organiser")
49 #define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_IDNAME ID_RICHTEXTSTYLEORGANISERDIALOG
50 #define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE wxSize(400, 300)
51 #define SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION wxDefaultPosition
52 ////@end control identifiers
53
54 /*!
55 * Flags for specifying permitted operations
56 */
57
58 #define wxRICHTEXT_ORGANISER_DELETE_STYLES 0x0001
59 #define wxRICHTEXT_ORGANISER_CREATE_STYLES 0x0002
60 #define wxRICHTEXT_ORGANISER_APPLY_STYLES 0x0004
61 #define wxRICHTEXT_ORGANISER_EDIT_STYLES 0x0008
62 #define wxRICHTEXT_ORGANISER_RENAME_STYLES 0x0010
63 #define wxRICHTEXT_ORGANISER_OK_CANCEL 0x0020
64 #define wxRICHTEXT_ORGANISER_RENUMBER 0x0040
65
66 // The permitted style types to show
67 #define wxRICHTEXT_ORGANISER_SHOW_CHARACTER 0x0100
68 #define wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH 0x0200
69 #define wxRICHTEXT_ORGANISER_SHOW_LIST 0x0400
70 #define wxRICHTEXT_ORGANISER_SHOW_BOX 0x0800
71 #define wxRICHTEXT_ORGANISER_SHOW_ALL 0x1000
72
73 // Common combinations
74 #define wxRICHTEXT_ORGANISER_ORGANISE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_DELETE_STYLES|wxRICHTEXT_ORGANISER_CREATE_STYLES|wxRICHTEXT_ORGANISER_APPLY_STYLES|wxRICHTEXT_ORGANISER_EDIT_STYLES|wxRICHTEXT_ORGANISER_RENAME_STYLES)
75 #define wxRICHTEXT_ORGANISER_BROWSE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_OK_CANCEL)
76 #define wxRICHTEXT_ORGANISER_BROWSE_NUMBERING (wxRICHTEXT_ORGANISER_SHOW_LIST|wxRICHTEXT_ORGANISER_OK_CANCEL|wxRICHTEXT_ORGANISER_RENUMBER)
77
78 /*!
79 * wxRichTextStyleOrganiserDialog class declaration
80 */
81
82 class WXDLLIMPEXP_RICHTEXT wxRichTextStyleOrganiserDialog: public wxDialog
83 {
84 DECLARE_DYNAMIC_CLASS( wxRichTextStyleOrganiserDialog )
85 DECLARE_EVENT_TABLE()
86 DECLARE_HELP_PROVISION()
87
88 public:
89 /// Constructors
90 wxRichTextStyleOrganiserDialog( );
91 wxRichTextStyleOrganiserDialog( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE );
92
93 /// Creation
94 bool Create( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& caption = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_TITLE, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE );
95
96 /// Creates the controls and sizers
97 void CreateControls();
98
99 /// Initialise member variables
100 void Init();
101
102 /// Transfer data from/to window
103 virtual bool TransferDataFromWindow();
104 virtual bool TransferDataToWindow();
105
106 /// Set/get style sheet
107 void SetStyleSheet(wxRichTextStyleSheet* sheet) { m_richTextStyleSheet = sheet; }
108 wxRichTextStyleSheet* GetStyleSheet() const { return m_richTextStyleSheet; }
109
110 /// Set/get control
111 void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_richTextCtrl = ctrl; }
112 wxRichTextCtrl* GetRichTextCtrl() const { return m_richTextCtrl; }
113
114 /// Set/get flags
115 void SetFlags(int flags) { m_flags = flags; }
116 int GetFlags() const { return m_flags; }
117
118 /// Show preview for given or selected preview
119 void ShowPreview(int sel = -1);
120
121 /// Clears the preview
122 void ClearPreview();
123
124 /// List selection
125 void OnListSelection(wxCommandEvent& event);
126
127 /// Get/set restart numbering boolean
128 bool GetRestartNumbering() const { return m_restartNumbering; }
129 void SetRestartNumbering(bool restartNumbering) { m_restartNumbering = restartNumbering; }
130
131 /// Get selected style name or definition
132 wxString GetSelectedStyle() const;
133 wxRichTextStyleDefinition* GetSelectedStyleDefinition() const;
134
135 /// Apply the style
136 bool ApplyStyle(wxRichTextCtrl* ctrl = NULL);
137
138 /// Should we show tooltips?
139 static bool ShowToolTips() { return sm_showToolTips; }
140
141 /// Determines whether tooltips will be shown
142 static void SetShowToolTips(bool show) { sm_showToolTips = show; }
143
144 ////@begin wxRichTextStyleOrganiserDialog event handler declarations
145
146 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR
147 void OnNewCharClick( wxCommandEvent& event );
148
149 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR
150 void OnNewCharUpdate( wxUpdateUIEvent& event );
151
152 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA
153 void OnNewParaClick( wxCommandEvent& event );
154
155 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA
156 void OnNewParaUpdate( wxUpdateUIEvent& event );
157
158 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
159 void OnNewListClick( wxCommandEvent& event );
160
161 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
162 void OnNewListUpdate( wxUpdateUIEvent& event );
163
164 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX
165 void OnNewBoxClick( wxCommandEvent& event );
166
167 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX
168 void OnNewBoxUpdate( wxUpdateUIEvent& event );
169
170 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
171 void OnApplyClick( wxCommandEvent& event );
172
173 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
174 void OnApplyUpdate( wxUpdateUIEvent& event );
175
176 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
177 void OnRenameClick( wxCommandEvent& event );
178
179 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
180 void OnRenameUpdate( wxUpdateUIEvent& event );
181
182 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
183 void OnEditClick( wxCommandEvent& event );
184
185 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
186 void OnEditUpdate( wxUpdateUIEvent& event );
187
188 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
189 void OnDeleteClick( wxCommandEvent& event );
190
191 /// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
192 void OnDeleteUpdate( wxUpdateUIEvent& event );
193
194 ////@end wxRichTextStyleOrganiserDialog event handler declarations
195
196 ////@begin wxRichTextStyleOrganiserDialog member function declarations
197
198 /// Retrieves bitmap resources
199 wxBitmap GetBitmapResource( const wxString& name );
200
201 /// Retrieves icon resources
202 wxIcon GetIconResource( const wxString& name );
203 ////@end wxRichTextStyleOrganiserDialog member function declarations
204
205 ////@begin wxRichTextStyleOrganiserDialog member variables
206 wxBoxSizer* m_innerSizer;
207 wxBoxSizer* m_buttonSizerParent;
208 wxRichTextStyleListCtrl* m_stylesListBox;
209 wxRichTextCtrl* m_previewCtrl;
210 wxBoxSizer* m_buttonSizer;
211 wxButton* m_newCharacter;
212 wxButton* m_newParagraph;
213 wxButton* m_newList;
214 wxButton* m_newBox;
215 wxButton* m_applyStyle;
216 wxButton* m_renameStyle;
217 wxButton* m_editStyle;
218 wxButton* m_deleteStyle;
219 wxButton* m_closeButton;
220 wxBoxSizer* m_bottomButtonSizer;
221 wxCheckBox* m_restartNumberingCtrl;
222 wxStdDialogButtonSizer* m_stdButtonSizer;
223 wxButton* m_okButton;
224 wxButton* m_cancelButton;
225 /// Control identifiers
226 enum {
227 ID_RICHTEXTSTYLEORGANISERDIALOG = 10500,
228 ID_RICHTEXTSTYLEORGANISERDIALOG_STYLES = 10501,
229 ID_RICHTEXTSTYLEORGANISERDIALOG_CURRENT_STYLE = 10510,
230 ID_RICHTEXTSTYLEORGANISERDIALOG_PREVIEW = 10509,
231 ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR = 10504,
232 ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA = 10505,
233 ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST = 10508,
234 ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX = 10512,
235 ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY = 10503,
236 ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME = 10502,
237 ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT = 10506,
238 ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE = 10507,
239 ID_RICHTEXTSTYLEORGANISERDIALOG_RESTART_NUMBERING = 10511
240 };
241 ////@end wxRichTextStyleOrganiserDialog member variables
242
243 private:
244
245 wxRichTextCtrl* m_richTextCtrl;
246 wxRichTextStyleSheet* m_richTextStyleSheet;
247
248 bool m_dontUpdate;
249 int m_flags;
250 static bool sm_showToolTips;
251 bool m_restartNumbering;
252 };
253
254 #endif
255 // _RICHTEXTSTYLEDLG_H_