1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/richtext/richtextliststylepage.cpp
4 // Author: Julian Smart
6 // Created: 10/18/2006 11:36:37 AM
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #include "wx/richtext/richtextliststylepage.h"
17 * wxRichTextListStylePage type definition
20 IMPLEMENT_DYNAMIC_CLASS( wxRichTextListStylePage
, wxRichTextDialogPage
)
23 * wxRichTextListStylePage event table definition
26 BEGIN_EVENT_TABLE( wxRichTextListStylePage
, wxRichTextDialogPage
)
28 ////@begin wxRichTextListStylePage event table entries
29 EVT_SPINCTRL( ID_RICHTEXTLISTSTYLEPAGE_LEVEL
, wxRichTextListStylePage::OnLevelUpdated
)
30 EVT_SPIN_UP( ID_RICHTEXTLISTSTYLEPAGE_LEVEL
, wxRichTextListStylePage::OnLevelUp
)
31 EVT_SPIN_DOWN( ID_RICHTEXTLISTSTYLEPAGE_LEVEL
, wxRichTextListStylePage::OnLevelDown
)
32 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_LEVEL
, wxRichTextListStylePage::OnLevelTextUpdated
)
33 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_LEVEL
, wxRichTextListStylePage::OnLevelUIUpdate
)
35 EVT_BUTTON( ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT
, wxRichTextListStylePage::OnChooseFontClick
)
37 EVT_LISTBOX( ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX
, wxRichTextListStylePage::OnStylelistboxSelected
)
39 EVT_CHECKBOX( ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
, wxRichTextListStylePage::OnPeriodctrlClick
)
40 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
, wxRichTextListStylePage::OnPeriodctrlUpdate
)
42 EVT_CHECKBOX( ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL
, wxRichTextListStylePage::OnParenthesesctrlClick
)
43 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL
, wxRichTextListStylePage::OnParenthesesctrlUpdate
)
45 EVT_CHECKBOX( ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL
, wxRichTextListStylePage::OnRightParenthesisCtrlClick
)
46 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL
, wxRichTextListStylePage::OnRightParenthesisCtrlUpdate
)
48 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL
, wxRichTextListStylePage::OnBulletAlignmentCtrlSelected
)
50 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC
, wxRichTextListStylePage::OnSymbolstaticUpdate
)
52 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL
, wxRichTextListStylePage::OnSymbolctrlSelected
)
53 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL
, wxRichTextListStylePage::OnSymbolctrlUpdated
)
54 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL
, wxRichTextListStylePage::OnSymbolctrlUIUpdate
)
56 EVT_BUTTON( ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL
, wxRichTextListStylePage::OnChooseSymbolClick
)
57 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL
, wxRichTextListStylePage::OnChooseSymbolUpdate
)
59 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
, wxRichTextListStylePage::OnSymbolfontctrlSelected
)
60 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
, wxRichTextListStylePage::OnSymbolfontctrlUpdated
)
61 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
, wxRichTextListStylePage::OnSymbolfontctrlUIUpdate
)
63 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC
, wxRichTextListStylePage::OnNamestaticUpdate
)
65 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
, wxRichTextListStylePage::OnNamectrlSelected
)
66 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
, wxRichTextListStylePage::OnNamectrlUpdated
)
67 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
, wxRichTextListStylePage::OnNamectrlUIUpdate
)
69 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT
, wxRichTextListStylePage::OnRichtextliststylepageAlignleftSelected
)
71 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT
, wxRichTextListStylePage::OnRichtextliststylepageAlignrightSelected
)
73 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED
, wxRichTextListStylePage::OnRichtextliststylepageJustifiedSelected
)
75 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_CENTERED
, wxRichTextListStylePage::OnRichtextliststylepageCenteredSelected
)
77 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE
, wxRichTextListStylePage::OnRichtextliststylepageAlignindeterminateSelected
)
79 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT
, wxRichTextListStylePage::OnIndentLeftUpdated
)
81 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE
, wxRichTextListStylePage::OnIndentFirstLineUpdated
)
83 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT
, wxRichTextListStylePage::OnIndentRightUpdated
)
85 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE
, wxRichTextListStylePage::OnSpacingBeforeUpdated
)
87 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER
, wxRichTextListStylePage::OnSpacingAfterUpdated
)
89 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_LINESPACING
, wxRichTextListStylePage::OnLineSpacingSelected
)
91 ////@end wxRichTextListStylePage event table entries
95 IMPLEMENT_HELP_PROVISION(wxRichTextListStylePage
)
98 * wxRichTextListStylePage constructors
101 wxRichTextListStylePage::wxRichTextListStylePage( )
106 wxRichTextListStylePage::wxRichTextListStylePage( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
109 Create(parent
, id
, pos
, size
, style
);
113 * wxRichTextListStylePage creator
116 bool wxRichTextListStylePage::Create( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
118 ////@begin wxRichTextListStylePage creation
119 wxRichTextDialogPage::Create( parent
, id
, pos
, size
, style
);
124 GetSizer()->SetSizeHints(this);
127 ////@end wxRichTextListStylePage creation
132 * Member initialisation
135 void wxRichTextListStylePage::Init()
137 m_dontUpdate
= false;
140 ////@begin wxRichTextListStylePage member initialisation
142 m_styleListBox
= NULL
;
144 m_parenthesesCtrl
= NULL
;
145 m_rightParenthesisCtrl
= NULL
;
146 m_bulletAlignmentCtrl
= NULL
;
148 m_symbolFontCtrl
= NULL
;
149 m_bulletNameCtrl
= NULL
;
150 m_alignmentLeft
= NULL
;
151 m_alignmentRight
= NULL
;
152 m_alignmentJustified
= NULL
;
153 m_alignmentCentred
= NULL
;
154 m_alignmentIndeterminate
= NULL
;
156 m_indentLeftFirst
= NULL
;
157 m_indentRight
= NULL
;
158 m_spacingBefore
= NULL
;
159 m_spacingAfter
= NULL
;
160 m_spacingLine
= NULL
;
161 m_previewCtrl
= NULL
;
162 ////@end wxRichTextListStylePage member initialisation
166 * Control creation for wxRichTextListStylePage
169 void wxRichTextListStylePage::CreateControls()
171 ////@begin wxRichTextListStylePage content construction
172 wxRichTextListStylePage
* itemRichTextDialogPage1
= this;
174 wxBoxSizer
* itemBoxSizer2
= new wxBoxSizer(wxVERTICAL
);
175 itemRichTextDialogPage1
->SetSizer(itemBoxSizer2
);
177 wxBoxSizer
* itemBoxSizer3
= new wxBoxSizer(wxVERTICAL
);
178 itemBoxSizer2
->Add(itemBoxSizer3
, 1, wxGROW
|wxALL
, 5);
180 wxBoxSizer
* itemBoxSizer4
= new wxBoxSizer(wxHORIZONTAL
);
181 itemBoxSizer3
->Add(itemBoxSizer4
, 0, wxALIGN_CENTER_HORIZONTAL
, 5);
183 wxStaticText
* itemStaticText5
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("&List level:"), wxDefaultPosition
, wxDefaultSize
, 0 );
184 itemBoxSizer4
->Add(itemStaticText5
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
186 m_levelCtrl
= new wxSpinCtrl( itemRichTextDialogPage1
, ID_RICHTEXTLISTSTYLEPAGE_LEVEL
, wxT("1"), wxDefaultPosition
, wxSize(60, -1), wxSP_ARROW_KEYS
, 1, 10, 1 );
187 m_levelCtrl
->SetHelpText(_("Selects the list level to edit."));
188 if (wxRichTextListStylePage::ShowToolTips())
189 m_levelCtrl
->SetToolTip(_("Selects the list level to edit."));
190 itemBoxSizer4
->Add(m_levelCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
192 itemBoxSizer4
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
194 wxButton
* itemButton8
= new wxButton( itemRichTextDialogPage1
, ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT
, _("&Font for Level..."), wxDefaultPosition
, wxDefaultSize
, 0 );
195 itemButton8
->SetHelpText(_("Click to choose the font for this level."));
196 if (wxRichTextListStylePage::ShowToolTips())
197 itemButton8
->SetToolTip(_("Click to choose the font for this level."));
198 itemBoxSizer4
->Add(itemButton8
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
200 wxNotebook
* itemNotebook9
= new wxNotebook( itemRichTextDialogPage1
, ID_RICHTEXTLISTSTYLEPAGE_NOTEBOOK
, wxDefaultPosition
, wxDefaultSize
, wxBK_DEFAULT
|wxBK_TOP
);
202 wxPanel
* itemPanel10
= new wxPanel( itemNotebook9
, ID_RICHTEXTLISTSTYLEPAGE_BULLETS
, wxDefaultPosition
, wxDefaultSize
, wxNO_BORDER
|wxTAB_TRAVERSAL
);
203 wxBoxSizer
* itemBoxSizer11
= new wxBoxSizer(wxVERTICAL
);
204 itemPanel10
->SetSizer(itemBoxSizer11
);
206 wxBoxSizer
* itemBoxSizer12
= new wxBoxSizer(wxHORIZONTAL
);
207 itemBoxSizer11
->Add(itemBoxSizer12
, 1, wxGROW
, 5);
208 wxBoxSizer
* itemBoxSizer13
= new wxBoxSizer(wxVERTICAL
);
209 itemBoxSizer12
->Add(itemBoxSizer13
, 0, wxGROW
, 5);
210 wxStaticText
* itemStaticText14
= new wxStaticText( itemPanel10
, wxID_STATIC
, _("&Bullet style:"), wxDefaultPosition
, wxDefaultSize
, 0 );
211 itemBoxSizer13
->Add(itemStaticText14
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
, 5);
213 wxArrayString m_styleListBoxStrings
;
214 m_styleListBox
= new wxListBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX
, wxDefaultPosition
, wxSize(-1, 80), m_styleListBoxStrings
, wxLB_SINGLE
);
215 m_styleListBox
->SetHelpText(_("The available bullet styles."));
216 if (wxRichTextListStylePage::ShowToolTips())
217 m_styleListBox
->SetToolTip(_("The available bullet styles."));
218 itemBoxSizer13
->Add(m_styleListBox
, 1, wxGROW
|wxALL
, 5);
220 wxBoxSizer
* itemBoxSizer16
= new wxBoxSizer(wxHORIZONTAL
);
221 itemBoxSizer13
->Add(itemBoxSizer16
, 0, wxGROW
, 5);
222 m_periodCtrl
= new wxCheckBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
, _("Peri&od"), wxDefaultPosition
, wxDefaultSize
, 0 );
223 m_periodCtrl
->SetValue(false);
224 m_periodCtrl
->SetHelpText(_("Check to add a period after the bullet."));
225 if (wxRichTextListStylePage::ShowToolTips())
226 m_periodCtrl
->SetToolTip(_("Check to add a period after the bullet."));
227 itemBoxSizer16
->Add(m_periodCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
229 m_parenthesesCtrl
= new wxCheckBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL
, _("(*)"), wxDefaultPosition
, wxDefaultSize
, 0 );
230 m_parenthesesCtrl
->SetValue(false);
231 m_parenthesesCtrl
->SetHelpText(_("Check to enclose the bullet in parentheses."));
232 if (wxRichTextListStylePage::ShowToolTips())
233 m_parenthesesCtrl
->SetToolTip(_("Check to enclose the bullet in parentheses."));
234 itemBoxSizer16
->Add(m_parenthesesCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
236 m_rightParenthesisCtrl
= new wxCheckBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL
, _("*)"), wxDefaultPosition
, wxDefaultSize
, 0 );
237 m_rightParenthesisCtrl
->SetValue(false);
238 m_rightParenthesisCtrl
->SetHelpText(_("Check to add a right parenthesis."));
239 if (wxRichTextListStylePage::ShowToolTips())
240 m_rightParenthesisCtrl
->SetToolTip(_("Check to add a right parenthesis."));
241 itemBoxSizer16
->Add(m_rightParenthesisCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
243 itemBoxSizer13
->Add(2, 1, 0, wxALIGN_CENTER_HORIZONTAL
, 5);
245 wxStaticText
* itemStaticText21
= new wxStaticText( itemPanel10
, wxID_STATIC
, _("Bullet &Alignment:"), wxDefaultPosition
, wxDefaultSize
, 0 );
246 itemBoxSizer13
->Add(itemStaticText21
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
, 5);
248 wxArrayString m_bulletAlignmentCtrlStrings
;
249 m_bulletAlignmentCtrlStrings
.Add(_("Left"));
250 m_bulletAlignmentCtrlStrings
.Add(_("Centre"));
251 m_bulletAlignmentCtrlStrings
.Add(_("Right"));
252 m_bulletAlignmentCtrl
= new wxComboBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL
, _("Left"), wxDefaultPosition
, wxSize(60, -1), m_bulletAlignmentCtrlStrings
, wxCB_READONLY
);
253 m_bulletAlignmentCtrl
->SetStringSelection(_("Left"));
254 m_bulletAlignmentCtrl
->SetHelpText(_("The bullet character."));
255 if (wxRichTextListStylePage::ShowToolTips())
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
, 5);
271 wxBoxSizer
* itemBoxSizer28
= new wxBoxSizer(wxHORIZONTAL
);
272 itemBoxSizer26
->Add(itemBoxSizer28
, 0, wxGROW
, 5);
273 wxArrayString m_symbolCtrlStrings
;
274 m_symbolCtrl
= new wxComboBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL
, wxEmptyString
, wxDefaultPosition
, wxSize(60, -1), m_symbolCtrlStrings
, wxCB_DROPDOWN
);
275 m_symbolCtrl
->SetHelpText(_("The bullet character."));
276 if (wxRichTextListStylePage::ShowToolTips())
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."));
282 if (wxRichTextListStylePage::ShowToolTips())
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
, 5);
291 wxArrayString m_symbolFontCtrlStrings
;
292 m_symbolFontCtrl
= new wxComboBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
, wxEmptyString
, wxDefaultPosition
, wxDefaultSize
, m_symbolFontCtrlStrings
, wxCB_DROPDOWN
);
293 if (wxRichTextListStylePage::ShowToolTips())
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
, 5);
302 wxArrayString m_bulletNameCtrlStrings
;
303 m_bulletNameCtrl
= new wxComboBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
, wxEmptyString
, wxDefaultPosition
, wxDefaultSize
, m_bulletNameCtrlStrings
, wxCB_DROPDOWN
);
304 m_bulletNameCtrl
->SetHelpText(_("A standard bullet name."));
305 if (wxRichTextListStylePage::ShowToolTips())
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
, 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."));
331 if (wxRichTextListStylePage::ShowToolTips())
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."));
338 if (wxRichTextListStylePage::ShowToolTips())
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."));
345 if (wxRichTextListStylePage::ShowToolTips())
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."));
352 if (wxRichTextListStylePage::ShowToolTips())
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."));
359 if (wxRichTextListStylePage::ShowToolTips())
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
, 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(0, 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
, 5);
384 m_indentLeft
= new wxTextCtrl( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT
, wxEmptyString
, wxDefaultPosition
, wxSize(50, -1), 0 );
385 m_indentLeft
->SetHelpText(_("The left indent."));
386 if (wxRichTextListStylePage::ShowToolTips())
387 m_indentLeft
->SetToolTip(_("The left indent."));
388 itemFlexGridSizer57
->Add(m_indentLeft
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
390 wxStaticText
* itemStaticText60
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("Left (&first line):"), wxDefaultPosition
, wxDefaultSize
, 0 );
391 itemFlexGridSizer57
->Add(itemStaticText60
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
393 m_indentLeftFirst
= new wxTextCtrl( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE
, wxEmptyString
, wxDefaultPosition
, wxSize(50, -1), 0 );
394 m_indentLeftFirst
->SetHelpText(_("The first line indent."));
395 if (wxRichTextListStylePage::ShowToolTips())
396 m_indentLeftFirst
->SetToolTip(_("The first line indent."));
397 itemFlexGridSizer57
->Add(m_indentLeftFirst
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
399 wxStaticText
* itemStaticText62
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("&Right:"), wxDefaultPosition
, wxDefaultSize
, 0 );
400 itemFlexGridSizer57
->Add(itemStaticText62
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
402 m_indentRight
= new wxTextCtrl( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT
, wxEmptyString
, wxDefaultPosition
, wxSize(50, -1), 0 );
403 m_indentRight
->SetHelpText(_("The right indent."));
404 if (wxRichTextListStylePage::ShowToolTips())
405 m_indentRight
->SetToolTip(_("The right indent."));
406 itemFlexGridSizer57
->Add(m_indentRight
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
408 itemBoxSizer39
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
410 wxStaticLine
* itemStaticLine65
= new wxStaticLine( itemPanel37
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_VERTICAL
);
411 itemBoxSizer39
->Add(itemStaticLine65
, 0, wxGROW
|wxTOP
|wxBOTTOM
, 5);
413 itemBoxSizer39
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
415 wxBoxSizer
* itemBoxSizer67
= new wxBoxSizer(wxVERTICAL
);
416 itemBoxSizer39
->Add(itemBoxSizer67
, 0, wxGROW
, 5);
417 wxStaticText
* itemStaticText68
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("&Spacing (tenths of a mm)"), wxDefaultPosition
, wxDefaultSize
, 0 );
418 itemBoxSizer67
->Add(itemStaticText68
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
, 5);
420 wxBoxSizer
* itemBoxSizer69
= new wxBoxSizer(wxHORIZONTAL
);
421 itemBoxSizer67
->Add(itemBoxSizer69
, 0, wxALIGN_LEFT
|wxALL
, 5);
422 itemBoxSizer69
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
, 5);
424 wxFlexGridSizer
* itemFlexGridSizer71
= new wxFlexGridSizer(0, 2, 0, 0);
425 itemBoxSizer69
->Add(itemFlexGridSizer71
, 0, wxALIGN_CENTER_VERTICAL
, 5);
426 wxStaticText
* itemStaticText72
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("Before a paragraph:"), wxDefaultPosition
, wxDefaultSize
, 0 );
427 itemFlexGridSizer71
->Add(itemStaticText72
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
429 m_spacingBefore
= new wxTextCtrl( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE
, wxEmptyString
, wxDefaultPosition
, wxSize(50, -1), 0 );
430 m_spacingBefore
->SetHelpText(_("The spacing before the paragraph."));
431 if (wxRichTextListStylePage::ShowToolTips())
432 m_spacingBefore
->SetToolTip(_("The spacing before the paragraph."));
433 itemFlexGridSizer71
->Add(m_spacingBefore
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
435 wxStaticText
* itemStaticText74
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("After a paragraph:"), wxDefaultPosition
, wxDefaultSize
, 0 );
436 itemFlexGridSizer71
->Add(itemStaticText74
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
438 m_spacingAfter
= new wxTextCtrl( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER
, wxEmptyString
, wxDefaultPosition
, wxSize(50, -1), 0 );
439 m_spacingAfter
->SetHelpText(_("The spacing after the paragraph."));
440 if (wxRichTextListStylePage::ShowToolTips())
441 m_spacingAfter
->SetToolTip(_("The spacing after the paragraph."));
442 itemFlexGridSizer71
->Add(m_spacingAfter
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
444 wxStaticText
* itemStaticText76
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("Line spacing:"), wxDefaultPosition
, wxDefaultSize
, 0 );
445 itemFlexGridSizer71
->Add(itemStaticText76
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
447 wxArrayString m_spacingLineStrings
;
448 m_spacingLineStrings
.Add(_("(none)"));
449 m_spacingLineStrings
.Add(_("Single"));
450 m_spacingLineStrings
.Add(_("1.1"));
451 m_spacingLineStrings
.Add(_("1.2"));
452 m_spacingLineStrings
.Add(_("1.3"));
453 m_spacingLineStrings
.Add(_("1.4"));
454 m_spacingLineStrings
.Add(_("1.5"));
455 m_spacingLineStrings
.Add(_("1.6"));
456 m_spacingLineStrings
.Add(_("1.7"));
457 m_spacingLineStrings
.Add(_("1.8"));
458 m_spacingLineStrings
.Add(_("1.9"));
459 m_spacingLineStrings
.Add(_("2"));
460 m_spacingLine
= new wxComboBox( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_LINESPACING
, _("(none)"), wxDefaultPosition
, wxSize(85, -1), m_spacingLineStrings
, wxCB_READONLY
);
461 m_spacingLine
->SetStringSelection(_("(none)"));
462 m_spacingLine
->SetHelpText(_("The line spacing."));
463 if (wxRichTextListStylePage::ShowToolTips())
464 m_spacingLine
->SetToolTip(_("The line spacing."));
465 itemFlexGridSizer71
->Add(m_spacingLine
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
467 itemNotebook9
->AddPage(itemPanel37
, _("Spacing"));
469 itemBoxSizer3
->Add(itemNotebook9
, 0, wxGROW
|wxALL
, 5);
471 m_previewCtrl
= new wxRichTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXTLISTSTYLEPAGE_RICHTEXTCTRL
, wxEmptyString
, wxDefaultPosition
, wxSize(350, 140), wxBORDER_THEME
|wxVSCROLL
|wxTE_READONLY
);
472 m_previewCtrl
->SetHelpText(_("Shows a preview of the bullet settings."));
473 if (wxRichTextListStylePage::ShowToolTips())
474 m_previewCtrl
->SetToolTip(_("Shows a preview of the bullet settings."));
475 itemBoxSizer3
->Add(m_previewCtrl
, 0, wxGROW
|wxALL
, 5);
477 ////@end wxRichTextListStylePage content construction
481 m_styleListBox
->Append(_("(None)"));
482 m_styleListBox
->Append(_("Arabic"));
483 m_styleListBox
->Append(_("Upper case letters"));
484 m_styleListBox
->Append(_("Lower case letters"));
485 m_styleListBox
->Append(_("Upper case roman numerals"));
486 m_styleListBox
->Append(_("Lower case roman numerals"));
487 m_styleListBox
->Append(_("Numbered outline"));
488 m_styleListBox
->Append(_("Symbol"));
489 m_styleListBox
->Append(_("Bitmap"));
490 m_styleListBox
->Append(_("Standard"));
492 m_symbolCtrl
->Append(_("*"));
493 m_symbolCtrl
->Append(_("-"));
494 m_symbolCtrl
->Append(_(">"));
495 m_symbolCtrl
->Append(_("+"));
496 m_symbolCtrl
->Append(_("~"));
498 wxArrayString standardBulletNames
;
499 if (wxRichTextBuffer::GetRenderer())
500 wxRichTextBuffer::GetRenderer()->EnumerateStandardBulletNames(standardBulletNames
);
502 m_bulletNameCtrl
->Append(standardBulletNames
);
503 wxArrayString facenames
= wxRichTextCtrl::GetAvailableFontNames();
506 m_symbolFontCtrl
->Append(facenames
);
508 m_levelCtrl
->SetValue(m_currentLevel
);
510 m_dontUpdate
= false;
513 /// Updates the font preview
514 void wxRichTextListStylePage::UpdatePreview()
516 static const wxChar
* s_para1
= wxT("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \
517 Nullam ante sapien, vestibulum nonummy, pulvinar sed, luctus ut, lacus.\n");
519 static const wxChar
* s_para2
= wxT("Duis pharetra consequat dui. Nullam vitae justo id mauris lobortis interdum.\n");
521 static const wxChar
* s_para3
= wxT("Integer convallis dolor at augue \
522 iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
524 wxRichTextListStyleDefinition
* def
= wxDynamicCast(wxRichTextFormattingDialog::GetDialogStyleDefinition(this),
525 wxRichTextListStyleDefinition
);
527 wxRichTextStyleSheet
* styleSheet
= wxRichTextFormattingDialog::GetDialog(this)->GetStyleSheet();
529 wxRichTextAttr
attr((const wxRichTextAttr
&)(styleSheet
? def
->GetStyle() : def
->GetStyleMergedWithBase(styleSheet
)));
531 attr
.SetFlags(attr
.GetFlags() &
532 (wxTEXT_ATTR_ALIGNMENT
|wxTEXT_ATTR_LEFT_INDENT
|wxTEXT_ATTR_RIGHT_INDENT
|wxTEXT_ATTR_PARA_SPACING_BEFORE
|wxTEXT_ATTR_PARA_SPACING_AFTER
|
533 wxTEXT_ATTR_LINE_SPACING
|
534 wxTEXT_ATTR_BULLET_STYLE
|wxTEXT_ATTR_BULLET_NUMBER
|wxTEXT_ATTR_BULLET_TEXT
));
536 wxFont
font(m_previewCtrl
->GetFont());
537 font
.SetPointSize(9);
538 m_previewCtrl
->SetFont(font
);
540 wxRichTextAttr normalParaAttr
;
541 normalParaAttr
.SetFont(font
);
542 normalParaAttr
.SetTextColour(wxColour(wxT("LIGHT GREY")));
544 m_previewCtrl
->Freeze();
545 m_previewCtrl
->Clear();
547 m_previewCtrl
->BeginStyle(normalParaAttr
);
548 m_previewCtrl
->WriteText(s_para1
);
549 m_previewCtrl
->EndStyle();
551 m_previewCtrl
->BeginStyle(attr
);
552 long listStart
= m_previewCtrl
->GetInsertionPoint() + 1;
555 for (i
= 0; i
< 10; i
++)
557 wxRichTextAttr levelAttr
= * def
->GetLevelAttributes(i
);
558 levelAttr
.SetBulletNumber(1);
559 m_previewCtrl
->BeginStyle(levelAttr
);
560 m_previewCtrl
->WriteText(wxString::Format(wxT("List level %d. "), i
+1) + s_para2
);
561 m_previewCtrl
->EndStyle();
563 m_previewCtrl
->EndStyle();
564 long listEnd
= m_previewCtrl
->GetInsertionPoint();
566 m_previewCtrl
->BeginStyle(normalParaAttr
);
567 m_previewCtrl
->WriteText(s_para3
);
568 m_previewCtrl
->EndStyle();
570 m_previewCtrl
->NumberList(wxRichTextRange(listStart
, listEnd
), def
);
572 m_previewCtrl
->Thaw();
575 /// Transfer data from/to window
576 bool wxRichTextListStylePage::TransferDataFromWindow()
578 wxPanel::TransferDataFromWindow();
580 m_currentLevel
= m_levelCtrl
->GetValue();
582 wxRichTextAttr
* attr
= GetAttributesForSelection();
584 if (m_alignmentLeft
->GetValue())
585 attr
->SetAlignment(wxTEXT_ALIGNMENT_LEFT
);
586 else if (m_alignmentCentred
->GetValue())
587 attr
->SetAlignment(wxTEXT_ALIGNMENT_CENTRE
);
588 else if (m_alignmentRight
->GetValue())
589 attr
->SetAlignment(wxTEXT_ALIGNMENT_RIGHT
);
590 else if (m_alignmentJustified
->GetValue())
591 attr
->SetAlignment(wxTEXT_ALIGNMENT_JUSTIFIED
);
594 attr
->SetAlignment(wxTEXT_ALIGNMENT_DEFAULT
);
595 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_ALIGNMENT
));
598 wxString
leftIndent(m_indentLeft
->GetValue());
599 wxString
leftFirstIndent(m_indentLeftFirst
->GetValue());
600 if (!leftIndent
.empty())
602 int visualLeftIndent
= wxAtoi(leftIndent
);
603 int visualLeftFirstIndent
= wxAtoi(leftFirstIndent
);
604 int actualLeftIndent
= visualLeftFirstIndent
;
605 int actualLeftSubIndent
= visualLeftIndent
- visualLeftFirstIndent
;
607 attr
->SetLeftIndent(actualLeftIndent
, actualLeftSubIndent
);
610 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_LEFT_INDENT
));
612 wxString
rightIndent(m_indentRight
->GetValue());
613 if (!rightIndent
.empty())
614 attr
->SetRightIndent(wxAtoi(rightIndent
));
616 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_RIGHT_INDENT
));
618 wxString
spacingAfter(m_spacingAfter
->GetValue());
619 if (!spacingAfter
.empty())
620 attr
->SetParagraphSpacingAfter(wxAtoi(spacingAfter
));
622 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_PARA_SPACING_AFTER
));
624 wxString
spacingBefore(m_spacingBefore
->GetValue());
625 if (!spacingBefore
.empty())
626 attr
->SetParagraphSpacingBefore(wxAtoi(spacingBefore
));
628 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_PARA_SPACING_BEFORE
));
630 int spacingIndex
= m_spacingLine
->GetSelection() - 1;
632 if (spacingIndex
> -1)
633 lineSpacing
= 10 + spacingIndex
;
635 if (lineSpacing
== 0)
636 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_LINE_SPACING
));
638 attr
->SetLineSpacing(lineSpacing
);
641 // if (m_hasBulletStyle)
643 long bulletStyle
= 0;
645 int index
= m_styleListBox
->GetSelection();
646 if (index
== wxRICHTEXT_BULLETINDEX_ARABIC
)
647 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_ARABIC
;
649 else if (index
== wxRICHTEXT_BULLETINDEX_UPPER_CASE
)
650 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER
;
652 else if (index
== wxRICHTEXT_BULLETINDEX_LOWER_CASE
)
653 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER
;
655 else if (index
== wxRICHTEXT_BULLETINDEX_UPPER_CASE_ROMAN
)
656 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER
;
658 else if (index
== wxRICHTEXT_BULLETINDEX_LOWER_CASE_ROMAN
)
659 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER
;
661 else if (index
== wxRICHTEXT_BULLETINDEX_OUTLINE
)
662 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_OUTLINE
;
664 else if (index
== wxRICHTEXT_BULLETINDEX_SYMBOL
)
665 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_SYMBOL
;
667 else if (index
== wxRICHTEXT_BULLETINDEX_BITMAP
)
669 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_BITMAP
;
670 if (m_bulletNameCtrl
->GetValue().IsEmpty())
671 attr
->SetFlags(attr
->GetFlags() & ~wxTEXT_ATTR_BULLET_NAME
);
673 attr
->SetBulletName(m_bulletNameCtrl
->GetValue());
676 else if (index
== wxRICHTEXT_BULLETINDEX_STANDARD
)
678 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_STANDARD
;
679 attr
->SetBulletName(m_bulletNameCtrl
->GetValue());
682 if (m_parenthesesCtrl
->GetValue())
683 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_PARENTHESES
;
684 if (m_rightParenthesisCtrl
->GetValue())
685 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS
;
686 if (m_periodCtrl
->GetValue())
687 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_PERIOD
;
689 if (m_bulletAlignmentCtrl
->GetSelection() == 1)
690 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE
;
691 else if (m_bulletAlignmentCtrl
->GetSelection() == 2)
692 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT
;
695 attr
->SetBulletStyle(bulletStyle
);
698 // if (m_hasBulletSymbol)
700 attr
->SetBulletText(m_symbolCtrl
->GetValue());
701 attr
->SetBulletFont(m_symbolFontCtrl
->GetValue());
707 bool wxRichTextListStylePage::TransferDataToWindow()
709 DoTransferDataToWindow();
715 /// Just transfer to the window
716 void wxRichTextListStylePage::DoTransferDataToWindow()
720 wxPanel::TransferDataToWindow();
722 wxRichTextAttr
* attr
= GetAttributesForSelection();
724 if (attr
->HasAlignment())
726 if (attr
->GetAlignment() == wxTEXT_ALIGNMENT_LEFT
)
727 m_alignmentLeft
->SetValue(true);
728 else if (attr
->GetAlignment() == wxTEXT_ALIGNMENT_RIGHT
)
729 m_alignmentRight
->SetValue(true);
730 else if (attr
->GetAlignment() == wxTEXT_ALIGNMENT_CENTRE
)
731 m_alignmentCentred
->SetValue(true);
732 else if (attr
->GetAlignment() == wxTEXT_ALIGNMENT_JUSTIFIED
)
733 m_alignmentJustified
->SetValue(true);
735 m_alignmentIndeterminate
->SetValue(true);
738 m_alignmentIndeterminate
->SetValue(true);
740 if (attr
->HasLeftIndent())
742 wxString
leftIndent(wxString::Format(wxT("%ld"), attr
->GetLeftIndent() + attr
->GetLeftSubIndent()));
743 wxString
leftFirstIndent(wxString::Format(wxT("%ld"), attr
->GetLeftIndent()));
745 m_indentLeft
->SetValue(leftIndent
);
746 m_indentLeftFirst
->SetValue(leftFirstIndent
);
750 m_indentLeft
->SetValue(wxEmptyString
);
751 m_indentLeftFirst
->SetValue(wxEmptyString
);
754 if (attr
->HasRightIndent())
756 wxString
rightIndent(wxString::Format(wxT("%ld"), attr
->GetRightIndent()));
758 m_indentRight
->SetValue(rightIndent
);
761 m_indentRight
->SetValue(wxEmptyString
);
763 if (attr
->HasParagraphSpacingAfter())
765 wxString
spacingAfter(wxString::Format(wxT("%d"), attr
->GetParagraphSpacingAfter()));
767 m_spacingAfter
->SetValue(spacingAfter
);
770 m_spacingAfter
->SetValue(wxEmptyString
);
772 if (attr
->HasParagraphSpacingBefore())
774 wxString
spacingBefore(wxString::Format(wxT("%d"), attr
->GetParagraphSpacingBefore()));
776 m_spacingBefore
->SetValue(spacingBefore
);
779 m_spacingBefore
->SetValue(wxEmptyString
);
781 if (attr
->HasLineSpacing())
785 int lineSpacing
= attr
->GetLineSpacing();
786 if (lineSpacing
>= 10 && lineSpacing
<= 20)
787 index
= (lineSpacing
- 10) + 1;
791 m_spacingLine
->SetSelection(index
);
794 m_spacingLine
->SetSelection(0);
797 if (attr
->HasBulletStyle())
800 if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ARABIC
)
801 index
= wxRICHTEXT_BULLETINDEX_ARABIC
;
803 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER
)
804 index
= wxRICHTEXT_BULLETINDEX_UPPER_CASE
;
806 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER
)
807 index
= wxRICHTEXT_BULLETINDEX_LOWER_CASE
;
809 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER
)
810 index
= wxRICHTEXT_BULLETINDEX_UPPER_CASE_ROMAN
;
812 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER
)
813 index
= wxRICHTEXT_BULLETINDEX_LOWER_CASE_ROMAN
;
815 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_OUTLINE
)
816 index
= wxRICHTEXT_BULLETINDEX_OUTLINE
;
818 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_SYMBOL
)
819 index
= wxRICHTEXT_BULLETINDEX_SYMBOL
;
821 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_BITMAP
)
822 index
= wxRICHTEXT_BULLETINDEX_BITMAP
;
824 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_STANDARD
)
825 index
= wxRICHTEXT_BULLETINDEX_STANDARD
;
827 m_styleListBox
->SetSelection(index
);
829 if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PARENTHESES
)
830 m_parenthesesCtrl
->SetValue(true);
832 m_parenthesesCtrl
->SetValue(false);
834 if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS
)
835 m_rightParenthesisCtrl
->SetValue(true);
837 m_rightParenthesisCtrl
->SetValue(false);
839 if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PERIOD
)
840 m_periodCtrl
->SetValue(true);
842 m_periodCtrl
->SetValue(false);
844 if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE
)
845 m_bulletAlignmentCtrl
->SetSelection(1);
846 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT
)
847 m_bulletAlignmentCtrl
->SetSelection(2);
849 m_bulletAlignmentCtrl
->SetSelection(0);
853 m_styleListBox
->SetSelection(-1);
854 m_bulletAlignmentCtrl
->SetSelection(-1);
857 if (attr
->HasBulletText())
859 m_symbolCtrl
->SetValue(attr
->GetBulletText());
860 m_symbolFontCtrl
->SetValue(attr
->GetBulletFont());
863 m_symbolCtrl
->SetValue(wxEmptyString
);
865 if (attr
->HasBulletName())
866 m_bulletNameCtrl
->SetValue(attr
->GetBulletName());
868 m_bulletNameCtrl
->SetValue(wxEmptyString
);
870 m_dontUpdate
= false;
873 /// Get attributes for selected level
874 wxRichTextAttr
* wxRichTextListStylePage::GetAttributesForSelection()
876 wxRichTextListStyleDefinition
* def
= wxDynamicCast(wxRichTextFormattingDialog::GetDialogStyleDefinition(this),
877 wxRichTextListStyleDefinition
);
879 int value
= m_levelCtrl
->GetValue();
882 return def
->GetLevelAttributes(value
-1);
887 /// Just transfer from the window and update the preview
888 void wxRichTextListStylePage::TransferAndPreview()
892 TransferDataFromWindow();
899 * wxEVT_SPINCTRL event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
902 void wxRichTextListStylePage::OnLevelUpdated( wxSpinEvent
& WXUNUSED(event
) )
906 m_currentLevel
= m_levelCtrl
->GetValue();
907 TransferDataToWindow();
912 * wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
915 void wxRichTextListStylePage::OnLevelUp( wxSpinEvent
& event
)
919 m_currentLevel
= event
.GetPosition();
920 TransferDataToWindow();
925 * wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
928 void wxRichTextListStylePage::OnLevelDown( wxSpinEvent
& event
)
932 m_currentLevel
= event
.GetPosition();
933 TransferDataToWindow();
938 * wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
941 void wxRichTextListStylePage::OnLevelTextUpdated( wxCommandEvent
& WXUNUSED(event
) )
943 // Can cause problems
947 m_currentLevel
= event
.GetInt();
948 TransferDataToWindow();
954 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
957 void wxRichTextListStylePage::OnLevelUIUpdate( wxUpdateUIEvent
& event
)
959 ////@begin wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL in wxRichTextListStylePage.
960 // Before editing this code, remove the block markers.
962 ////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL in wxRichTextListStylePage.
966 * wxEVT_LISTBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX
969 void wxRichTextListStylePage::OnStylelistboxSelected( wxCommandEvent
& WXUNUSED(event
) )
971 TransferAndPreview();
975 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC
978 void wxRichTextListStylePage::OnSymbolstaticUpdate( wxUpdateUIEvent
& event
)
980 OnSymbolUpdate(event
);
984 * wxEVT_COMBOBOX event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
987 void wxRichTextListStylePage::OnSymbolctrlSelected( wxCommandEvent
& WXUNUSED(event
) )
989 TransferAndPreview();
993 * wxEVT_TEXT event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
996 void wxRichTextListStylePage::OnSymbolctrlUpdated( wxCommandEvent
& WXUNUSED(event
) )
998 TransferAndPreview();
1002 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
1005 void wxRichTextListStylePage::OnSymbolctrlUIUpdate( wxUpdateUIEvent
& event
)
1007 OnSymbolUpdate(event
);
1011 * wxEVT_BUTTON event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
1014 void wxRichTextListStylePage::OnChooseSymbolClick( wxCommandEvent
& WXUNUSED(event
) )
1016 int sel
= m_styleListBox
->GetSelection();
1017 if (sel
== wxRICHTEXT_BULLETINDEX_SYMBOL
)
1019 wxString symbol
= m_symbolCtrl
->GetValue();
1020 wxString fontName
= m_symbolFontCtrl
->GetValue();
1021 wxSymbolPickerDialog
dlg(symbol
, fontName
, fontName
, this);
1023 if (dlg
.ShowModal() == wxID_OK
)
1025 m_dontUpdate
= true;
1027 m_symbolCtrl
->SetValue(dlg
.GetSymbol());
1028 m_symbolFontCtrl
->SetValue(dlg
.GetFontName());
1030 TransferAndPreview();
1032 m_dontUpdate
= false;
1038 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
1041 void wxRichTextListStylePage::OnChooseSymbolUpdate( wxUpdateUIEvent
& event
)
1043 OnSymbolUpdate(event
);
1047 * wxEVT_COMBOBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
1050 void wxRichTextListStylePage::OnSymbolfontctrlSelected( wxCommandEvent
& WXUNUSED(event
) )
1052 TransferAndPreview();
1056 * wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
1059 void wxRichTextListStylePage::OnSymbolfontctrlUpdated( wxCommandEvent
& WXUNUSED(event
) )
1061 TransferAndPreview();
1065 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
1068 void wxRichTextListStylePage::OnSymbolfontctrlUIUpdate( wxUpdateUIEvent
& event
)
1070 OnSymbolUpdate(event
);
1074 * wxEVT_CHECKBOX event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL
1077 void wxRichTextListStylePage::OnParenthesesctrlClick( wxCommandEvent
& WXUNUSED(event
) )
1079 TransferAndPreview();
1083 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL
1086 void wxRichTextListStylePage::OnParenthesesctrlUpdate( wxUpdateUIEvent
& event
)
1088 int sel
= m_styleListBox
->GetSelection();
1089 event
.Enable((sel
!= wxRICHTEXT_BULLETINDEX_SYMBOL
&&
1090 sel
!= wxRICHTEXT_BULLETINDEX_BITMAP
&&
1091 sel
!= wxRICHTEXT_BULLETINDEX_NONE
));
1095 * wxEVT_CHECKBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
1098 void wxRichTextListStylePage::OnPeriodctrlClick( wxCommandEvent
& WXUNUSED(event
) )
1100 TransferAndPreview();
1104 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
1107 void wxRichTextListStylePage::OnPeriodctrlUpdate( wxUpdateUIEvent
& event
)
1109 int sel
= m_styleListBox
->GetSelection();
1110 event
.Enable((sel
!= wxRICHTEXT_BULLETINDEX_SYMBOL
&&
1111 sel
!= wxRICHTEXT_BULLETINDEX_BITMAP
&&
1112 sel
!= wxRICHTEXT_BULLETINDEX_NONE
));
1116 * wxEVT_RADIOBUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT
1119 void wxRichTextListStylePage::OnRichtextliststylepageAlignleftSelected( wxCommandEvent
& WXUNUSED(event
) )
1121 TransferAndPreview();
1125 * wxEVT_RADIOBUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT
1128 void wxRichTextListStylePage::OnRichtextliststylepageAlignrightSelected( wxCommandEvent
& WXUNUSED(event
) )
1130 TransferAndPreview();
1134 * wxEVT_RADIOBUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED
1137 void wxRichTextListStylePage::OnRichtextliststylepageJustifiedSelected( wxCommandEvent
& WXUNUSED(event
) )
1139 TransferAndPreview();
1143 * wxEVT_RADIOBUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_CENTERED
1146 void wxRichTextListStylePage::OnRichtextliststylepageCenteredSelected( wxCommandEvent
& WXUNUSED(event
) )
1148 TransferAndPreview();
1152 * wxEVT_RADIOBUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE
1155 void wxRichTextListStylePage::OnRichtextliststylepageAlignindeterminateSelected( wxCommandEvent
& WXUNUSED(event
) )
1157 TransferAndPreview();
1161 * wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT
1164 void wxRichTextListStylePage::OnIndentLeftUpdated( wxCommandEvent
& WXUNUSED(event
) )
1166 TransferAndPreview();
1170 * wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE
1173 void wxRichTextListStylePage::OnIndentFirstLineUpdated( wxCommandEvent
& WXUNUSED(event
) )
1175 TransferAndPreview();
1179 * wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT
1182 void wxRichTextListStylePage::OnIndentRightUpdated( wxCommandEvent
& WXUNUSED(event
) )
1184 TransferAndPreview();
1188 * wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE
1191 void wxRichTextListStylePage::OnSpacingBeforeUpdated( wxCommandEvent
& WXUNUSED(event
) )
1193 TransferAndPreview();
1197 * wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER
1200 void wxRichTextListStylePage::OnSpacingAfterUpdated( wxCommandEvent
& WXUNUSED(event
) )
1202 TransferAndPreview();
1206 * wxEVT_COMBOBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_LINESPACING
1209 void wxRichTextListStylePage::OnLineSpacingSelected( wxCommandEvent
& WXUNUSED(event
) )
1211 TransferAndPreview();
1215 * Should we show tooltips?
1218 bool wxRichTextListStylePage::ShowToolTips()
1220 return wxRichTextFormattingDialog::ShowToolTips();
1224 * Get bitmap resources
1227 wxBitmap
wxRichTextListStylePage::GetBitmapResource( const wxString
& name
)
1230 ////@begin wxRichTextListStylePage bitmap retrieval
1232 return wxNullBitmap
;
1233 ////@end wxRichTextListStylePage bitmap retrieval
1237 * Get icon resources
1240 wxIcon
wxRichTextListStylePage::GetIconResource( const wxString
& name
)
1243 ////@begin wxRichTextListStylePage icon retrieval
1246 ////@end wxRichTextListStylePage icon retrieval
1249 /// Update for symbol-related controls
1250 void wxRichTextListStylePage::OnSymbolUpdate( wxUpdateUIEvent
& event
)
1252 int sel
= m_styleListBox
->GetSelection();
1253 event
.Enable(sel
== wxRICHTEXT_BULLETINDEX_SYMBOL
);
1256 /// Update for number-related controls
1257 void wxRichTextListStylePage::OnNumberUpdate( wxUpdateUIEvent
& event
)
1259 int sel
= m_styleListBox
->GetSelection();
1260 event
.Enable((sel
!= wxRICHTEXT_BULLETINDEX_SYMBOL
&&
1261 sel
!= wxRICHTEXT_BULLETINDEX_BITMAP
&&
1262 sel
!= wxRICHTEXT_BULLETINDEX_STANDARD
&&
1263 sel
!= wxRICHTEXT_BULLETINDEX_NONE
));
1266 /// Update for standard bullet-related controls
1267 void wxRichTextListStylePage::OnStandardBulletUpdate( wxUpdateUIEvent
& event
)
1269 int sel
= m_styleListBox
->GetSelection();
1270 event
.Enable( sel
== wxRICHTEXT_BULLETINDEX_STANDARD
|| sel
== wxRICHTEXT_BULLETINDEX_BITMAP
);
1274 * wxEVT_BUTTON event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT
1277 void wxRichTextListStylePage::OnChooseFontClick( wxCommandEvent
& WXUNUSED(event
) )
1279 wxRichTextAttr
* attr
= GetAttributesForSelection();
1281 int pages
= wxRICHTEXT_FORMAT_FONT
;
1282 wxRichTextFormattingDialog formatDlg
;
1283 formatDlg
.SetStyle(*attr
, false);
1284 formatDlg
.Create(pages
, this);
1286 if (formatDlg
.ShowModal() == wxID_OK
)
1288 (*attr
) = formatDlg
.GetAttributes();
1289 TransferAndPreview();
1293 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC
1296 void wxRichTextListStylePage::OnNamestaticUpdate( wxUpdateUIEvent
& event
)
1298 OnStandardBulletUpdate(event
);
1302 * wxEVT_COMBOBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
1305 void wxRichTextListStylePage::OnNamectrlSelected( wxCommandEvent
& WXUNUSED(event
) )
1307 TransferAndPreview();
1311 * wxEVT_TEXT event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
1314 void wxRichTextListStylePage::OnNamectrlUpdated( wxCommandEvent
& WXUNUSED(event
) )
1316 TransferAndPreview();
1320 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
1323 void wxRichTextListStylePage::OnNamectrlUIUpdate( wxUpdateUIEvent
& event
)
1325 OnStandardBulletUpdate(event
);
1328 * wxEVT_CHECKBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL
1331 void wxRichTextListStylePage::OnRightParenthesisCtrlClick( wxCommandEvent
& WXUNUSED(event
) )
1333 TransferAndPreview();
1337 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL
1340 void wxRichTextListStylePage::OnRightParenthesisCtrlUpdate( wxUpdateUIEvent
& event
)
1342 int sel
= m_styleListBox
->GetSelection();
1343 event
.Enable((sel
!= wxRICHTEXT_BULLETINDEX_SYMBOL
&&
1344 sel
!= wxRICHTEXT_BULLETINDEX_BITMAP
&&
1345 sel
!= wxRICHTEXT_BULLETINDEX_NONE
));
1349 * wxEVT_COMBOBOX event handler for ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL
1352 void wxRichTextListStylePage::OnBulletAlignmentCtrlSelected( wxCommandEvent
& WXUNUSED(event
) )
1354 TransferAndPreview();