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_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC
, wxRichTextListStylePage::OnSymbolstaticUpdate
)
48 EVT_COMBOBOX( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
, wxRichTextListStylePage::OnSymbolctrlSelected
)
49 EVT_TEXT( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
, wxRichTextListStylePage::OnSymbolctrlUpdated
)
50 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
, wxRichTextListStylePage::OnSymbolctrlUIUpdate
)
52 EVT_BUTTON( ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
, wxRichTextListStylePage::OnChooseSymbolClick
)
53 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
, wxRichTextListStylePage::OnChooseSymbolUpdate
)
55 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
, wxRichTextListStylePage::OnSymbolfontctrlSelected
)
56 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
, wxRichTextListStylePage::OnSymbolfontctrlUpdated
)
57 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
, wxRichTextListStylePage::OnSymbolfontctrlUIUpdate
)
59 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC
, wxRichTextListStylePage::OnNamestaticUpdate
)
61 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
, wxRichTextListStylePage::OnNamectrlSelected
)
62 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
, wxRichTextListStylePage::OnNamectrlUpdated
)
63 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
, wxRichTextListStylePage::OnNamectrlUIUpdate
)
65 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT
, wxRichTextListStylePage::OnRichtextliststylepageAlignleftSelected
)
67 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT
, wxRichTextListStylePage::OnRichtextliststylepageAlignrightSelected
)
69 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED
, wxRichTextListStylePage::OnRichtextliststylepageJustifiedSelected
)
71 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_CENTERED
, wxRichTextListStylePage::OnRichtextliststylepageCenteredSelected
)
73 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE
, wxRichTextListStylePage::OnRichtextliststylepageAlignindeterminateSelected
)
75 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT
, wxRichTextListStylePage::OnIndentLeftUpdated
)
77 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE
, wxRichTextListStylePage::OnIndentFirstLineUpdated
)
79 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT
, wxRichTextListStylePage::OnIndentRightUpdated
)
81 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE
, wxRichTextListStylePage::OnSpacingBeforeUpdated
)
83 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER
, wxRichTextListStylePage::OnSpacingAfterUpdated
)
85 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_LINESPACING
, wxRichTextListStylePage::OnLineSpacingSelected
)
87 ////@end wxRichTextListStylePage event table entries
92 * wxRichTextListStylePage constructors
95 wxRichTextListStylePage::wxRichTextListStylePage( )
100 wxRichTextListStylePage::wxRichTextListStylePage( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
103 Create(parent
, id
, pos
, size
, style
);
107 * wxRichTextListStylePage creator
110 bool wxRichTextListStylePage::Create( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
112 ////@begin wxRichTextListStylePage creation
113 wxPanel::Create( parent
, id
, pos
, size
, style
);
118 GetSizer()->SetSizeHints(this);
121 ////@end wxRichTextListStylePage creation
126 * Member initialisation
129 void wxRichTextListStylePage::Init()
131 m_dontUpdate
= false;
134 ////@begin wxRichTextListStylePage member initialisation
136 m_styleListBox
= NULL
;
138 m_parenthesesCtrl
= NULL
;
140 m_symbolFontCtrl
= NULL
;
141 m_bulletNameCtrl
= NULL
;
142 m_alignmentLeft
= NULL
;
143 m_alignmentRight
= NULL
;
144 m_alignmentJustified
= NULL
;
145 m_alignmentCentred
= NULL
;
146 m_alignmentIndeterminate
= NULL
;
148 m_indentLeftFirst
= NULL
;
149 m_indentRight
= NULL
;
150 m_spacingBefore
= NULL
;
151 m_spacingAfter
= NULL
;
152 m_spacingLine
= NULL
;
153 m_previewCtrl
= NULL
;
154 ////@end wxRichTextListStylePage member initialisation
158 * Control creation for wxRichTextListStylePage
161 void wxRichTextListStylePage::CreateControls()
163 ////@begin wxRichTextListStylePage content construction
164 wxRichTextListStylePage
* itemPanel1
= this;
166 wxBoxSizer
* itemBoxSizer2
= new wxBoxSizer(wxVERTICAL
);
167 itemPanel1
->SetSizer(itemBoxSizer2
);
169 wxBoxSizer
* itemBoxSizer3
= new wxBoxSizer(wxVERTICAL
);
170 itemBoxSizer2
->Add(itemBoxSizer3
, 1, wxGROW
|wxALL
, 5);
172 wxBoxSizer
* itemBoxSizer4
= new wxBoxSizer(wxHORIZONTAL
);
173 itemBoxSizer3
->Add(itemBoxSizer4
, 0, wxALIGN_CENTER_HORIZONTAL
, 5);
175 wxStaticText
* itemStaticText5
= new wxStaticText( itemPanel1
, wxID_STATIC
, _("&List level:"), wxDefaultPosition
, wxDefaultSize
, 0 );
176 itemBoxSizer4
->Add(itemStaticText5
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
|wxADJUST_MINSIZE
, 5);
178 m_levelCtrl
= new wxSpinCtrl( itemPanel1
, ID_RICHTEXTLISTSTYLEPAGE_LEVEL
, _T("1"), wxDefaultPosition
, wxSize(60, -1), wxSP_ARROW_KEYS
, 1, 10, 1 );
179 m_levelCtrl
->SetHelpText(_("Selects the list level to edit."));
181 m_levelCtrl
->SetToolTip(_("Selects the list level to edit."));
182 itemBoxSizer4
->Add(m_levelCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
184 itemBoxSizer4
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
186 wxButton
* itemButton8
= new wxButton( itemPanel1
, ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT
, _("&Font for Level..."), wxDefaultPosition
, wxDefaultSize
, 0 );
187 itemButton8
->SetHelpText(_("Click to choose the font for this level."));
189 itemButton8
->SetToolTip(_("Click to choose the font for this level."));
190 itemBoxSizer4
->Add(itemButton8
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
192 wxBookCtrl
* itemBook9
= new wxBookCtrl( itemPanel1
, ID_RICHTEXTLISTSTYLEPAGE_BOOK
, wxDefaultPosition
, wxDefaultSize
, wxBK_TOP
);
194 wxPanel
* itemPanel10
= new wxPanel( itemBook9
, ID_RICHTEXTLISTSTYLEPAGE_BULLETS
, wxDefaultPosition
, wxDefaultSize
, wxNO_BORDER
|wxTAB_TRAVERSAL
);
195 wxBoxSizer
* itemBoxSizer11
= new wxBoxSizer(wxVERTICAL
);
196 itemPanel10
->SetSizer(itemBoxSizer11
);
198 wxBoxSizer
* itemBoxSizer12
= new wxBoxSizer(wxHORIZONTAL
);
199 itemBoxSizer11
->Add(itemBoxSizer12
, 1, wxGROW
, 5);
200 wxBoxSizer
* itemBoxSizer13
= new wxBoxSizer(wxVERTICAL
);
201 itemBoxSizer12
->Add(itemBoxSizer13
, 0, wxGROW
, 5);
202 wxStaticText
* itemStaticText14
= new wxStaticText( itemPanel10
, wxID_STATIC
, _("&Bullet style:"), wxDefaultPosition
, wxDefaultSize
, 0 );
203 itemBoxSizer13
->Add(itemStaticText14
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
|wxADJUST_MINSIZE
, 5);
205 wxString
* m_styleListBoxStrings
= NULL
;
206 m_styleListBox
= new wxListBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX
, wxDefaultPosition
, wxSize(-1, 130), 0, m_styleListBoxStrings
, wxLB_SINGLE
);
207 m_styleListBox
->SetHelpText(_("The available bullet styles."));
209 m_styleListBox
->SetToolTip(_("The available bullet styles."));
210 itemBoxSizer13
->Add(m_styleListBox
, 1, wxGROW
|wxALL
, 5);
212 wxBoxSizer
* itemBoxSizer16
= new wxBoxSizer(wxHORIZONTAL
);
213 itemBoxSizer13
->Add(itemBoxSizer16
, 0, wxGROW
, 5);
214 m_periodCtrl
= new wxCheckBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
, _("Peri&od"), wxDefaultPosition
, wxDefaultSize
, 0 );
215 m_periodCtrl
->SetValue(false);
216 m_periodCtrl
->SetHelpText(_("Check to add a period after the bullet."));
218 m_periodCtrl
->SetToolTip(_("Check to add a period after the bullet."));
219 itemBoxSizer16
->Add(m_periodCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
221 m_parenthesesCtrl
= new wxCheckBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL
, _("&Parentheses"), wxDefaultPosition
, wxDefaultSize
, 0 );
222 m_parenthesesCtrl
->SetValue(false);
223 m_parenthesesCtrl
->SetHelpText(_("Check to enclose the bullet in parentheses."));
225 m_parenthesesCtrl
->SetToolTip(_("Check to enclose the bullet in parentheses."));
226 itemBoxSizer16
->Add(m_parenthesesCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
228 itemBoxSizer12
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
230 wxStaticLine
* itemStaticLine20
= new wxStaticLine( itemPanel10
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_VERTICAL
);
231 itemBoxSizer12
->Add(itemStaticLine20
, 0, wxGROW
|wxALL
, 5);
233 itemBoxSizer12
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
235 wxBoxSizer
* itemBoxSizer22
= new wxBoxSizer(wxVERTICAL
);
236 itemBoxSizer12
->Add(itemBoxSizer22
, 0, wxGROW
, 5);
237 wxStaticText
* itemStaticText23
= new wxStaticText( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC
, _("&Symbol:"), wxDefaultPosition
, wxDefaultSize
, 0 );
238 itemBoxSizer22
->Add(itemStaticText23
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
|wxADJUST_MINSIZE
, 5);
240 wxBoxSizer
* itemBoxSizer24
= new wxBoxSizer(wxHORIZONTAL
);
241 itemBoxSizer22
->Add(itemBoxSizer24
, 0, wxGROW
, 5);
242 wxString
* m_symbolCtrlStrings
= NULL
;
243 m_symbolCtrl
= new wxComboBox( itemPanel10
, ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
, _T(""), wxDefaultPosition
, wxSize(60, -1), 0, m_symbolCtrlStrings
, wxCB_DROPDOWN
);
244 m_symbolCtrl
->SetHelpText(_("The bullet character."));
246 m_symbolCtrl
->SetToolTip(_("The bullet character."));
247 itemBoxSizer24
->Add(m_symbolCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
|wxFIXED_MINSIZE
, 5);
249 wxButton
* itemButton26
= new wxButton( itemPanel10
, ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
, _("Ch&oose..."), wxDefaultPosition
, wxDefaultSize
, 0 );
250 itemButton26
->SetHelpText(_("Click to browse for a symbol."));
252 itemButton26
->SetToolTip(_("Click to browse for a symbol."));
253 itemBoxSizer24
->Add(itemButton26
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
255 itemBoxSizer22
->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL
, 5);
257 wxStaticText
* itemStaticText28
= new wxStaticText( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC
, _("Symbol &font:"), wxDefaultPosition
, wxDefaultSize
, 0 );
258 itemBoxSizer22
->Add(itemStaticText28
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
|wxADJUST_MINSIZE
, 5);
260 wxString
* m_symbolFontCtrlStrings
= NULL
;
261 m_symbolFontCtrl
= new wxComboBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
, _T(""), wxDefaultPosition
, wxDefaultSize
, 0, m_symbolFontCtrlStrings
, wxCB_DROPDOWN
);
263 m_symbolFontCtrl
->SetToolTip(_("Available fonts."));
264 itemBoxSizer22
->Add(m_symbolFontCtrl
, 0, wxGROW
|wxALL
, 5);
266 itemBoxSizer22
->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL
, 5);
268 wxStaticText
* itemStaticText31
= new wxStaticText( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC
, _("S&tandard bullet name:"), wxDefaultPosition
, wxDefaultSize
, 0 );
269 itemBoxSizer22
->Add(itemStaticText31
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
|wxADJUST_MINSIZE
, 5);
271 wxString
* m_bulletNameCtrlStrings
= NULL
;
272 m_bulletNameCtrl
= new wxComboBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
, _T(""), wxDefaultPosition
, wxDefaultSize
, 0, m_bulletNameCtrlStrings
, wxCB_DROPDOWN
);
273 m_bulletNameCtrl
->SetHelpText(_("A standard bullet name."));
275 m_bulletNameCtrl
->SetToolTip(_("A standard bullet name."));
276 itemBoxSizer22
->Add(m_bulletNameCtrl
, 0, wxGROW
|wxALL
, 5);
278 itemBook9
->AddPage(itemPanel10
, _("Bullet style"));
280 wxPanel
* itemPanel33
= new wxPanel( itemBook9
, ID_RICHTEXTLISTSTYLEPAGE_SPACING
, wxDefaultPosition
, wxDefaultSize
, wxNO_BORDER
|wxTAB_TRAVERSAL
);
281 wxBoxSizer
* itemBoxSizer34
= new wxBoxSizer(wxVERTICAL
);
282 itemPanel33
->SetSizer(itemBoxSizer34
);
284 wxBoxSizer
* itemBoxSizer35
= new wxBoxSizer(wxHORIZONTAL
);
285 itemBoxSizer34
->Add(itemBoxSizer35
, 0, wxGROW
, 5);
286 wxBoxSizer
* itemBoxSizer36
= new wxBoxSizer(wxVERTICAL
);
287 itemBoxSizer35
->Add(itemBoxSizer36
, 0, wxGROW
, 5);
288 wxStaticText
* itemStaticText37
= new wxStaticText( itemPanel33
, wxID_STATIC
, _("&Alignment"), wxDefaultPosition
, wxDefaultSize
, 0 );
289 itemBoxSizer36
->Add(itemStaticText37
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
|wxADJUST_MINSIZE
, 5);
291 wxBoxSizer
* itemBoxSizer38
= new wxBoxSizer(wxHORIZONTAL
);
292 itemBoxSizer36
->Add(itemBoxSizer38
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALL
, 5);
293 itemBoxSizer38
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
, 5);
295 wxBoxSizer
* itemBoxSizer40
= new wxBoxSizer(wxVERTICAL
);
296 itemBoxSizer38
->Add(itemBoxSizer40
, 0, wxALIGN_CENTER_VERTICAL
|wxTOP
, 5);
297 m_alignmentLeft
= new wxRadioButton( itemPanel33
, ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT
, _("&Left"), wxDefaultPosition
, wxDefaultSize
, wxRB_GROUP
);
298 m_alignmentLeft
->SetValue(false);
299 m_alignmentLeft
->SetHelpText(_("Left-align text."));
301 m_alignmentLeft
->SetToolTip(_("Left-align text."));
302 itemBoxSizer40
->Add(m_alignmentLeft
, 0, wxALIGN_LEFT
|wxALL
, 5);
304 m_alignmentRight
= new wxRadioButton( itemPanel33
, ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT
, _("&Right"), wxDefaultPosition
, wxDefaultSize
, 0 );
305 m_alignmentRight
->SetValue(false);
306 m_alignmentRight
->SetHelpText(_("Right-align text."));
308 m_alignmentRight
->SetToolTip(_("Right-align text."));
309 itemBoxSizer40
->Add(m_alignmentRight
, 0, wxALIGN_LEFT
|wxALL
, 5);
311 m_alignmentJustified
= new wxRadioButton( itemPanel33
, ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED
, _("&Justified"), wxDefaultPosition
, wxDefaultSize
, 0 );
312 m_alignmentJustified
->SetValue(false);
313 m_alignmentJustified
->SetHelpText(_("Justify text left and right."));
315 m_alignmentJustified
->SetToolTip(_("Justify text left and right."));
316 itemBoxSizer40
->Add(m_alignmentJustified
, 0, wxALIGN_LEFT
|wxALL
, 5);
318 m_alignmentCentred
= new wxRadioButton( itemPanel33
, ID_RICHTEXTLISTSTYLEPAGE_CENTERED
, _("Cen&tred"), wxDefaultPosition
, wxDefaultSize
, 0 );
319 m_alignmentCentred
->SetValue(false);
320 m_alignmentCentred
->SetHelpText(_("Centre text."));
322 m_alignmentCentred
->SetToolTip(_("Centre text."));
323 itemBoxSizer40
->Add(m_alignmentCentred
, 0, wxALIGN_LEFT
|wxALL
, 5);
325 m_alignmentIndeterminate
= new wxRadioButton( itemPanel33
, ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE
, _("&Indeterminate"), wxDefaultPosition
, wxDefaultSize
, 0 );
326 m_alignmentIndeterminate
->SetValue(false);
327 m_alignmentIndeterminate
->SetHelpText(_("Use the current alignment setting."));
329 m_alignmentIndeterminate
->SetToolTip(_("Use the current alignment setting."));
330 itemBoxSizer40
->Add(m_alignmentIndeterminate
, 0, wxALIGN_LEFT
|wxALL
, 5);
332 itemBoxSizer35
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
334 wxStaticLine
* itemStaticLine47
= new wxStaticLine( itemPanel33
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_VERTICAL
);
335 itemBoxSizer35
->Add(itemStaticLine47
, 0, wxGROW
|wxLEFT
|wxBOTTOM
, 5);
337 itemBoxSizer35
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
339 wxBoxSizer
* itemBoxSizer49
= new wxBoxSizer(wxVERTICAL
);
340 itemBoxSizer35
->Add(itemBoxSizer49
, 0, wxGROW
, 5);
341 wxStaticText
* itemStaticText50
= new wxStaticText( itemPanel33
, wxID_STATIC
, _("&Indentation (tenths of a mm)"), wxDefaultPosition
, wxDefaultSize
, 0 );
342 itemBoxSizer49
->Add(itemStaticText50
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
|wxADJUST_MINSIZE
, 5);
344 wxBoxSizer
* itemBoxSizer51
= new wxBoxSizer(wxHORIZONTAL
);
345 itemBoxSizer49
->Add(itemBoxSizer51
, 0, wxALIGN_LEFT
|wxALL
, 5);
346 itemBoxSizer51
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
, 5);
348 wxFlexGridSizer
* itemFlexGridSizer53
= new wxFlexGridSizer(2, 2, 0, 0);
349 itemBoxSizer51
->Add(itemFlexGridSizer53
, 0, wxALIGN_CENTER_VERTICAL
, 5);
350 wxStaticText
* itemStaticText54
= new wxStaticText( itemPanel33
, wxID_STATIC
, _("&Left:"), wxDefaultPosition
, wxDefaultSize
, 0 );
351 itemFlexGridSizer53
->Add(itemStaticText54
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
|wxADJUST_MINSIZE
, 5);
353 wxBoxSizer
* itemBoxSizer55
= new wxBoxSizer(wxHORIZONTAL
);
354 itemFlexGridSizer53
->Add(itemBoxSizer55
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 5);
355 m_indentLeft
= new wxTextCtrl( itemPanel33
, ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT
, _T(""), wxDefaultPosition
, wxSize(50, -1), 0 );
356 m_indentLeft
->SetHelpText(_("The left indent."));
358 m_indentLeft
->SetToolTip(_("The left indent."));
359 itemBoxSizer55
->Add(m_indentLeft
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
361 wxStaticText
* itemStaticText57
= new wxStaticText( itemPanel33
, wxID_STATIC
, _("Left (&first line):"), wxDefaultPosition
, wxDefaultSize
, 0 );
362 itemFlexGridSizer53
->Add(itemStaticText57
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
|wxADJUST_MINSIZE
, 5);
364 wxBoxSizer
* itemBoxSizer58
= new wxBoxSizer(wxHORIZONTAL
);
365 itemFlexGridSizer53
->Add(itemBoxSizer58
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 5);
366 m_indentLeftFirst
= new wxTextCtrl( itemPanel33
, ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE
, _T(""), wxDefaultPosition
, wxSize(50, -1), 0 );
367 m_indentLeftFirst
->SetHelpText(_("The first line indent."));
369 m_indentLeftFirst
->SetToolTip(_("The first line indent."));
370 itemBoxSizer58
->Add(m_indentLeftFirst
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
372 wxStaticText
* itemStaticText60
= new wxStaticText( itemPanel33
, wxID_STATIC
, _("&Right:"), wxDefaultPosition
, wxDefaultSize
, 0 );
373 itemFlexGridSizer53
->Add(itemStaticText60
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
|wxADJUST_MINSIZE
, 5);
375 wxBoxSizer
* itemBoxSizer61
= new wxBoxSizer(wxHORIZONTAL
);
376 itemFlexGridSizer53
->Add(itemBoxSizer61
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 5);
377 m_indentRight
= new wxTextCtrl( itemPanel33
, ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT
, _T(""), wxDefaultPosition
, wxSize(50, -1), 0 );
378 m_indentRight
->SetHelpText(_("The right indent."));
380 m_indentRight
->SetToolTip(_("The right indent."));
381 itemBoxSizer61
->Add(m_indentRight
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
383 itemBoxSizer35
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
385 wxStaticLine
* itemStaticLine64
= new wxStaticLine( itemPanel33
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_VERTICAL
);
386 itemBoxSizer35
->Add(itemStaticLine64
, 0, wxGROW
|wxTOP
|wxBOTTOM
, 5);
388 itemBoxSizer35
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
390 wxBoxSizer
* itemBoxSizer66
= new wxBoxSizer(wxVERTICAL
);
391 itemBoxSizer35
->Add(itemBoxSizer66
, 0, wxGROW
, 5);
392 wxStaticText
* itemStaticText67
= new wxStaticText( itemPanel33
, wxID_STATIC
, _("&Spacing (tenths of a mm)"), wxDefaultPosition
, wxDefaultSize
, 0 );
393 itemBoxSizer66
->Add(itemStaticText67
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
|wxADJUST_MINSIZE
, 5);
395 wxBoxSizer
* itemBoxSizer68
= new wxBoxSizer(wxHORIZONTAL
);
396 itemBoxSizer66
->Add(itemBoxSizer68
, 0, wxALIGN_LEFT
|wxALL
, 5);
397 itemBoxSizer68
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
, 5);
399 wxFlexGridSizer
* itemFlexGridSizer70
= new wxFlexGridSizer(2, 2, 0, 0);
400 itemBoxSizer68
->Add(itemFlexGridSizer70
, 0, wxALIGN_CENTER_VERTICAL
, 5);
401 wxStaticText
* itemStaticText71
= new wxStaticText( itemPanel33
, wxID_STATIC
, _("Before a paragraph:"), wxDefaultPosition
, wxDefaultSize
, 0 );
402 itemFlexGridSizer70
->Add(itemStaticText71
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
|wxADJUST_MINSIZE
, 5);
404 wxBoxSizer
* itemBoxSizer72
= new wxBoxSizer(wxHORIZONTAL
);
405 itemFlexGridSizer70
->Add(itemBoxSizer72
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 5);
406 m_spacingBefore
= new wxTextCtrl( itemPanel33
, ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE
, _T(""), wxDefaultPosition
, wxSize(50, -1), 0 );
407 m_spacingBefore
->SetHelpText(_("The spacing before the paragraph."));
409 m_spacingBefore
->SetToolTip(_("The spacing before the paragraph."));
410 itemBoxSizer72
->Add(m_spacingBefore
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
412 wxStaticText
* itemStaticText74
= new wxStaticText( itemPanel33
, wxID_STATIC
, _("After a paragraph:"), wxDefaultPosition
, wxDefaultSize
, 0 );
413 itemFlexGridSizer70
->Add(itemStaticText74
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
|wxADJUST_MINSIZE
, 5);
415 wxBoxSizer
* itemBoxSizer75
= new wxBoxSizer(wxHORIZONTAL
);
416 itemFlexGridSizer70
->Add(itemBoxSizer75
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 5);
417 m_spacingAfter
= new wxTextCtrl( itemPanel33
, ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER
, _T(""), wxDefaultPosition
, wxSize(50, -1), 0 );
418 m_spacingAfter
->SetHelpText(_("The spacing after the paragraph."));
420 m_spacingAfter
->SetToolTip(_("The spacing after the paragraph."));
421 itemBoxSizer75
->Add(m_spacingAfter
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
423 wxStaticText
* itemStaticText77
= new wxStaticText( itemPanel33
, wxID_STATIC
, _("Line spacing:"), wxDefaultPosition
, wxDefaultSize
, 0 );
424 itemFlexGridSizer70
->Add(itemStaticText77
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
|wxADJUST_MINSIZE
, 5);
426 wxBoxSizer
* itemBoxSizer78
= new wxBoxSizer(wxHORIZONTAL
);
427 itemFlexGridSizer70
->Add(itemBoxSizer78
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 5);
428 wxString m_spacingLineStrings
[] = {
433 m_spacingLine
= new wxComboBox( itemPanel33
, ID_RICHTEXTLISTSTYLEPAGE_LINESPACING
, _("Single"), wxDefaultPosition
, wxDefaultSize
, 3, m_spacingLineStrings
, wxCB_READONLY
);
434 m_spacingLine
->SetStringSelection(_("Single"));
435 m_spacingLine
->SetHelpText(_("The line spacing."));
437 m_spacingLine
->SetToolTip(_("The line spacing."));
438 itemBoxSizer78
->Add(m_spacingLine
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
440 itemBook9
->AddPage(itemPanel33
, _("Spacing"));
442 itemBoxSizer3
->Add(itemBook9
, 0, wxGROW
|wxALL
, 5);
444 m_previewCtrl
= new wxRichTextCtrl( itemPanel1
, ID_RICHTEXTLISTSTYLEPAGE_RICHTEXTCTRL
, wxEmptyString
, wxDefaultPosition
, wxSize(350, 180), wxSUNKEN_BORDER
);
445 m_previewCtrl
->SetHelpText(_("Shows a preview of the bullet settings."));
447 m_previewCtrl
->SetToolTip(_("Shows a preview of the bullet settings."));
448 itemBoxSizer3
->Add(m_previewCtrl
, 0, wxGROW
|wxALL
, 5);
450 ////@end wxRichTextListStylePage content construction
452 m_styleListBox
->Append(_("(None)"));
453 m_styleListBox
->Append(_("Arabic"));
454 m_styleListBox
->Append(_("Upper case letters"));
455 m_styleListBox
->Append(_("Lower case letters"));
456 m_styleListBox
->Append(_("Upper case roman numerals"));
457 m_styleListBox
->Append(_("Lower case roman numerals"));
458 m_styleListBox
->Append(_("Symbol"));
459 m_styleListBox
->Append(_("Bitmap"));
460 m_styleListBox
->Append(_("Standard"));
462 m_symbolCtrl
->Append(_("*"));
463 m_symbolCtrl
->Append(_("-"));
464 m_symbolCtrl
->Append(_(">"));
465 m_symbolCtrl
->Append(_("+"));
466 m_symbolCtrl
->Append(_("~"));
468 m_bulletNameCtrl
->Append(_("standard/round"));
469 m_bulletNameCtrl
->Append(_("standard/square"));
471 wxArrayString facenames
= wxRichTextCtrl::GetAvailableFontNames();
474 m_symbolFontCtrl
->Append(facenames
);
477 /// Updates the font preview
478 void wxRichTextListStylePage::UpdatePreview()
480 static const wxChar
* s_para1
= wxT("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \
481 Nullam ante sapien, vestibulum nonummy, pulvinar sed, luctus ut, lacus.");
483 static const wxChar
* s_para2
= wxT("Duis pharetra consequat dui. Nullam vitae justo id mauris lobortis interdum.");
485 static const wxChar
* s_para3
= wxT("\nInteger convallis dolor at augue \
486 iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
488 wxRichTextListStyleDefinition
* def
= wxDynamicCast(wxRichTextFormattingDialog::GetDialogStyleDefinition(this),
489 wxRichTextListStyleDefinition
);
491 wxTextAttrEx
attr(def
->GetStyle());
492 attr
.SetFlags(attr
.GetFlags() &
493 (wxTEXT_ATTR_ALIGNMENT
|wxTEXT_ATTR_LEFT_INDENT
|wxTEXT_ATTR_RIGHT_INDENT
|wxTEXT_ATTR_PARA_SPACING_BEFORE
|wxTEXT_ATTR_PARA_SPACING_AFTER
|
494 wxTEXT_ATTR_LINE_SPACING
|
495 wxTEXT_ATTR_BULLET_STYLE
|wxTEXT_ATTR_BULLET_NUMBER
|wxTEXT_ATTR_BULLET_SYMBOL
));
497 wxFont
font(m_previewCtrl
->GetFont());
498 font
.SetPointSize(9);
499 m_previewCtrl
->SetFont(font
);
501 wxTextAttrEx normalParaAttr
;
502 normalParaAttr
.SetFont(font
);
503 normalParaAttr
.SetTextColour(wxColour(wxT("LIGHT GREY")));
505 m_previewCtrl
->Freeze();
506 m_previewCtrl
->Clear();
508 m_previewCtrl
->BeginStyle(normalParaAttr
);
509 m_previewCtrl
->WriteText(s_para1
);
510 m_previewCtrl
->EndStyle();
512 m_previewCtrl
->BeginStyle(attr
);
515 for (i
= 0; i
< 10; i
++)
517 wxTextAttrEx levelAttr
= * def
->GetLevelAttributes(i
);
518 levelAttr
.SetBulletNumber(1);
519 m_previewCtrl
->BeginStyle(levelAttr
);
520 m_previewCtrl
->WriteText(wxString::Format(wxT("\nList level %d. "), i
+1) + s_para2
);
521 m_previewCtrl
->EndStyle();
523 m_previewCtrl
->EndStyle();
525 m_previewCtrl
->BeginStyle(normalParaAttr
);
526 m_previewCtrl
->WriteText(s_para3
);
527 m_previewCtrl
->EndStyle();
529 m_previewCtrl
->Thaw();
532 /// Transfer data from/to window
533 bool wxRichTextListStylePage::TransferDataFromWindow()
535 wxPanel::TransferDataFromWindow();
537 m_currentLevel
= m_levelCtrl
->GetValue();
539 wxTextAttrEx
* attr
= GetAttributesForSelection();
541 if (m_alignmentLeft
->GetValue())
542 attr
->SetAlignment(wxTEXT_ALIGNMENT_LEFT
);
543 else if (m_alignmentCentred
->GetValue())
544 attr
->SetAlignment(wxTEXT_ALIGNMENT_CENTRE
);
545 else if (m_alignmentRight
->GetValue())
546 attr
->SetAlignment(wxTEXT_ALIGNMENT_RIGHT
);
547 else if (m_alignmentJustified
->GetValue())
548 attr
->SetAlignment(wxTEXT_ALIGNMENT_JUSTIFIED
);
551 attr
->SetAlignment(wxTEXT_ALIGNMENT_DEFAULT
);
552 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_ALIGNMENT
));
555 wxString
leftIndent(m_indentLeft
->GetValue());
556 wxString
leftFirstIndent(m_indentLeftFirst
->GetValue());
557 if (!leftIndent
.empty())
559 int visualLeftIndent
= wxAtoi(leftIndent
);
560 int visualLeftFirstIndent
= wxAtoi(leftFirstIndent
);
561 int actualLeftIndent
= visualLeftFirstIndent
;
562 int actualLeftSubIndent
= visualLeftIndent
- visualLeftFirstIndent
;
564 attr
->SetLeftIndent(actualLeftIndent
, actualLeftSubIndent
);
567 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_LEFT_INDENT
));
569 wxString
rightIndent(m_indentRight
->GetValue());
570 if (!rightIndent
.empty())
571 attr
->SetRightIndent(wxAtoi(rightIndent
));
573 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_RIGHT_INDENT
));
575 wxString
spacingAfter(m_spacingAfter
->GetValue());
576 if (!spacingAfter
.empty())
577 attr
->SetParagraphSpacingAfter(wxAtoi(spacingAfter
));
579 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_PARA_SPACING_AFTER
));
581 wxString
spacingBefore(m_spacingBefore
->GetValue());
582 if (!spacingBefore
.empty())
583 attr
->SetParagraphSpacingBefore(wxAtoi(spacingBefore
));
585 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_PARA_SPACING_BEFORE
));
587 int spacingIndex
= m_spacingLine
->GetSelection();
589 if (spacingIndex
== 0)
591 else if (spacingIndex
== 1)
593 else if (spacingIndex
== 2)
596 if (lineSpacing
== 0)
597 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_LINE_SPACING
));
599 attr
->SetLineSpacing(lineSpacing
);
602 if (true) // m_hasBulletStyle)
604 long bulletStyle
= 0;
606 int index
= m_styleListBox
->GetSelection();
608 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_ARABIC
;
610 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER
;
612 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER
;
614 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER
;
616 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER
;
618 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_SYMBOL
;
620 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_BITMAP
;
623 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_STANDARD
;
624 attr
->SetBulletName(m_bulletNameCtrl
->GetValue());
627 if (m_parenthesesCtrl
->GetValue())
628 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_PARENTHESES
;
629 if (m_periodCtrl
->GetValue())
630 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_PERIOD
;
632 attr
->SetBulletStyle(bulletStyle
);
635 // if (m_hasBulletSymbol)
638 if (m_symbolCtrl
->GetValue().length() > 0)
639 c
= m_symbolCtrl
->GetValue()[0];
640 attr
->SetBulletSymbol(c
);
641 attr
->SetBulletFont(m_symbolFontCtrl
->GetValue());
647 bool wxRichTextListStylePage::TransferDataToWindow()
649 DoTransferDataToWindow();
655 /// Just transfer to the window
656 void wxRichTextListStylePage::DoTransferDataToWindow()
660 wxPanel::TransferDataToWindow();
662 m_levelCtrl
->SetValue(m_currentLevel
);
664 wxTextAttrEx
* attr
= GetAttributesForSelection();
666 if (attr
->HasAlignment())
668 if (attr
->GetAlignment() == wxTEXT_ALIGNMENT_LEFT
)
669 m_alignmentLeft
->SetValue(true);
670 else if (attr
->GetAlignment() == wxTEXT_ALIGNMENT_RIGHT
)
671 m_alignmentRight
->SetValue(true);
672 else if (attr
->GetAlignment() == wxTEXT_ALIGNMENT_CENTRE
)
673 m_alignmentCentred
->SetValue(true);
674 else if (attr
->GetAlignment() == wxTEXT_ALIGNMENT_JUSTIFIED
)
675 m_alignmentJustified
->SetValue(true);
677 m_alignmentIndeterminate
->SetValue(true);
680 m_alignmentIndeterminate
->SetValue(true);
682 if (attr
->HasLeftIndent())
684 wxString
leftIndent(wxString::Format(wxT("%ld"), attr
->GetLeftIndent() + attr
->GetLeftSubIndent()));
685 wxString
leftFirstIndent(wxString::Format(wxT("%ld"), attr
->GetLeftIndent()));
687 m_indentLeft
->SetValue(leftIndent
);
688 m_indentLeftFirst
->SetValue(leftFirstIndent
);
692 m_indentLeft
->SetValue(wxEmptyString
);
693 m_indentLeftFirst
->SetValue(wxEmptyString
);
696 if (attr
->HasRightIndent())
698 wxString
rightIndent(wxString::Format(wxT("%ld"), attr
->GetRightIndent()));
700 m_indentRight
->SetValue(rightIndent
);
703 m_indentRight
->SetValue(wxEmptyString
);
705 if (attr
->HasParagraphSpacingAfter())
707 wxString
spacingAfter(wxString::Format(wxT("%d"), attr
->GetParagraphSpacingAfter()));
709 m_spacingAfter
->SetValue(spacingAfter
);
712 m_spacingAfter
->SetValue(wxEmptyString
);
714 if (attr
->HasParagraphSpacingBefore())
716 wxString
spacingBefore(wxString::Format(wxT("%d"), attr
->GetParagraphSpacingBefore()));
718 m_spacingBefore
->SetValue(spacingBefore
);
721 m_spacingBefore
->SetValue(wxEmptyString
);
723 if (attr
->HasLineSpacing())
727 int lineSpacing
= attr
->GetLineSpacing();
728 if (lineSpacing
== 10)
730 else if (lineSpacing
== 15)
732 else if (lineSpacing
== 20)
737 m_spacingLine
->SetSelection(index
);
740 m_spacingLine
->SetSelection(-1);
743 if (attr
->HasBulletStyle())
746 if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ARABIC
)
748 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER
)
750 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER
)
752 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER
)
754 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER
)
756 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_SYMBOL
)
758 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_BITMAP
)
760 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_STANDARD
)
762 m_styleListBox
->SetSelection(index
);
764 if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PARENTHESES
)
765 m_parenthesesCtrl
->SetValue(true);
767 m_parenthesesCtrl
->SetValue(false);
769 if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PERIOD
)
770 m_periodCtrl
->SetValue(true);
772 m_periodCtrl
->SetValue(false);
775 m_styleListBox
->SetSelection(-1);
777 if (attr
->HasBulletSymbol())
779 wxChar c
= attr
->GetBulletSymbol();
782 m_symbolCtrl
->SetValue(s
);
783 m_symbolFontCtrl
->SetValue(attr
->GetBulletFont());
786 m_symbolCtrl
->SetValue(wxEmptyString
);
788 if (attr
->HasBulletName())
789 m_bulletNameCtrl
->SetValue(attr
->GetBulletName());
791 m_bulletNameCtrl
->SetValue(wxEmptyString
);
793 m_dontUpdate
= false;
796 /// Get attributes for selected level
797 wxTextAttrEx
* wxRichTextListStylePage::GetAttributesForSelection()
799 wxRichTextListStyleDefinition
* def
= wxDynamicCast(wxRichTextFormattingDialog::GetDialogStyleDefinition(this),
800 wxRichTextListStyleDefinition
);
802 int value
= m_levelCtrl
->GetValue();
805 return def
->GetLevelAttributes(value
-1);
810 /// Just transfer from the window and update the preview
811 void wxRichTextListStylePage::TransferAndPreview()
815 TransferDataFromWindow();
822 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
825 void wxRichTextListStylePage::OnLevelUpdated( wxSpinEvent
& WXUNUSED(event
) )
829 m_currentLevel
= m_levelCtrl
->GetValue();
830 TransferDataToWindow();
835 * wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
838 void wxRichTextListStylePage::OnLevelUp( wxSpinEvent
& event
)
842 m_currentLevel
= event
.GetPosition();
843 TransferDataToWindow();
848 * wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
851 void wxRichTextListStylePage::OnLevelDown( wxSpinEvent
& event
)
855 m_currentLevel
= event
.GetPosition();
856 TransferDataToWindow();
861 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
864 void wxRichTextListStylePage::OnLevelTextUpdated( wxCommandEvent
& WXUNUSED(event
) )
866 // Can cause problems
870 m_currentLevel
= event
.GetInt();
871 TransferDataToWindow();
877 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
880 void wxRichTextListStylePage::OnLevelUIUpdate( wxUpdateUIEvent
& event
)
882 ////@begin wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL in wxRichTextListStylePage.
883 // Before editing this code, remove the block markers.
885 ////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL in wxRichTextListStylePage.
889 * wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX
892 void wxRichTextListStylePage::OnStylelistboxSelected( wxCommandEvent
& WXUNUSED(event
) )
894 TransferAndPreview();
898 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC
901 void wxRichTextListStylePage::OnSymbolstaticUpdate( wxUpdateUIEvent
& event
)
903 OnSymbolUpdate(event
);
907 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
910 void wxRichTextListStylePage::OnSymbolctrlSelected( wxCommandEvent
& WXUNUSED(event
) )
912 TransferAndPreview();
916 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
919 void wxRichTextListStylePage::OnSymbolctrlUpdated( wxCommandEvent
& WXUNUSED(event
) )
921 TransferAndPreview();
925 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
928 void wxRichTextListStylePage::OnSymbolctrlUIUpdate( wxUpdateUIEvent
& event
)
930 OnSymbolUpdate(event
);
934 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
937 void wxRichTextListStylePage::OnChooseSymbolClick( wxCommandEvent
& WXUNUSED(event
) )
939 int sel
= m_styleListBox
->GetSelection();
942 wxString symbol
= m_symbolCtrl
->GetValue();
943 wxString fontName
= m_symbolFontCtrl
->GetValue();
944 wxSymbolPickerDialog
dlg(symbol
, fontName
, fontName
, this);
946 if (dlg
.ShowModal() == wxID_OK
)
950 m_symbolCtrl
->SetValue(dlg
.GetSymbol());
951 m_symbolFontCtrl
->SetValue(dlg
.GetFontName());
953 TransferAndPreview();
955 m_dontUpdate
= false;
961 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
964 void wxRichTextListStylePage::OnChooseSymbolUpdate( wxUpdateUIEvent
& event
)
966 OnSymbolUpdate(event
);
970 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
973 void wxRichTextListStylePage::OnSymbolfontctrlSelected( wxCommandEvent
& WXUNUSED(event
) )
975 TransferAndPreview();
979 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
982 void wxRichTextListStylePage::OnSymbolfontctrlUpdated( wxCommandEvent
& WXUNUSED(event
) )
984 TransferAndPreview();
988 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
991 void wxRichTextListStylePage::OnSymbolfontctrlUIUpdate( wxUpdateUIEvent
& event
)
993 OnSymbolUpdate(event
);
997 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL
1000 void wxRichTextListStylePage::OnParenthesesctrlClick( wxCommandEvent
& WXUNUSED(event
) )
1002 TransferAndPreview();
1006 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL
1009 void wxRichTextListStylePage::OnParenthesesctrlUpdate( wxUpdateUIEvent
& event
)
1011 ////@begin wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL in wxRichTextListStylePage.
1012 // Before editing this code, remove the block markers.
1014 ////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL in wxRichTextListStylePage.
1018 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
1021 void wxRichTextListStylePage::OnPeriodctrlClick( wxCommandEvent
& WXUNUSED(event
) )
1023 TransferAndPreview();
1027 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
1030 void wxRichTextListStylePage::OnPeriodctrlUpdate( wxUpdateUIEvent
& event
)
1032 ////@begin wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL in wxRichTextListStylePage.
1033 // Before editing this code, remove the block markers.
1035 ////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL in wxRichTextListStylePage.
1039 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT
1042 void wxRichTextListStylePage::OnRichtextliststylepageAlignleftSelected( wxCommandEvent
& WXUNUSED(event
) )
1044 TransferAndPreview();
1048 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT
1051 void wxRichTextListStylePage::OnRichtextliststylepageAlignrightSelected( wxCommandEvent
& WXUNUSED(event
) )
1053 TransferAndPreview();
1057 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED
1060 void wxRichTextListStylePage::OnRichtextliststylepageJustifiedSelected( wxCommandEvent
& WXUNUSED(event
) )
1062 TransferAndPreview();
1066 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_CENTERED
1069 void wxRichTextListStylePage::OnRichtextliststylepageCenteredSelected( wxCommandEvent
& WXUNUSED(event
) )
1071 TransferAndPreview();
1075 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE
1078 void wxRichTextListStylePage::OnRichtextliststylepageAlignindeterminateSelected( wxCommandEvent
& WXUNUSED(event
) )
1080 TransferAndPreview();
1084 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT
1087 void wxRichTextListStylePage::OnIndentLeftUpdated( wxCommandEvent
& WXUNUSED(event
) )
1089 TransferAndPreview();
1093 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE
1096 void wxRichTextListStylePage::OnIndentFirstLineUpdated( wxCommandEvent
& WXUNUSED(event
) )
1098 TransferAndPreview();
1102 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT
1105 void wxRichTextListStylePage::OnIndentRightUpdated( wxCommandEvent
& WXUNUSED(event
) )
1107 TransferAndPreview();
1111 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE
1114 void wxRichTextListStylePage::OnSpacingBeforeUpdated( wxCommandEvent
& WXUNUSED(event
) )
1116 TransferAndPreview();
1120 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER
1123 void wxRichTextListStylePage::OnSpacingAfterUpdated( wxCommandEvent
& WXUNUSED(event
) )
1125 TransferAndPreview();
1129 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_LINESPACING
1132 void wxRichTextListStylePage::OnLineSpacingSelected( wxCommandEvent
& WXUNUSED(event
) )
1134 TransferAndPreview();
1138 * Should we show tooltips?
1141 bool wxRichTextListStylePage::ShowToolTips()
1143 return wxRichTextFormattingDialog::ShowToolTips();
1147 * Get bitmap resources
1150 wxBitmap
wxRichTextListStylePage::GetBitmapResource( const wxString
& name
)
1153 ////@begin wxRichTextListStylePage bitmap retrieval
1155 return wxNullBitmap
;
1156 ////@end wxRichTextListStylePage bitmap retrieval
1160 * Get icon resources
1163 wxIcon
wxRichTextListStylePage::GetIconResource( const wxString
& name
)
1166 ////@begin wxRichTextListStylePage icon retrieval
1169 ////@end wxRichTextListStylePage icon retrieval
1172 /// Update for symbol-related controls
1173 void wxRichTextListStylePage::OnSymbolUpdate( wxUpdateUIEvent
& event
)
1175 int sel
= m_styleListBox
->GetSelection();
1176 event
.Enable(sel
== 6);
1179 /// Update for number-related controls
1180 void wxRichTextListStylePage::OnNumberUpdate( wxUpdateUIEvent
& event
)
1182 int sel
= m_styleListBox
->GetSelection();
1183 event
.Enable((sel
!= 6 && sel
!= 7 && sel
!= 8 && sel
!= 0));
1186 /// Update for standard bullet-related controls
1187 void wxRichTextListStylePage::OnStandardBulletUpdate( wxUpdateUIEvent
& event
)
1189 int sel
= m_styleListBox
->GetSelection();
1190 event
.Enable( sel
== 8 );
1194 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT
1197 void wxRichTextListStylePage::OnChooseFontClick( wxCommandEvent
& WXUNUSED(event
) )
1199 wxTextAttrEx
* attr
= GetAttributesForSelection();
1201 int pages
= wxRICHTEXT_FORMAT_FONT
;
1202 wxRichTextFormattingDialog formatDlg
;
1203 formatDlg
.SetStyle(*attr
, false);
1204 formatDlg
.Create(pages
, this);
1206 if (formatDlg
.ShowModal() == wxID_OK
)
1208 (*attr
) = formatDlg
.GetAttributes();
1209 TransferAndPreview();
1213 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC
1216 void wxRichTextListStylePage::OnNamestaticUpdate( wxUpdateUIEvent
& event
)
1218 OnStandardBulletUpdate(event
);
1222 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
1225 void wxRichTextListStylePage::OnNamectrlSelected( wxCommandEvent
& WXUNUSED(event
) )
1227 TransferAndPreview();
1231 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
1234 void wxRichTextListStylePage::OnNamectrlUpdated( wxCommandEvent
& WXUNUSED(event
) )
1236 TransferAndPreview();
1240 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
1243 void wxRichTextListStylePage::OnNamectrlUIUpdate( wxUpdateUIEvent
& event
)
1245 OnStandardBulletUpdate(event
);