]> git.saurik.com Git - wxWidgets.git/blame - src/richtext/richtextbulletspage.cpp
added wxWindowDisabler ctor for conditionally disabling all windows and use it in...
[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
f464ecc7
JS
14#include "wx/spinctrl.h"
15
b68603d5
WS
16#include "wx/richtext/richtextbulletspage.h"
17
97ff49b3 18#include "wx/richtext/richtextsymboldlg.h"
97ff49b3 19
97ff49b3
JS
20/*!
21 * wxRichTextBulletsPage type definition
22 */
23
24IMPLEMENT_DYNAMIC_CLASS( wxRichTextBulletsPage, wxPanel )
25
26/*!
27 * wxRichTextBulletsPage event table definition
28 */
29
30BEGIN_EVENT_TABLE( wxRichTextBulletsPage, wxPanel )
31
32////@begin wxRichTextBulletsPage event table entries
33 EVT_LISTBOX( ID_RICHTEXTBULLETSPAGE_STYLELISTBOX, wxRichTextBulletsPage::OnStylelistboxSelected )
34
f089713f
JS
35 EVT_CHECKBOX( ID_RICHTEXTBULLETSPAGE_PERIODCTRL, wxRichTextBulletsPage::OnPeriodctrlClick )
36 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_PERIODCTRL, wxRichTextBulletsPage::OnPeriodctrlUpdate )
37
38 EVT_CHECKBOX( ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL, wxRichTextBulletsPage::OnParenthesesctrlClick )
39 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL, wxRichTextBulletsPage::OnParenthesesctrlUpdate )
40
d2d0adc7
JS
41 EVT_CHECKBOX( ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL, wxRichTextBulletsPage::OnRightParenthesisCtrlClick )
42 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL, wxRichTextBulletsPage::OnRightParenthesisCtrlUpdate )
f089713f 43
d2d0adc7 44 EVT_COMBOBOX( ID_RICHTEXTBULLETSPAGE_BULLETALIGNMENTCTRL, wxRichTextBulletsPage::OnBulletAlignmentCtrlSelected )
f089713f 45
97ff49b3
JS
46 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC, wxRichTextBulletsPage::OnSymbolstaticUpdate )
47
48 EVT_COMBOBOX( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxRichTextBulletsPage::OnSymbolctrlSelected )
49 EVT_TEXT( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxRichTextBulletsPage::OnSymbolctrlUpdated )
50 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxRichTextBulletsPage::OnSymbolctrlUpdate )
51
52 EVT_BUTTON( ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL, wxRichTextBulletsPage::OnChooseSymbolClick )
53 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL, wxRichTextBulletsPage::OnChooseSymbolUpdate )
54
55 EVT_COMBOBOX( ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, wxRichTextBulletsPage::OnSymbolfontctrlSelected )
56 EVT_TEXT( ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, wxRichTextBulletsPage::OnSymbolfontctrlUpdated )
57 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, wxRichTextBulletsPage::OnSymbolfontctrlUIUpdate )
58
f089713f 59 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_NAMESTATIC, wxRichTextBulletsPage::OnNamestaticUpdate )
97ff49b3 60
f089713f
JS
61 EVT_COMBOBOX( ID_RICHTEXTBULLETSPAGE_NAMECTRL, wxRichTextBulletsPage::OnNamectrlSelected )
62 EVT_TEXT( ID_RICHTEXTBULLETSPAGE_NAMECTRL, wxRichTextBulletsPage::OnNamectrlUpdated )
63 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_NAMECTRL, wxRichTextBulletsPage::OnNamectrlUIUpdate )
97ff49b3 64
d2d0adc7
JS
65 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC, wxRichTextBulletsPage::OnNumberstaticUpdate )
66
67 EVT_SPINCTRL( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxRichTextBulletsPage::OnNumberctrlUpdated )
68 EVT_SPIN_UP( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxRichTextBulletsPage::OnNumberctrlUp )
69 EVT_SPIN_DOWN( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxRichTextBulletsPage::OnNumberctrlDown )
70 EVT_TEXT( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxRichTextBulletsPage::OnNumberctrlTextUpdated )
71 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxRichTextBulletsPage::OnNumberctrlUpdate )
72
97ff49b3
JS
73////@end wxRichTextBulletsPage event table entries
74
75END_EVENT_TABLE()
76
77/*!
78 * wxRichTextBulletsPage constructors
79 */
80
81wxRichTextBulletsPage::wxRichTextBulletsPage( )
82{
83 Init();
84}
85
86wxRichTextBulletsPage::wxRichTextBulletsPage( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
87{
88 Init();
89 Create(parent, id, pos, size, style);
90}
91
92/*!
93 * Initialise members
94 */
5778b3c8 95
97ff49b3
JS
96void wxRichTextBulletsPage::Init()
97{
98 m_hasBulletStyle = false;
99 m_hasBulletNumber = false;
100 m_hasBulletSymbol = false;
101 m_dontUpdate = false;
102
103////@begin wxRichTextBulletsPage member initialisation
104 m_styleListBox = NULL;
f089713f
JS
105 m_periodCtrl = NULL;
106 m_parenthesesCtrl = NULL;
d2d0adc7
JS
107 m_rightParenthesisCtrl = NULL;
108 m_bulletAlignmentCtrl = NULL;
97ff49b3
JS
109 m_symbolCtrl = NULL;
110 m_symbolFontCtrl = NULL;
f089713f 111 m_bulletNameCtrl = NULL;
d2d0adc7 112 m_numberCtrl = NULL;
97ff49b3
JS
113 m_previewCtrl = NULL;
114////@end wxRichTextBulletsPage member initialisation
115}
116
117/*!
118 * wxRichTextBulletsPage creator
119 */
120
121bool wxRichTextBulletsPage::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
122{
123////@begin wxRichTextBulletsPage creation
124 wxPanel::Create( parent, id, pos, size, style );
125
126 CreateControls();
127 if (GetSizer())
128 {
129 GetSizer()->SetSizeHints(this);
130 }
131 Centre();
132////@end wxRichTextBulletsPage creation
133 return true;
134}
135
136/*!
137 * Control creation for wxRichTextBulletsPage
138 */
139
140void wxRichTextBulletsPage::CreateControls()
141{
142////@begin wxRichTextBulletsPage content construction
143 wxRichTextBulletsPage* itemPanel1 = this;
144
145 wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
146 itemPanel1->SetSizer(itemBoxSizer2);
147
148 wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
149 itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5);
150
151 wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
152 itemBoxSizer3->Add(itemBoxSizer4, 0, wxGROW, 5);
153
154 wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
155 itemBoxSizer4->Add(itemBoxSizer5, 0, wxGROW, 5);
156
157 wxStaticText* itemStaticText6 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Bullet style:"), wxDefaultPosition, wxDefaultSize, 0 );
69ce77e2 158 itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
97ff49b3 159
6103234e 160 wxArrayString m_styleListBoxStrings;
2fce6547 161 m_styleListBox = new wxListBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_STYLELISTBOX, wxDefaultPosition, wxSize(-1, 90), m_styleListBoxStrings, wxLB_SINGLE );
dadd4f55 162 m_styleListBox->SetHelpText(_("The available bullet styles."));
6103234e 163 if (wxRichTextBulletsPage::ShowToolTips())
dadd4f55 164 m_styleListBox->SetToolTip(_("The available bullet styles."));
f089713f
JS
165 itemBoxSizer5->Add(m_styleListBox, 1, wxGROW|wxALL, 5);
166
167 wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxHORIZONTAL);
168 itemBoxSizer5->Add(itemBoxSizer8, 0, wxGROW, 5);
169
170 m_periodCtrl = new wxCheckBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_PERIODCTRL, _("Peri&od"), wxDefaultPosition, wxDefaultSize, 0 );
171 m_periodCtrl->SetValue(false);
172 m_periodCtrl->SetHelpText(_("Check to add a period after the bullet."));
6103234e 173 if (wxRichTextBulletsPage::ShowToolTips())
f089713f
JS
174 m_periodCtrl->SetToolTip(_("Check to add a period after the bullet."));
175 itemBoxSizer8->Add(m_periodCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
176
d2d0adc7 177 m_parenthesesCtrl = new wxCheckBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL, _("(*)"), wxDefaultPosition, wxDefaultSize, 0 );
f089713f
JS
178 m_parenthesesCtrl->SetValue(false);
179 m_parenthesesCtrl->SetHelpText(_("Check to enclose the bullet in parentheses."));
6103234e 180 if (wxRichTextBulletsPage::ShowToolTips())
f089713f
JS
181 m_parenthesesCtrl->SetToolTip(_("Check to enclose the bullet in parentheses."));
182 itemBoxSizer8->Add(m_parenthesesCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
183
d2d0adc7
JS
184 m_rightParenthesisCtrl = new wxCheckBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL, _("*)"), wxDefaultPosition, wxDefaultSize, 0 );
185 m_rightParenthesisCtrl->SetValue(false);
186 m_rightParenthesisCtrl->SetHelpText(_("Check to add a right parenthesis."));
6103234e 187 if (wxRichTextBulletsPage::ShowToolTips())
d2d0adc7
JS
188 m_rightParenthesisCtrl->SetToolTip(_("Check to add a right parenthesis."));
189 itemBoxSizer8->Add(m_rightParenthesisCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
f089713f 190
d2d0adc7 191 itemBoxSizer5->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5);
f089713f 192
d2d0adc7 193 wxStaticText* itemStaticText13 = new wxStaticText( itemPanel1, wxID_STATIC, _("Bullet &Alignment:"), wxDefaultPosition, wxDefaultSize, 0 );
69ce77e2 194 itemBoxSizer5->Add(itemStaticText13, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
d2d0adc7 195
6103234e
JS
196 wxArrayString m_bulletAlignmentCtrlStrings;
197 m_bulletAlignmentCtrlStrings.Add(_("Left"));
198 m_bulletAlignmentCtrlStrings.Add(_("Centre"));
199 m_bulletAlignmentCtrlStrings.Add(_("Right"));
200 m_bulletAlignmentCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_BULLETALIGNMENTCTRL, _("Left"), wxDefaultPosition, wxSize(60, -1), m_bulletAlignmentCtrlStrings, wxCB_READONLY );
d2d0adc7
JS
201 m_bulletAlignmentCtrl->SetStringSelection(_("Left"));
202 m_bulletAlignmentCtrl->SetHelpText(_("The bullet character."));
6103234e 203 if (wxRichTextBulletsPage::ShowToolTips())
d2d0adc7
JS
204 m_bulletAlignmentCtrl->SetToolTip(_("The bullet character."));
205 itemBoxSizer5->Add(m_bulletAlignmentCtrl, 0, wxGROW|wxALL|wxFIXED_MINSIZE, 5);
97ff49b3
JS
206
207 itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
208
d2d0adc7
JS
209 wxStaticLine* itemStaticLine16 = new wxStaticLine( itemPanel1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
210 itemBoxSizer4->Add(itemStaticLine16, 0, wxGROW|wxLEFT|wxRIGHT, 5);
97ff49b3
JS
211
212 itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
213
d2d0adc7
JS
214 wxBoxSizer* itemBoxSizer18 = new wxBoxSizer(wxVERTICAL);
215 itemBoxSizer4->Add(itemBoxSizer18, 0, wxGROW, 5);
97ff49b3 216
d2d0adc7 217 wxStaticText* itemStaticText19 = new wxStaticText( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC, _("&Symbol:"), wxDefaultPosition, wxDefaultSize, 0 );
69ce77e2 218 itemBoxSizer18->Add(itemStaticText19, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
97ff49b3 219
d2d0adc7
JS
220 wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL);
221 itemBoxSizer18->Add(itemBoxSizer20, 0, wxGROW, 5);
97ff49b3 222
6103234e
JS
223 wxArrayString m_symbolCtrlStrings;
224 m_symbolCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, _T(""), wxDefaultPosition, wxSize(60, -1), m_symbolCtrlStrings, wxCB_DROPDOWN );
dadd4f55 225 m_symbolCtrl->SetHelpText(_("The bullet character."));
6103234e 226 if (wxRichTextBulletsPage::ShowToolTips())
dadd4f55 227 m_symbolCtrl->SetToolTip(_("The bullet character."));
d2d0adc7 228 itemBoxSizer20->Add(m_symbolCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxFIXED_MINSIZE, 5);
97ff49b3 229
d2d0adc7
JS
230 wxButton* itemButton22 = new wxButton( itemPanel1, ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL, _("Ch&oose..."), wxDefaultPosition, wxDefaultSize, 0 );
231 itemButton22->SetHelpText(_("Click to browse for a symbol."));
6103234e 232 if (wxRichTextBulletsPage::ShowToolTips())
d2d0adc7
JS
233 itemButton22->SetToolTip(_("Click to browse for a symbol."));
234 itemBoxSizer20->Add(itemButton22, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
97ff49b3 235
d2d0adc7 236 itemBoxSizer18->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5);
97ff49b3 237
d2d0adc7 238 wxStaticText* itemStaticText24 = new wxStaticText( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC, _("Symbol &font:"), wxDefaultPosition, wxDefaultSize, 0 );
69ce77e2 239 itemBoxSizer18->Add(itemStaticText24, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
97ff49b3 240
6103234e
JS
241 wxArrayString m_symbolFontCtrlStrings;
242 m_symbolFontCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, m_symbolFontCtrlStrings, wxCB_DROPDOWN );
dadd4f55 243 m_symbolFontCtrl->SetHelpText(_("Available fonts."));
6103234e 244 if (wxRichTextBulletsPage::ShowToolTips())
dadd4f55 245 m_symbolFontCtrl->SetToolTip(_("Available fonts."));
d2d0adc7 246 itemBoxSizer18->Add(m_symbolFontCtrl, 0, wxGROW|wxALL, 5);
97ff49b3 247
2fce6547 248 itemBoxSizer18->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL, 5);
97ff49b3 249
d2d0adc7 250 wxStaticText* itemStaticText27 = new wxStaticText( itemPanel1, ID_RICHTEXTBULLETSPAGE_NAMESTATIC, _("S&tandard bullet name:"), wxDefaultPosition, wxDefaultSize, 0 );
69ce77e2 251 itemBoxSizer18->Add(itemStaticText27, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
97ff49b3 252
6103234e
JS
253 wxArrayString m_bulletNameCtrlStrings;
254 m_bulletNameCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_NAMECTRL, _T(""), wxDefaultPosition, wxDefaultSize, m_bulletNameCtrlStrings, wxCB_DROPDOWN );
f089713f 255 m_bulletNameCtrl->SetHelpText(_("A standard bullet name."));
6103234e 256 if (wxRichTextBulletsPage::ShowToolTips())
f089713f 257 m_bulletNameCtrl->SetToolTip(_("A standard bullet name."));
d2d0adc7
JS
258 itemBoxSizer18->Add(m_bulletNameCtrl, 0, wxGROW|wxALL, 5);
259
2fce6547 260 itemBoxSizer18->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL, 5);
d2d0adc7
JS
261
262 wxStaticText* itemStaticText30 = new wxStaticText( itemPanel1, ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC, _("&Number:"), wxDefaultPosition, wxDefaultSize, 0 );
69ce77e2 263 itemBoxSizer18->Add(itemStaticText30, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
d2d0adc7
JS
264
265 m_numberCtrl = new wxSpinCtrl( itemPanel1, ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, _T("0"), wxDefaultPosition, wxSize(50, -1), wxSP_ARROW_KEYS, 0, 100000, 0 );
266 m_numberCtrl->SetHelpText(_("The list item number."));
6103234e 267 if (wxRichTextBulletsPage::ShowToolTips())
d2d0adc7
JS
268 m_numberCtrl->SetToolTip(_("The list item number."));
269 itemBoxSizer18->Add(m_numberCtrl, 0, wxGROW|wxALL, 5);
97ff49b3 270
2fce6547 271 itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5);
97ff49b3 272
2fce6547 273 m_previewCtrl = new wxRichTextCtrl( itemPanel1, ID_RICHTEXTBULLETSPAGE_PREVIEW_CTRL, wxEmptyString, wxDefaultPosition, wxSize(350, 100), wxVSCROLL|wxTE_READONLY );
97ff49b3 274 m_previewCtrl->SetHelpText(_("Shows a preview of the bullet settings."));
6103234e 275 if (wxRichTextBulletsPage::ShowToolTips())
97ff49b3 276 m_previewCtrl->SetToolTip(_("Shows a preview of the bullet settings."));
2fce6547 277 itemBoxSizer3->Add(m_previewCtrl, 1, wxGROW|wxALL, 5);
97ff49b3
JS
278
279////@end wxRichTextBulletsPage content construction
280
281 m_styleListBox->Append(_("(None)"));
282 m_styleListBox->Append(_("Arabic"));
283 m_styleListBox->Append(_("Upper case letters"));
284 m_styleListBox->Append(_("Lower case letters"));
285 m_styleListBox->Append(_("Upper case roman numerals"));
286 m_styleListBox->Append(_("Lower case roman numerals"));
d2d0adc7 287 m_styleListBox->Append(_("Numbered outline"));
97ff49b3
JS
288 m_styleListBox->Append(_("Symbol"));
289 m_styleListBox->Append(_("Bitmap"));
f089713f 290 m_styleListBox->Append(_("Standard"));
69ce77e2 291
97ff49b3
JS
292 m_symbolCtrl->Append(_("*"));
293 m_symbolCtrl->Append(_("-"));
294 m_symbolCtrl->Append(_(">"));
295 m_symbolCtrl->Append(_("+"));
296 m_symbolCtrl->Append(_("~"));
69ce77e2 297
d2d0adc7
JS
298 wxArrayString standardBulletNames;
299 if (wxRichTextBuffer::GetRenderer())
300 wxRichTextBuffer::GetRenderer()->EnumerateStandardBulletNames(standardBulletNames);
301
302 m_bulletNameCtrl->Append(standardBulletNames);
5778b3c8 303
dadd4f55 304 wxArrayString facenames = wxRichTextCtrl::GetAvailableFontNames();
97ff49b3 305 facenames.Sort();
5778b3c8 306
97ff49b3
JS
307 m_symbolFontCtrl->Append(facenames);
308}
309
310/// Transfer data from/to window
311bool wxRichTextBulletsPage::TransferDataFromWindow()
312{
313 wxPanel::TransferDataFromWindow();
314
44cc96a8 315 wxTextAttr* attr = GetAttributes();
97ff49b3
JS
316
317 if (m_hasBulletStyle)
318 {
d2d0adc7 319 long bulletStyle = wxRICHTEXT_BULLETINDEX_NONE;
97ff49b3
JS
320
321 int index = m_styleListBox->GetSelection();
d2d0adc7 322 if (index == wxRICHTEXT_BULLETINDEX_ARABIC)
97ff49b3 323 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ARABIC;
d2d0adc7
JS
324
325 else if (index == wxRICHTEXT_BULLETINDEX_UPPER_CASE)
97ff49b3 326 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER;
d2d0adc7
JS
327
328 else if (index == wxRICHTEXT_BULLETINDEX_LOWER_CASE)
97ff49b3 329 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER;
d2d0adc7
JS
330
331 else if (index == wxRICHTEXT_BULLETINDEX_UPPER_CASE_ROMAN)
97ff49b3 332 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER;
d2d0adc7
JS
333
334 else if (index == wxRICHTEXT_BULLETINDEX_LOWER_CASE_ROMAN)
97ff49b3 335 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER;
d2d0adc7
JS
336
337 else if (index == wxRICHTEXT_BULLETINDEX_OUTLINE)
338 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_OUTLINE;
339
340 else if (index == wxRICHTEXT_BULLETINDEX_SYMBOL)
97ff49b3 341 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_SYMBOL;
d2d0adc7
JS
342
343 else if (index == wxRICHTEXT_BULLETINDEX_BITMAP)
97ff49b3 344 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_BITMAP;
d2d0adc7
JS
345
346 else if (index == wxRICHTEXT_BULLETINDEX_STANDARD)
f089713f
JS
347 {
348 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_STANDARD;
349 attr->SetBulletName(m_bulletNameCtrl->GetValue());
350 }
97ff49b3
JS
351
352 if (m_parenthesesCtrl->GetValue())
353 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_PARENTHESES;
d2d0adc7
JS
354 if (m_rightParenthesisCtrl->GetValue())
355 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS;
97ff49b3
JS
356 if (m_periodCtrl->GetValue())
357 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_PERIOD;
69ce77e2 358
d2d0adc7
JS
359 if (m_bulletAlignmentCtrl->GetSelection() == 1)
360 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE;
361 else if (m_bulletAlignmentCtrl->GetSelection() == 2)
362 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT;
69ce77e2 363 // Left is implied
97ff49b3
JS
364
365 attr->SetBulletStyle(bulletStyle);
366 }
367
368 if (m_hasBulletNumber)
369 {
370 attr->SetBulletNumber(m_numberCtrl->GetValue());
371 }
372
373 if (m_hasBulletSymbol)
374 {
d2d0adc7 375 attr->SetBulletText(m_symbolCtrl->GetValue());
97ff49b3
JS
376 attr->SetBulletFont(m_symbolFontCtrl->GetValue());
377 }
69ce77e2 378
97ff49b3
JS
379 return true;
380}
381
382bool wxRichTextBulletsPage::TransferDataToWindow()
383{
384 m_dontUpdate = true;
385
386 wxPanel::TransferDataToWindow();
387
44cc96a8 388 wxTextAttr* attr = GetAttributes();
97ff49b3
JS
389
390 if (attr->HasBulletStyle())
391 {
f089713f 392 m_hasBulletStyle = true;
d2d0adc7
JS
393 int index = wxRICHTEXT_BULLETINDEX_NONE;
394
97ff49b3 395 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ARABIC)
d2d0adc7
JS
396 index = wxRICHTEXT_BULLETINDEX_ARABIC;
397
97ff49b3 398 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER)
d2d0adc7
JS
399 index = wxRICHTEXT_BULLETINDEX_UPPER_CASE;
400
97ff49b3 401 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER)
d2d0adc7
JS
402 index = wxRICHTEXT_BULLETINDEX_LOWER_CASE;
403
97ff49b3 404 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER)
d2d0adc7
JS
405 index = wxRICHTEXT_BULLETINDEX_UPPER_CASE_ROMAN;
406
97ff49b3 407 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER)
d2d0adc7
JS
408 index = wxRICHTEXT_BULLETINDEX_LOWER_CASE_ROMAN;
409
410 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_OUTLINE)
411 index = wxRICHTEXT_BULLETINDEX_OUTLINE;
412
97ff49b3 413 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_SYMBOL)
d2d0adc7
JS
414 index = wxRICHTEXT_BULLETINDEX_SYMBOL;
415
97ff49b3 416 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_BITMAP)
d2d0adc7
JS
417 index = wxRICHTEXT_BULLETINDEX_BITMAP;
418
f089713f 419 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_STANDARD)
d2d0adc7
JS
420 index = wxRICHTEXT_BULLETINDEX_STANDARD;
421
97ff49b3
JS
422 m_styleListBox->SetSelection(index);
423
424 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PARENTHESES)
425 m_parenthesesCtrl->SetValue(true);
426 else
427 m_parenthesesCtrl->SetValue(false);
428
d2d0adc7
JS
429 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS)
430 m_rightParenthesisCtrl->SetValue(true);
431 else
432 m_rightParenthesisCtrl->SetValue(false);
433
97ff49b3
JS
434 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PERIOD)
435 m_periodCtrl->SetValue(true);
436 else
5778b3c8 437 m_periodCtrl->SetValue(false);
d2d0adc7
JS
438
439 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE)
440 m_bulletAlignmentCtrl->SetSelection(1);
441 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT)
442 m_bulletAlignmentCtrl->SetSelection(2);
443 else
444 m_bulletAlignmentCtrl->SetSelection(0);
97ff49b3
JS
445 }
446 else
f089713f
JS
447 {
448 m_hasBulletStyle = false;
97ff49b3 449 m_styleListBox->SetSelection(-1);
d2d0adc7 450 m_bulletAlignmentCtrl->SetSelection(-1);
f089713f 451 }
97ff49b3 452
d2d0adc7 453 if (attr->HasBulletText())
97ff49b3 454 {
d2d0adc7 455 m_symbolCtrl->SetValue(attr->GetBulletText());
97ff49b3
JS
456 m_symbolFontCtrl->SetValue(attr->GetBulletFont());
457 }
458 else
459 m_symbolCtrl->SetValue(wxEmptyString);
460
461 if (attr->HasBulletNumber())
462 m_numberCtrl->SetValue(attr->GetBulletNumber());
463 else
464 m_numberCtrl->SetValue(0);
465
f089713f
JS
466 if (attr->HasBulletName())
467 m_bulletNameCtrl->SetValue(attr->GetBulletName());
468 else
469 m_bulletNameCtrl->SetValue(wxEmptyString);
470
97ff49b3
JS
471 UpdatePreview();
472
473 m_dontUpdate = false;
474
475 return true;
476}
477
478/// Updates the bullet preview
479void wxRichTextBulletsPage::UpdatePreview()
480{
481 static const wxChar* s_para1 = wxT("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \
482Nullam ante sapien, vestibulum nonummy, pulvinar sed, luctus ut, lacus.");
483
484 static const wxChar* s_para2 = wxT("\nDuis pharetra consequat dui. Cum sociis natoque penatibus \
485et magnis dis parturient montes, nascetur ridiculus mus. Nullam vitae justo id mauris lobortis interdum.");
486
487 static const wxChar* s_para3 = wxT("\nInteger convallis dolor at augue \
488iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
489
490 TransferDataFromWindow();
44cc96a8 491 wxTextAttr attr(*GetAttributes());
97ff49b3 492 attr.SetFlags(attr.GetFlags() &
d2d0adc7 493 (wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_TEXT|wxTEXT_ATTR_BULLET_NAME|
97ff49b3
JS
494 wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|
495 wxTEXT_ATTR_LINE_SPACING));
496
497 wxFont font(m_previewCtrl->GetFont());
498 font.SetPointSize(9);
499 m_previewCtrl->SetFont(font);
500
44cc96a8 501 wxTextAttr normalParaAttr;
dadd4f55
JS
502 normalParaAttr.SetFont(font);
503 normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY")));
97ff49b3 504
dadd4f55 505 m_previewCtrl->Freeze();
97ff49b3
JS
506 m_previewCtrl->Clear();
507
dadd4f55 508 m_previewCtrl->BeginStyle(normalParaAttr);
97ff49b3 509 m_previewCtrl->WriteText(s_para1);
dadd4f55 510 m_previewCtrl->EndStyle();
41a85215 511
97ff49b3
JS
512 m_previewCtrl->BeginStyle(attr);
513 m_previewCtrl->WriteText(s_para2);
514 m_previewCtrl->EndStyle();
dadd4f55
JS
515
516 m_previewCtrl->BeginStyle(normalParaAttr);
97ff49b3 517 m_previewCtrl->WriteText(s_para3);
dadd4f55 518 m_previewCtrl->EndStyle();
69ce77e2 519
d2d0adc7 520 m_previewCtrl->NumberList(wxRichTextRange(0, m_previewCtrl->GetLastPosition()+1));
dadd4f55
JS
521
522 m_previewCtrl->Thaw();
97ff49b3
JS
523}
524
44cc96a8 525wxTextAttr* wxRichTextBulletsPage::GetAttributes()
97ff49b3
JS
526{
527 return wxRichTextFormattingDialog::GetDialogAttributes(this);
528}
529
530/*!
531 * Should we show tooltips?
532 */
533
534bool wxRichTextBulletsPage::ShowToolTips()
535{
dadd4f55 536 return wxRichTextFormattingDialog::ShowToolTips();
97ff49b3
JS
537}
538
539/*!
540 * Get bitmap resources
541 */
542
543wxBitmap wxRichTextBulletsPage::GetBitmapResource( const wxString& name )
544{
545 // Bitmap retrieval
546////@begin wxRichTextBulletsPage bitmap retrieval
547 wxUnusedVar(name);
548 return wxNullBitmap;
549////@end wxRichTextBulletsPage bitmap retrieval
550}
551
552/*!
553 * Get icon resources
554 */
555
556wxIcon wxRichTextBulletsPage::GetIconResource( const wxString& name )
557{
558 // Icon retrieval
559////@begin wxRichTextBulletsPage icon retrieval
560 wxUnusedVar(name);
561 return wxNullIcon;
562////@end wxRichTextBulletsPage icon retrieval
563}
564
565/*!
566 * wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_STYLELISTBOX
567 */
568
569void wxRichTextBulletsPage::OnStylelistboxSelected( wxCommandEvent& WXUNUSED(event) )
570{
571 if (!m_dontUpdate)
572 {
573 m_hasBulletStyle = true;
574
d2d0adc7 575 if (m_styleListBox->GetSelection() == wxRICHTEXT_BULLETINDEX_SYMBOL)
97ff49b3
JS
576 m_hasBulletSymbol = true;
577
578 UpdatePreview();
579 }
580}
581
582/*!
583 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
584 */
585
586void wxRichTextBulletsPage::OnSymbolctrlSelected( wxCommandEvent& WXUNUSED(event) )
587{
588 if (!m_dontUpdate)
589 {
590 m_hasBulletSymbol = true;
591 UpdatePreview();
592 }
593}
594
595/*!
596 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
597 */
598
599void wxRichTextBulletsPage::OnSymbolctrlUpdated( wxCommandEvent& WXUNUSED(event) )
600{
601 if (!m_dontUpdate)
602 {
603 m_hasBulletSymbol = true;
604 UpdatePreview();
605 }
606}
607
608/*!
609 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
610 */
611
612void wxRichTextBulletsPage::OnSymbolctrlUpdate( wxUpdateUIEvent& event )
613{
614 OnSymbolUpdate(event);
615}
616
617/*!
618 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
619 */
620
621void wxRichTextBulletsPage::OnNumberctrlUpdated( wxSpinEvent& WXUNUSED(event) )
622{
623 if (!m_dontUpdate)
624 {
625 m_hasBulletNumber = true;
626 UpdatePreview();
627 }
628}
629
630/*!
631 * wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
632 */
633
634void wxRichTextBulletsPage::OnNumberctrlUp( wxSpinEvent& WXUNUSED(event) )
635{
636 if (!m_dontUpdate)
637 {
638 m_hasBulletNumber = true;
639 UpdatePreview();
640 }
641}
642
643/*!
644 * wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
645 */
646
647void wxRichTextBulletsPage::OnNumberctrlDown( wxSpinEvent& WXUNUSED(event) )
648{
649 if (!m_dontUpdate)
650 {
651 m_hasBulletNumber = true;
652 UpdatePreview();
653 }
654}
655
656/*!
657 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
658 */
659
660void wxRichTextBulletsPage::OnNumberctrlTextUpdated( wxCommandEvent& WXUNUSED(event) )
661{
662 if (!m_dontUpdate)
663 {
664 m_hasBulletNumber = true;
665 UpdatePreview();
666 }
667}
668
669/*!
670 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
671 */
672
673void wxRichTextBulletsPage::OnNumberctrlUpdate( wxUpdateUIEvent& event )
674{
675 OnNumberUpdate(event);
676}
677
678/*!
679 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL
680 */
681
682void wxRichTextBulletsPage::OnParenthesesctrlClick( wxCommandEvent& WXUNUSED(event) )
683{
684 if (!m_dontUpdate)
685 {
686 m_hasBulletStyle = true;
687 UpdatePreview();
688 }
689}
690
691/*!
692 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL
693 */
694
695void wxRichTextBulletsPage::OnParenthesesctrlUpdate( wxUpdateUIEvent& event )
696{
697 int sel = m_styleListBox->GetSelection();
d2d0adc7
JS
698 event.Enable(m_hasBulletStyle && (sel != wxRICHTEXT_BULLETINDEX_SYMBOL &&
699 sel != wxRICHTEXT_BULLETINDEX_BITMAP &&
700 sel != wxRICHTEXT_BULLETINDEX_NONE));
97ff49b3
JS
701}
702
703/*!
704 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_PERIODCTRL
705 */
706
707void wxRichTextBulletsPage::OnPeriodctrlClick( wxCommandEvent& WXUNUSED(event) )
708{
709 if (!m_dontUpdate)
710 {
711 m_hasBulletStyle = true;
712 UpdatePreview();
713 }
714}
715
716/*!
717 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_PERIODCTRL
718 */
719
720void wxRichTextBulletsPage::OnPeriodctrlUpdate( wxUpdateUIEvent& event )
721{
722 int sel = m_styleListBox->GetSelection();
d2d0adc7
JS
723 event.Enable(m_hasBulletStyle && (sel != wxRICHTEXT_BULLETINDEX_SYMBOL &&
724 sel != wxRICHTEXT_BULLETINDEX_BITMAP &&
725 sel != wxRICHTEXT_BULLETINDEX_NONE));
97ff49b3
JS
726}
727
728/*!
729 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
730 */
731
732void wxRichTextBulletsPage::OnChooseSymbolClick( wxCommandEvent& WXUNUSED(event) )
733{
734 int sel = m_styleListBox->GetSelection();
d2d0adc7 735 if (m_hasBulletStyle && sel == wxRICHTEXT_BULLETINDEX_SYMBOL)
97ff49b3
JS
736 {
737 wxString symbol = m_symbolCtrl->GetValue();
738 wxString fontName = m_symbolFontCtrl->GetValue();
739 wxSymbolPickerDialog dlg(symbol, fontName, fontName, this);
740
741 if (dlg.ShowModal() == wxID_OK)
742 {
743 m_dontUpdate = true;
5778b3c8 744
97ff49b3
JS
745 m_symbolCtrl->SetValue(dlg.GetSymbol());
746 m_symbolFontCtrl->SetValue(dlg.GetFontName());
5778b3c8 747
97ff49b3
JS
748 UpdatePreview();
749
750 m_dontUpdate = false;
751 }
752 }
753}
754
755/*!
756 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
757 */
758
759void wxRichTextBulletsPage::OnChooseSymbolUpdate( wxUpdateUIEvent& event )
760{
761 OnSymbolUpdate(event);
762}
763/*!
764 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
765 */
766
767void wxRichTextBulletsPage::OnSymbolfontctrlSelected( wxCommandEvent& WXUNUSED(event) )
768{
769 if (m_dontUpdate)
770 return;
771 UpdatePreview();
772}
773
774/*!
775 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
776 */
777
778void wxRichTextBulletsPage::OnSymbolfontctrlUpdated( wxCommandEvent& WXUNUSED(event) )
779{
780 if (m_dontUpdate)
781 return;
782 UpdatePreview();
783}
784
785
786/*!
787 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
788 */
789
790void wxRichTextBulletsPage::OnSymbolfontctrlUIUpdate( wxUpdateUIEvent& event )
791{
792 OnSymbolUpdate(event);
793}
794
795/// Update for symbol-related controls
796void wxRichTextBulletsPage::OnSymbolUpdate( wxUpdateUIEvent& event )
797{
798 int sel = m_styleListBox->GetSelection();
d2d0adc7 799 event.Enable(m_hasBulletStyle && (sel == wxRICHTEXT_BULLETINDEX_SYMBOL));
97ff49b3
JS
800}
801
802/// Update for number-related controls
803void wxRichTextBulletsPage::OnNumberUpdate( wxUpdateUIEvent& event )
804{
805 int sel = m_styleListBox->GetSelection();
d2d0adc7
JS
806 event.Enable( m_hasBulletStyle && (sel != wxRICHTEXT_BULLETINDEX_SYMBOL &&
807 sel != wxRICHTEXT_BULLETINDEX_BITMAP &&
808 sel != wxRICHTEXT_BULLETINDEX_STANDARD &&
809 sel != wxRICHTEXT_BULLETINDEX_NONE));
97ff49b3
JS
810}
811
f089713f
JS
812/// Update for standard bullet-related controls
813void wxRichTextBulletsPage::OnStandardBulletUpdate( wxUpdateUIEvent& event )
814{
815 int sel = m_styleListBox->GetSelection();
d2d0adc7 816 event.Enable( sel == wxRICHTEXT_BULLETINDEX_STANDARD );
f089713f
JS
817}
818
819
97ff49b3
JS
820/*!
821 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC
822 */
823
824void wxRichTextBulletsPage::OnSymbolstaticUpdate( wxUpdateUIEvent& event )
825{
826 OnSymbolUpdate(event);
827}
828
829
830/*!
831 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC
832 */
833
834void wxRichTextBulletsPage::OnNumberstaticUpdate( wxUpdateUIEvent& event )
835{
836 OnNumberUpdate(event);
837}
838
f089713f
JS
839/*!
840 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NAMESTATIC
841 */
842
843void wxRichTextBulletsPage::OnNamestaticUpdate( wxUpdateUIEvent& event )
844{
845 OnStandardBulletUpdate(event);
846}
847
848
849/*!
850 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL
851 */
852
853void wxRichTextBulletsPage::OnNamectrlSelected( wxCommandEvent& WXUNUSED(event) )
854{
855 if (m_dontUpdate)
856 return;
857 UpdatePreview();
858}
859
860/*!
861 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL
862 */
863
864void wxRichTextBulletsPage::OnNamectrlUpdated( wxCommandEvent& WXUNUSED(event) )
865{
866 if (m_dontUpdate)
867 return;
868 UpdatePreview();
869}
870
871/*!
872 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL
873 */
874
875void wxRichTextBulletsPage::OnNamectrlUIUpdate( wxUpdateUIEvent& event )
876{
877 OnStandardBulletUpdate(event);
878}
879
b68603d5 880#endif // wxUSE_RICHTEXT
d2d0adc7
JS
881/*!
882 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_RIGHT_PARENTHESIS_CTRL
883 */
884
885void wxRichTextBulletsPage::OnRightParenthesisCtrlClick( wxCommandEvent& WXUNUSED(event) )
886{
887 if (!m_dontUpdate)
888 {
889 m_hasBulletStyle = true;
890 UpdatePreview();
891 }
892}
893
894/*!
895 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_RIGHT_PARENTHESIS_CTRL
896 */
897
898void wxRichTextBulletsPage::OnRightParenthesisCtrlUpdate( wxUpdateUIEvent& event )
899{
900 int sel = m_styleListBox->GetSelection();
901 event.Enable(m_hasBulletStyle && (sel != wxRICHTEXT_BULLETINDEX_SYMBOL &&
902 sel != wxRICHTEXT_BULLETINDEX_BITMAP &&
903 sel != wxRICHTEXT_BULLETINDEX_NONE));
904}
905
906/*!
907 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_COMBOBOX
908 */
909
910void wxRichTextBulletsPage::OnBulletAlignmentCtrlSelected( wxCommandEvent& WXUNUSED(event) )
911{
912 if (m_dontUpdate)
913 return;
914 UpdatePreview();
915}
916
917