]> git.saurik.com Git - wxWidgets.git/blame - src/richtext/richtextbulletspage.cpp
fixing classname
[wxWidgets.git] / src / richtext / richtextbulletspage.cpp
CommitLineData
97ff49b3 1/////////////////////////////////////////////////////////////////////////////
b68603d5 2// Name: src/richtext/richtextbulletspage.cpp
97ff49b3
JS
3// Purpose:
4// Author: Julian Smart
5// Modified by:
6// Created: 10/4/2006 10:32:31 AM
b68603d5 7// RCS-ID: $Id$
97ff49b3 8// Copyright: (c) Julian Smart
b68603d5 9// Licence: wxWindows licence
97ff49b3
JS
10/////////////////////////////////////////////////////////////////////////////
11
b68603d5
WS
12#if wxUSE_RICHTEXT
13
14#include "wx/richtext/richtextbulletspage.h"
15
97ff49b3 16#include "wx/richtext/richtextsymboldlg.h"
97ff49b3 17
97ff49b3
JS
18/*!
19 * wxRichTextBulletsPage type definition
20 */
21
22IMPLEMENT_DYNAMIC_CLASS( wxRichTextBulletsPage, wxPanel )
23
24/*!
25 * wxRichTextBulletsPage event table definition
26 */
27
28BEGIN_EVENT_TABLE( wxRichTextBulletsPage, wxPanel )
29
30////@begin wxRichTextBulletsPage event table entries
31 EVT_LISTBOX( ID_RICHTEXTBULLETSPAGE_STYLELISTBOX, wxRichTextBulletsPage::OnStylelistboxSelected )
32
33 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC, wxRichTextBulletsPage::OnSymbolstaticUpdate )
34
35 EVT_COMBOBOX( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxRichTextBulletsPage::OnSymbolctrlSelected )
36 EVT_TEXT( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxRichTextBulletsPage::OnSymbolctrlUpdated )
37 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxRichTextBulletsPage::OnSymbolctrlUpdate )
38
39 EVT_BUTTON( ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL, wxRichTextBulletsPage::OnChooseSymbolClick )
40 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL, wxRichTextBulletsPage::OnChooseSymbolUpdate )
41
42 EVT_COMBOBOX( ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, wxRichTextBulletsPage::OnSymbolfontctrlSelected )
43 EVT_TEXT( ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, wxRichTextBulletsPage::OnSymbolfontctrlUpdated )
44 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, wxRichTextBulletsPage::OnSymbolfontctrlUIUpdate )
45
46 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC, wxRichTextBulletsPage::OnNumberstaticUpdate )
47
48 EVT_SPINCTRL( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxRichTextBulletsPage::OnNumberctrlUpdated )
49 EVT_SPIN_UP( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxRichTextBulletsPage::OnNumberctrlUp )
50 EVT_SPIN_DOWN( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxRichTextBulletsPage::OnNumberctrlDown )
51 EVT_TEXT( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxRichTextBulletsPage::OnNumberctrlTextUpdated )
52 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxRichTextBulletsPage::OnNumberctrlUpdate )
53
54 EVT_CHECKBOX( ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL, wxRichTextBulletsPage::OnParenthesesctrlClick )
55 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL, wxRichTextBulletsPage::OnParenthesesctrlUpdate )
56
57 EVT_CHECKBOX( ID_RICHTEXTBULLETSPAGE_PERIODCTRL, wxRichTextBulletsPage::OnPeriodctrlClick )
58 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_PERIODCTRL, wxRichTextBulletsPage::OnPeriodctrlUpdate )
59
60////@end wxRichTextBulletsPage event table entries
61
62END_EVENT_TABLE()
63
64/*!
65 * wxRichTextBulletsPage constructors
66 */
67
68wxRichTextBulletsPage::wxRichTextBulletsPage( )
69{
70 Init();
71}
72
73wxRichTextBulletsPage::wxRichTextBulletsPage( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
74{
75 Init();
76 Create(parent, id, pos, size, style);
77}
78
79/*!
80 * Initialise members
81 */
5778b3c8 82
97ff49b3
JS
83void wxRichTextBulletsPage::Init()
84{
85 m_hasBulletStyle = false;
86 m_hasBulletNumber = false;
87 m_hasBulletSymbol = false;
88 m_dontUpdate = false;
89
90////@begin wxRichTextBulletsPage member initialisation
91 m_styleListBox = NULL;
92 m_symbolCtrl = NULL;
93 m_symbolFontCtrl = NULL;
94 m_numberCtrl = NULL;
95 m_parenthesesCtrl = NULL;
96 m_periodCtrl = NULL;
97 m_previewCtrl = NULL;
98////@end wxRichTextBulletsPage member initialisation
99}
100
101/*!
102 * wxRichTextBulletsPage creator
103 */
104
105bool wxRichTextBulletsPage::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
106{
107////@begin wxRichTextBulletsPage creation
108 wxPanel::Create( parent, id, pos, size, style );
109
110 CreateControls();
111 if (GetSizer())
112 {
113 GetSizer()->SetSizeHints(this);
114 }
115 Centre();
116////@end wxRichTextBulletsPage creation
117 return true;
118}
119
120/*!
121 * Control creation for wxRichTextBulletsPage
122 */
123
124void wxRichTextBulletsPage::CreateControls()
125{
126////@begin wxRichTextBulletsPage content construction
127 wxRichTextBulletsPage* itemPanel1 = this;
128
129 wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
130 itemPanel1->SetSizer(itemBoxSizer2);
131
132 wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
133 itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5);
134
135 wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
136 itemBoxSizer3->Add(itemBoxSizer4, 0, wxGROW, 5);
137
138 wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
139 itemBoxSizer4->Add(itemBoxSizer5, 0, wxGROW, 5);
140
141 wxStaticText* itemStaticText6 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Bullet style:"), wxDefaultPosition, wxDefaultSize, 0 );
142 itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
143
144 wxString* m_styleListBoxStrings = NULL;
145 m_styleListBox = new wxListBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_STYLELISTBOX, wxDefaultPosition, wxDefaultSize, 0, m_styleListBoxStrings, wxLB_SINGLE );
dadd4f55
JS
146 m_styleListBox->SetHelpText(_("The available bullet styles."));
147 if (ShowToolTips())
148 m_styleListBox->SetToolTip(_("The available bullet styles."));
97ff49b3
JS
149 itemBoxSizer5->Add(m_styleListBox, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
150
151 itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
152
153 wxStaticLine* itemStaticLine9 = new wxStaticLine( itemPanel1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
154 itemBoxSizer4->Add(itemStaticLine9, 0, wxGROW|wxALL, 5);
155
156 itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
157
158 wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL);
159 itemBoxSizer4->Add(itemBoxSizer11, 0, wxGROW, 5);
160
161 wxStaticText* itemStaticText12 = new wxStaticText( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC, _("&Symbol:"), wxDefaultPosition, wxDefaultSize, 0 );
162 itemBoxSizer11->Add(itemStaticText12, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
163
164 wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxHORIZONTAL);
165 itemBoxSizer11->Add(itemBoxSizer13, 0, wxGROW, 5);
166
167 wxString* m_symbolCtrlStrings = NULL;
41a85215 168 m_symbolCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0, m_symbolCtrlStrings, wxCB_DROPDOWN );
dadd4f55
JS
169 m_symbolCtrl->SetHelpText(_("The bullet character."));
170 if (ShowToolTips())
171 m_symbolCtrl->SetToolTip(_("The bullet character."));
97ff49b3
JS
172 itemBoxSizer13->Add(m_symbolCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxFIXED_MINSIZE, 5);
173
174 wxButton* itemButton15 = new wxButton( itemPanel1, ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL, _("Ch&oose..."), wxDefaultPosition, wxDefaultSize, 0 );
dadd4f55
JS
175 itemButton15->SetHelpText(_("Click to browse for a symbol."));
176 if (ShowToolTips())
177 itemButton15->SetToolTip(_("Click to browse for a symbol."));
97ff49b3
JS
178 itemBoxSizer13->Add(itemButton15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
179
180 itemBoxSizer11->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
181
182 wxStaticText* itemStaticText17 = new wxStaticText( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC, _("Symbol &font:"), wxDefaultPosition, wxDefaultSize, 0 );
183 itemBoxSizer11->Add(itemStaticText17, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
184
185 wxString* m_symbolFontCtrlStrings = NULL;
41a85215 186 m_symbolFontCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, m_symbolFontCtrlStrings, wxCB_DROPDOWN );
dadd4f55
JS
187 m_symbolFontCtrl->SetHelpText(_("Available fonts."));
188 if (ShowToolTips())
189 m_symbolFontCtrl->SetToolTip(_("Available fonts."));
97ff49b3
JS
190 itemBoxSizer11->Add(m_symbolFontCtrl, 0, wxGROW|wxALL, 5);
191
192 itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
193
194 wxStaticLine* itemStaticLine20 = new wxStaticLine( itemPanel1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
195 itemBoxSizer4->Add(itemStaticLine20, 0, wxGROW|wxALL, 5);
196
197 itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
198
199 wxBoxSizer* itemBoxSizer22 = new wxBoxSizer(wxVERTICAL);
200 itemBoxSizer4->Add(itemBoxSizer22, 0, wxGROW, 5);
201
202 wxStaticText* itemStaticText23 = new wxStaticText( itemPanel1, ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC, _("&Number:"), wxDefaultPosition, wxDefaultSize, 0 );
203 itemBoxSizer22->Add(itemStaticText23, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
204
dadd4f55
JS
205 m_numberCtrl = new wxSpinCtrl( itemPanel1, ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, _T("0"), wxDefaultPosition, wxSize(50, -1), wxSP_ARROW_KEYS, 0, 100000, 0 );
206 m_numberCtrl->SetHelpText(_("The list item number."));
207 if (ShowToolTips())
208 m_numberCtrl->SetToolTip(_("The list item number."));
97ff49b3
JS
209 itemBoxSizer22->Add(m_numberCtrl, 0, wxGROW|wxALL, 5);
210
211 itemBoxSizer22->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
212
213 m_parenthesesCtrl = new wxCheckBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL, _("&Parentheses"), wxDefaultPosition, wxDefaultSize, 0 );
214 m_parenthesesCtrl->SetValue(false);
dadd4f55
JS
215 m_parenthesesCtrl->SetHelpText(_("Check to enclose the bullet in parentheses."));
216 if (ShowToolTips())
217 m_parenthesesCtrl->SetToolTip(_("Check to enclose the bullet in parentheses."));
97ff49b3
JS
218 itemBoxSizer22->Add(m_parenthesesCtrl, 0, wxALIGN_LEFT|wxALL, 5);
219
220 m_periodCtrl = new wxCheckBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_PERIODCTRL, _("Peri&od"), wxDefaultPosition, wxDefaultSize, 0 );
221 m_periodCtrl->SetValue(false);
dadd4f55
JS
222 m_periodCtrl->SetHelpText(_("Check to add a period after the bullet."));
223 if (ShowToolTips())
224 m_periodCtrl->SetToolTip(_("Check to add a period after the bullet."));
97ff49b3
JS
225 itemBoxSizer22->Add(m_periodCtrl, 0, wxALIGN_LEFT|wxALL, 5);
226
227 itemBoxSizer3->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
228
229 m_previewCtrl = new wxRichTextCtrl( itemPanel1, ID_RICHTEXTBULLETSPAGE_PREVIEW_CTRL, wxEmptyString, wxDefaultPosition, wxSize(350, 180), wxSUNKEN_BORDER );
230 m_previewCtrl->SetHelpText(_("Shows a preview of the bullet settings."));
231 if (ShowToolTips())
232 m_previewCtrl->SetToolTip(_("Shows a preview of the bullet settings."));
233 itemBoxSizer3->Add(m_previewCtrl, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
234
235////@end wxRichTextBulletsPage content construction
236
237 m_styleListBox->Append(_("(None)"));
238 m_styleListBox->Append(_("Arabic"));
239 m_styleListBox->Append(_("Upper case letters"));
240 m_styleListBox->Append(_("Lower case letters"));
241 m_styleListBox->Append(_("Upper case roman numerals"));
242 m_styleListBox->Append(_("Lower case roman numerals"));
243 m_styleListBox->Append(_("Symbol"));
244 m_styleListBox->Append(_("Bitmap"));
245
246 m_symbolCtrl->Append(_("*"));
247 m_symbolCtrl->Append(_("-"));
248 m_symbolCtrl->Append(_(">"));
249 m_symbolCtrl->Append(_("+"));
250 m_symbolCtrl->Append(_("~"));
5778b3c8 251
dadd4f55 252 wxArrayString facenames = wxRichTextCtrl::GetAvailableFontNames();
97ff49b3 253 facenames.Sort();
5778b3c8 254
97ff49b3
JS
255 m_symbolFontCtrl->Append(facenames);
256}
257
258/// Transfer data from/to window
259bool wxRichTextBulletsPage::TransferDataFromWindow()
260{
261 wxPanel::TransferDataFromWindow();
262
263 wxTextAttrEx* attr = GetAttributes();
264
265 if (m_hasBulletStyle)
266 {
267 long bulletStyle = 0;
268
269 int index = m_styleListBox->GetSelection();
270 if (index == 1)
271 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ARABIC;
272 else if (index == 2)
273 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER;
274 else if (index == 3)
275 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER;
276 else if (index == 4)
277 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER;
278 else if (index == 5)
279 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER;
280 else if (index == 6)
281 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_SYMBOL;
282 else if (index == 7)
283 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_BITMAP;
284
285 if (m_parenthesesCtrl->GetValue())
286 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_PARENTHESES;
287 if (m_periodCtrl->GetValue())
288 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_PERIOD;
289
290 attr->SetBulletStyle(bulletStyle);
291 }
292
293 if (m_hasBulletNumber)
294 {
295 attr->SetBulletNumber(m_numberCtrl->GetValue());
296 }
297
298 if (m_hasBulletSymbol)
299 {
300 wxChar c(wxT('*'));
b68603d5 301 if (m_symbolCtrl->GetValue().length() > 0)
97ff49b3
JS
302 c = m_symbolCtrl->GetValue()[0];
303 attr->SetBulletSymbol(c);
304 attr->SetBulletFont(m_symbolFontCtrl->GetValue());
305 }
306 return true;
307}
308
309bool wxRichTextBulletsPage::TransferDataToWindow()
310{
311 m_dontUpdate = true;
312
313 wxPanel::TransferDataToWindow();
314
315 wxTextAttrEx* attr = GetAttributes();
316
317 if (attr->HasBulletStyle())
318 {
319 int index = -1;
320 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ARABIC)
321 index = 1;
322 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER)
323 index = 2;
324 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER)
325 index = 3;
326 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER)
327 index = 4;
328 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER)
329 index = 5;
330 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_SYMBOL)
331 index = 6;
332 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_BITMAP)
333 index = 7;
334 m_styleListBox->SetSelection(index);
335
336 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PARENTHESES)
337 m_parenthesesCtrl->SetValue(true);
338 else
339 m_parenthesesCtrl->SetValue(false);
340
341 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PERIOD)
342 m_periodCtrl->SetValue(true);
343 else
5778b3c8 344 m_periodCtrl->SetValue(false);
97ff49b3
JS
345 }
346 else
347 m_styleListBox->SetSelection(-1);
348
349 if (attr->HasBulletSymbol())
350 {
351 wxChar c = attr->GetBulletSymbol();
352 wxString s;
353 s << c;
354 m_symbolCtrl->SetValue(s);
355 m_symbolFontCtrl->SetValue(attr->GetBulletFont());
356 }
357 else
358 m_symbolCtrl->SetValue(wxEmptyString);
359
360 if (attr->HasBulletNumber())
361 m_numberCtrl->SetValue(attr->GetBulletNumber());
362 else
363 m_numberCtrl->SetValue(0);
364
365 UpdatePreview();
366
367 m_dontUpdate = false;
368
369 return true;
370}
371
372/// Updates the bullet preview
373void wxRichTextBulletsPage::UpdatePreview()
374{
375 static const wxChar* s_para1 = wxT("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \
376Nullam ante sapien, vestibulum nonummy, pulvinar sed, luctus ut, lacus.");
377
378 static const wxChar* s_para2 = wxT("\nDuis pharetra consequat dui. Cum sociis natoque penatibus \
379et magnis dis parturient montes, nascetur ridiculus mus. Nullam vitae justo id mauris lobortis interdum.");
380
381 static const wxChar* s_para3 = wxT("\nInteger convallis dolor at augue \
382iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
383
384 TransferDataFromWindow();
385 wxTextAttrEx attr(*GetAttributes());
386 attr.SetFlags(attr.GetFlags() &
387 (wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_SYMBOL|
388 wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|
389 wxTEXT_ATTR_LINE_SPACING));
390
391 wxFont font(m_previewCtrl->GetFont());
392 font.SetPointSize(9);
393 m_previewCtrl->SetFont(font);
394
dadd4f55
JS
395 wxTextAttrEx normalParaAttr;
396 normalParaAttr.SetFont(font);
397 normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY")));
97ff49b3 398
dadd4f55 399 m_previewCtrl->Freeze();
97ff49b3
JS
400 m_previewCtrl->Clear();
401
dadd4f55 402 m_previewCtrl->BeginStyle(normalParaAttr);
97ff49b3 403 m_previewCtrl->WriteText(s_para1);
dadd4f55 404 m_previewCtrl->EndStyle();
41a85215 405
97ff49b3
JS
406 m_previewCtrl->BeginStyle(attr);
407 m_previewCtrl->WriteText(s_para2);
408 m_previewCtrl->EndStyle();
dadd4f55
JS
409
410 m_previewCtrl->BeginStyle(normalParaAttr);
97ff49b3 411 m_previewCtrl->WriteText(s_para3);
dadd4f55
JS
412 m_previewCtrl->EndStyle();
413
414 m_previewCtrl->Thaw();
97ff49b3
JS
415}
416
417wxTextAttrEx* wxRichTextBulletsPage::GetAttributes()
418{
419 return wxRichTextFormattingDialog::GetDialogAttributes(this);
420}
421
422/*!
423 * Should we show tooltips?
424 */
425
426bool wxRichTextBulletsPage::ShowToolTips()
427{
dadd4f55 428 return wxRichTextFormattingDialog::ShowToolTips();
97ff49b3
JS
429}
430
431/*!
432 * Get bitmap resources
433 */
434
435wxBitmap wxRichTextBulletsPage::GetBitmapResource( const wxString& name )
436{
437 // Bitmap retrieval
438////@begin wxRichTextBulletsPage bitmap retrieval
439 wxUnusedVar(name);
440 return wxNullBitmap;
441////@end wxRichTextBulletsPage bitmap retrieval
442}
443
444/*!
445 * Get icon resources
446 */
447
448wxIcon wxRichTextBulletsPage::GetIconResource( const wxString& name )
449{
450 // Icon retrieval
451////@begin wxRichTextBulletsPage icon retrieval
452 wxUnusedVar(name);
453 return wxNullIcon;
454////@end wxRichTextBulletsPage icon retrieval
455}
456
457/*!
458 * wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_STYLELISTBOX
459 */
460
461void wxRichTextBulletsPage::OnStylelistboxSelected( wxCommandEvent& WXUNUSED(event) )
462{
463 if (!m_dontUpdate)
464 {
465 m_hasBulletStyle = true;
466
467 if (m_styleListBox->GetSelection() == 6)
468 m_hasBulletSymbol = true;
469
470 UpdatePreview();
471 }
472}
473
474/*!
475 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
476 */
477
478void wxRichTextBulletsPage::OnSymbolctrlSelected( wxCommandEvent& WXUNUSED(event) )
479{
480 if (!m_dontUpdate)
481 {
482 m_hasBulletSymbol = true;
483 UpdatePreview();
484 }
485}
486
487/*!
488 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
489 */
490
491void wxRichTextBulletsPage::OnSymbolctrlUpdated( wxCommandEvent& WXUNUSED(event) )
492{
493 if (!m_dontUpdate)
494 {
495 m_hasBulletSymbol = true;
496 UpdatePreview();
497 }
498}
499
500/*!
501 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
502 */
503
504void wxRichTextBulletsPage::OnSymbolctrlUpdate( wxUpdateUIEvent& event )
505{
506 OnSymbolUpdate(event);
507}
508
509/*!
510 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
511 */
512
513void wxRichTextBulletsPage::OnNumberctrlUpdated( wxSpinEvent& WXUNUSED(event) )
514{
515 if (!m_dontUpdate)
516 {
517 m_hasBulletNumber = true;
518 UpdatePreview();
519 }
520}
521
522/*!
523 * wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
524 */
525
526void wxRichTextBulletsPage::OnNumberctrlUp( wxSpinEvent& WXUNUSED(event) )
527{
528 if (!m_dontUpdate)
529 {
530 m_hasBulletNumber = true;
531 UpdatePreview();
532 }
533}
534
535/*!
536 * wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
537 */
538
539void wxRichTextBulletsPage::OnNumberctrlDown( wxSpinEvent& WXUNUSED(event) )
540{
541 if (!m_dontUpdate)
542 {
543 m_hasBulletNumber = true;
544 UpdatePreview();
545 }
546}
547
548/*!
549 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
550 */
551
552void wxRichTextBulletsPage::OnNumberctrlTextUpdated( wxCommandEvent& WXUNUSED(event) )
553{
554 if (!m_dontUpdate)
555 {
556 m_hasBulletNumber = true;
557 UpdatePreview();
558 }
559}
560
561/*!
562 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
563 */
564
565void wxRichTextBulletsPage::OnNumberctrlUpdate( wxUpdateUIEvent& event )
566{
567 OnNumberUpdate(event);
568}
569
570/*!
571 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL
572 */
573
574void wxRichTextBulletsPage::OnParenthesesctrlClick( wxCommandEvent& WXUNUSED(event) )
575{
576 if (!m_dontUpdate)
577 {
578 m_hasBulletStyle = true;
579 UpdatePreview();
580 }
581}
582
583/*!
584 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL
585 */
586
587void wxRichTextBulletsPage::OnParenthesesctrlUpdate( wxUpdateUIEvent& event )
588{
589 int sel = m_styleListBox->GetSelection();
590 event.Enable(m_hasBulletStyle && (sel != 6 && sel != 7 && sel != 0));
591}
592
593/*!
594 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_PERIODCTRL
595 */
596
597void wxRichTextBulletsPage::OnPeriodctrlClick( wxCommandEvent& WXUNUSED(event) )
598{
599 if (!m_dontUpdate)
600 {
601 m_hasBulletStyle = true;
602 UpdatePreview();
603 }
604}
605
606/*!
607 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_PERIODCTRL
608 */
609
610void wxRichTextBulletsPage::OnPeriodctrlUpdate( wxUpdateUIEvent& event )
611{
612 int sel = m_styleListBox->GetSelection();
613 event.Enable(m_hasBulletStyle && (sel != 6 && sel != 7 && sel != 0));
614}
615
616/*!
617 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
618 */
619
620void wxRichTextBulletsPage::OnChooseSymbolClick( wxCommandEvent& WXUNUSED(event) )
621{
622 int sel = m_styleListBox->GetSelection();
623 if (m_hasBulletStyle && sel == 6)
624 {
625 wxString symbol = m_symbolCtrl->GetValue();
626 wxString fontName = m_symbolFontCtrl->GetValue();
627 wxSymbolPickerDialog dlg(symbol, fontName, fontName, this);
628
629 if (dlg.ShowModal() == wxID_OK)
630 {
631 m_dontUpdate = true;
5778b3c8 632
97ff49b3
JS
633 m_symbolCtrl->SetValue(dlg.GetSymbol());
634 m_symbolFontCtrl->SetValue(dlg.GetFontName());
5778b3c8 635
97ff49b3
JS
636 UpdatePreview();
637
638 m_dontUpdate = false;
639 }
640 }
641}
642
643/*!
644 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
645 */
646
647void wxRichTextBulletsPage::OnChooseSymbolUpdate( wxUpdateUIEvent& event )
648{
649 OnSymbolUpdate(event);
650}
651/*!
652 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
653 */
654
655void wxRichTextBulletsPage::OnSymbolfontctrlSelected( wxCommandEvent& WXUNUSED(event) )
656{
657 if (m_dontUpdate)
658 return;
659 UpdatePreview();
660}
661
662/*!
663 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
664 */
665
666void wxRichTextBulletsPage::OnSymbolfontctrlUpdated( wxCommandEvent& WXUNUSED(event) )
667{
668 if (m_dontUpdate)
669 return;
670 UpdatePreview();
671}
672
673
674/*!
675 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
676 */
677
678void wxRichTextBulletsPage::OnSymbolfontctrlUIUpdate( wxUpdateUIEvent& event )
679{
680 OnSymbolUpdate(event);
681}
682
683/// Update for symbol-related controls
684void wxRichTextBulletsPage::OnSymbolUpdate( wxUpdateUIEvent& event )
685{
686 int sel = m_styleListBox->GetSelection();
687 event.Enable(m_hasBulletStyle && (sel == 6));
688}
689
690/// Update for number-related controls
691void wxRichTextBulletsPage::OnNumberUpdate( wxUpdateUIEvent& event )
692{
693 int sel = m_styleListBox->GetSelection();
694 event.Enable( m_hasBulletStyle && (sel != 6 && sel != 7 && sel != 0));
695}
696
697/*!
698 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC
699 */
700
701void wxRichTextBulletsPage::OnSymbolstaticUpdate( wxUpdateUIEvent& event )
702{
703 OnSymbolUpdate(event);
704}
705
706
707/*!
708 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC
709 */
710
711void wxRichTextBulletsPage::OnNumberstaticUpdate( wxUpdateUIEvent& event )
712{
713 OnNumberUpdate(event);
714}
715
b68603d5 716#endif // wxUSE_RICHTEXT