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