]> git.saurik.com Git - wxWidgets.git/blame - src/richtext/richtextliststylepage.cpp
Ensure there is valid context for DrawRectangle
[wxWidgets.git] / src / richtext / richtextliststylepage.cpp
CommitLineData
dadd4f55 1/////////////////////////////////////////////////////////////////////////////
41a85215
WS
2// Name: src/richtext/richtextliststylepage.cpp
3// Purpose:
dadd4f55 4// Author: Julian Smart
41a85215 5// Modified by:
dadd4f55 6// Created: 10/18/2006 11:36:37 AM
41a85215 7// RCS-ID: $Id$
dadd4f55 8// Copyright: (c) Julian Smart
41a85215 9// Licence: wxWindows licence
dadd4f55
JS
10/////////////////////////////////////////////////////////////////////////////
11
41a85215 12#include "wx/richtext/richtextliststylepage.h"
dadd4f55
JS
13
14////@begin XPM images
15////@end XPM images
16
17/*!
18 * wxRichTextListStylePage type definition
19 */
20
603f702b 21IMPLEMENT_DYNAMIC_CLASS( wxRichTextListStylePage, wxRichTextDialogPage )
dadd4f55
JS
22
23/*!
24 * wxRichTextListStylePage event table definition
25 */
26
603f702b 27BEGIN_EVENT_TABLE( wxRichTextListStylePage, wxRichTextDialogPage )
dadd4f55
JS
28
29////@begin wxRichTextListStylePage event table entries
30 EVT_SPINCTRL( ID_RICHTEXTLISTSTYLEPAGE_LEVEL, wxRichTextListStylePage::OnLevelUpdated )
31 EVT_SPIN_UP( ID_RICHTEXTLISTSTYLEPAGE_LEVEL, wxRichTextListStylePage::OnLevelUp )
32 EVT_SPIN_DOWN( ID_RICHTEXTLISTSTYLEPAGE_LEVEL, wxRichTextListStylePage::OnLevelDown )
33 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_LEVEL, wxRichTextListStylePage::OnLevelTextUpdated )
34 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_LEVEL, wxRichTextListStylePage::OnLevelUIUpdate )
35
36 EVT_BUTTON( ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT, wxRichTextListStylePage::OnChooseFontClick )
37
38 EVT_LISTBOX( ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX, wxRichTextListStylePage::OnStylelistboxSelected )
39
f089713f
JS
40 EVT_CHECKBOX( ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL, wxRichTextListStylePage::OnPeriodctrlClick )
41 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL, wxRichTextListStylePage::OnPeriodctrlUpdate )
42
43 EVT_CHECKBOX( ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL, wxRichTextListStylePage::OnParenthesesctrlClick )
44 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL, wxRichTextListStylePage::OnParenthesesctrlUpdate )
45
d2d0adc7
JS
46 EVT_CHECKBOX( ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL, wxRichTextListStylePage::OnRightParenthesisCtrlClick )
47 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL, wxRichTextListStylePage::OnRightParenthesisCtrlUpdate )
48
49 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL, wxRichTextListStylePage::OnBulletAlignmentCtrlSelected )
50
dadd4f55
JS
51 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC, wxRichTextListStylePage::OnSymbolstaticUpdate )
52
cbfc8d9a
JS
53 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL, wxRichTextListStylePage::OnSymbolctrlSelected )
54 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL, wxRichTextListStylePage::OnSymbolctrlUpdated )
55 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL, wxRichTextListStylePage::OnSymbolctrlUIUpdate )
dadd4f55 56
cbfc8d9a
JS
57 EVT_BUTTON( ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL, wxRichTextListStylePage::OnChooseSymbolClick )
58 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL, wxRichTextListStylePage::OnChooseSymbolUpdate )
dadd4f55
JS
59
60 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL, wxRichTextListStylePage::OnSymbolfontctrlSelected )
61 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL, wxRichTextListStylePage::OnSymbolfontctrlUpdated )
62 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL, wxRichTextListStylePage::OnSymbolfontctrlUIUpdate )
63
f089713f 64 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC, wxRichTextListStylePage::OnNamestaticUpdate )
dadd4f55 65
f089713f
JS
66 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL, wxRichTextListStylePage::OnNamectrlSelected )
67 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL, wxRichTextListStylePage::OnNamectrlUpdated )
68 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL, wxRichTextListStylePage::OnNamectrlUIUpdate )
dadd4f55
JS
69
70 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT, wxRichTextListStylePage::OnRichtextliststylepageAlignleftSelected )
71
72 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT, wxRichTextListStylePage::OnRichtextliststylepageAlignrightSelected )
73
74 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED, wxRichTextListStylePage::OnRichtextliststylepageJustifiedSelected )
75
76 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_CENTERED, wxRichTextListStylePage::OnRichtextliststylepageCenteredSelected )
77
78 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE, wxRichTextListStylePage::OnRichtextliststylepageAlignindeterminateSelected )
79
80 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT, wxRichTextListStylePage::OnIndentLeftUpdated )
81
82 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE, wxRichTextListStylePage::OnIndentFirstLineUpdated )
83
84 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT, wxRichTextListStylePage::OnIndentRightUpdated )
85
86 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE, wxRichTextListStylePage::OnSpacingBeforeUpdated )
87
88 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER, wxRichTextListStylePage::OnSpacingAfterUpdated )
89
90 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_LINESPACING, wxRichTextListStylePage::OnLineSpacingSelected )
91
92////@end wxRichTextListStylePage event table entries
93
94END_EVENT_TABLE()
95
603f702b
JS
96IMPLEMENT_HELP_PROVISION(wxRichTextListStylePage)
97
dadd4f55
JS
98/*!
99 * wxRichTextListStylePage constructors
100 */
101
102wxRichTextListStylePage::wxRichTextListStylePage( )
103{
104 Init();
105}
106
107wxRichTextListStylePage::wxRichTextListStylePage( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
108{
109 Init();
110 Create(parent, id, pos, size, style);
111}
112
113/*!
114 * wxRichTextListStylePage creator
115 */
116
117bool wxRichTextListStylePage::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
118{
119////@begin wxRichTextListStylePage creation
603f702b 120 wxRichTextDialogPage::Create( parent, id, pos, size, style );
dadd4f55
JS
121
122 CreateControls();
123 if (GetSizer())
124 {
125 GetSizer()->SetSizeHints(this);
126 }
127 Centre();
128////@end wxRichTextListStylePage creation
129 return true;
130}
131
132/*!
41a85215 133 * Member initialisation
dadd4f55
JS
134 */
135
136void wxRichTextListStylePage::Init()
137{
138 m_dontUpdate = false;
139 m_currentLevel = 1;
140
141////@begin wxRichTextListStylePage member initialisation
142 m_levelCtrl = NULL;
143 m_styleListBox = NULL;
f089713f
JS
144 m_periodCtrl = NULL;
145 m_parenthesesCtrl = NULL;
d2d0adc7
JS
146 m_rightParenthesisCtrl = NULL;
147 m_bulletAlignmentCtrl = NULL;
dadd4f55
JS
148 m_symbolCtrl = NULL;
149 m_symbolFontCtrl = NULL;
f089713f 150 m_bulletNameCtrl = NULL;
dadd4f55
JS
151 m_alignmentLeft = NULL;
152 m_alignmentRight = NULL;
153 m_alignmentJustified = NULL;
154 m_alignmentCentred = NULL;
155 m_alignmentIndeterminate = NULL;
156 m_indentLeft = NULL;
157 m_indentLeftFirst = NULL;
158 m_indentRight = NULL;
159 m_spacingBefore = NULL;
160 m_spacingAfter = NULL;
161 m_spacingLine = NULL;
162 m_previewCtrl = NULL;
163////@end wxRichTextListStylePage member initialisation
164}
f089713f 165
dadd4f55
JS
166/*!
167 * Control creation for wxRichTextListStylePage
168 */
169
170void wxRichTextListStylePage::CreateControls()
41a85215 171{
dadd4f55 172////@begin wxRichTextListStylePage content construction
603f702b 173 wxRichTextListStylePage* itemRichTextDialogPage1 = this;
dadd4f55
JS
174
175 wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
603f702b 176 itemRichTextDialogPage1->SetSizer(itemBoxSizer2);
dadd4f55
JS
177
178 wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
179 itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5);
180
181 wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
182 itemBoxSizer3->Add(itemBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL, 5);
183
603f702b 184 wxStaticText* itemStaticText5 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&List level:"), wxDefaultPosition, wxDefaultSize, 0 );
69ce77e2 185 itemBoxSizer4->Add(itemStaticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
dadd4f55 186
2e92ad1b 187 m_levelCtrl = new wxSpinCtrl( itemRichTextDialogPage1, ID_RICHTEXTLISTSTYLEPAGE_LEVEL, wxT("1"), wxDefaultPosition, wxSize(60, -1), wxSP_ARROW_KEYS, 1, 10, 1 );
dadd4f55 188 m_levelCtrl->SetHelpText(_("Selects the list level to edit."));
6103234e 189 if (wxRichTextListStylePage::ShowToolTips())
dadd4f55
JS
190 m_levelCtrl->SetToolTip(_("Selects the list level to edit."));
191 itemBoxSizer4->Add(m_levelCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
192
193 itemBoxSizer4->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
194
603f702b 195 wxButton* itemButton8 = new wxButton( itemRichTextDialogPage1, ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT, _("&Font for Level..."), wxDefaultPosition, wxDefaultSize, 0 );
dadd4f55 196 itemButton8->SetHelpText(_("Click to choose the font for this level."));
6103234e 197 if (wxRichTextListStylePage::ShowToolTips())
dadd4f55
JS
198 itemButton8->SetToolTip(_("Click to choose the font for this level."));
199 itemBoxSizer4->Add(itemButton8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
200
603f702b 201 wxNotebook* itemNotebook9 = new wxNotebook( itemRichTextDialogPage1, ID_RICHTEXTLISTSTYLEPAGE_NOTEBOOK, wxDefaultPosition, wxDefaultSize, wxBK_DEFAULT|wxBK_TOP );
dadd4f55 202
d2d0adc7 203 wxPanel* itemPanel10 = new wxPanel( itemNotebook9, ID_RICHTEXTLISTSTYLEPAGE_BULLETS, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
dadd4f55
JS
204 wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL);
205 itemPanel10->SetSizer(itemBoxSizer11);
206
207 wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxHORIZONTAL);
208 itemBoxSizer11->Add(itemBoxSizer12, 1, wxGROW, 5);
209 wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxVERTICAL);
210 itemBoxSizer12->Add(itemBoxSizer13, 0, wxGROW, 5);
211 wxStaticText* itemStaticText14 = new wxStaticText( itemPanel10, wxID_STATIC, _("&Bullet style:"), wxDefaultPosition, wxDefaultSize, 0 );
69ce77e2 212 itemBoxSizer13->Add(itemStaticText14, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
dadd4f55 213
6103234e 214 wxArrayString m_styleListBoxStrings;
706465df 215 m_styleListBox = new wxListBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX, wxDefaultPosition, wxSize(-1, 80), m_styleListBoxStrings, wxLB_SINGLE );
dadd4f55 216 m_styleListBox->SetHelpText(_("The available bullet styles."));
6103234e 217 if (wxRichTextListStylePage::ShowToolTips())
dadd4f55 218 m_styleListBox->SetToolTip(_("The available bullet styles."));
f089713f
JS
219 itemBoxSizer13->Add(m_styleListBox, 1, wxGROW|wxALL, 5);
220
221 wxBoxSizer* itemBoxSizer16 = new wxBoxSizer(wxHORIZONTAL);
222 itemBoxSizer13->Add(itemBoxSizer16, 0, wxGROW, 5);
223 m_periodCtrl = new wxCheckBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL, _("Peri&od"), wxDefaultPosition, wxDefaultSize, 0 );
224 m_periodCtrl->SetValue(false);
225 m_periodCtrl->SetHelpText(_("Check to add a period after the bullet."));
6103234e 226 if (wxRichTextListStylePage::ShowToolTips())
f089713f
JS
227 m_periodCtrl->SetToolTip(_("Check to add a period after the bullet."));
228 itemBoxSizer16->Add(m_periodCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
229
d2d0adc7 230 m_parenthesesCtrl = new wxCheckBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL, _("(*)"), wxDefaultPosition, wxDefaultSize, 0 );
f089713f
JS
231 m_parenthesesCtrl->SetValue(false);
232 m_parenthesesCtrl->SetHelpText(_("Check to enclose the bullet in parentheses."));
6103234e 233 if (wxRichTextListStylePage::ShowToolTips())
f089713f
JS
234 m_parenthesesCtrl->SetToolTip(_("Check to enclose the bullet in parentheses."));
235 itemBoxSizer16->Add(m_parenthesesCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
dadd4f55 236
d2d0adc7
JS
237 m_rightParenthesisCtrl = new wxCheckBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL, _("*)"), wxDefaultPosition, wxDefaultSize, 0 );
238 m_rightParenthesisCtrl->SetValue(false);
239 m_rightParenthesisCtrl->SetHelpText(_("Check to add a right parenthesis."));
6103234e 240 if (wxRichTextListStylePage::ShowToolTips())
d2d0adc7
JS
241 m_rightParenthesisCtrl->SetToolTip(_("Check to add a right parenthesis."));
242 itemBoxSizer16->Add(m_rightParenthesisCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
243
244 itemBoxSizer13->Add(2, 1, 0, wxALIGN_CENTER_HORIZONTAL, 5);
245
246 wxStaticText* itemStaticText21 = new wxStaticText( itemPanel10, wxID_STATIC, _("Bullet &Alignment:"), wxDefaultPosition, wxDefaultSize, 0 );
69ce77e2 247 itemBoxSizer13->Add(itemStaticText21, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
d2d0adc7 248
6103234e
JS
249 wxArrayString m_bulletAlignmentCtrlStrings;
250 m_bulletAlignmentCtrlStrings.Add(_("Left"));
251 m_bulletAlignmentCtrlStrings.Add(_("Centre"));
252 m_bulletAlignmentCtrlStrings.Add(_("Right"));
253 m_bulletAlignmentCtrl = new wxComboBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL, _("Left"), wxDefaultPosition, wxSize(60, -1), m_bulletAlignmentCtrlStrings, wxCB_READONLY );
d2d0adc7
JS
254 m_bulletAlignmentCtrl->SetStringSelection(_("Left"));
255 m_bulletAlignmentCtrl->SetHelpText(_("The bullet character."));
6103234e 256 if (wxRichTextListStylePage::ShowToolTips())
d2d0adc7
JS
257 m_bulletAlignmentCtrl->SetToolTip(_("The bullet character."));
258 itemBoxSizer13->Add(m_bulletAlignmentCtrl, 0, wxGROW|wxALL|wxFIXED_MINSIZE, 5);
259
dadd4f55
JS
260 itemBoxSizer12->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
261
d2d0adc7
JS
262 wxStaticLine* itemStaticLine24 = new wxStaticLine( itemPanel10, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
263 itemBoxSizer12->Add(itemStaticLine24, 0, wxGROW|wxALL, 5);
dadd4f55
JS
264
265 itemBoxSizer12->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
266
d2d0adc7
JS
267 wxBoxSizer* itemBoxSizer26 = new wxBoxSizer(wxVERTICAL);
268 itemBoxSizer12->Add(itemBoxSizer26, 0, wxGROW, 5);
269 wxStaticText* itemStaticText27 = new wxStaticText( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC, _("&Symbol:"), wxDefaultPosition, wxDefaultSize, 0 );
69ce77e2 270 itemBoxSizer26->Add(itemStaticText27, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
dadd4f55 271
d2d0adc7
JS
272 wxBoxSizer* itemBoxSizer28 = new wxBoxSizer(wxHORIZONTAL);
273 itemBoxSizer26->Add(itemBoxSizer28, 0, wxGROW, 5);
6103234e 274 wxArrayString m_symbolCtrlStrings;
603f702b 275 m_symbolCtrl = new wxComboBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL, wxEmptyString, wxDefaultPosition, wxSize(60, -1), m_symbolCtrlStrings, wxCB_DROPDOWN );
dadd4f55 276 m_symbolCtrl->SetHelpText(_("The bullet character."));
6103234e 277 if (wxRichTextListStylePage::ShowToolTips())
dadd4f55 278 m_symbolCtrl->SetToolTip(_("The bullet character."));
d2d0adc7 279 itemBoxSizer28->Add(m_symbolCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxFIXED_MINSIZE, 5);
dadd4f55 280
cbfc8d9a 281 wxButton* itemButton30 = new wxButton( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL, _("Ch&oose..."), wxDefaultPosition, wxDefaultSize, 0 );
d2d0adc7 282 itemButton30->SetHelpText(_("Click to browse for a symbol."));
6103234e 283 if (wxRichTextListStylePage::ShowToolTips())
d2d0adc7
JS
284 itemButton30->SetToolTip(_("Click to browse for a symbol."));
285 itemBoxSizer28->Add(itemButton30, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
dadd4f55 286
d2d0adc7 287 itemBoxSizer26->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5);
dadd4f55 288
d2d0adc7 289 wxStaticText* itemStaticText32 = new wxStaticText( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC, _("Symbol &font:"), wxDefaultPosition, wxDefaultSize, 0 );
69ce77e2 290 itemBoxSizer26->Add(itemStaticText32, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
dadd4f55 291
6103234e 292 wxArrayString m_symbolFontCtrlStrings;
603f702b 293 m_symbolFontCtrl = new wxComboBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_symbolFontCtrlStrings, wxCB_DROPDOWN );
6103234e 294 if (wxRichTextListStylePage::ShowToolTips())
dadd4f55 295 m_symbolFontCtrl->SetToolTip(_("Available fonts."));
d2d0adc7 296 itemBoxSizer26->Add(m_symbolFontCtrl, 0, wxGROW|wxALL, 5);
dadd4f55 297
d2d0adc7 298 itemBoxSizer26->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL, 5);
dadd4f55 299
d2d0adc7 300 wxStaticText* itemStaticText35 = new wxStaticText( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC, _("S&tandard bullet name:"), wxDefaultPosition, wxDefaultSize, 0 );
69ce77e2 301 itemBoxSizer26->Add(itemStaticText35, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
dadd4f55 302
6103234e 303 wxArrayString m_bulletNameCtrlStrings;
603f702b 304 m_bulletNameCtrl = new wxComboBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_bulletNameCtrlStrings, wxCB_DROPDOWN );
f089713f 305 m_bulletNameCtrl->SetHelpText(_("A standard bullet name."));
6103234e 306 if (wxRichTextListStylePage::ShowToolTips())
f089713f 307 m_bulletNameCtrl->SetToolTip(_("A standard bullet name."));
d2d0adc7 308 itemBoxSizer26->Add(m_bulletNameCtrl, 0, wxGROW|wxALL, 5);
dadd4f55 309
d2d0adc7 310 itemNotebook9->AddPage(itemPanel10, _("Bullet style"));
dadd4f55 311
d2d0adc7
JS
312 wxPanel* itemPanel37 = new wxPanel( itemNotebook9, ID_RICHTEXTLISTSTYLEPAGE_SPACING, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
313 wxBoxSizer* itemBoxSizer38 = new wxBoxSizer(wxVERTICAL);
314 itemPanel37->SetSizer(itemBoxSizer38);
dadd4f55 315
d2d0adc7
JS
316 wxBoxSizer* itemBoxSizer39 = new wxBoxSizer(wxHORIZONTAL);
317 itemBoxSizer38->Add(itemBoxSizer39, 0, wxGROW, 5);
318 wxBoxSizer* itemBoxSizer40 = new wxBoxSizer(wxVERTICAL);
319 itemBoxSizer39->Add(itemBoxSizer40, 0, wxGROW, 5);
320 wxStaticText* itemStaticText41 = new wxStaticText( itemPanel37, wxID_STATIC, _("&Alignment"), wxDefaultPosition, wxDefaultSize, 0 );
69ce77e2 321 itemBoxSizer40->Add(itemStaticText41, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
dadd4f55 322
d2d0adc7
JS
323 wxBoxSizer* itemBoxSizer42 = new wxBoxSizer(wxHORIZONTAL);
324 itemBoxSizer40->Add(itemBoxSizer42, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
325 itemBoxSizer42->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5);
dadd4f55 326
d2d0adc7
JS
327 wxBoxSizer* itemBoxSizer44 = new wxBoxSizer(wxVERTICAL);
328 itemBoxSizer42->Add(itemBoxSizer44, 0, wxALIGN_CENTER_VERTICAL|wxTOP, 5);
329 m_alignmentLeft = new wxRadioButton( itemPanel37, ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT, _("&Left"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
dadd4f55
JS
330 m_alignmentLeft->SetValue(false);
331 m_alignmentLeft->SetHelpText(_("Left-align text."));
6103234e 332 if (wxRichTextListStylePage::ShowToolTips())
dadd4f55 333 m_alignmentLeft->SetToolTip(_("Left-align text."));
d2d0adc7 334 itemBoxSizer44->Add(m_alignmentLeft, 0, wxALIGN_LEFT|wxALL, 5);
dadd4f55 335
d2d0adc7 336 m_alignmentRight = new wxRadioButton( itemPanel37, ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT, _("&Right"), wxDefaultPosition, wxDefaultSize, 0 );
dadd4f55
JS
337 m_alignmentRight->SetValue(false);
338 m_alignmentRight->SetHelpText(_("Right-align text."));
6103234e 339 if (wxRichTextListStylePage::ShowToolTips())
dadd4f55 340 m_alignmentRight->SetToolTip(_("Right-align text."));
d2d0adc7 341 itemBoxSizer44->Add(m_alignmentRight, 0, wxALIGN_LEFT|wxALL, 5);
dadd4f55 342
d2d0adc7 343 m_alignmentJustified = new wxRadioButton( itemPanel37, ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED, _("&Justified"), wxDefaultPosition, wxDefaultSize, 0 );
dadd4f55
JS
344 m_alignmentJustified->SetValue(false);
345 m_alignmentJustified->SetHelpText(_("Justify text left and right."));
6103234e 346 if (wxRichTextListStylePage::ShowToolTips())
dadd4f55 347 m_alignmentJustified->SetToolTip(_("Justify text left and right."));
d2d0adc7 348 itemBoxSizer44->Add(m_alignmentJustified, 0, wxALIGN_LEFT|wxALL, 5);
dadd4f55 349
d2d0adc7 350 m_alignmentCentred = new wxRadioButton( itemPanel37, ID_RICHTEXTLISTSTYLEPAGE_CENTERED, _("Cen&tred"), wxDefaultPosition, wxDefaultSize, 0 );
dadd4f55
JS
351 m_alignmentCentred->SetValue(false);
352 m_alignmentCentred->SetHelpText(_("Centre text."));
6103234e 353 if (wxRichTextListStylePage::ShowToolTips())
dadd4f55 354 m_alignmentCentred->SetToolTip(_("Centre text."));
d2d0adc7 355 itemBoxSizer44->Add(m_alignmentCentred, 0, wxALIGN_LEFT|wxALL, 5);
dadd4f55 356
d2d0adc7 357 m_alignmentIndeterminate = new wxRadioButton( itemPanel37, ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE, _("&Indeterminate"), wxDefaultPosition, wxDefaultSize, 0 );
dadd4f55
JS
358 m_alignmentIndeterminate->SetValue(false);
359 m_alignmentIndeterminate->SetHelpText(_("Use the current alignment setting."));
6103234e 360 if (wxRichTextListStylePage::ShowToolTips())
dadd4f55 361 m_alignmentIndeterminate->SetToolTip(_("Use the current alignment setting."));
d2d0adc7 362 itemBoxSizer44->Add(m_alignmentIndeterminate, 0, wxALIGN_LEFT|wxALL, 5);
dadd4f55 363
d2d0adc7 364 itemBoxSizer39->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
dadd4f55 365
d2d0adc7
JS
366 wxStaticLine* itemStaticLine51 = new wxStaticLine( itemPanel37, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
367 itemBoxSizer39->Add(itemStaticLine51, 0, wxGROW|wxLEFT|wxBOTTOM, 5);
dadd4f55 368
d2d0adc7 369 itemBoxSizer39->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
dadd4f55 370
d2d0adc7
JS
371 wxBoxSizer* itemBoxSizer53 = new wxBoxSizer(wxVERTICAL);
372 itemBoxSizer39->Add(itemBoxSizer53, 0, wxGROW, 5);
373 wxStaticText* itemStaticText54 = new wxStaticText( itemPanel37, wxID_STATIC, _("&Indentation (tenths of a mm)"), wxDefaultPosition, wxDefaultSize, 0 );
69ce77e2 374 itemBoxSizer53->Add(itemStaticText54, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
dadd4f55 375
d2d0adc7
JS
376 wxBoxSizer* itemBoxSizer55 = new wxBoxSizer(wxHORIZONTAL);
377 itemBoxSizer53->Add(itemBoxSizer55, 0, wxALIGN_LEFT|wxALL, 5);
378 itemBoxSizer55->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5);
dadd4f55 379
706465df 380 wxFlexGridSizer* itemFlexGridSizer57 = new wxFlexGridSizer(0, 2, 0, 0);
d2d0adc7
JS
381 itemBoxSizer55->Add(itemFlexGridSizer57, 0, wxALIGN_CENTER_VERTICAL, 5);
382 wxStaticText* itemStaticText58 = new wxStaticText( itemPanel37, wxID_STATIC, _("&Left:"), wxDefaultPosition, wxDefaultSize, 0 );
69ce77e2 383 itemFlexGridSizer57->Add(itemStaticText58, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
dadd4f55 384
603f702b 385 m_indentLeft = new wxTextCtrl( itemPanel37, ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
dadd4f55 386 m_indentLeft->SetHelpText(_("The left indent."));
6103234e 387 if (wxRichTextListStylePage::ShowToolTips())
dadd4f55 388 m_indentLeft->SetToolTip(_("The left indent."));
41d9dcbc 389 itemFlexGridSizer57->Add(m_indentLeft, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
dadd4f55 390
41d9dcbc
JS
391 wxStaticText* itemStaticText60 = new wxStaticText( itemPanel37, wxID_STATIC, _("Left (&first line):"), wxDefaultPosition, wxDefaultSize, 0 );
392 itemFlexGridSizer57->Add(itemStaticText60, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
dadd4f55 393
603f702b 394 m_indentLeftFirst = new wxTextCtrl( itemPanel37, ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
dadd4f55 395 m_indentLeftFirst->SetHelpText(_("The first line indent."));
6103234e 396 if (wxRichTextListStylePage::ShowToolTips())
dadd4f55 397 m_indentLeftFirst->SetToolTip(_("The first line indent."));
41d9dcbc 398 itemFlexGridSizer57->Add(m_indentLeftFirst, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
dadd4f55 399
41d9dcbc
JS
400 wxStaticText* itemStaticText62 = new wxStaticText( itemPanel37, wxID_STATIC, _("&Right:"), wxDefaultPosition, wxDefaultSize, 0 );
401 itemFlexGridSizer57->Add(itemStaticText62, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
dadd4f55 402
603f702b 403 m_indentRight = new wxTextCtrl( itemPanel37, ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
dadd4f55 404 m_indentRight->SetHelpText(_("The right indent."));
6103234e 405 if (wxRichTextListStylePage::ShowToolTips())
dadd4f55 406 m_indentRight->SetToolTip(_("The right indent."));
41d9dcbc 407 itemFlexGridSizer57->Add(m_indentRight, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
dadd4f55 408
d2d0adc7 409 itemBoxSizer39->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
dadd4f55 410
41d9dcbc
JS
411 wxStaticLine* itemStaticLine65 = new wxStaticLine( itemPanel37, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
412 itemBoxSizer39->Add(itemStaticLine65, 0, wxGROW|wxTOP|wxBOTTOM, 5);
dadd4f55 413
d2d0adc7 414 itemBoxSizer39->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
dadd4f55 415
41d9dcbc
JS
416 wxBoxSizer* itemBoxSizer67 = new wxBoxSizer(wxVERTICAL);
417 itemBoxSizer39->Add(itemBoxSizer67, 0, wxGROW, 5);
418 wxStaticText* itemStaticText68 = new wxStaticText( itemPanel37, wxID_STATIC, _("&Spacing (tenths of a mm)"), wxDefaultPosition, wxDefaultSize, 0 );
419 itemBoxSizer67->Add(itemStaticText68, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
dadd4f55 420
41d9dcbc
JS
421 wxBoxSizer* itemBoxSizer69 = new wxBoxSizer(wxHORIZONTAL);
422 itemBoxSizer67->Add(itemBoxSizer69, 0, wxALIGN_LEFT|wxALL, 5);
423 itemBoxSizer69->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5);
dadd4f55 424
41d9dcbc
JS
425 wxFlexGridSizer* itemFlexGridSizer71 = new wxFlexGridSizer(0, 2, 0, 0);
426 itemBoxSizer69->Add(itemFlexGridSizer71, 0, wxALIGN_CENTER_VERTICAL, 5);
427 wxStaticText* itemStaticText72 = new wxStaticText( itemPanel37, wxID_STATIC, _("Before a paragraph:"), wxDefaultPosition, wxDefaultSize, 0 );
428 itemFlexGridSizer71->Add(itemStaticText72, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
dadd4f55 429
603f702b 430 m_spacingBefore = new wxTextCtrl( itemPanel37, ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
dadd4f55 431 m_spacingBefore->SetHelpText(_("The spacing before the paragraph."));
6103234e 432 if (wxRichTextListStylePage::ShowToolTips())
dadd4f55 433 m_spacingBefore->SetToolTip(_("The spacing before the paragraph."));
41d9dcbc 434 itemFlexGridSizer71->Add(m_spacingBefore, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
dadd4f55 435
41d9dcbc
JS
436 wxStaticText* itemStaticText74 = new wxStaticText( itemPanel37, wxID_STATIC, _("After a paragraph:"), wxDefaultPosition, wxDefaultSize, 0 );
437 itemFlexGridSizer71->Add(itemStaticText74, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
dadd4f55 438
603f702b 439 m_spacingAfter = new wxTextCtrl( itemPanel37, ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 );
dadd4f55 440 m_spacingAfter->SetHelpText(_("The spacing after the paragraph."));
6103234e 441 if (wxRichTextListStylePage::ShowToolTips())
dadd4f55 442 m_spacingAfter->SetToolTip(_("The spacing after the paragraph."));
41d9dcbc 443 itemFlexGridSizer71->Add(m_spacingAfter, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
dadd4f55 444
41d9dcbc
JS
445 wxStaticText* itemStaticText76 = new wxStaticText( itemPanel37, wxID_STATIC, _("Line spacing:"), wxDefaultPosition, wxDefaultSize, 0 );
446 itemFlexGridSizer71->Add(itemStaticText76, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
dadd4f55 447
6103234e 448 wxArrayString m_spacingLineStrings;
41d9dcbc 449 m_spacingLineStrings.Add(_("(none)"));
6103234e 450 m_spacingLineStrings.Add(_("Single"));
41d9dcbc
JS
451 m_spacingLineStrings.Add(_("1.1"));
452 m_spacingLineStrings.Add(_("1.2"));
453 m_spacingLineStrings.Add(_("1.3"));
454 m_spacingLineStrings.Add(_("1.4"));
6103234e 455 m_spacingLineStrings.Add(_("1.5"));
41d9dcbc
JS
456 m_spacingLineStrings.Add(_("1.6"));
457 m_spacingLineStrings.Add(_("1.7"));
458 m_spacingLineStrings.Add(_("1.8"));
459 m_spacingLineStrings.Add(_("1.9"));
6103234e 460 m_spacingLineStrings.Add(_("2"));
41d9dcbc
JS
461 m_spacingLine = new wxComboBox( itemPanel37, ID_RICHTEXTLISTSTYLEPAGE_LINESPACING, _("(none)"), wxDefaultPosition, wxSize(85, -1), m_spacingLineStrings, wxCB_READONLY );
462 m_spacingLine->SetStringSelection(_("(none)"));
dadd4f55 463 m_spacingLine->SetHelpText(_("The line spacing."));
6103234e 464 if (wxRichTextListStylePage::ShowToolTips())
dadd4f55 465 m_spacingLine->SetToolTip(_("The line spacing."));
41d9dcbc 466 itemFlexGridSizer71->Add(m_spacingLine, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
dadd4f55 467
d2d0adc7 468 itemNotebook9->AddPage(itemPanel37, _("Spacing"));
dadd4f55 469
d2d0adc7 470 itemBoxSizer3->Add(itemNotebook9, 0, wxGROW|wxALL, 5);
dadd4f55 471
706465df 472 m_previewCtrl = new wxRichTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTLISTSTYLEPAGE_RICHTEXTCTRL, wxEmptyString, wxDefaultPosition, wxSize(350, 140), wxBORDER_THEME|wxVSCROLL|wxTE_READONLY );
dadd4f55 473 m_previewCtrl->SetHelpText(_("Shows a preview of the bullet settings."));
6103234e 474 if (wxRichTextListStylePage::ShowToolTips())
dadd4f55
JS
475 m_previewCtrl->SetToolTip(_("Shows a preview of the bullet settings."));
476 itemBoxSizer3->Add(m_previewCtrl, 0, wxGROW|wxALL, 5);
477
478////@end wxRichTextListStylePage content construction
479
d2d0adc7 480 m_dontUpdate = true;
69ce77e2 481
dadd4f55
JS
482 m_styleListBox->Append(_("(None)"));
483 m_styleListBox->Append(_("Arabic"));
484 m_styleListBox->Append(_("Upper case letters"));
485 m_styleListBox->Append(_("Lower case letters"));
486 m_styleListBox->Append(_("Upper case roman numerals"));
487 m_styleListBox->Append(_("Lower case roman numerals"));
d2d0adc7 488 m_styleListBox->Append(_("Numbered outline"));
dadd4f55
JS
489 m_styleListBox->Append(_("Symbol"));
490 m_styleListBox->Append(_("Bitmap"));
f089713f 491 m_styleListBox->Append(_("Standard"));
dadd4f55
JS
492
493 m_symbolCtrl->Append(_("*"));
494 m_symbolCtrl->Append(_("-"));
495 m_symbolCtrl->Append(_(">"));
496 m_symbolCtrl->Append(_("+"));
497 m_symbolCtrl->Append(_("~"));
69ce77e2 498
d2d0adc7
JS
499 wxArrayString standardBulletNames;
500 if (wxRichTextBuffer::GetRenderer())
501 wxRichTextBuffer::GetRenderer()->EnumerateStandardBulletNames(standardBulletNames);
dadd4f55 502
d2d0adc7 503 m_bulletNameCtrl->Append(standardBulletNames);
dadd4f55
JS
504 wxArrayString facenames = wxRichTextCtrl::GetAvailableFontNames();
505 facenames.Sort();
506
507 m_symbolFontCtrl->Append(facenames);
d2d0adc7
JS
508
509 m_levelCtrl->SetValue(m_currentLevel);
510
511 m_dontUpdate = false;
dadd4f55
JS
512}
513
514/// Updates the font preview
515void wxRichTextListStylePage::UpdatePreview()
516{
517 static const wxChar* s_para1 = wxT("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \
2a94806c 518Nullam ante sapien, vestibulum nonummy, pulvinar sed, luctus ut, lacus.\n");
dadd4f55 519
2a94806c 520 static const wxChar* s_para2 = wxT("Duis pharetra consequat dui. Nullam vitae justo id mauris lobortis interdum.\n");
dadd4f55 521
2a94806c 522 static const wxChar* s_para3 = wxT("Integer convallis dolor at augue \
dadd4f55
JS
523iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
524
525 wxRichTextListStyleDefinition* def = wxDynamicCast(wxRichTextFormattingDialog::GetDialogStyleDefinition(this),
526 wxRichTextListStyleDefinition);
69ce77e2 527
336d8ae9 528 wxRichTextStyleSheet* styleSheet = wxRichTextFormattingDialog::GetDialog(this)->GetStyleSheet();
2a94806c 529
24777478 530 wxRichTextAttr attr((const wxRichTextAttr &)(styleSheet ? def->GetStyle() : def->GetStyleMergedWithBase(styleSheet)));
2a94806c 531
dadd4f55
JS
532 attr.SetFlags(attr.GetFlags() &
533 (wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|
534 wxTEXT_ATTR_LINE_SPACING|
d2d0adc7 535 wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_TEXT));
dadd4f55
JS
536
537 wxFont font(m_previewCtrl->GetFont());
538 font.SetPointSize(9);
539 m_previewCtrl->SetFont(font);
540
24777478 541 wxRichTextAttr normalParaAttr;
dadd4f55
JS
542 normalParaAttr.SetFont(font);
543 normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY")));
544
545 m_previewCtrl->Freeze();
546 m_previewCtrl->Clear();
547
548 m_previewCtrl->BeginStyle(normalParaAttr);
549 m_previewCtrl->WriteText(s_para1);
550 m_previewCtrl->EndStyle();
41a85215 551
dadd4f55 552 m_previewCtrl->BeginStyle(attr);
d2d0adc7 553 long listStart = m_previewCtrl->GetInsertionPoint() + 1;
41a85215 554
dadd4f55
JS
555 int i;
556 for (i = 0; i < 10; i++)
557 {
24777478 558 wxRichTextAttr levelAttr = * def->GetLevelAttributes(i);
dadd4f55
JS
559 levelAttr.SetBulletNumber(1);
560 m_previewCtrl->BeginStyle(levelAttr);
2a94806c 561 m_previewCtrl->WriteText(wxString::Format(wxT("List level %d. "), i+1) + s_para2);
dadd4f55
JS
562 m_previewCtrl->EndStyle();
563 }
564 m_previewCtrl->EndStyle();
d2d0adc7 565 long listEnd = m_previewCtrl->GetInsertionPoint();
dadd4f55
JS
566
567 m_previewCtrl->BeginStyle(normalParaAttr);
568 m_previewCtrl->WriteText(s_para3);
569 m_previewCtrl->EndStyle();
570
d2d0adc7
JS
571 m_previewCtrl->NumberList(wxRichTextRange(listStart, listEnd), def);
572
dadd4f55
JS
573 m_previewCtrl->Thaw();
574}
575
576/// Transfer data from/to window
577bool wxRichTextListStylePage::TransferDataFromWindow()
578{
579 wxPanel::TransferDataFromWindow();
580
581 m_currentLevel = m_levelCtrl->GetValue();
582
24777478 583 wxRichTextAttr* attr = GetAttributesForSelection();
dadd4f55
JS
584
585 if (m_alignmentLeft->GetValue())
586 attr->SetAlignment(wxTEXT_ALIGNMENT_LEFT);
587 else if (m_alignmentCentred->GetValue())
588 attr->SetAlignment(wxTEXT_ALIGNMENT_CENTRE);
589 else if (m_alignmentRight->GetValue())
590 attr->SetAlignment(wxTEXT_ALIGNMENT_RIGHT);
591 else if (m_alignmentJustified->GetValue())
592 attr->SetAlignment(wxTEXT_ALIGNMENT_JUSTIFIED);
593 else
594 {
595 attr->SetAlignment(wxTEXT_ALIGNMENT_DEFAULT);
596 attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_ALIGNMENT));
597 }
598
599 wxString leftIndent(m_indentLeft->GetValue());
600 wxString leftFirstIndent(m_indentLeftFirst->GetValue());
601 if (!leftIndent.empty())
602 {
603 int visualLeftIndent = wxAtoi(leftIndent);
604 int visualLeftFirstIndent = wxAtoi(leftFirstIndent);
605 int actualLeftIndent = visualLeftFirstIndent;
606 int actualLeftSubIndent = visualLeftIndent - visualLeftFirstIndent;
607
608 attr->SetLeftIndent(actualLeftIndent, actualLeftSubIndent);
609 }
610 else
611 attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_LEFT_INDENT));
612
613 wxString rightIndent(m_indentRight->GetValue());
614 if (!rightIndent.empty())
615 attr->SetRightIndent(wxAtoi(rightIndent));
616 else
617 attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_RIGHT_INDENT));
618
619 wxString spacingAfter(m_spacingAfter->GetValue());
620 if (!spacingAfter.empty())
621 attr->SetParagraphSpacingAfter(wxAtoi(spacingAfter));
622 else
623 attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_PARA_SPACING_AFTER));
624
625 wxString spacingBefore(m_spacingBefore->GetValue());
626 if (!spacingBefore.empty())
627 attr->SetParagraphSpacingBefore(wxAtoi(spacingBefore));
628 else
629 attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_PARA_SPACING_BEFORE));
630
41d9dcbc 631 int spacingIndex = m_spacingLine->GetSelection() - 1;
dadd4f55 632 int lineSpacing = 0;
41d9dcbc
JS
633 if (spacingIndex > -1)
634 lineSpacing = 10 + spacingIndex;
dadd4f55
JS
635
636 if (lineSpacing == 0)
637 attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_LINE_SPACING));
638 else
639 attr->SetLineSpacing(lineSpacing);
640
641 /// BULLETS
476a3029 642 // if (m_hasBulletStyle)
dadd4f55
JS
643 {
644 long bulletStyle = 0;
645
646 int index = m_styleListBox->GetSelection();
d2d0adc7 647 if (index == wxRICHTEXT_BULLETINDEX_ARABIC)
dadd4f55 648 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ARABIC;
d2d0adc7
JS
649
650 else if (index == wxRICHTEXT_BULLETINDEX_UPPER_CASE)
dadd4f55 651 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER;
d2d0adc7
JS
652
653 else if (index == wxRICHTEXT_BULLETINDEX_LOWER_CASE)
dadd4f55 654 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER;
d2d0adc7
JS
655
656 else if (index == wxRICHTEXT_BULLETINDEX_UPPER_CASE_ROMAN)
dadd4f55 657 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER;
d2d0adc7
JS
658
659 else if (index == wxRICHTEXT_BULLETINDEX_LOWER_CASE_ROMAN)
dadd4f55 660 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER;
d2d0adc7
JS
661
662 else if (index == wxRICHTEXT_BULLETINDEX_OUTLINE)
663 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_OUTLINE;
664
665 else if (index == wxRICHTEXT_BULLETINDEX_SYMBOL)
dadd4f55 666 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_SYMBOL;
d2d0adc7
JS
667
668 else if (index == wxRICHTEXT_BULLETINDEX_BITMAP)
0ab8f402 669 {
dadd4f55 670 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_BITMAP;
0ab8f402
JS
671 if (m_bulletNameCtrl->GetValue().IsEmpty())
672 attr->SetFlags(attr->GetFlags() & ~wxTEXT_ATTR_BULLET_NAME);
673 else
674 attr->SetBulletName(m_bulletNameCtrl->GetValue());
675 }
d2d0adc7
JS
676
677 else if (index == wxRICHTEXT_BULLETINDEX_STANDARD)
f089713f
JS
678 {
679 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_STANDARD;
680 attr->SetBulletName(m_bulletNameCtrl->GetValue());
681 }
dadd4f55
JS
682
683 if (m_parenthesesCtrl->GetValue())
684 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_PARENTHESES;
d2d0adc7
JS
685 if (m_rightParenthesisCtrl->GetValue())
686 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS;
dadd4f55
JS
687 if (m_periodCtrl->GetValue())
688 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_PERIOD;
689
d2d0adc7
JS
690 if (m_bulletAlignmentCtrl->GetSelection() == 1)
691 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE;
692 else if (m_bulletAlignmentCtrl->GetSelection() == 2)
693 bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT;
69ce77e2 694 // Left is implied
d2d0adc7 695
dadd4f55
JS
696 attr->SetBulletStyle(bulletStyle);
697 }
698
699 // if (m_hasBulletSymbol)
700 {
d2d0adc7 701 attr->SetBulletText(m_symbolCtrl->GetValue());
dadd4f55
JS
702 attr->SetBulletFont(m_symbolFontCtrl->GetValue());
703 }
41a85215 704
dadd4f55
JS
705 return true;
706}
707
708bool wxRichTextListStylePage::TransferDataToWindow()
709{
710 DoTransferDataToWindow();
711 UpdatePreview();
41a85215 712
dadd4f55
JS
713 return true;
714}
715
716/// Just transfer to the window
717void wxRichTextListStylePage::DoTransferDataToWindow()
718{
719 m_dontUpdate = true;
720
721 wxPanel::TransferDataToWindow();
41a85215 722
24777478 723 wxRichTextAttr* attr = GetAttributesForSelection();
dadd4f55
JS
724
725 if (attr->HasAlignment())
726 {
727 if (attr->GetAlignment() == wxTEXT_ALIGNMENT_LEFT)
728 m_alignmentLeft->SetValue(true);
729 else if (attr->GetAlignment() == wxTEXT_ALIGNMENT_RIGHT)
730 m_alignmentRight->SetValue(true);
731 else if (attr->GetAlignment() == wxTEXT_ALIGNMENT_CENTRE)
732 m_alignmentCentred->SetValue(true);
733 else if (attr->GetAlignment() == wxTEXT_ALIGNMENT_JUSTIFIED)
734 m_alignmentJustified->SetValue(true);
735 else
736 m_alignmentIndeterminate->SetValue(true);
737 }
738 else
739 m_alignmentIndeterminate->SetValue(true);
740
741 if (attr->HasLeftIndent())
742 {
743 wxString leftIndent(wxString::Format(wxT("%ld"), attr->GetLeftIndent() + attr->GetLeftSubIndent()));
744 wxString leftFirstIndent(wxString::Format(wxT("%ld"), attr->GetLeftIndent()));
745
746 m_indentLeft->SetValue(leftIndent);
747 m_indentLeftFirst->SetValue(leftFirstIndent);
748 }
749 else
750 {
751 m_indentLeft->SetValue(wxEmptyString);
752 m_indentLeftFirst->SetValue(wxEmptyString);
753 }
754
755 if (attr->HasRightIndent())
756 {
757 wxString rightIndent(wxString::Format(wxT("%ld"), attr->GetRightIndent()));
758
759 m_indentRight->SetValue(rightIndent);
760 }
761 else
762 m_indentRight->SetValue(wxEmptyString);
763
764 if (attr->HasParagraphSpacingAfter())
765 {
766 wxString spacingAfter(wxString::Format(wxT("%d"), attr->GetParagraphSpacingAfter()));
767
768 m_spacingAfter->SetValue(spacingAfter);
769 }
770 else
771 m_spacingAfter->SetValue(wxEmptyString);
772
773 if (attr->HasParagraphSpacingBefore())
774 {
775 wxString spacingBefore(wxString::Format(wxT("%d"), attr->GetParagraphSpacingBefore()));
776
777 m_spacingBefore->SetValue(spacingBefore);
778 }
779 else
780 m_spacingBefore->SetValue(wxEmptyString);
781
782 if (attr->HasLineSpacing())
783 {
784 int index = 0;
785
786 int lineSpacing = attr->GetLineSpacing();
41d9dcbc
JS
787 if (lineSpacing >= 10 && lineSpacing <= 20)
788 index = (lineSpacing - 10) + 1;
dadd4f55 789 else
41d9dcbc 790 index = 0;
dadd4f55
JS
791
792 m_spacingLine->SetSelection(index);
793 }
794 else
41d9dcbc 795 m_spacingLine->SetSelection(0);
dadd4f55
JS
796
797 /// BULLETS
798 if (attr->HasBulletStyle())
799 {
d2d0adc7 800 int index = 0;
dadd4f55 801 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ARABIC)
d2d0adc7
JS
802 index = wxRICHTEXT_BULLETINDEX_ARABIC;
803
dadd4f55 804 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER)
d2d0adc7
JS
805 index = wxRICHTEXT_BULLETINDEX_UPPER_CASE;
806
dadd4f55 807 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER)
d2d0adc7
JS
808 index = wxRICHTEXT_BULLETINDEX_LOWER_CASE;
809
dadd4f55 810 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER)
d2d0adc7
JS
811 index = wxRICHTEXT_BULLETINDEX_UPPER_CASE_ROMAN;
812
dadd4f55 813 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER)
d2d0adc7
JS
814 index = wxRICHTEXT_BULLETINDEX_LOWER_CASE_ROMAN;
815
816 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_OUTLINE)
817 index = wxRICHTEXT_BULLETINDEX_OUTLINE;
818
dadd4f55 819 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_SYMBOL)
d2d0adc7
JS
820 index = wxRICHTEXT_BULLETINDEX_SYMBOL;
821
dadd4f55 822 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_BITMAP)
d2d0adc7
JS
823 index = wxRICHTEXT_BULLETINDEX_BITMAP;
824
f089713f 825 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_STANDARD)
d2d0adc7
JS
826 index = wxRICHTEXT_BULLETINDEX_STANDARD;
827
dadd4f55
JS
828 m_styleListBox->SetSelection(index);
829
830 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PARENTHESES)
831 m_parenthesesCtrl->SetValue(true);
832 else
833 m_parenthesesCtrl->SetValue(false);
834
d2d0adc7
JS
835 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS)
836 m_rightParenthesisCtrl->SetValue(true);
837 else
838 m_rightParenthesisCtrl->SetValue(false);
839
dadd4f55
JS
840 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PERIOD)
841 m_periodCtrl->SetValue(true);
842 else
843 m_periodCtrl->SetValue(false);
d2d0adc7
JS
844
845 if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE)
846 m_bulletAlignmentCtrl->SetSelection(1);
847 else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT)
848 m_bulletAlignmentCtrl->SetSelection(2);
849 else
850 m_bulletAlignmentCtrl->SetSelection(0);
dadd4f55
JS
851 }
852 else
d2d0adc7 853 {
dadd4f55 854 m_styleListBox->SetSelection(-1);
d2d0adc7
JS
855 m_bulletAlignmentCtrl->SetSelection(-1);
856 }
dadd4f55 857
d2d0adc7 858 if (attr->HasBulletText())
dadd4f55 859 {
d2d0adc7 860 m_symbolCtrl->SetValue(attr->GetBulletText());
dadd4f55
JS
861 m_symbolFontCtrl->SetValue(attr->GetBulletFont());
862 }
863 else
864 m_symbolCtrl->SetValue(wxEmptyString);
865
f089713f
JS
866 if (attr->HasBulletName())
867 m_bulletNameCtrl->SetValue(attr->GetBulletName());
868 else
869 m_bulletNameCtrl->SetValue(wxEmptyString);
870
dadd4f55
JS
871 m_dontUpdate = false;
872}
873
874/// Get attributes for selected level
24777478 875wxRichTextAttr* wxRichTextListStylePage::GetAttributesForSelection()
dadd4f55
JS
876{
877 wxRichTextListStyleDefinition* def = wxDynamicCast(wxRichTextFormattingDialog::GetDialogStyleDefinition(this),
878 wxRichTextListStyleDefinition);
41a85215 879
dadd4f55 880 int value = m_levelCtrl->GetValue();
41a85215 881
dadd4f55
JS
882 if (def)
883 return def->GetLevelAttributes(value-1);
884 else
885 return NULL;
886}
887
888/// Just transfer from the window and update the preview
889void wxRichTextListStylePage::TransferAndPreview()
890{
891 if (!m_dontUpdate)
892 {
893 TransferDataFromWindow();
894 UpdatePreview();
895 }
896}
897
898
899/*!
900 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
901 */
902
903void wxRichTextListStylePage::OnLevelUpdated( wxSpinEvent& WXUNUSED(event) )
904{
905 if (!m_dontUpdate)
906 {
907 m_currentLevel = m_levelCtrl->GetValue();
908 TransferDataToWindow();
909 }
910}
911
912/*!
913 * wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
914 */
915
d33700db 916void wxRichTextListStylePage::OnLevelUp( wxSpinEvent& event )
dadd4f55
JS
917{
918 if (!m_dontUpdate)
919 {
d33700db 920 m_currentLevel = event.GetPosition();
dadd4f55
JS
921 TransferDataToWindow();
922 }
923}
924
925/*!
926 * wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
927 */
928
d33700db 929void wxRichTextListStylePage::OnLevelDown( wxSpinEvent& event )
dadd4f55
JS
930{
931 if (!m_dontUpdate)
932 {
d33700db 933 m_currentLevel = event.GetPosition();
dadd4f55
JS
934 TransferDataToWindow();
935 }
936}
937
938/*!
939 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
940 */
941
f089713f 942void wxRichTextListStylePage::OnLevelTextUpdated( wxCommandEvent& WXUNUSED(event) )
dadd4f55 943{
d33700db
JS
944 // Can cause problems
945#if 0
dadd4f55
JS
946 if (!m_dontUpdate)
947 {
d33700db 948 m_currentLevel = event.GetInt();
dadd4f55
JS
949 TransferDataToWindow();
950 }
d33700db 951#endif
dadd4f55
JS
952}
953
954/*!
955 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
956 */
957
958void wxRichTextListStylePage::OnLevelUIUpdate( wxUpdateUIEvent& event )
959{
960////@begin wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL in wxRichTextListStylePage.
961 // Before editing this code, remove the block markers.
962 event.Skip();
41a85215 963////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL in wxRichTextListStylePage.
dadd4f55
JS
964}
965
966/*!
967 * wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX
968 */
969
970void wxRichTextListStylePage::OnStylelistboxSelected( wxCommandEvent& WXUNUSED(event) )
971{
972 TransferAndPreview();
973}
974
975/*!
976 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC
977 */
978
979void wxRichTextListStylePage::OnSymbolstaticUpdate( wxUpdateUIEvent& event )
980{
981 OnSymbolUpdate(event);
982}
983
984/*!
985 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
986 */
987
988void wxRichTextListStylePage::OnSymbolctrlSelected( wxCommandEvent& WXUNUSED(event) )
989{
990 TransferAndPreview();
991}
992
993/*!
994 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
995 */
996
997void wxRichTextListStylePage::OnSymbolctrlUpdated( wxCommandEvent& WXUNUSED(event) )
998{
999 TransferAndPreview();
1000}
1001
1002/*!
1003 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
1004 */
1005
1006void wxRichTextListStylePage::OnSymbolctrlUIUpdate( wxUpdateUIEvent& event )
1007{
1008 OnSymbolUpdate(event);
1009}
1010
1011/*!
1012 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
1013 */
1014
1015void wxRichTextListStylePage::OnChooseSymbolClick( wxCommandEvent& WXUNUSED(event) )
1016{
1017 int sel = m_styleListBox->GetSelection();
d2d0adc7 1018 if (sel == wxRICHTEXT_BULLETINDEX_SYMBOL)
dadd4f55
JS
1019 {
1020 wxString symbol = m_symbolCtrl->GetValue();
1021 wxString fontName = m_symbolFontCtrl->GetValue();
1022 wxSymbolPickerDialog dlg(symbol, fontName, fontName, this);
1023
1024 if (dlg.ShowModal() == wxID_OK)
1025 {
1026 m_dontUpdate = true;
1027
1028 m_symbolCtrl->SetValue(dlg.GetSymbol());
1029 m_symbolFontCtrl->SetValue(dlg.GetFontName());
1030
1031 TransferAndPreview();
1032
1033 m_dontUpdate = false;
1034 }
1035 }
1036}
1037
1038/*!
1039 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
1040 */
1041
1042void wxRichTextListStylePage::OnChooseSymbolUpdate( wxUpdateUIEvent& event )
1043{
1044 OnSymbolUpdate(event);
1045}
1046
1047/*!
1048 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
1049 */
1050
1051void wxRichTextListStylePage::OnSymbolfontctrlSelected( wxCommandEvent& WXUNUSED(event) )
1052{
1053 TransferAndPreview();
1054}
1055
1056/*!
1057 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
1058 */
1059
1060void wxRichTextListStylePage::OnSymbolfontctrlUpdated( wxCommandEvent& WXUNUSED(event) )
1061{
1062 TransferAndPreview();
1063}
1064
1065/*!
1066 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
1067 */
1068
1069void wxRichTextListStylePage::OnSymbolfontctrlUIUpdate( wxUpdateUIEvent& event )
1070{
1071 OnSymbolUpdate(event);
1072}
1073
1074/*!
1075 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL
1076 */
1077
1078void wxRichTextListStylePage::OnParenthesesctrlClick( wxCommandEvent& WXUNUSED(event) )
1079{
1080 TransferAndPreview();
1081}
1082
1083/*!
1084 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL
1085 */
1086
1087void wxRichTextListStylePage::OnParenthesesctrlUpdate( wxUpdateUIEvent& event )
1088{
d2d0adc7
JS
1089 int sel = m_styleListBox->GetSelection();
1090 event.Enable((sel != wxRICHTEXT_BULLETINDEX_SYMBOL &&
1091 sel != wxRICHTEXT_BULLETINDEX_BITMAP &&
1092 sel != wxRICHTEXT_BULLETINDEX_NONE));
dadd4f55
JS
1093}
1094
1095/*!
1096 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
1097 */
1098
1099void wxRichTextListStylePage::OnPeriodctrlClick( wxCommandEvent& WXUNUSED(event) )
1100{
1101 TransferAndPreview();
1102}
1103
1104/*!
1105 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
1106 */
1107
1108void wxRichTextListStylePage::OnPeriodctrlUpdate( wxUpdateUIEvent& event )
1109{
d2d0adc7
JS
1110 int sel = m_styleListBox->GetSelection();
1111 event.Enable((sel != wxRICHTEXT_BULLETINDEX_SYMBOL &&
1112 sel != wxRICHTEXT_BULLETINDEX_BITMAP &&
1113 sel != wxRICHTEXT_BULLETINDEX_NONE));
dadd4f55
JS
1114}
1115
1116/*!
1117 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT
1118 */
1119
1120void wxRichTextListStylePage::OnRichtextliststylepageAlignleftSelected( wxCommandEvent& WXUNUSED(event) )
1121{
1122 TransferAndPreview();
1123}
1124
1125/*!
1126 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT
1127 */
1128
1129void wxRichTextListStylePage::OnRichtextliststylepageAlignrightSelected( wxCommandEvent& WXUNUSED(event) )
1130{
1131 TransferAndPreview();
1132}
1133
1134/*!
1135 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED
1136 */
1137
1138void wxRichTextListStylePage::OnRichtextliststylepageJustifiedSelected( wxCommandEvent& WXUNUSED(event) )
1139{
1140 TransferAndPreview();
1141}
1142
1143/*!
1144 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_CENTERED
1145 */
1146
1147void wxRichTextListStylePage::OnRichtextliststylepageCenteredSelected( wxCommandEvent& WXUNUSED(event) )
1148{
1149 TransferAndPreview();
1150}
1151
1152/*!
1153 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE
1154 */
1155
1156void wxRichTextListStylePage::OnRichtextliststylepageAlignindeterminateSelected( wxCommandEvent& WXUNUSED(event) )
1157{
1158 TransferAndPreview();
1159}
1160
1161/*!
1162 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT
1163 */
1164
1165void wxRichTextListStylePage::OnIndentLeftUpdated( wxCommandEvent& WXUNUSED(event) )
1166{
1167 TransferAndPreview();
1168}
1169
1170/*!
1171 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE
1172 */
1173
1174void wxRichTextListStylePage::OnIndentFirstLineUpdated( wxCommandEvent& WXUNUSED(event) )
1175{
1176 TransferAndPreview();
1177}
1178
1179/*!
1180 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT
1181 */
1182
1183void wxRichTextListStylePage::OnIndentRightUpdated( wxCommandEvent& WXUNUSED(event) )
1184{
1185 TransferAndPreview();
1186}
1187
1188/*!
1189 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE
1190 */
1191
1192void wxRichTextListStylePage::OnSpacingBeforeUpdated( wxCommandEvent& WXUNUSED(event) )
1193{
1194 TransferAndPreview();
1195}
1196
1197/*!
1198 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER
1199 */
1200
1201void wxRichTextListStylePage::OnSpacingAfterUpdated( wxCommandEvent& WXUNUSED(event) )
1202{
1203 TransferAndPreview();
1204}
1205
1206/*!
1207 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_LINESPACING
1208 */
1209
1210void wxRichTextListStylePage::OnLineSpacingSelected( wxCommandEvent& WXUNUSED(event) )
1211{
1212 TransferAndPreview();
1213}
1214
1215/*!
1216 * Should we show tooltips?
1217 */
1218
1219bool wxRichTextListStylePage::ShowToolTips()
1220{
1221 return wxRichTextFormattingDialog::ShowToolTips();
1222}
1223
1224/*!
1225 * Get bitmap resources
1226 */
1227
1228wxBitmap wxRichTextListStylePage::GetBitmapResource( const wxString& name )
1229{
1230 // Bitmap retrieval
1231////@begin wxRichTextListStylePage bitmap retrieval
1232 wxUnusedVar(name);
1233 return wxNullBitmap;
1234////@end wxRichTextListStylePage bitmap retrieval
1235}
1236
1237/*!
1238 * Get icon resources
1239 */
1240
1241wxIcon wxRichTextListStylePage::GetIconResource( const wxString& name )
1242{
1243 // Icon retrieval
1244////@begin wxRichTextListStylePage icon retrieval
1245 wxUnusedVar(name);
1246 return wxNullIcon;
1247////@end wxRichTextListStylePage icon retrieval
1248}
1249
1250/// Update for symbol-related controls
1251void wxRichTextListStylePage::OnSymbolUpdate( wxUpdateUIEvent& event )
1252{
1253 int sel = m_styleListBox->GetSelection();
d2d0adc7 1254 event.Enable(sel == wxRICHTEXT_BULLETINDEX_SYMBOL);
dadd4f55
JS
1255}
1256
1257/// Update for number-related controls
1258void wxRichTextListStylePage::OnNumberUpdate( wxUpdateUIEvent& event )
1259{
1260 int sel = m_styleListBox->GetSelection();
d2d0adc7
JS
1261 event.Enable((sel != wxRICHTEXT_BULLETINDEX_SYMBOL &&
1262 sel != wxRICHTEXT_BULLETINDEX_BITMAP &&
1263 sel != wxRICHTEXT_BULLETINDEX_STANDARD &&
1264 sel != wxRICHTEXT_BULLETINDEX_NONE));
f089713f
JS
1265}
1266
1267/// Update for standard bullet-related controls
1268void wxRichTextListStylePage::OnStandardBulletUpdate( wxUpdateUIEvent& event )
1269{
1270 int sel = m_styleListBox->GetSelection();
0ab8f402 1271 event.Enable( sel == wxRICHTEXT_BULLETINDEX_STANDARD || sel == wxRICHTEXT_BULLETINDEX_BITMAP );
dadd4f55
JS
1272}
1273
1274/*!
1275 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT
1276 */
1277
1278void wxRichTextListStylePage::OnChooseFontClick( wxCommandEvent& WXUNUSED(event) )
1279{
24777478 1280 wxRichTextAttr* attr = GetAttributesForSelection();
dadd4f55
JS
1281
1282 int pages = wxRICHTEXT_FORMAT_FONT;
1283 wxRichTextFormattingDialog formatDlg;
1284 formatDlg.SetStyle(*attr, false);
1285 formatDlg.Create(pages, this);
1286
1287 if (formatDlg.ShowModal() == wxID_OK)
1288 {
1289 (*attr) = formatDlg.GetAttributes();
1290 TransferAndPreview();
1291 }
1292}
f089713f
JS
1293/*!
1294 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC
1295 */
1296
1297void wxRichTextListStylePage::OnNamestaticUpdate( wxUpdateUIEvent& event )
1298{
1299 OnStandardBulletUpdate(event);
1300}
1301
1302/*!
1303 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
1304 */
1305
1306void wxRichTextListStylePage::OnNamectrlSelected( wxCommandEvent& WXUNUSED(event) )
1307{
1308 TransferAndPreview();
1309}
1310
1311/*!
1312 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
1313 */
1314
1315void wxRichTextListStylePage::OnNamectrlUpdated( wxCommandEvent& WXUNUSED(event) )
1316{
1317 TransferAndPreview();
1318}
1319
1320/*!
1321 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
1322 */
1323
1324void wxRichTextListStylePage::OnNamectrlUIUpdate( wxUpdateUIEvent& event )
1325{
1326 OnStandardBulletUpdate(event);
1327}
d2d0adc7
JS
1328/*!
1329 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL
1330 */
1331
1332void wxRichTextListStylePage::OnRightParenthesisCtrlClick( wxCommandEvent& WXUNUSED(event) )
1333{
1334 TransferAndPreview();
1335}
1336
1337/*!
1338 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL
1339 */
1340
1341void wxRichTextListStylePage::OnRightParenthesisCtrlUpdate( wxUpdateUIEvent& event )
1342{
1343 int sel = m_styleListBox->GetSelection();
1344 event.Enable((sel != wxRICHTEXT_BULLETINDEX_SYMBOL &&
1345 sel != wxRICHTEXT_BULLETINDEX_BITMAP &&
1346 sel != wxRICHTEXT_BULLETINDEX_NONE));
1347}
1348
1349/*!
1350 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL
1351 */
1352
1353void wxRichTextListStylePage::OnBulletAlignmentCtrlSelected( wxCommandEvent& WXUNUSED(event) )
1354{
1355 TransferAndPreview();
1356}