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