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