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