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