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