]> git.saurik.com Git - wxWidgets.git/blob - src/richtext/richtextstyledlg.cpp
Use wxPageSetupDialogData instead of old wxPageSetupData everywhere.
[wxWidgets.git] / src / richtext / richtextstyledlg.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/richtext/richtextstyledlg.cpp
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 // For compilers that support precompilation, includes "wx/wx.h".
13 #include "wx/wxprec.h"
14
15 #ifdef __BORLANDC__
16 #pragma hdrstop
17 #endif
18
19 #if wxUSE_RICHTEXT
20
21 #ifndef WX_PRECOMP
22 #include "wx/wx.h"
23 #endif
24
25 #include "wx/richtext/richtextstyledlg.h"
26 #include "wx/richtext/richtextformatdlg.h"
27
28 /*!
29 * wxRichTextStyleOrganiserDialog type definition
30 */
31
32 bool wxRichTextStyleOrganiserDialog::sm_showToolTips = false;
33
34 IMPLEMENT_DYNAMIC_CLASS( wxRichTextStyleOrganiserDialog, wxDialog )
35
36 /*!
37 * wxRichTextStyleOrganiserDialog event table definition
38 */
39
40 BEGIN_EVENT_TABLE( wxRichTextStyleOrganiserDialog, wxDialog )
41
42 EVT_LISTBOX(wxID_ANY, wxRichTextStyleOrganiserDialog::OnListSelection)
43
44 ////@begin wxRichTextStyleOrganiserDialog event table entries
45 EVT_BUTTON( ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR, wxRichTextStyleOrganiserDialog::OnNewCharClick )
46 EVT_UPDATE_UI( ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR, wxRichTextStyleOrganiserDialog::OnNewCharUpdate )
47
48 EVT_BUTTON( ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA, wxRichTextStyleOrganiserDialog::OnNewParaClick )
49 EVT_UPDATE_UI( ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA, wxRichTextStyleOrganiserDialog::OnNewParaUpdate )
50
51 EVT_BUTTON( ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST, wxRichTextStyleOrganiserDialog::OnNewListClick )
52 EVT_UPDATE_UI( ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST, wxRichTextStyleOrganiserDialog::OnNewListUpdate )
53
54 EVT_BUTTON( ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX, wxRichTextStyleOrganiserDialog::OnNewBoxClick )
55 EVT_UPDATE_UI( ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX, wxRichTextStyleOrganiserDialog::OnNewBoxUpdate )
56
57 EVT_BUTTON( ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY, wxRichTextStyleOrganiserDialog::OnApplyClick )
58 EVT_UPDATE_UI( ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY, wxRichTextStyleOrganiserDialog::OnApplyUpdate )
59
60 EVT_BUTTON( ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME, wxRichTextStyleOrganiserDialog::OnRenameClick )
61 EVT_UPDATE_UI( ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME, wxRichTextStyleOrganiserDialog::OnRenameUpdate )
62
63 EVT_BUTTON( ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT, wxRichTextStyleOrganiserDialog::OnEditClick )
64 EVT_UPDATE_UI( ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT, wxRichTextStyleOrganiserDialog::OnEditUpdate )
65
66 EVT_BUTTON( ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE, wxRichTextStyleOrganiserDialog::OnDeleteClick )
67 EVT_UPDATE_UI( ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE, wxRichTextStyleOrganiserDialog::OnDeleteUpdate )
68
69 ////@end wxRichTextStyleOrganiserDialog event table entries
70
71 END_EVENT_TABLE()
72
73 IMPLEMENT_HELP_PROVISION(wxRichTextStyleOrganiserDialog)
74
75 /*!
76 * wxRichTextStyleOrganiserDialog constructors
77 */
78
79 wxRichTextStyleOrganiserDialog::wxRichTextStyleOrganiserDialog( )
80 {
81 Init();
82 }
83
84 wxRichTextStyleOrganiserDialog::wxRichTextStyleOrganiserDialog( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
85 {
86 Init();
87 Create(flags, sheet, ctrl, parent, id, caption, pos, size, style);
88 }
89
90 /*!
91 * Member initialisation for wxSymbolPickerDialog
92 */
93
94 void wxRichTextStyleOrganiserDialog::Init()
95 {
96 m_richTextStyleSheet = NULL;
97 m_richTextCtrl = NULL;
98 m_dontUpdate = false;
99 m_flags = 0;
100 m_restartNumbering = true;
101
102 ////@begin wxRichTextStyleOrganiserDialog member initialisation
103 m_innerSizer = NULL;
104 m_buttonSizerParent = NULL;
105 m_stylesListBox = NULL;
106 m_previewCtrl = NULL;
107 m_buttonSizer = NULL;
108 m_newCharacter = NULL;
109 m_newParagraph = NULL;
110 m_newList = NULL;
111 m_newBox = NULL;
112 m_applyStyle = NULL;
113 m_renameStyle = NULL;
114 m_editStyle = NULL;
115 m_deleteStyle = NULL;
116 m_closeButton = NULL;
117 m_bottomButtonSizer = NULL;
118 m_restartNumberingCtrl = NULL;
119 m_stdButtonSizer = NULL;
120 m_okButton = NULL;
121 m_cancelButton = NULL;
122 ////@end wxRichTextStyleOrganiserDialog member initialisation
123 }
124
125 /*!
126 * wxRichTextStyleOrganiserDialog creator
127 */
128
129 bool wxRichTextStyleOrganiserDialog::Create( int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl, wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
130 {
131 m_richTextStyleSheet = sheet;
132 m_richTextCtrl = ctrl;
133 m_flags = flags;
134
135 ////@begin wxRichTextStyleOrganiserDialog creation
136 SetExtraStyle(wxWS_EX_BLOCK_EVENTS|wxDIALOG_EX_CONTEXTHELP);
137 wxDialog::Create( parent, id, caption, pos, size, style );
138
139 CreateControls();
140 if (GetSizer())
141 {
142 GetSizer()->SetSizeHints(this);
143 }
144 Centre();
145 ////@end wxRichTextStyleOrganiserDialog creation
146 return true;
147 }
148
149 /*!
150 * Control creation for wxRichTextStyleOrganiserDialog
151 */
152
153 void wxRichTextStyleOrganiserDialog::CreateControls()
154 {
155 bool hideTypeSelector = false;
156 wxRichTextStyleListBox::wxRichTextStyleType typesToShow = wxRichTextStyleListBox::wxRICHTEXT_STYLE_ALL;
157
158 if ((m_flags & wxRICHTEXT_ORGANISER_SHOW_CHARACTER) != 0)
159 {
160 typesToShow = wxRichTextStyleListBox::wxRICHTEXT_STYLE_CHARACTER;
161 hideTypeSelector = true;
162 }
163 else if ((m_flags & wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH) != 0)
164 {
165 typesToShow = wxRichTextStyleListBox::wxRICHTEXT_STYLE_PARAGRAPH;
166 hideTypeSelector = true;
167 }
168 else if ((m_flags & wxRICHTEXT_ORGANISER_SHOW_BOX) != 0)
169 {
170 typesToShow = wxRichTextStyleListBox::wxRICHTEXT_STYLE_BOX;
171 hideTypeSelector = true;
172 }
173 else if ((m_flags & wxRICHTEXT_ORGANISER_SHOW_LIST) != 0)
174 {
175 typesToShow = wxRichTextStyleListBox::wxRICHTEXT_STYLE_LIST;
176 hideTypeSelector = true;
177 }
178 else
179 {
180 // wxRICHTEXT_ORGANISER_SHOW_ALL is implied if the other styles aren't included
181 }
182
183 long listCtrlStyle = 0;
184 if (hideTypeSelector)
185 listCtrlStyle = wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR;
186
187 ////@begin wxRichTextStyleOrganiserDialog content construction
188 wxRichTextStyleOrganiserDialog* itemDialog1 = this;
189
190 wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
191 itemDialog1->SetSizer(itemBoxSizer2);
192
193 m_innerSizer = new wxBoxSizer(wxVERTICAL);
194 itemBoxSizer2->Add(m_innerSizer, 1, wxGROW|wxALL, 5);
195
196 m_buttonSizerParent = new wxBoxSizer(wxHORIZONTAL);
197 m_innerSizer->Add(m_buttonSizerParent, 1, wxGROW, 5);
198
199 wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
200 m_buttonSizerParent->Add(itemBoxSizer5, 1, wxGROW, 5);
201
202 wxStaticText* itemStaticText6 = new wxStaticText( itemDialog1, wxID_STATIC, _("&Styles:"), wxDefaultPosition, wxDefaultSize, 0 );
203 itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
204
205 m_stylesListBox = new wxRichTextStyleListCtrl( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_STYLES, wxDefaultPosition, wxSize(280, 260), listCtrlStyle );
206 m_stylesListBox->SetHelpText(_("The available styles."));
207 if (wxRichTextStyleOrganiserDialog::ShowToolTips())
208 m_stylesListBox->SetToolTip(_("The available styles."));
209 itemBoxSizer5->Add(m_stylesListBox, 1, wxGROW|wxALL, 5);
210
211 wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxVERTICAL);
212 m_buttonSizerParent->Add(itemBoxSizer8, 0, wxGROW, 5);
213
214 wxStaticText* itemStaticText9 = new wxStaticText( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_CURRENT_STYLE, _(" "), wxDefaultPosition, wxDefaultSize, 0 );
215 itemBoxSizer8->Add(itemStaticText9, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5);
216
217 m_previewCtrl = new wxRichTextCtrl( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_PREVIEW, wxEmptyString, wxDefaultPosition, wxSize(250, 200), wxBORDER_THEME|wxVSCROLL|wxTE_READONLY );
218 m_previewCtrl->SetHelpText(_("The style preview."));
219 if (wxRichTextStyleOrganiserDialog::ShowToolTips())
220 m_previewCtrl->SetToolTip(_("The style preview."));
221 itemBoxSizer8->Add(m_previewCtrl, 1, wxGROW|wxALL, 5);
222
223 m_buttonSizer = new wxBoxSizer(wxVERTICAL);
224 m_buttonSizerParent->Add(m_buttonSizer, 0, wxGROW, 5);
225
226 wxStaticText* itemStaticText12 = new wxStaticText( itemDialog1, wxID_STATIC, _(" "), wxDefaultPosition, wxDefaultSize, 0 );
227 m_buttonSizer->Add(itemStaticText12, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
228
229 m_newCharacter = new wxButton( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR, _("New &Character Style..."), wxDefaultPosition, wxDefaultSize, 0 );
230 m_newCharacter->SetHelpText(_("Click to create a new character style."));
231 if (wxRichTextStyleOrganiserDialog::ShowToolTips())
232 m_newCharacter->SetToolTip(_("Click to create a new character style."));
233 m_buttonSizer->Add(m_newCharacter, 0, wxGROW|wxALL, 5);
234
235 m_newParagraph = new wxButton( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA, _("New &Paragraph Style..."), wxDefaultPosition, wxDefaultSize, 0 );
236 m_newParagraph->SetHelpText(_("Click to create a new paragraph style."));
237 if (wxRichTextStyleOrganiserDialog::ShowToolTips())
238 m_newParagraph->SetToolTip(_("Click to create a new paragraph style."));
239 m_buttonSizer->Add(m_newParagraph, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
240
241 m_newList = new wxButton( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST, _("New &List Style..."), wxDefaultPosition, wxDefaultSize, 0 );
242 m_newList->SetHelpText(_("Click to create a new list style."));
243 if (wxRichTextStyleOrganiserDialog::ShowToolTips())
244 m_newList->SetToolTip(_("Click to create a new list style."));
245 m_buttonSizer->Add(m_newList, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
246
247 m_newBox = new wxButton( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX, _("New &Box Style..."), wxDefaultPosition, wxDefaultSize, 0 );
248 m_newBox->SetHelpText(_("Click to create a new box style."));
249 if (wxRichTextStyleOrganiserDialog::ShowToolTips())
250 m_newBox->SetToolTip(_("Click to create a new box style."));
251 m_buttonSizer->Add(m_newBox, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
252
253 m_buttonSizer->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
254
255 m_applyStyle = new wxButton( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY, _("&Apply Style"), wxDefaultPosition, wxDefaultSize, 0 );
256 m_applyStyle->SetHelpText(_("Click to apply the selected style."));
257 if (wxRichTextStyleOrganiserDialog::ShowToolTips())
258 m_applyStyle->SetToolTip(_("Click to apply the selected style."));
259 m_buttonSizer->Add(m_applyStyle, 0, wxGROW|wxALL, 5);
260
261 m_renameStyle = new wxButton( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME, _("&Rename Style..."), wxDefaultPosition, wxDefaultSize, 0 );
262 m_renameStyle->SetHelpText(_("Click to rename the selected style."));
263 if (wxRichTextStyleOrganiserDialog::ShowToolTips())
264 m_renameStyle->SetToolTip(_("Click to rename the selected style."));
265 m_buttonSizer->Add(m_renameStyle, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
266
267 m_editStyle = new wxButton( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT, _("&Edit Style..."), wxDefaultPosition, wxDefaultSize, 0 );
268 m_editStyle->SetHelpText(_("Click to edit the selected style."));
269 if (wxRichTextStyleOrganiserDialog::ShowToolTips())
270 m_editStyle->SetToolTip(_("Click to edit the selected style."));
271 m_buttonSizer->Add(m_editStyle, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
272
273 m_deleteStyle = new wxButton( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE, _("&Delete Style..."), wxDefaultPosition, wxDefaultSize, 0 );
274 m_deleteStyle->SetHelpText(_("Click to delete the selected style."));
275 if (wxRichTextStyleOrganiserDialog::ShowToolTips())
276 m_deleteStyle->SetToolTip(_("Click to delete the selected style."));
277 m_buttonSizer->Add(m_deleteStyle, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
278
279 m_buttonSizer->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
280
281 m_closeButton = new wxButton( itemDialog1, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
282 m_closeButton->SetDefault();
283 m_closeButton->SetHelpText(_("Click to close this window."));
284 if (wxRichTextStyleOrganiserDialog::ShowToolTips())
285 m_closeButton->SetToolTip(_("Click to close this window."));
286 m_buttonSizer->Add(m_closeButton, 0, wxGROW|wxALL, 5);
287
288 m_bottomButtonSizer = new wxBoxSizer(wxHORIZONTAL);
289 m_innerSizer->Add(m_bottomButtonSizer, 0, wxGROW, 5);
290
291 m_restartNumberingCtrl = new wxCheckBox( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_RESTART_NUMBERING, _("&Restart numbering"), wxDefaultPosition, wxDefaultSize, 0 );
292 m_restartNumberingCtrl->SetValue(false);
293 m_restartNumberingCtrl->SetHelpText(_("Check to restart numbering."));
294 if (wxRichTextStyleOrganiserDialog::ShowToolTips())
295 m_restartNumberingCtrl->SetToolTip(_("Check to restart numbering."));
296 m_bottomButtonSizer->Add(m_restartNumberingCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
297
298 m_stdButtonSizer = new wxStdDialogButtonSizer;
299
300 m_bottomButtonSizer->Add(m_stdButtonSizer, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
301 m_okButton = new wxButton( itemDialog1, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
302 m_stdButtonSizer->AddButton(m_okButton);
303
304 m_cancelButton = new wxButton( itemDialog1, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
305 m_stdButtonSizer->AddButton(m_cancelButton);
306
307 wxButton* itemButton29 = new wxButton( itemDialog1, wxID_HELP, _("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
308 m_stdButtonSizer->AddButton(itemButton29);
309
310 m_stdButtonSizer->Realize();
311
312 ////@end wxRichTextStyleOrganiserDialog content construction
313
314 if (GetHelpId() == -1)
315 {
316 wxWindow* button = FindWindowById(wxID_HELP);
317 if (button)
318 m_stdButtonSizer->Show(button, false);
319 }
320
321 if ((m_flags & wxRICHTEXT_ORGANISER_CREATE_STYLES) == 0)
322 {
323 m_buttonSizer->Show(m_newCharacter, false);
324 m_buttonSizer->Show(m_newParagraph, false);
325 m_buttonSizer->Show(m_newList, false);
326 m_buttonSizer->Show(m_newBox, false);
327 }
328 if ((m_flags & wxRICHTEXT_ORGANISER_DELETE_STYLES) == 0)
329 {
330 m_buttonSizer->Show(m_deleteStyle, false);
331 }
332 if ((m_flags & wxRICHTEXT_ORGANISER_APPLY_STYLES) == 0)
333 {
334 m_buttonSizer->Show(m_applyStyle, false);
335 }
336 if ((m_flags & wxRICHTEXT_ORGANISER_EDIT_STYLES) == 0)
337 {
338 m_buttonSizer->Show(m_editStyle, false);
339 }
340 if ((m_flags & wxRICHTEXT_ORGANISER_RENAME_STYLES) == 0)
341 {
342 m_buttonSizer->Show(m_renameStyle, false);
343 }
344 if ((m_flags & wxRICHTEXT_ORGANISER_RENUMBER) == 0)
345 {
346 m_bottomButtonSizer->Show(m_restartNumberingCtrl, false);
347 }
348
349 if ((m_flags & wxRICHTEXT_ORGANISER_OK_CANCEL) == 0)
350 {
351 m_stdButtonSizer->Show(m_okButton, false);
352 m_stdButtonSizer->Show(m_cancelButton, false);
353 }
354 else
355 {
356 m_buttonSizer->Show(m_closeButton, false);
357 }
358
359 // No buttons in the vertical group are shown, so hide the whole sizer
360 if ((m_flags & wxRICHTEXT_ORGANISER_ORGANISE) == 0)
361 {
362 m_buttonSizerParent->Show(m_buttonSizer, false);
363 }
364
365 // No buttons in the horizontal group are shown, so hide the whole sizer
366 if ((m_flags & (wxRICHTEXT_ORGANISER_OK_CANCEL|wxRICHTEXT_ORGANISER_RENUMBER)) == 0)
367 {
368 m_innerSizer->Show(m_bottomButtonSizer, false);
369 }
370
371 if (hideTypeSelector)
372 {
373 m_stylesListBox->GetStyleListBox()->SetStyleType(typesToShow);
374 }
375
376 m_stylesListBox->SetStyleSheet(m_richTextStyleSheet);
377 m_stylesListBox->SetRichTextCtrl(m_richTextCtrl);
378 m_stylesListBox->UpdateStyles();
379 m_stylesListBox->GetStyleListBox()->SetAutoSetSelection(false); // stop idle-time auto selection
380 if (m_stylesListBox->GetStyleListBox()->GetItemCount() > 0)
381 {
382 m_stylesListBox->GetStyleListBox()->SetSelection(0);
383 ShowPreview();
384 }
385 }
386
387 /*!
388 * Should we show tooltips?
389 */
390
391 /// Get selected style name or definition
392 wxString wxRichTextStyleOrganiserDialog::GetSelectedStyle() const
393 {
394 wxRichTextStyleDefinition* def = GetSelectedStyleDefinition();
395 if (def)
396 return def->GetName();
397 else
398 return wxEmptyString;
399 }
400
401 wxRichTextStyleDefinition* wxRichTextStyleOrganiserDialog::GetSelectedStyleDefinition() const
402 {
403 int sel = m_stylesListBox->GetStyleListBox()->GetSelection();
404 return m_stylesListBox->GetStyleListBox()->GetStyle(sel);
405 }
406
407
408 /// Transfer data from/to window
409 bool wxRichTextStyleOrganiserDialog::TransferDataFromWindow()
410 {
411 if (!wxDialog::TransferDataFromWindow())
412 return false;
413
414 m_restartNumbering = m_restartNumberingCtrl->GetValue();
415
416 return true;
417 }
418
419 bool wxRichTextStyleOrganiserDialog::TransferDataToWindow()
420 {
421 if (!wxDialog::TransferDataToWindow())
422 return false;
423
424 m_restartNumberingCtrl->SetValue(m_restartNumbering);
425
426 return true;
427 }
428
429 /// Show preview for given or selected preview
430 void wxRichTextStyleOrganiserDialog::ShowPreview(int sel)
431 {
432 static const wxChar* s_para1 = wxT("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \
433 Nullam ante sapien, vestibulum nonummy, pulvinar sed, luctus ut, lacus.\n");
434
435 static const wxChar* s_para2List = wxT("Duis pharetra consequat dui. Nullam vitae justo id mauris lobortis interdum.\n");
436
437 static const wxChar* s_para2 = wxT("Duis pharetra consequat dui. Cum sociis natoque penatibus \
438 et magnis dis parturient montes, nascetur ridiculus mus. Nullam vitae justo id mauris lobortis interdum.\n");
439
440 static const wxChar* s_para3 = wxT("Integer convallis dolor at augue \
441 iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
442
443 if (sel == -1)
444 {
445 sel = m_stylesListBox->GetStyleListBox()->GetSelection();
446 if (sel == -1)
447 return;
448 }
449
450 wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
451 wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition);
452 wxRichTextBoxStyleDefinition* boxDef = wxDynamicCast(def, wxRichTextBoxStyleDefinition);
453
454 wxStaticText* labelCtrl = (wxStaticText*) FindWindow(ID_RICHTEXTSTYLEORGANISERDIALOG_CURRENT_STYLE);
455 if (labelCtrl)
456 labelCtrl->SetLabel(def->GetName() + wxT(":"));
457
458 wxRichTextAttr attr(def->GetStyleMergedWithBase(GetStyleSheet()));
459
460 wxFont font(m_previewCtrl->GetFont());
461 font.SetPointSize(9);
462 m_previewCtrl->SetFont(font);
463
464 wxRichTextAttr normalParaAttr;
465 normalParaAttr.SetFont(font);
466 normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY")));
467
468 m_previewCtrl->Freeze();
469 m_previewCtrl->Clear();
470
471 m_previewCtrl->BeginStyle(normalParaAttr);
472 m_previewCtrl->WriteText(s_para1);
473 m_previewCtrl->EndStyle();
474
475 if (listDef)
476 {
477 m_previewCtrl->BeginStyle(attr);
478 long listStart = m_previewCtrl->GetInsertionPoint() + 1;
479 int i;
480 for (i = 0; i < 10; i++)
481 {
482 wxRichTextAttr levelAttr = * listDef->GetLevelAttributes(i);
483 levelAttr.SetBulletNumber(1);
484 m_previewCtrl->BeginStyle(levelAttr);
485 m_previewCtrl->WriteText(wxString::Format(wxT("List level %d. "), i+1) + s_para2List);
486 m_previewCtrl->EndStyle();
487 }
488 long listEnd = m_previewCtrl->GetInsertionPoint();
489 m_previewCtrl->NumberList(wxRichTextRange(listStart, listEnd), listDef);
490 m_previewCtrl->EndStyle();
491 }
492 else if (boxDef)
493 {
494 wxRichTextAttr cellParaAttr;
495 cellParaAttr.SetFont(font);
496 cellParaAttr.SetTextColour(*wxBLACK);
497
498 wxRichTextBox* textBox = m_previewCtrl->WriteTextBox(attr);
499 m_previewCtrl->SetFocusObject(textBox);
500 m_previewCtrl->BeginStyle(cellParaAttr);
501 wxString text(s_para2);
502 text.Replace(wxT("\n"), wxEmptyString);
503 m_previewCtrl->WriteText(text);
504 m_previewCtrl->EndStyle();
505 m_previewCtrl->SetFocusObject(NULL); // Set the focus back to the main buffer
506 m_previewCtrl->SetInsertionPointEnd();
507 m_previewCtrl->SetDefaultStyle(wxRichTextAttr());
508 }
509 else
510 {
511 m_previewCtrl->BeginStyle(attr);
512 m_previewCtrl->WriteText(s_para2);
513 m_previewCtrl->EndStyle();
514 }
515
516 m_previewCtrl->BeginStyle(normalParaAttr);
517 m_previewCtrl->WriteText(s_para3);
518 m_previewCtrl->EndStyle();
519
520 m_previewCtrl->Thaw();
521 }
522
523 /// Clears the preview
524 void wxRichTextStyleOrganiserDialog::ClearPreview()
525 {
526 m_previewCtrl->Clear();
527 wxStaticText* labelCtrl = (wxStaticText*) FindWindow(ID_RICHTEXTSTYLEORGANISERDIALOG_CURRENT_STYLE);
528 if (labelCtrl)
529 labelCtrl->SetLabel(wxEmptyString);
530 }
531
532 bool wxRichTextStyleOrganiserDialog::ApplyStyle(wxRichTextCtrl* ctrl)
533 {
534 int sel = m_stylesListBox->GetStyleListBox()->GetSelection();
535 if (sel == -1)
536 return false;
537 if (!ctrl)
538 ctrl = GetRichTextCtrl();
539 if (!ctrl)
540 return false;
541
542 wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
543 wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition);
544
545 if (listDef && m_restartNumberingCtrl->GetValue() && ctrl->HasSelection())
546 {
547 wxRichTextRange range = ctrl->GetSelectionRange();
548 return ctrl->SetListStyle(range, listDef, wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_RENUMBER);
549 }
550 else
551 {
552 return ctrl->ApplyStyle(def);
553 }
554 }
555
556 /*!
557 * Get bitmap resources
558 */
559
560 wxBitmap wxRichTextStyleOrganiserDialog::GetBitmapResource( const wxString& name )
561 {
562 // Bitmap retrieval
563 ////@begin wxRichTextStyleOrganiserDialog bitmap retrieval
564 wxUnusedVar(name);
565 return wxNullBitmap;
566 ////@end wxRichTextStyleOrganiserDialog bitmap retrieval
567 }
568
569 /*!
570 * Get icon resources
571 */
572
573 wxIcon wxRichTextStyleOrganiserDialog::GetIconResource( const wxString& name )
574 {
575 // Icon retrieval
576 ////@begin wxRichTextStyleOrganiserDialog icon retrieval
577 wxUnusedVar(name);
578 return wxNullIcon;
579 ////@end wxRichTextStyleOrganiserDialog icon retrieval
580 }
581
582 /*!
583 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
584 */
585
586 void wxRichTextStyleOrganiserDialog::OnApplyClick( wxCommandEvent& WXUNUSED(event) )
587 {
588 ApplyStyle();
589 }
590
591 /*!
592 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
593 */
594
595 void wxRichTextStyleOrganiserDialog::OnApplyUpdate( wxUpdateUIEvent& event )
596 {
597 event.Enable(((GetFlags() & wxRICHTEXT_ORGANISER_APPLY_STYLES) != 0) && m_stylesListBox->GetStyleListBox()->GetSelection() != wxNOT_FOUND);
598 }
599
600
601 /*!
602 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR
603 */
604
605 void wxRichTextStyleOrganiserDialog::OnNewCharClick( wxCommandEvent& WXUNUSED(event) )
606 {
607 wxString styleName = wxGetTextFromUser(_("Enter a character style name"), _("New Style"));
608 if (!styleName.IsEmpty())
609 {
610 if (GetStyleSheet()->FindCharacterStyle(styleName))
611 {
612 wxMessageBox(_("Sorry, that name is taken. Please choose another."), _("New Style"), wxICON_EXCLAMATION|wxOK, this);
613 return;
614 }
615
616 wxRichTextCharacterStyleDefinition* style = new wxRichTextCharacterStyleDefinition(styleName);
617
618 int pages = wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_STYLE_EDITOR;
619 wxRichTextFormattingDialog formatDlg;
620 formatDlg.SetStyleDefinition(*style, GetStyleSheet());
621 formatDlg.Create(pages, this);
622
623 if (formatDlg.ShowModal() == wxID_OK)
624 {
625 wxRichTextCharacterStyleDefinition* charDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextCharacterStyleDefinition);
626
627 (*((wxRichTextCharacterStyleDefinition* ) style)) = (*charDef);
628
629 GetStyleSheet()->AddCharacterStyle(style);
630
631 m_stylesListBox->UpdateStyles();
632 ShowPreview();
633 }
634 else
635 delete style;
636 }
637 }
638
639 /*!
640 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR
641 */
642
643 void wxRichTextStyleOrganiserDialog::OnNewCharUpdate( wxUpdateUIEvent& event )
644 {
645 event.Enable((GetFlags() & wxRICHTEXT_ORGANISER_CREATE_STYLES) != 0);
646 }
647
648
649 /*!
650 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA
651 */
652
653 void wxRichTextStyleOrganiserDialog::OnNewParaClick( wxCommandEvent& WXUNUSED(event) )
654 {
655 wxString styleName = wxGetTextFromUser(_("Enter a paragraph style name"), _("New Style"));
656 if (!styleName.IsEmpty())
657 {
658 if (GetStyleSheet()->FindParagraphStyle(styleName))
659 {
660 wxMessageBox(_("Sorry, that name is taken. Please choose another."), _("New Style"), wxICON_EXCLAMATION|wxOK, this);
661 return;
662 }
663
664 wxRichTextParagraphStyleDefinition* style = new wxRichTextParagraphStyleDefinition(styleName);
665
666 int pages = wxRICHTEXT_FORMAT_STYLE_EDITOR|wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING|wxRICHTEXT_FORMAT_TABS|wxRICHTEXT_FORMAT_BULLETS;
667 wxRichTextFormattingDialog formatDlg;
668 formatDlg.SetStyleDefinition(*style, GetStyleSheet());
669 formatDlg.Create(pages, this);
670
671 if (formatDlg.ShowModal() == wxID_OK)
672 {
673 wxRichTextParagraphStyleDefinition* paraDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextParagraphStyleDefinition);
674
675 (*((wxRichTextParagraphStyleDefinition* ) style)) = (*paraDef);
676
677 GetStyleSheet()->AddParagraphStyle(style);
678
679 m_stylesListBox->UpdateStyles();
680 ShowPreview();
681 }
682 else
683 delete style;
684 }
685 }
686
687 /*!
688 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA
689 */
690
691 void wxRichTextStyleOrganiserDialog::OnNewParaUpdate( wxUpdateUIEvent& event )
692 {
693 event.Enable((GetFlags() & wxRICHTEXT_ORGANISER_CREATE_STYLES) != 0);
694 }
695
696
697 /*!
698 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
699 */
700
701 void wxRichTextStyleOrganiserDialog::OnEditClick( wxCommandEvent& WXUNUSED(event) )
702 {
703 int sel = m_stylesListBox->GetStyleListBox()->GetSelection();
704 if (sel != wxNOT_FOUND)
705 {
706 wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
707
708 int pages = wxRICHTEXT_FORMAT_STYLE_EDITOR;
709
710 if (def->IsKindOf(CLASSINFO(wxRichTextCharacterStyleDefinition)))
711 {
712 pages |= wxRICHTEXT_FORMAT_FONT;
713 }
714 else if (def->IsKindOf(CLASSINFO(wxRichTextListStyleDefinition)))
715 {
716 pages |= wxRICHTEXT_FORMAT_LIST_STYLE|wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING;
717 }
718 else if (def->IsKindOf(CLASSINFO(wxRichTextParagraphStyleDefinition)))
719 {
720 pages |= wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING|wxRICHTEXT_FORMAT_TABS|wxRICHTEXT_FORMAT_BULLETS;
721 }
722 else if (def->IsKindOf(CLASSINFO(wxRichTextBoxStyleDefinition)))
723 {
724 pages |= wxRICHTEXT_FORMAT_MARGINS|wxRICHTEXT_FORMAT_SIZE|wxRICHTEXT_FORMAT_BORDERS|wxRICHTEXT_FORMAT_BACKGROUND;
725 }
726
727 wxRichTextFormattingDialog formatDlg;
728 formatDlg.SetStyleDefinition(*def, GetStyleSheet());
729 formatDlg.Create(pages, this);
730
731 if (formatDlg.ShowModal() == wxID_OK)
732 {
733 wxRichTextParagraphStyleDefinition* paraDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextParagraphStyleDefinition);
734 wxRichTextCharacterStyleDefinition* charDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextCharacterStyleDefinition);
735 wxRichTextListStyleDefinition* listDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextListStyleDefinition);
736 wxRichTextBoxStyleDefinition* boxDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextBoxStyleDefinition);
737
738 if (listDef)
739 {
740 (*((wxRichTextListStyleDefinition* ) def)) = (*listDef);
741 }
742 else if (paraDef)
743 {
744 (*((wxRichTextParagraphStyleDefinition* ) def)) = (*paraDef);
745 }
746 else if (boxDef)
747 {
748 (*((wxRichTextBoxStyleDefinition* ) def)) = (*boxDef);
749 }
750 else
751 {
752 (*((wxRichTextCharacterStyleDefinition* ) def)) = (*charDef);
753 }
754
755 m_stylesListBox->UpdateStyles();
756 m_stylesListBox->GetStyleListBox()->SetSelection(sel);
757 ShowPreview();
758 }
759 }
760 }
761
762 /*!
763 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT
764 */
765
766 void wxRichTextStyleOrganiserDialog::OnEditUpdate( wxUpdateUIEvent& event )
767 {
768 event.Enable(((GetFlags() & wxRICHTEXT_ORGANISER_EDIT_STYLES) != 0) && m_stylesListBox->GetStyleListBox()->GetSelection() != wxNOT_FOUND);
769 }
770
771
772 /*!
773 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
774 */
775
776 void wxRichTextStyleOrganiserDialog::OnDeleteClick( wxCommandEvent& WXUNUSED(event) )
777 {
778 int sel = m_stylesListBox->GetStyleListBox()->GetSelection();
779 if (sel != wxNOT_FOUND)
780 {
781 wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
782 wxString name(def->GetName());
783 if (wxYES == wxMessageBox(wxString::Format(_("Delete style %s?"), name), _("Delete Style"), wxYES_NO|wxICON_QUESTION, this))
784 {
785 m_stylesListBox->GetStyleListBox()->SetItemCount(0);
786
787 if (def->IsKindOf(CLASSINFO(wxRichTextListStyleDefinition)))
788 GetStyleSheet()->RemoveListStyle((wxRichTextListStyleDefinition*) def, true);
789 else if (def->IsKindOf(CLASSINFO(wxRichTextParagraphStyleDefinition)))
790 GetStyleSheet()->RemoveParagraphStyle((wxRichTextParagraphStyleDefinition*) def, true);
791 else if (def->IsKindOf(CLASSINFO(wxRichTextCharacterStyleDefinition)))
792 GetStyleSheet()->RemoveCharacterStyle((wxRichTextCharacterStyleDefinition*) def, true);
793 else if (def->IsKindOf(CLASSINFO(wxRichTextBoxStyleDefinition)))
794 GetStyleSheet()->RemoveBoxStyle((wxRichTextBoxStyleDefinition*) def, true);
795
796 m_stylesListBox->UpdateStyles();
797
798 if (m_stylesListBox->GetStyleListBox()->GetSelection() != -1)
799 ShowPreview();
800 else
801 ClearPreview();
802 }
803 }
804 }
805
806 /*!
807 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_DELETE
808 */
809
810 void wxRichTextStyleOrganiserDialog::OnDeleteUpdate( wxUpdateUIEvent& event )
811 {
812 event.Enable(((GetFlags() & wxRICHTEXT_ORGANISER_DELETE_STYLES) != 0) && m_stylesListBox->GetStyleListBox()->GetSelection() != wxNOT_FOUND);
813 }
814
815 /*!
816 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
817 */
818
819 void wxRichTextStyleOrganiserDialog::OnNewListClick( wxCommandEvent& WXUNUSED(event) )
820 {
821 wxString styleName = wxGetTextFromUser(_("Enter a list style name"), _("New Style"));
822 if (!styleName.IsEmpty())
823 {
824 if (GetStyleSheet()->FindListStyle(styleName))
825 {
826 wxMessageBox(_("Sorry, that name is taken. Please choose another."), _("New Style"), wxICON_EXCLAMATION|wxOK, this);
827 return;
828 }
829
830 wxRichTextListStyleDefinition* style = new wxRichTextListStyleDefinition(styleName);
831
832 // Initialize the style to make it easier to edit
833 int i;
834 for (i = 0; i < 10; i++)
835 {
836 wxString bulletSymbol;
837 if (i == 0)
838 bulletSymbol = wxT("*");
839 else if (i == 1)
840 bulletSymbol = wxT("-");
841 else if (i == 2)
842 bulletSymbol = wxT("*");
843 else if (i == 3)
844 bulletSymbol = wxT("-");
845 else
846 bulletSymbol = wxT("*");
847
848 style->SetAttributes(i, (i+1)*60, 60, wxTEXT_ATTR_BULLET_STYLE_SYMBOL, bulletSymbol);
849 }
850
851 int pages = wxRICHTEXT_FORMAT_LIST_STYLE|wxRICHTEXT_FORMAT_STYLE_EDITOR|wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING;
852 wxRichTextFormattingDialog formatDlg;
853 formatDlg.SetStyleDefinition(*style, GetStyleSheet());
854 formatDlg.Create(pages, this);
855
856 if (formatDlg.ShowModal() == wxID_OK)
857 {
858 wxRichTextListStyleDefinition* listDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextListStyleDefinition);
859
860 (*((wxRichTextListStyleDefinition* ) style)) = (*listDef);
861
862 GetStyleSheet()->AddListStyle(style);
863
864 m_stylesListBox->UpdateStyles();
865 ShowPreview();
866 }
867 else
868 delete style;
869 }
870 }
871
872 /*!
873 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
874 */
875
876 void wxRichTextStyleOrganiserDialog::OnNewListUpdate( wxUpdateUIEvent& event )
877 {
878 event.Enable((GetFlags() & wxRICHTEXT_ORGANISER_CREATE_STYLES) != 0);
879 }
880
881 /*!
882 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
883 */
884
885 void wxRichTextStyleOrganiserDialog::OnRenameClick( wxCommandEvent& WXUNUSED(event) )
886 {
887 int sel = m_stylesListBox->GetStyleListBox()->GetSelection();
888 if (sel == -1)
889 return;
890 wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
891 if (!def)
892 return;
893
894 wxString styleName = wxGetTextFromUser(_("Enter a new style name"), _("New Style"), def->GetName());
895 if (!styleName.IsEmpty())
896 {
897 if (styleName == def->GetName())
898 return;
899
900 if (GetStyleSheet()->FindParagraphStyle(styleName) || GetStyleSheet()->FindCharacterStyle(styleName) || GetStyleSheet()->FindListStyle(styleName) || GetStyleSheet()->FindBoxStyle(styleName))
901 {
902 wxMessageBox(_("Sorry, that name is taken. Please choose another."), _("New Style"), wxICON_EXCLAMATION|wxOK, this);
903 return;
904 }
905
906 def->SetName(styleName);
907 m_stylesListBox->UpdateStyles();
908 }
909 }
910
911 /*!
912 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME
913 */
914
915 void wxRichTextStyleOrganiserDialog::OnRenameUpdate( wxUpdateUIEvent& event )
916 {
917 event.Enable(((GetFlags() & wxRICHTEXT_ORGANISER_RENAME_STYLES) != 0) && m_stylesListBox->GetStyleListBox()->GetSelection() != wxNOT_FOUND);
918 }
919
920 /// List selection
921 void wxRichTextStyleOrganiserDialog::OnListSelection(wxCommandEvent& event)
922 {
923 if (event.GetEventObject() == m_stylesListBox->GetStyleListBox())
924 ShowPreview();
925 else
926 event.Skip();
927 }
928
929 /*!
930 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX
931 */
932
933 void wxRichTextStyleOrganiserDialog::OnNewBoxClick( wxCommandEvent& WXUNUSED(event) )
934 {
935 wxString styleName = wxGetTextFromUser(_("Enter a box style name"), _("New Style"));
936 if (!styleName.IsEmpty())
937 {
938 if (GetStyleSheet()->FindBoxStyle(styleName))
939 {
940 wxMessageBox(_("Sorry, that name is taken. Please choose another."), _("New Style"), wxICON_EXCLAMATION|wxOK, this);
941 return;
942 }
943
944 wxRichTextBoxStyleDefinition* style = new wxRichTextBoxStyleDefinition(styleName);
945
946 int pages = wxRICHTEXT_FORMAT_MARGINS|wxRICHTEXT_FORMAT_SIZE|wxRICHTEXT_FORMAT_BORDERS|wxRICHTEXT_FORMAT_BACKGROUND;
947 wxRichTextFormattingDialog formatDlg;
948 formatDlg.SetStyleDefinition(*style, GetStyleSheet());
949 formatDlg.Create(pages, this);
950
951 if (formatDlg.ShowModal() == wxID_OK)
952 {
953 wxRichTextBoxStyleDefinition* boxDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextBoxStyleDefinition);
954
955 (*((wxRichTextBoxStyleDefinition* ) style)) = (*boxDef);
956
957 GetStyleSheet()->AddBoxStyle(style);
958
959 m_stylesListBox->UpdateStyles();
960 ShowPreview();
961 }
962 else
963 delete style;
964 }
965 }
966
967 /*!
968 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX
969 */
970
971 void wxRichTextStyleOrganiserDialog::OnNewBoxUpdate( wxUpdateUIEvent& event )
972 {
973 event.Enable((GetFlags() & wxRICHTEXT_ORGANISER_CREATE_STYLES) != 0);
974 }
975
976 #endif
977 // wxUSE_RICHTEXT