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