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