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