1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/richtext/richtextliststylepage.cpp
4 // Author: Julian Smart
6 // Created: 10/18/2006 11:36:37 AM
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/richtext/richtextliststylepage.h"
18 * wxRichTextListStylePage type definition
21 IMPLEMENT_DYNAMIC_CLASS( wxRichTextListStylePage
, wxPanel
)
24 * wxRichTextListStylePage event table definition
27 BEGIN_EVENT_TABLE( wxRichTextListStylePage
, wxPanel
)
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
)
36 EVT_BUTTON( ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT
, wxRichTextListStylePage::OnChooseFontClick
)
38 EVT_LISTBOX( ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX
, wxRichTextListStylePage::OnStylelistboxSelected
)
40 EVT_CHECKBOX( ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
, wxRichTextListStylePage::OnPeriodctrlClick
)
41 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
, wxRichTextListStylePage::OnPeriodctrlUpdate
)
43 EVT_CHECKBOX( ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL
, wxRichTextListStylePage::OnParenthesesctrlClick
)
44 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL
, wxRichTextListStylePage::OnParenthesesctrlUpdate
)
46 EVT_CHECKBOX( ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL
, wxRichTextListStylePage::OnRightParenthesisCtrlClick
)
47 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL
, wxRichTextListStylePage::OnRightParenthesisCtrlUpdate
)
49 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL
, wxRichTextListStylePage::OnBulletAlignmentCtrlSelected
)
51 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC
, wxRichTextListStylePage::OnSymbolstaticUpdate
)
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
)
57 EVT_BUTTON( ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL
, wxRichTextListStylePage::OnChooseSymbolClick
)
58 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL
, wxRichTextListStylePage::OnChooseSymbolUpdate
)
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
)
64 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC
, wxRichTextListStylePage::OnNamestaticUpdate
)
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
)
70 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT
, wxRichTextListStylePage::OnRichtextliststylepageAlignleftSelected
)
72 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT
, wxRichTextListStylePage::OnRichtextliststylepageAlignrightSelected
)
74 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED
, wxRichTextListStylePage::OnRichtextliststylepageJustifiedSelected
)
76 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_CENTERED
, wxRichTextListStylePage::OnRichtextliststylepageCenteredSelected
)
78 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE
, wxRichTextListStylePage::OnRichtextliststylepageAlignindeterminateSelected
)
80 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT
, wxRichTextListStylePage::OnIndentLeftUpdated
)
82 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE
, wxRichTextListStylePage::OnIndentFirstLineUpdated
)
84 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT
, wxRichTextListStylePage::OnIndentRightUpdated
)
86 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE
, wxRichTextListStylePage::OnSpacingBeforeUpdated
)
88 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER
, wxRichTextListStylePage::OnSpacingAfterUpdated
)
90 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_LINESPACING
, wxRichTextListStylePage::OnLineSpacingSelected
)
92 ////@end wxRichTextListStylePage event table entries
97 * wxRichTextListStylePage constructors
100 wxRichTextListStylePage::wxRichTextListStylePage( )
105 wxRichTextListStylePage::wxRichTextListStylePage( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
108 Create(parent
, id
, pos
, size
, style
);
112 * wxRichTextListStylePage creator
115 bool wxRichTextListStylePage::Create( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
117 ////@begin wxRichTextListStylePage creation
118 wxPanel::Create( parent
, id
, pos
, size
, style
);
123 GetSizer()->SetSizeHints(this);
126 ////@end wxRichTextListStylePage creation
131 * Member initialisation
134 void wxRichTextListStylePage::Init()
136 m_dontUpdate
= false;
139 ////@begin wxRichTextListStylePage member initialisation
141 m_styleListBox
= NULL
;
143 m_parenthesesCtrl
= NULL
;
144 m_rightParenthesisCtrl
= NULL
;
145 m_bulletAlignmentCtrl
= NULL
;
147 m_symbolFontCtrl
= NULL
;
148 m_bulletNameCtrl
= NULL
;
149 m_alignmentLeft
= NULL
;
150 m_alignmentRight
= NULL
;
151 m_alignmentJustified
= NULL
;
152 m_alignmentCentred
= NULL
;
153 m_alignmentIndeterminate
= 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
165 * Control creation for wxRichTextListStylePage
168 void wxRichTextListStylePage::CreateControls()
170 ////@begin wxRichTextListStylePage content construction
171 wxRichTextListStylePage
* itemPanel1
= this;
173 wxBoxSizer
* itemBoxSizer2
= new wxBoxSizer(wxVERTICAL
);
174 itemPanel1
->SetSizer(itemBoxSizer2
);
176 wxBoxSizer
* itemBoxSizer3
= new wxBoxSizer(wxVERTICAL
);
177 itemBoxSizer2
->Add(itemBoxSizer3
, 1, wxGROW
|wxALL
, 5);
179 wxBoxSizer
* itemBoxSizer4
= new wxBoxSizer(wxHORIZONTAL
);
180 itemBoxSizer3
->Add(itemBoxSizer4
, 0, wxALIGN_CENTER_HORIZONTAL
, 5);
182 wxStaticText
* itemStaticText5
= new wxStaticText( itemPanel1
, wxID_STATIC
, _("&List level:"), wxDefaultPosition
, wxDefaultSize
, 0 );
183 itemBoxSizer4
->Add(itemStaticText5
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
|wxADJUST_MINSIZE
, 5);
185 m_levelCtrl
= new wxSpinCtrl( itemPanel1
, ID_RICHTEXTLISTSTYLEPAGE_LEVEL
, _T("1"), wxDefaultPosition
, wxSize(60, -1), wxSP_ARROW_KEYS
, 1, 10, 1 );
186 m_levelCtrl
->SetHelpText(_("Selects the list level to edit."));
188 m_levelCtrl
->SetToolTip(_("Selects the list level to edit."));
189 itemBoxSizer4
->Add(m_levelCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
191 itemBoxSizer4
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
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."));
196 itemButton8
->SetToolTip(_("Click to choose the font for this level."));
197 itemBoxSizer4
->Add(itemButton8
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
199 wxNotebook
* itemNotebook9
= new wxNotebook( itemPanel1
, ID_RICHTEXTLISTSTYLEPAGE_NOTEBOOK
, wxDefaultPosition
, wxDefaultSize
, wxNB_TOP
);
201 wxPanel
* itemPanel10
= new wxPanel( itemNotebook9
, ID_RICHTEXTLISTSTYLEPAGE_BULLETS
, wxDefaultPosition
, wxDefaultSize
, wxNO_BORDER
|wxTAB_TRAVERSAL
);
202 wxBoxSizer
* itemBoxSizer11
= new wxBoxSizer(wxVERTICAL
);
203 itemPanel10
->SetSizer(itemBoxSizer11
);
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 );
210 itemBoxSizer13
->Add(itemStaticText14
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
|wxADJUST_MINSIZE
, 5);
212 wxString
* m_styleListBoxStrings
= NULL
;
213 m_styleListBox
= new wxListBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX
, wxDefaultPosition
, wxSize(-1, 140), 0, m_styleListBoxStrings
, wxLB_SINGLE
);
214 m_styleListBox
->SetHelpText(_("The available bullet styles."));
216 m_styleListBox
->SetToolTip(_("The available bullet styles."));
217 itemBoxSizer13
->Add(m_styleListBox
, 1, wxGROW
|wxALL
, 5);
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."));
225 m_periodCtrl
->SetToolTip(_("Check to add a period after the bullet."));
226 itemBoxSizer16
->Add(m_periodCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
228 m_parenthesesCtrl
= new wxCheckBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL
, _("(*)"), wxDefaultPosition
, wxDefaultSize
, 0 );
229 m_parenthesesCtrl
->SetValue(false);
230 m_parenthesesCtrl
->SetHelpText(_("Check to enclose the bullet in parentheses."));
232 m_parenthesesCtrl
->SetToolTip(_("Check to enclose the bullet in parentheses."));
233 itemBoxSizer16
->Add(m_parenthesesCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
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."));
239 m_rightParenthesisCtrl
->SetToolTip(_("Check to add a right parenthesis."));
240 itemBoxSizer16
->Add(m_rightParenthesisCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
242 itemBoxSizer13
->Add(2, 1, 0, wxALIGN_CENTER_HORIZONTAL
, 5);
244 wxStaticText
* itemStaticText21
= new wxStaticText( itemPanel10
, wxID_STATIC
, _("Bullet &Alignment:"), wxDefaultPosition
, wxDefaultSize
, 0 );
245 itemBoxSizer13
->Add(itemStaticText21
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
|wxADJUST_MINSIZE
, 5);
247 wxString m_bulletAlignmentCtrlStrings
[] = {
252 m_bulletAlignmentCtrl
= new wxComboBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL
, _("Left"), wxDefaultPosition
, wxSize(60, -1), 3, m_bulletAlignmentCtrlStrings
, wxCB_READONLY
);
253 m_bulletAlignmentCtrl
->SetStringSelection(_("Left"));
254 m_bulletAlignmentCtrl
->SetHelpText(_("The bullet character."));
256 m_bulletAlignmentCtrl
->SetToolTip(_("The bullet character."));
257 itemBoxSizer13
->Add(m_bulletAlignmentCtrl
, 0, wxGROW
|wxALL
|wxFIXED_MINSIZE
, 5);
259 itemBoxSizer12
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
261 wxStaticLine
* itemStaticLine24
= new wxStaticLine( itemPanel10
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_VERTICAL
);
262 itemBoxSizer12
->Add(itemStaticLine24
, 0, wxGROW
|wxALL
, 5);
264 itemBoxSizer12
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
266 wxBoxSizer
* itemBoxSizer26
= new wxBoxSizer(wxVERTICAL
);
267 itemBoxSizer12
->Add(itemBoxSizer26
, 0, wxGROW
, 5);
268 wxStaticText
* itemStaticText27
= new wxStaticText( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC
, _("&Symbol:"), wxDefaultPosition
, wxDefaultSize
, 0 );
269 itemBoxSizer26
->Add(itemStaticText27
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
|wxADJUST_MINSIZE
, 5);
271 wxBoxSizer
* itemBoxSizer28
= new wxBoxSizer(wxHORIZONTAL
);
272 itemBoxSizer26
->Add(itemBoxSizer28
, 0, wxGROW
, 5);
273 wxString
* m_symbolCtrlStrings
= NULL
;
274 m_symbolCtrl
= new wxComboBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL
, _T(""), wxDefaultPosition
, wxSize(60, -1), 0, m_symbolCtrlStrings
, wxCB_DROPDOWN
);
275 m_symbolCtrl
->SetHelpText(_("The bullet character."));
277 m_symbolCtrl
->SetToolTip(_("The bullet character."));
278 itemBoxSizer28
->Add(m_symbolCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
|wxFIXED_MINSIZE
, 5);
280 wxButton
* itemButton30
= new wxButton( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL
, _("Ch&oose..."), wxDefaultPosition
, wxDefaultSize
, 0 );
281 itemButton30
->SetHelpText(_("Click to browse for a symbol."));
283 itemButton30
->SetToolTip(_("Click to browse for a symbol."));
284 itemBoxSizer28
->Add(itemButton30
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
286 itemBoxSizer26
->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL
, 5);
288 wxStaticText
* itemStaticText32
= new wxStaticText( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC
, _("Symbol &font:"), wxDefaultPosition
, wxDefaultSize
, 0 );
289 itemBoxSizer26
->Add(itemStaticText32
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
|wxADJUST_MINSIZE
, 5);
291 wxString
* m_symbolFontCtrlStrings
= NULL
;
292 m_symbolFontCtrl
= new wxComboBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
, _T(""), wxDefaultPosition
, wxDefaultSize
, 0, m_symbolFontCtrlStrings
, wxCB_DROPDOWN
);
294 m_symbolFontCtrl
->SetToolTip(_("Available fonts."));
295 itemBoxSizer26
->Add(m_symbolFontCtrl
, 0, wxGROW
|wxALL
, 5);
297 itemBoxSizer26
->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL
, 5);
299 wxStaticText
* itemStaticText35
= new wxStaticText( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC
, _("S&tandard bullet name:"), wxDefaultPosition
, wxDefaultSize
, 0 );
300 itemBoxSizer26
->Add(itemStaticText35
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
|wxADJUST_MINSIZE
, 5);
302 wxString
* m_bulletNameCtrlStrings
= NULL
;
303 m_bulletNameCtrl
= new wxComboBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
, _T(""), wxDefaultPosition
, wxDefaultSize
, 0, m_bulletNameCtrlStrings
, wxCB_DROPDOWN
);
304 m_bulletNameCtrl
->SetHelpText(_("A standard bullet name."));
306 m_bulletNameCtrl
->SetToolTip(_("A standard bullet name."));
307 itemBoxSizer26
->Add(m_bulletNameCtrl
, 0, wxGROW
|wxALL
, 5);
309 itemNotebook9
->AddPage(itemPanel10
, _("Bullet style"));
311 wxPanel
* itemPanel37
= new wxPanel( itemNotebook9
, ID_RICHTEXTLISTSTYLEPAGE_SPACING
, wxDefaultPosition
, wxDefaultSize
, wxNO_BORDER
|wxTAB_TRAVERSAL
);
312 wxBoxSizer
* itemBoxSizer38
= new wxBoxSizer(wxVERTICAL
);
313 itemPanel37
->SetSizer(itemBoxSizer38
);
315 wxBoxSizer
* itemBoxSizer39
= new wxBoxSizer(wxHORIZONTAL
);
316 itemBoxSizer38
->Add(itemBoxSizer39
, 0, wxGROW
, 5);
317 wxBoxSizer
* itemBoxSizer40
= new wxBoxSizer(wxVERTICAL
);
318 itemBoxSizer39
->Add(itemBoxSizer40
, 0, wxGROW
, 5);
319 wxStaticText
* itemStaticText41
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("&Alignment"), wxDefaultPosition
, wxDefaultSize
, 0 );
320 itemBoxSizer40
->Add(itemStaticText41
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
|wxADJUST_MINSIZE
, 5);
322 wxBoxSizer
* itemBoxSizer42
= new wxBoxSizer(wxHORIZONTAL
);
323 itemBoxSizer40
->Add(itemBoxSizer42
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALL
, 5);
324 itemBoxSizer42
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
, 5);
326 wxBoxSizer
* itemBoxSizer44
= new wxBoxSizer(wxVERTICAL
);
327 itemBoxSizer42
->Add(itemBoxSizer44
, 0, wxALIGN_CENTER_VERTICAL
|wxTOP
, 5);
328 m_alignmentLeft
= new wxRadioButton( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT
, _("&Left"), wxDefaultPosition
, wxDefaultSize
, wxRB_GROUP
);
329 m_alignmentLeft
->SetValue(false);
330 m_alignmentLeft
->SetHelpText(_("Left-align text."));
332 m_alignmentLeft
->SetToolTip(_("Left-align text."));
333 itemBoxSizer44
->Add(m_alignmentLeft
, 0, wxALIGN_LEFT
|wxALL
, 5);
335 m_alignmentRight
= new wxRadioButton( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT
, _("&Right"), wxDefaultPosition
, wxDefaultSize
, 0 );
336 m_alignmentRight
->SetValue(false);
337 m_alignmentRight
->SetHelpText(_("Right-align text."));
339 m_alignmentRight
->SetToolTip(_("Right-align text."));
340 itemBoxSizer44
->Add(m_alignmentRight
, 0, wxALIGN_LEFT
|wxALL
, 5);
342 m_alignmentJustified
= new wxRadioButton( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED
, _("&Justified"), wxDefaultPosition
, wxDefaultSize
, 0 );
343 m_alignmentJustified
->SetValue(false);
344 m_alignmentJustified
->SetHelpText(_("Justify text left and right."));
346 m_alignmentJustified
->SetToolTip(_("Justify text left and right."));
347 itemBoxSizer44
->Add(m_alignmentJustified
, 0, wxALIGN_LEFT
|wxALL
, 5);
349 m_alignmentCentred
= new wxRadioButton( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_CENTERED
, _("Cen&tred"), wxDefaultPosition
, wxDefaultSize
, 0 );
350 m_alignmentCentred
->SetValue(false);
351 m_alignmentCentred
->SetHelpText(_("Centre text."));
353 m_alignmentCentred
->SetToolTip(_("Centre text."));
354 itemBoxSizer44
->Add(m_alignmentCentred
, 0, wxALIGN_LEFT
|wxALL
, 5);
356 m_alignmentIndeterminate
= new wxRadioButton( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE
, _("&Indeterminate"), wxDefaultPosition
, wxDefaultSize
, 0 );
357 m_alignmentIndeterminate
->SetValue(false);
358 m_alignmentIndeterminate
->SetHelpText(_("Use the current alignment setting."));
360 m_alignmentIndeterminate
->SetToolTip(_("Use the current alignment setting."));
361 itemBoxSizer44
->Add(m_alignmentIndeterminate
, 0, wxALIGN_LEFT
|wxALL
, 5);
363 itemBoxSizer39
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
365 wxStaticLine
* itemStaticLine51
= new wxStaticLine( itemPanel37
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_VERTICAL
);
366 itemBoxSizer39
->Add(itemStaticLine51
, 0, wxGROW
|wxLEFT
|wxBOTTOM
, 5);
368 itemBoxSizer39
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
370 wxBoxSizer
* itemBoxSizer53
= new wxBoxSizer(wxVERTICAL
);
371 itemBoxSizer39
->Add(itemBoxSizer53
, 0, wxGROW
, 5);
372 wxStaticText
* itemStaticText54
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("&Indentation (tenths of a mm)"), wxDefaultPosition
, wxDefaultSize
, 0 );
373 itemBoxSizer53
->Add(itemStaticText54
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
|wxADJUST_MINSIZE
, 5);
375 wxBoxSizer
* itemBoxSizer55
= new wxBoxSizer(wxHORIZONTAL
);
376 itemBoxSizer53
->Add(itemBoxSizer55
, 0, wxALIGN_LEFT
|wxALL
, 5);
377 itemBoxSizer55
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
, 5);
379 wxFlexGridSizer
* itemFlexGridSizer57
= new wxFlexGridSizer(2, 2, 0, 0);
380 itemBoxSizer55
->Add(itemFlexGridSizer57
, 0, wxALIGN_CENTER_VERTICAL
, 5);
381 wxStaticText
* itemStaticText58
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("&Left:"), wxDefaultPosition
, wxDefaultSize
, 0 );
382 itemFlexGridSizer57
->Add(itemStaticText58
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
|wxADJUST_MINSIZE
, 5);
384 wxBoxSizer
* itemBoxSizer59
= new wxBoxSizer(wxHORIZONTAL
);
385 itemFlexGridSizer57
->Add(itemBoxSizer59
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 5);
386 m_indentLeft
= new wxTextCtrl( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT
, _T(""), wxDefaultPosition
, wxSize(50, -1), 0 );
387 m_indentLeft
->SetHelpText(_("The left indent."));
389 m_indentLeft
->SetToolTip(_("The left indent."));
390 itemBoxSizer59
->Add(m_indentLeft
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
392 wxStaticText
* itemStaticText61
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("Left (&first line):"), wxDefaultPosition
, wxDefaultSize
, 0 );
393 itemFlexGridSizer57
->Add(itemStaticText61
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
|wxADJUST_MINSIZE
, 5);
395 wxBoxSizer
* itemBoxSizer62
= new wxBoxSizer(wxHORIZONTAL
);
396 itemFlexGridSizer57
->Add(itemBoxSizer62
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 5);
397 m_indentLeftFirst
= new wxTextCtrl( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE
, _T(""), wxDefaultPosition
, wxSize(50, -1), 0 );
398 m_indentLeftFirst
->SetHelpText(_("The first line indent."));
400 m_indentLeftFirst
->SetToolTip(_("The first line indent."));
401 itemBoxSizer62
->Add(m_indentLeftFirst
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
403 wxStaticText
* itemStaticText64
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("&Right:"), wxDefaultPosition
, wxDefaultSize
, 0 );
404 itemFlexGridSizer57
->Add(itemStaticText64
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
|wxADJUST_MINSIZE
, 5);
406 wxBoxSizer
* itemBoxSizer65
= new wxBoxSizer(wxHORIZONTAL
);
407 itemFlexGridSizer57
->Add(itemBoxSizer65
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 5);
408 m_indentRight
= new wxTextCtrl( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT
, _T(""), wxDefaultPosition
, wxSize(50, -1), 0 );
409 m_indentRight
->SetHelpText(_("The right indent."));
411 m_indentRight
->SetToolTip(_("The right indent."));
412 itemBoxSizer65
->Add(m_indentRight
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
414 itemBoxSizer39
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
416 wxStaticLine
* itemStaticLine68
= new wxStaticLine( itemPanel37
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_VERTICAL
);
417 itemBoxSizer39
->Add(itemStaticLine68
, 0, wxGROW
|wxTOP
|wxBOTTOM
, 5);
419 itemBoxSizer39
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
421 wxBoxSizer
* itemBoxSizer70
= new wxBoxSizer(wxVERTICAL
);
422 itemBoxSizer39
->Add(itemBoxSizer70
, 0, wxGROW
, 5);
423 wxStaticText
* itemStaticText71
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("&Spacing (tenths of a mm)"), wxDefaultPosition
, wxDefaultSize
, 0 );
424 itemBoxSizer70
->Add(itemStaticText71
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
|wxADJUST_MINSIZE
, 5);
426 wxBoxSizer
* itemBoxSizer72
= new wxBoxSizer(wxHORIZONTAL
);
427 itemBoxSizer70
->Add(itemBoxSizer72
, 0, wxALIGN_LEFT
|wxALL
, 5);
428 itemBoxSizer72
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
, 5);
430 wxFlexGridSizer
* itemFlexGridSizer74
= new wxFlexGridSizer(2, 2, 0, 0);
431 itemBoxSizer72
->Add(itemFlexGridSizer74
, 0, wxALIGN_CENTER_VERTICAL
, 5);
432 wxStaticText
* itemStaticText75
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("Before a paragraph:"), wxDefaultPosition
, wxDefaultSize
, 0 );
433 itemFlexGridSizer74
->Add(itemStaticText75
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
|wxADJUST_MINSIZE
, 5);
435 wxBoxSizer
* itemBoxSizer76
= new wxBoxSizer(wxHORIZONTAL
);
436 itemFlexGridSizer74
->Add(itemBoxSizer76
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 5);
437 m_spacingBefore
= new wxTextCtrl( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE
, _T(""), wxDefaultPosition
, wxSize(50, -1), 0 );
438 m_spacingBefore
->SetHelpText(_("The spacing before the paragraph."));
440 m_spacingBefore
->SetToolTip(_("The spacing before the paragraph."));
441 itemBoxSizer76
->Add(m_spacingBefore
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
443 wxStaticText
* itemStaticText78
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("After a paragraph:"), wxDefaultPosition
, wxDefaultSize
, 0 );
444 itemFlexGridSizer74
->Add(itemStaticText78
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
|wxADJUST_MINSIZE
, 5);
446 wxBoxSizer
* itemBoxSizer79
= new wxBoxSizer(wxHORIZONTAL
);
447 itemFlexGridSizer74
->Add(itemBoxSizer79
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 5);
448 m_spacingAfter
= new wxTextCtrl( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER
, _T(""), wxDefaultPosition
, wxSize(50, -1), 0 );
449 m_spacingAfter
->SetHelpText(_("The spacing after the paragraph."));
451 m_spacingAfter
->SetToolTip(_("The spacing after the paragraph."));
452 itemBoxSizer79
->Add(m_spacingAfter
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
454 wxStaticText
* itemStaticText81
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("Line spacing:"), wxDefaultPosition
, wxDefaultSize
, 0 );
455 itemFlexGridSizer74
->Add(itemStaticText81
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
|wxADJUST_MINSIZE
, 5);
457 wxBoxSizer
* itemBoxSizer82
= new wxBoxSizer(wxHORIZONTAL
);
458 itemFlexGridSizer74
->Add(itemBoxSizer82
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 5);
459 wxString m_spacingLineStrings
[] = {
464 m_spacingLine
= new wxComboBox( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_LINESPACING
, _("Single"), wxDefaultPosition
, wxDefaultSize
, 3, m_spacingLineStrings
, wxCB_READONLY
);
465 m_spacingLine
->SetStringSelection(_("Single"));
466 m_spacingLine
->SetHelpText(_("The line spacing."));
468 m_spacingLine
->SetToolTip(_("The line spacing."));
469 itemBoxSizer82
->Add(m_spacingLine
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
471 itemNotebook9
->AddPage(itemPanel37
, _("Spacing"));
473 itemBoxSizer3
->Add(itemNotebook9
, 0, wxGROW
|wxALL
, 5);
475 m_previewCtrl
= new wxRichTextCtrl( itemPanel1
, ID_RICHTEXTLISTSTYLEPAGE_RICHTEXTCTRL
, wxEmptyString
, wxDefaultPosition
, wxSize(350, 180), wxSUNKEN_BORDER
|wxTE_READONLY
);
476 m_previewCtrl
->SetHelpText(_("Shows a preview of the bullet settings."));
478 m_previewCtrl
->SetToolTip(_("Shows a preview of the bullet settings."));
479 itemBoxSizer3
->Add(m_previewCtrl
, 0, wxGROW
|wxALL
, 5);
481 ////@end wxRichTextListStylePage content construction
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"));
496 m_symbolCtrl
->Append(_("*"));
497 m_symbolCtrl
->Append(_("-"));
498 m_symbolCtrl
->Append(_(">"));
499 m_symbolCtrl
->Append(_("+"));
500 m_symbolCtrl
->Append(_("~"));
502 wxArrayString standardBulletNames
;
503 if (wxRichTextBuffer::GetRenderer())
504 wxRichTextBuffer::GetRenderer()->EnumerateStandardBulletNames(standardBulletNames
);
506 m_bulletNameCtrl
->Append(standardBulletNames
);
507 wxArrayString facenames
= wxRichTextCtrl::GetAvailableFontNames();
510 m_symbolFontCtrl
->Append(facenames
);
512 m_levelCtrl
->SetValue(m_currentLevel
);
514 m_dontUpdate
= false;
517 /// Updates the font preview
518 void wxRichTextListStylePage::UpdatePreview()
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.");
523 static const wxChar
* s_para2
= wxT("Duis pharetra consequat dui. Nullam vitae justo id mauris lobortis interdum.");
525 static const wxChar
* s_para3
= wxT("\nInteger convallis dolor at augue \
526 iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
528 wxRichTextListStyleDefinition
* def
= wxDynamicCast(wxRichTextFormattingDialog::GetDialogStyleDefinition(this),
529 wxRichTextListStyleDefinition
);
531 wxRichTextStyleSheet
* styleSheet
= wxRichTextFormattingDialog::GetDialog(this)->GetStyleSheet();
533 wxTextAttrEx
attr(styleSheet
? def
->GetStyle() : def
->GetStyleMergedWithBase(styleSheet
));
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
));
540 wxFont
font(m_previewCtrl
->GetFont());
541 font
.SetPointSize(9);
542 m_previewCtrl
->SetFont(font
);
544 wxTextAttrEx normalParaAttr
;
545 normalParaAttr
.SetFont(font
);
546 normalParaAttr
.SetTextColour(wxColour(wxT("LIGHT GREY")));
548 m_previewCtrl
->Freeze();
549 m_previewCtrl
->Clear();
551 m_previewCtrl
->BeginStyle(normalParaAttr
);
552 m_previewCtrl
->WriteText(s_para1
);
553 m_previewCtrl
->EndStyle();
555 m_previewCtrl
->BeginStyle(attr
);
556 long listStart
= m_previewCtrl
->GetInsertionPoint() + 1;
559 for (i
= 0; i
< 10; i
++)
561 wxTextAttrEx levelAttr
= * def
->GetLevelAttributes(i
);
562 levelAttr
.SetBulletNumber(1);
563 m_previewCtrl
->BeginStyle(levelAttr
);
564 m_previewCtrl
->WriteText(wxString::Format(wxT("\nList level %d. "), i
+1) + s_para2
);
565 m_previewCtrl
->EndStyle();
567 m_previewCtrl
->EndStyle();
568 long listEnd
= m_previewCtrl
->GetInsertionPoint();
570 m_previewCtrl
->BeginStyle(normalParaAttr
);
571 m_previewCtrl
->WriteText(s_para3
);
572 m_previewCtrl
->EndStyle();
574 m_previewCtrl
->NumberList(wxRichTextRange(listStart
, listEnd
), def
);
576 m_previewCtrl
->Thaw();
579 /// Transfer data from/to window
580 bool wxRichTextListStylePage::TransferDataFromWindow()
582 wxPanel::TransferDataFromWindow();
584 m_currentLevel
= m_levelCtrl
->GetValue();
586 wxRichTextAttr
* attr
= GetAttributesForSelection();
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
);
598 attr
->SetAlignment(wxTEXT_ALIGNMENT_DEFAULT
);
599 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_ALIGNMENT
));
602 wxString
leftIndent(m_indentLeft
->GetValue());
603 wxString
leftFirstIndent(m_indentLeftFirst
->GetValue());
604 if (!leftIndent
.empty())
606 int visualLeftIndent
= wxAtoi(leftIndent
);
607 int visualLeftFirstIndent
= wxAtoi(leftFirstIndent
);
608 int actualLeftIndent
= visualLeftFirstIndent
;
609 int actualLeftSubIndent
= visualLeftIndent
- visualLeftFirstIndent
;
611 attr
->SetLeftIndent(actualLeftIndent
, actualLeftSubIndent
);
614 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_LEFT_INDENT
));
616 wxString
rightIndent(m_indentRight
->GetValue());
617 if (!rightIndent
.empty())
618 attr
->SetRightIndent(wxAtoi(rightIndent
));
620 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_RIGHT_INDENT
));
622 wxString
spacingAfter(m_spacingAfter
->GetValue());
623 if (!spacingAfter
.empty())
624 attr
->SetParagraphSpacingAfter(wxAtoi(spacingAfter
));
626 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_PARA_SPACING_AFTER
));
628 wxString
spacingBefore(m_spacingBefore
->GetValue());
629 if (!spacingBefore
.empty())
630 attr
->SetParagraphSpacingBefore(wxAtoi(spacingBefore
));
632 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_PARA_SPACING_BEFORE
));
634 int spacingIndex
= m_spacingLine
->GetSelection();
636 if (spacingIndex
== 0)
638 else if (spacingIndex
== 1)
640 else if (spacingIndex
== 2)
643 if (lineSpacing
== 0)
644 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_LINE_SPACING
));
646 attr
->SetLineSpacing(lineSpacing
);
649 // if (m_hasBulletStyle)
651 long bulletStyle
= 0;
653 int index
= m_styleListBox
->GetSelection();
654 if (index
== wxRICHTEXT_BULLETINDEX_ARABIC
)
655 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_ARABIC
;
657 else if (index
== wxRICHTEXT_BULLETINDEX_UPPER_CASE
)
658 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER
;
660 else if (index
== wxRICHTEXT_BULLETINDEX_LOWER_CASE
)
661 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER
;
663 else if (index
== wxRICHTEXT_BULLETINDEX_UPPER_CASE_ROMAN
)
664 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER
;
666 else if (index
== wxRICHTEXT_BULLETINDEX_LOWER_CASE_ROMAN
)
667 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER
;
669 else if (index
== wxRICHTEXT_BULLETINDEX_OUTLINE
)
670 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_OUTLINE
;
672 else if (index
== wxRICHTEXT_BULLETINDEX_SYMBOL
)
673 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_SYMBOL
;
675 else if (index
== wxRICHTEXT_BULLETINDEX_BITMAP
)
676 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_BITMAP
;
678 else if (index
== wxRICHTEXT_BULLETINDEX_STANDARD
)
680 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_STANDARD
;
681 attr
->SetBulletName(m_bulletNameCtrl
->GetValue());
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
;
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
;
697 attr
->SetBulletStyle(bulletStyle
);
700 // if (m_hasBulletSymbol)
702 attr
->SetBulletText(m_symbolCtrl
->GetValue());
703 attr
->SetBulletFont(m_symbolFontCtrl
->GetValue());
709 bool wxRichTextListStylePage::TransferDataToWindow()
711 DoTransferDataToWindow();
717 /// Just transfer to the window
718 void wxRichTextListStylePage::DoTransferDataToWindow()
722 wxPanel::TransferDataToWindow();
724 wxRichTextAttr
* attr
= GetAttributesForSelection();
726 if (attr
->HasAlignment())
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);
737 m_alignmentIndeterminate
->SetValue(true);
740 m_alignmentIndeterminate
->SetValue(true);
742 if (attr
->HasLeftIndent())
744 wxString
leftIndent(wxString::Format(wxT("%ld"), attr
->GetLeftIndent() + attr
->GetLeftSubIndent()));
745 wxString
leftFirstIndent(wxString::Format(wxT("%ld"), attr
->GetLeftIndent()));
747 m_indentLeft
->SetValue(leftIndent
);
748 m_indentLeftFirst
->SetValue(leftFirstIndent
);
752 m_indentLeft
->SetValue(wxEmptyString
);
753 m_indentLeftFirst
->SetValue(wxEmptyString
);
756 if (attr
->HasRightIndent())
758 wxString
rightIndent(wxString::Format(wxT("%ld"), attr
->GetRightIndent()));
760 m_indentRight
->SetValue(rightIndent
);
763 m_indentRight
->SetValue(wxEmptyString
);
765 if (attr
->HasParagraphSpacingAfter())
767 wxString
spacingAfter(wxString::Format(wxT("%d"), attr
->GetParagraphSpacingAfter()));
769 m_spacingAfter
->SetValue(spacingAfter
);
772 m_spacingAfter
->SetValue(wxEmptyString
);
774 if (attr
->HasParagraphSpacingBefore())
776 wxString
spacingBefore(wxString::Format(wxT("%d"), attr
->GetParagraphSpacingBefore()));
778 m_spacingBefore
->SetValue(spacingBefore
);
781 m_spacingBefore
->SetValue(wxEmptyString
);
783 if (attr
->HasLineSpacing())
787 int lineSpacing
= attr
->GetLineSpacing();
788 if (lineSpacing
== 10)
790 else if (lineSpacing
== 15)
792 else if (lineSpacing
== 20)
797 m_spacingLine
->SetSelection(index
);
800 m_spacingLine
->SetSelection(-1);
803 if (attr
->HasBulletStyle())
806 if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ARABIC
)
807 index
= wxRICHTEXT_BULLETINDEX_ARABIC
;
809 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER
)
810 index
= wxRICHTEXT_BULLETINDEX_UPPER_CASE
;
812 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER
)
813 index
= wxRICHTEXT_BULLETINDEX_LOWER_CASE
;
815 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER
)
816 index
= wxRICHTEXT_BULLETINDEX_UPPER_CASE_ROMAN
;
818 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER
)
819 index
= wxRICHTEXT_BULLETINDEX_LOWER_CASE_ROMAN
;
821 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_OUTLINE
)
822 index
= wxRICHTEXT_BULLETINDEX_OUTLINE
;
824 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_SYMBOL
)
825 index
= wxRICHTEXT_BULLETINDEX_SYMBOL
;
827 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_BITMAP
)
828 index
= wxRICHTEXT_BULLETINDEX_BITMAP
;
830 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_STANDARD
)
831 index
= wxRICHTEXT_BULLETINDEX_STANDARD
;
833 m_styleListBox
->SetSelection(index
);
835 if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PARENTHESES
)
836 m_parenthesesCtrl
->SetValue(true);
838 m_parenthesesCtrl
->SetValue(false);
840 if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS
)
841 m_rightParenthesisCtrl
->SetValue(true);
843 m_rightParenthesisCtrl
->SetValue(false);
845 if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PERIOD
)
846 m_periodCtrl
->SetValue(true);
848 m_periodCtrl
->SetValue(false);
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);
855 m_bulletAlignmentCtrl
->SetSelection(0);
859 m_styleListBox
->SetSelection(-1);
860 m_bulletAlignmentCtrl
->SetSelection(-1);
863 if (attr
->HasBulletText())
865 m_symbolCtrl
->SetValue(attr
->GetBulletText());
866 m_symbolFontCtrl
->SetValue(attr
->GetBulletFont());
869 m_symbolCtrl
->SetValue(wxEmptyString
);
871 if (attr
->HasBulletName())
872 m_bulletNameCtrl
->SetValue(attr
->GetBulletName());
874 m_bulletNameCtrl
->SetValue(wxEmptyString
);
876 m_dontUpdate
= false;
879 /// Get attributes for selected level
880 wxRichTextAttr
* wxRichTextListStylePage::GetAttributesForSelection()
882 wxRichTextListStyleDefinition
* def
= wxDynamicCast(wxRichTextFormattingDialog::GetDialogStyleDefinition(this),
883 wxRichTextListStyleDefinition
);
885 int value
= m_levelCtrl
->GetValue();
888 return def
->GetLevelAttributes(value
-1);
893 /// Just transfer from the window and update the preview
894 void wxRichTextListStylePage::TransferAndPreview()
898 TransferDataFromWindow();
905 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
908 void wxRichTextListStylePage::OnLevelUpdated( wxSpinEvent
& WXUNUSED(event
) )
912 m_currentLevel
= m_levelCtrl
->GetValue();
913 TransferDataToWindow();
918 * wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
921 void wxRichTextListStylePage::OnLevelUp( wxSpinEvent
& event
)
925 m_currentLevel
= event
.GetPosition();
926 TransferDataToWindow();
931 * wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
934 void wxRichTextListStylePage::OnLevelDown( wxSpinEvent
& event
)
938 m_currentLevel
= event
.GetPosition();
939 TransferDataToWindow();
944 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
947 void wxRichTextListStylePage::OnLevelTextUpdated( wxCommandEvent
& WXUNUSED(event
) )
949 // Can cause problems
953 m_currentLevel
= event
.GetInt();
954 TransferDataToWindow();
960 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
963 void wxRichTextListStylePage::OnLevelUIUpdate( wxUpdateUIEvent
& event
)
965 ////@begin wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL in wxRichTextListStylePage.
966 // Before editing this code, remove the block markers.
968 ////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL in wxRichTextListStylePage.
972 * wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX
975 void wxRichTextListStylePage::OnStylelistboxSelected( wxCommandEvent
& WXUNUSED(event
) )
977 TransferAndPreview();
981 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC
984 void wxRichTextListStylePage::OnSymbolstaticUpdate( wxUpdateUIEvent
& event
)
986 OnSymbolUpdate(event
);
990 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
993 void wxRichTextListStylePage::OnSymbolctrlSelected( wxCommandEvent
& WXUNUSED(event
) )
995 TransferAndPreview();
999 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
1002 void wxRichTextListStylePage::OnSymbolctrlUpdated( wxCommandEvent
& WXUNUSED(event
) )
1004 TransferAndPreview();
1008 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
1011 void wxRichTextListStylePage::OnSymbolctrlUIUpdate( wxUpdateUIEvent
& event
)
1013 OnSymbolUpdate(event
);
1017 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
1020 void wxRichTextListStylePage::OnChooseSymbolClick( wxCommandEvent
& WXUNUSED(event
) )
1022 int sel
= m_styleListBox
->GetSelection();
1023 if (sel
== wxRICHTEXT_BULLETINDEX_SYMBOL
)
1025 wxString symbol
= m_symbolCtrl
->GetValue();
1026 wxString fontName
= m_symbolFontCtrl
->GetValue();
1027 wxSymbolPickerDialog
dlg(symbol
, fontName
, fontName
, this);
1029 if (dlg
.ShowModal() == wxID_OK
)
1031 m_dontUpdate
= true;
1033 m_symbolCtrl
->SetValue(dlg
.GetSymbol());
1034 m_symbolFontCtrl
->SetValue(dlg
.GetFontName());
1036 TransferAndPreview();
1038 m_dontUpdate
= false;
1044 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
1047 void wxRichTextListStylePage::OnChooseSymbolUpdate( wxUpdateUIEvent
& event
)
1049 OnSymbolUpdate(event
);
1053 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
1056 void wxRichTextListStylePage::OnSymbolfontctrlSelected( wxCommandEvent
& WXUNUSED(event
) )
1058 TransferAndPreview();
1062 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
1065 void wxRichTextListStylePage::OnSymbolfontctrlUpdated( wxCommandEvent
& WXUNUSED(event
) )
1067 TransferAndPreview();
1071 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
1074 void wxRichTextListStylePage::OnSymbolfontctrlUIUpdate( wxUpdateUIEvent
& event
)
1076 OnSymbolUpdate(event
);
1080 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL
1083 void wxRichTextListStylePage::OnParenthesesctrlClick( wxCommandEvent
& WXUNUSED(event
) )
1085 TransferAndPreview();
1089 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL
1092 void wxRichTextListStylePage::OnParenthesesctrlUpdate( wxUpdateUIEvent
& event
)
1094 int sel
= m_styleListBox
->GetSelection();
1095 event
.Enable((sel
!= wxRICHTEXT_BULLETINDEX_SYMBOL
&&
1096 sel
!= wxRICHTEXT_BULLETINDEX_BITMAP
&&
1097 sel
!= wxRICHTEXT_BULLETINDEX_NONE
));
1101 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
1104 void wxRichTextListStylePage::OnPeriodctrlClick( wxCommandEvent
& WXUNUSED(event
) )
1106 TransferAndPreview();
1110 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
1113 void wxRichTextListStylePage::OnPeriodctrlUpdate( wxUpdateUIEvent
& event
)
1115 int sel
= m_styleListBox
->GetSelection();
1116 event
.Enable((sel
!= wxRICHTEXT_BULLETINDEX_SYMBOL
&&
1117 sel
!= wxRICHTEXT_BULLETINDEX_BITMAP
&&
1118 sel
!= wxRICHTEXT_BULLETINDEX_NONE
));
1122 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT
1125 void wxRichTextListStylePage::OnRichtextliststylepageAlignleftSelected( wxCommandEvent
& WXUNUSED(event
) )
1127 TransferAndPreview();
1131 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT
1134 void wxRichTextListStylePage::OnRichtextliststylepageAlignrightSelected( wxCommandEvent
& WXUNUSED(event
) )
1136 TransferAndPreview();
1140 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED
1143 void wxRichTextListStylePage::OnRichtextliststylepageJustifiedSelected( wxCommandEvent
& WXUNUSED(event
) )
1145 TransferAndPreview();
1149 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_CENTERED
1152 void wxRichTextListStylePage::OnRichtextliststylepageCenteredSelected( wxCommandEvent
& WXUNUSED(event
) )
1154 TransferAndPreview();
1158 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE
1161 void wxRichTextListStylePage::OnRichtextliststylepageAlignindeterminateSelected( wxCommandEvent
& WXUNUSED(event
) )
1163 TransferAndPreview();
1167 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT
1170 void wxRichTextListStylePage::OnIndentLeftUpdated( wxCommandEvent
& WXUNUSED(event
) )
1172 TransferAndPreview();
1176 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE
1179 void wxRichTextListStylePage::OnIndentFirstLineUpdated( wxCommandEvent
& WXUNUSED(event
) )
1181 TransferAndPreview();
1185 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT
1188 void wxRichTextListStylePage::OnIndentRightUpdated( wxCommandEvent
& WXUNUSED(event
) )
1190 TransferAndPreview();
1194 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE
1197 void wxRichTextListStylePage::OnSpacingBeforeUpdated( wxCommandEvent
& WXUNUSED(event
) )
1199 TransferAndPreview();
1203 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER
1206 void wxRichTextListStylePage::OnSpacingAfterUpdated( wxCommandEvent
& WXUNUSED(event
) )
1208 TransferAndPreview();
1212 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_LINESPACING
1215 void wxRichTextListStylePage::OnLineSpacingSelected( wxCommandEvent
& WXUNUSED(event
) )
1217 TransferAndPreview();
1221 * Should we show tooltips?
1224 bool wxRichTextListStylePage::ShowToolTips()
1226 return wxRichTextFormattingDialog::ShowToolTips();
1230 * Get bitmap resources
1233 wxBitmap
wxRichTextListStylePage::GetBitmapResource( const wxString
& name
)
1236 ////@begin wxRichTextListStylePage bitmap retrieval
1238 return wxNullBitmap
;
1239 ////@end wxRichTextListStylePage bitmap retrieval
1243 * Get icon resources
1246 wxIcon
wxRichTextListStylePage::GetIconResource( const wxString
& name
)
1249 ////@begin wxRichTextListStylePage icon retrieval
1252 ////@end wxRichTextListStylePage icon retrieval
1255 /// Update for symbol-related controls
1256 void wxRichTextListStylePage::OnSymbolUpdate( wxUpdateUIEvent
& event
)
1258 int sel
= m_styleListBox
->GetSelection();
1259 event
.Enable(sel
== wxRICHTEXT_BULLETINDEX_SYMBOL
);
1262 /// Update for number-related controls
1263 void wxRichTextListStylePage::OnNumberUpdate( wxUpdateUIEvent
& event
)
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
));
1272 /// Update for standard bullet-related controls
1273 void wxRichTextListStylePage::OnStandardBulletUpdate( wxUpdateUIEvent
& event
)
1275 int sel
= m_styleListBox
->GetSelection();
1276 event
.Enable( sel
== wxRICHTEXT_BULLETINDEX_STANDARD
);
1280 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT
1283 void wxRichTextListStylePage::OnChooseFontClick( wxCommandEvent
& WXUNUSED(event
) )
1285 wxRichTextAttr
* attr
= GetAttributesForSelection();
1287 int pages
= wxRICHTEXT_FORMAT_FONT
;
1288 wxRichTextFormattingDialog formatDlg
;
1289 formatDlg
.SetStyle(*attr
, false);
1290 formatDlg
.Create(pages
, this);
1292 if (formatDlg
.ShowModal() == wxID_OK
)
1294 (*attr
) = formatDlg
.GetAttributes();
1295 TransferAndPreview();
1299 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC
1302 void wxRichTextListStylePage::OnNamestaticUpdate( wxUpdateUIEvent
& event
)
1304 OnStandardBulletUpdate(event
);
1308 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
1311 void wxRichTextListStylePage::OnNamectrlSelected( wxCommandEvent
& WXUNUSED(event
) )
1313 TransferAndPreview();
1317 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
1320 void wxRichTextListStylePage::OnNamectrlUpdated( wxCommandEvent
& WXUNUSED(event
) )
1322 TransferAndPreview();
1326 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
1329 void wxRichTextListStylePage::OnNamectrlUIUpdate( wxUpdateUIEvent
& event
)
1331 OnStandardBulletUpdate(event
);
1334 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL
1337 void wxRichTextListStylePage::OnRightParenthesisCtrlClick( wxCommandEvent
& WXUNUSED(event
) )
1339 TransferAndPreview();
1343 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL
1346 void wxRichTextListStylePage::OnRightParenthesisCtrlUpdate( wxUpdateUIEvent
& event
)
1348 int sel
= m_styleListBox
->GetSelection();
1349 event
.Enable((sel
!= wxRICHTEXT_BULLETINDEX_SYMBOL
&&
1350 sel
!= wxRICHTEXT_BULLETINDEX_BITMAP
&&
1351 sel
!= wxRICHTEXT_BULLETINDEX_NONE
));
1355 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL
1358 void wxRichTextListStylePage::OnBulletAlignmentCtrlSelected( wxCommandEvent
& WXUNUSED(event
) )
1360 TransferAndPreview();