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
, wxRichTextDialogPage
)
24 * wxRichTextListStylePage event table definition
27 BEGIN_EVENT_TABLE( wxRichTextListStylePage
, wxRichTextDialogPage
)
29 ////@begin wxRichTextListStylePage event table entries
30 EVT_SPINCTRL( ID_RICHTEXTLISTSTYLEPAGE_LEVEL
, wxRichTextListStylePage::OnLevelUpdated
)
31 EVT_SPIN_UP( ID_RICHTEXTLISTSTYLEPAGE_LEVEL
, wxRichTextListStylePage::OnLevelUp
)
32 EVT_SPIN_DOWN( ID_RICHTEXTLISTSTYLEPAGE_LEVEL
, wxRichTextListStylePage::OnLevelDown
)
33 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_LEVEL
, wxRichTextListStylePage::OnLevelTextUpdated
)
34 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_LEVEL
, wxRichTextListStylePage::OnLevelUIUpdate
)
36 EVT_BUTTON( ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT
, wxRichTextListStylePage::OnChooseFontClick
)
38 EVT_LISTBOX( ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX
, wxRichTextListStylePage::OnStylelistboxSelected
)
40 EVT_CHECKBOX( ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
, wxRichTextListStylePage::OnPeriodctrlClick
)
41 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
, wxRichTextListStylePage::OnPeriodctrlUpdate
)
43 EVT_CHECKBOX( ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL
, wxRichTextListStylePage::OnParenthesesctrlClick
)
44 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL
, wxRichTextListStylePage::OnParenthesesctrlUpdate
)
46 EVT_CHECKBOX( ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL
, wxRichTextListStylePage::OnRightParenthesisCtrlClick
)
47 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL
, wxRichTextListStylePage::OnRightParenthesisCtrlUpdate
)
49 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL
, wxRichTextListStylePage::OnBulletAlignmentCtrlSelected
)
51 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC
, wxRichTextListStylePage::OnSymbolstaticUpdate
)
53 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL
, wxRichTextListStylePage::OnSymbolctrlSelected
)
54 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL
, wxRichTextListStylePage::OnSymbolctrlUpdated
)
55 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL
, wxRichTextListStylePage::OnSymbolctrlUIUpdate
)
57 EVT_BUTTON( ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL
, wxRichTextListStylePage::OnChooseSymbolClick
)
58 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL
, wxRichTextListStylePage::OnChooseSymbolUpdate
)
60 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
, wxRichTextListStylePage::OnSymbolfontctrlSelected
)
61 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
, wxRichTextListStylePage::OnSymbolfontctrlUpdated
)
62 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
, wxRichTextListStylePage::OnSymbolfontctrlUIUpdate
)
64 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC
, wxRichTextListStylePage::OnNamestaticUpdate
)
66 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
, wxRichTextListStylePage::OnNamectrlSelected
)
67 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
, wxRichTextListStylePage::OnNamectrlUpdated
)
68 EVT_UPDATE_UI( ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
, wxRichTextListStylePage::OnNamectrlUIUpdate
)
70 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT
, wxRichTextListStylePage::OnRichtextliststylepageAlignleftSelected
)
72 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT
, wxRichTextListStylePage::OnRichtextliststylepageAlignrightSelected
)
74 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED
, wxRichTextListStylePage::OnRichtextliststylepageJustifiedSelected
)
76 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_CENTERED
, wxRichTextListStylePage::OnRichtextliststylepageCenteredSelected
)
78 EVT_RADIOBUTTON( ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE
, wxRichTextListStylePage::OnRichtextliststylepageAlignindeterminateSelected
)
80 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT
, wxRichTextListStylePage::OnIndentLeftUpdated
)
82 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE
, wxRichTextListStylePage::OnIndentFirstLineUpdated
)
84 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT
, wxRichTextListStylePage::OnIndentRightUpdated
)
86 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE
, wxRichTextListStylePage::OnSpacingBeforeUpdated
)
88 EVT_TEXT( ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER
, wxRichTextListStylePage::OnSpacingAfterUpdated
)
90 EVT_COMBOBOX( ID_RICHTEXTLISTSTYLEPAGE_LINESPACING
, wxRichTextListStylePage::OnLineSpacingSelected
)
92 ////@end wxRichTextListStylePage event table entries
96 IMPLEMENT_HELP_PROVISION(wxRichTextListStylePage
)
99 * wxRichTextListStylePage constructors
102 wxRichTextListStylePage::wxRichTextListStylePage( )
107 wxRichTextListStylePage::wxRichTextListStylePage( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
110 Create(parent
, id
, pos
, size
, style
);
114 * wxRichTextListStylePage creator
117 bool wxRichTextListStylePage::Create( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
119 ////@begin wxRichTextListStylePage creation
120 wxRichTextDialogPage::Create( parent
, id
, pos
, size
, style
);
125 GetSizer()->SetSizeHints(this);
128 ////@end wxRichTextListStylePage creation
133 * Member initialisation
136 void wxRichTextListStylePage::Init()
138 m_dontUpdate
= false;
141 ////@begin wxRichTextListStylePage member initialisation
143 m_styleListBox
= NULL
;
145 m_parenthesesCtrl
= NULL
;
146 m_rightParenthesisCtrl
= NULL
;
147 m_bulletAlignmentCtrl
= NULL
;
149 m_symbolFontCtrl
= NULL
;
150 m_bulletNameCtrl
= NULL
;
151 m_alignmentLeft
= NULL
;
152 m_alignmentRight
= NULL
;
153 m_alignmentJustified
= NULL
;
154 m_alignmentCentred
= NULL
;
155 m_alignmentIndeterminate
= NULL
;
157 m_indentLeftFirst
= NULL
;
158 m_indentRight
= NULL
;
159 m_spacingBefore
= NULL
;
160 m_spacingAfter
= NULL
;
161 m_spacingLine
= NULL
;
162 m_previewCtrl
= NULL
;
163 ////@end wxRichTextListStylePage member initialisation
167 * Control creation for wxRichTextListStylePage
170 void wxRichTextListStylePage::CreateControls()
172 ////@begin wxRichTextListStylePage content construction
173 wxRichTextListStylePage
* itemRichTextDialogPage1
= this;
175 wxBoxSizer
* itemBoxSizer2
= new wxBoxSizer(wxVERTICAL
);
176 itemRichTextDialogPage1
->SetSizer(itemBoxSizer2
);
178 wxBoxSizer
* itemBoxSizer3
= new wxBoxSizer(wxVERTICAL
);
179 itemBoxSizer2
->Add(itemBoxSizer3
, 1, wxGROW
|wxALL
, 5);
181 wxBoxSizer
* itemBoxSizer4
= new wxBoxSizer(wxHORIZONTAL
);
182 itemBoxSizer3
->Add(itemBoxSizer4
, 0, wxALIGN_CENTER_HORIZONTAL
, 5);
184 wxStaticText
* itemStaticText5
= new wxStaticText( itemRichTextDialogPage1
, wxID_STATIC
, _("&List level:"), wxDefaultPosition
, wxDefaultSize
, 0 );
185 itemBoxSizer4
->Add(itemStaticText5
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
187 m_levelCtrl
= new wxSpinCtrl( itemRichTextDialogPage1
, ID_RICHTEXTLISTSTYLEPAGE_LEVEL
, wxT("1"), wxDefaultPosition
, wxSize(60, -1), wxSP_ARROW_KEYS
, 1, 10, 1 );
188 m_levelCtrl
->SetHelpText(_("Selects the list level to edit."));
189 if (wxRichTextListStylePage::ShowToolTips())
190 m_levelCtrl
->SetToolTip(_("Selects the list level to edit."));
191 itemBoxSizer4
->Add(m_levelCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
193 itemBoxSizer4
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
195 wxButton
* itemButton8
= new wxButton( itemRichTextDialogPage1
, ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT
, _("&Font for Level..."), wxDefaultPosition
, wxDefaultSize
, 0 );
196 itemButton8
->SetHelpText(_("Click to choose the font for this level."));
197 if (wxRichTextListStylePage::ShowToolTips())
198 itemButton8
->SetToolTip(_("Click to choose the font for this level."));
199 itemBoxSizer4
->Add(itemButton8
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
201 wxNotebook
* itemNotebook9
= new wxNotebook( itemRichTextDialogPage1
, ID_RICHTEXTLISTSTYLEPAGE_NOTEBOOK
, wxDefaultPosition
, wxDefaultSize
, wxBK_DEFAULT
|wxBK_TOP
);
203 wxPanel
* itemPanel10
= new wxPanel( itemNotebook9
, ID_RICHTEXTLISTSTYLEPAGE_BULLETS
, wxDefaultPosition
, wxDefaultSize
, wxNO_BORDER
|wxTAB_TRAVERSAL
);
204 wxBoxSizer
* itemBoxSizer11
= new wxBoxSizer(wxVERTICAL
);
205 itemPanel10
->SetSizer(itemBoxSizer11
);
207 wxBoxSizer
* itemBoxSizer12
= new wxBoxSizer(wxHORIZONTAL
);
208 itemBoxSizer11
->Add(itemBoxSizer12
, 1, wxGROW
, 5);
209 wxBoxSizer
* itemBoxSizer13
= new wxBoxSizer(wxVERTICAL
);
210 itemBoxSizer12
->Add(itemBoxSizer13
, 0, wxGROW
, 5);
211 wxStaticText
* itemStaticText14
= new wxStaticText( itemPanel10
, wxID_STATIC
, _("&Bullet style:"), wxDefaultPosition
, wxDefaultSize
, 0 );
212 itemBoxSizer13
->Add(itemStaticText14
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
, 5);
214 wxArrayString m_styleListBoxStrings
;
215 m_styleListBox
= new wxListBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX
, wxDefaultPosition
, wxSize(-1, 80), m_styleListBoxStrings
, wxLB_SINGLE
);
216 m_styleListBox
->SetHelpText(_("The available bullet styles."));
217 if (wxRichTextListStylePage::ShowToolTips())
218 m_styleListBox
->SetToolTip(_("The available bullet styles."));
219 itemBoxSizer13
->Add(m_styleListBox
, 1, wxGROW
|wxALL
, 5);
221 wxBoxSizer
* itemBoxSizer16
= new wxBoxSizer(wxHORIZONTAL
);
222 itemBoxSizer13
->Add(itemBoxSizer16
, 0, wxGROW
, 5);
223 m_periodCtrl
= new wxCheckBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
, _("Peri&od"), wxDefaultPosition
, wxDefaultSize
, 0 );
224 m_periodCtrl
->SetValue(false);
225 m_periodCtrl
->SetHelpText(_("Check to add a period after the bullet."));
226 if (wxRichTextListStylePage::ShowToolTips())
227 m_periodCtrl
->SetToolTip(_("Check to add a period after the bullet."));
228 itemBoxSizer16
->Add(m_periodCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
230 m_parenthesesCtrl
= new wxCheckBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_PARENTHESESCTRL
, _("(*)"), wxDefaultPosition
, wxDefaultSize
, 0 );
231 m_parenthesesCtrl
->SetValue(false);
232 m_parenthesesCtrl
->SetHelpText(_("Check to enclose the bullet in parentheses."));
233 if (wxRichTextListStylePage::ShowToolTips())
234 m_parenthesesCtrl
->SetToolTip(_("Check to enclose the bullet in parentheses."));
235 itemBoxSizer16
->Add(m_parenthesesCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
237 m_rightParenthesisCtrl
= new wxCheckBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL
, _("*)"), wxDefaultPosition
, wxDefaultSize
, 0 );
238 m_rightParenthesisCtrl
->SetValue(false);
239 m_rightParenthesisCtrl
->SetHelpText(_("Check to add a right parenthesis."));
240 if (wxRichTextListStylePage::ShowToolTips())
241 m_rightParenthesisCtrl
->SetToolTip(_("Check to add a right parenthesis."));
242 itemBoxSizer16
->Add(m_rightParenthesisCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
244 itemBoxSizer13
->Add(2, 1, 0, wxALIGN_CENTER_HORIZONTAL
, 5);
246 wxStaticText
* itemStaticText21
= new wxStaticText( itemPanel10
, wxID_STATIC
, _("Bullet &Alignment:"), wxDefaultPosition
, wxDefaultSize
, 0 );
247 itemBoxSizer13
->Add(itemStaticText21
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
, 5);
249 wxArrayString m_bulletAlignmentCtrlStrings
;
250 m_bulletAlignmentCtrlStrings
.Add(_("Left"));
251 m_bulletAlignmentCtrlStrings
.Add(_("Centre"));
252 m_bulletAlignmentCtrlStrings
.Add(_("Right"));
253 m_bulletAlignmentCtrl
= new wxComboBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL
, _("Left"), wxDefaultPosition
, wxSize(60, -1), m_bulletAlignmentCtrlStrings
, wxCB_READONLY
);
254 m_bulletAlignmentCtrl
->SetStringSelection(_("Left"));
255 m_bulletAlignmentCtrl
->SetHelpText(_("The bullet character."));
256 if (wxRichTextListStylePage::ShowToolTips())
257 m_bulletAlignmentCtrl
->SetToolTip(_("The bullet character."));
258 itemBoxSizer13
->Add(m_bulletAlignmentCtrl
, 0, wxGROW
|wxALL
|wxFIXED_MINSIZE
, 5);
260 itemBoxSizer12
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
262 wxStaticLine
* itemStaticLine24
= new wxStaticLine( itemPanel10
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_VERTICAL
);
263 itemBoxSizer12
->Add(itemStaticLine24
, 0, wxGROW
|wxALL
, 5);
265 itemBoxSizer12
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
267 wxBoxSizer
* itemBoxSizer26
= new wxBoxSizer(wxVERTICAL
);
268 itemBoxSizer12
->Add(itemBoxSizer26
, 0, wxGROW
, 5);
269 wxStaticText
* itemStaticText27
= new wxStaticText( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC
, _("&Symbol:"), wxDefaultPosition
, wxDefaultSize
, 0 );
270 itemBoxSizer26
->Add(itemStaticText27
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
, 5);
272 wxBoxSizer
* itemBoxSizer28
= new wxBoxSizer(wxHORIZONTAL
);
273 itemBoxSizer26
->Add(itemBoxSizer28
, 0, wxGROW
, 5);
274 wxArrayString m_symbolCtrlStrings
;
275 m_symbolCtrl
= new wxComboBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLCTRL
, wxEmptyString
, wxDefaultPosition
, wxSize(60, -1), m_symbolCtrlStrings
, wxCB_DROPDOWN
);
276 m_symbolCtrl
->SetHelpText(_("The bullet character."));
277 if (wxRichTextListStylePage::ShowToolTips())
278 m_symbolCtrl
->SetToolTip(_("The bullet character."));
279 itemBoxSizer28
->Add(m_symbolCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
|wxFIXED_MINSIZE
, 5);
281 wxButton
* itemButton30
= new wxButton( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_SYMBOL
, _("Ch&oose..."), wxDefaultPosition
, wxDefaultSize
, 0 );
282 itemButton30
->SetHelpText(_("Click to browse for a symbol."));
283 if (wxRichTextListStylePage::ShowToolTips())
284 itemButton30
->SetToolTip(_("Click to browse for a symbol."));
285 itemBoxSizer28
->Add(itemButton30
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
287 itemBoxSizer26
->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL
, 5);
289 wxStaticText
* itemStaticText32
= new wxStaticText( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC
, _("Symbol &font:"), wxDefaultPosition
, wxDefaultSize
, 0 );
290 itemBoxSizer26
->Add(itemStaticText32
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
, 5);
292 wxArrayString m_symbolFontCtrlStrings
;
293 m_symbolFontCtrl
= new wxComboBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
, wxEmptyString
, wxDefaultPosition
, wxDefaultSize
, m_symbolFontCtrlStrings
, wxCB_DROPDOWN
);
294 if (wxRichTextListStylePage::ShowToolTips())
295 m_symbolFontCtrl
->SetToolTip(_("Available fonts."));
296 itemBoxSizer26
->Add(m_symbolFontCtrl
, 0, wxGROW
|wxALL
, 5);
298 itemBoxSizer26
->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL
, 5);
300 wxStaticText
* itemStaticText35
= new wxStaticText( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC
, _("S&tandard bullet name:"), wxDefaultPosition
, wxDefaultSize
, 0 );
301 itemBoxSizer26
->Add(itemStaticText35
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
, 5);
303 wxArrayString m_bulletNameCtrlStrings
;
304 m_bulletNameCtrl
= new wxComboBox( itemPanel10
, ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
, wxEmptyString
, wxDefaultPosition
, wxDefaultSize
, m_bulletNameCtrlStrings
, wxCB_DROPDOWN
);
305 m_bulletNameCtrl
->SetHelpText(_("A standard bullet name."));
306 if (wxRichTextListStylePage::ShowToolTips())
307 m_bulletNameCtrl
->SetToolTip(_("A standard bullet name."));
308 itemBoxSizer26
->Add(m_bulletNameCtrl
, 0, wxGROW
|wxALL
, 5);
310 itemNotebook9
->AddPage(itemPanel10
, _("Bullet style"));
312 wxPanel
* itemPanel37
= new wxPanel( itemNotebook9
, ID_RICHTEXTLISTSTYLEPAGE_SPACING
, wxDefaultPosition
, wxDefaultSize
, wxNO_BORDER
|wxTAB_TRAVERSAL
);
313 wxBoxSizer
* itemBoxSizer38
= new wxBoxSizer(wxVERTICAL
);
314 itemPanel37
->SetSizer(itemBoxSizer38
);
316 wxBoxSizer
* itemBoxSizer39
= new wxBoxSizer(wxHORIZONTAL
);
317 itemBoxSizer38
->Add(itemBoxSizer39
, 0, wxGROW
, 5);
318 wxBoxSizer
* itemBoxSizer40
= new wxBoxSizer(wxVERTICAL
);
319 itemBoxSizer39
->Add(itemBoxSizer40
, 0, wxGROW
, 5);
320 wxStaticText
* itemStaticText41
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("&Alignment"), wxDefaultPosition
, wxDefaultSize
, 0 );
321 itemBoxSizer40
->Add(itemStaticText41
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
, 5);
323 wxBoxSizer
* itemBoxSizer42
= new wxBoxSizer(wxHORIZONTAL
);
324 itemBoxSizer40
->Add(itemBoxSizer42
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALL
, 5);
325 itemBoxSizer42
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
, 5);
327 wxBoxSizer
* itemBoxSizer44
= new wxBoxSizer(wxVERTICAL
);
328 itemBoxSizer42
->Add(itemBoxSizer44
, 0, wxALIGN_CENTER_VERTICAL
|wxTOP
, 5);
329 m_alignmentLeft
= new wxRadioButton( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT
, _("&Left"), wxDefaultPosition
, wxDefaultSize
, wxRB_GROUP
);
330 m_alignmentLeft
->SetValue(false);
331 m_alignmentLeft
->SetHelpText(_("Left-align text."));
332 if (wxRichTextListStylePage::ShowToolTips())
333 m_alignmentLeft
->SetToolTip(_("Left-align text."));
334 itemBoxSizer44
->Add(m_alignmentLeft
, 0, wxALIGN_LEFT
|wxALL
, 5);
336 m_alignmentRight
= new wxRadioButton( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT
, _("&Right"), wxDefaultPosition
, wxDefaultSize
, 0 );
337 m_alignmentRight
->SetValue(false);
338 m_alignmentRight
->SetHelpText(_("Right-align text."));
339 if (wxRichTextListStylePage::ShowToolTips())
340 m_alignmentRight
->SetToolTip(_("Right-align text."));
341 itemBoxSizer44
->Add(m_alignmentRight
, 0, wxALIGN_LEFT
|wxALL
, 5);
343 m_alignmentJustified
= new wxRadioButton( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED
, _("&Justified"), wxDefaultPosition
, wxDefaultSize
, 0 );
344 m_alignmentJustified
->SetValue(false);
345 m_alignmentJustified
->SetHelpText(_("Justify text left and right."));
346 if (wxRichTextListStylePage::ShowToolTips())
347 m_alignmentJustified
->SetToolTip(_("Justify text left and right."));
348 itemBoxSizer44
->Add(m_alignmentJustified
, 0, wxALIGN_LEFT
|wxALL
, 5);
350 m_alignmentCentred
= new wxRadioButton( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_CENTERED
, _("Cen&tred"), wxDefaultPosition
, wxDefaultSize
, 0 );
351 m_alignmentCentred
->SetValue(false);
352 m_alignmentCentred
->SetHelpText(_("Centre text."));
353 if (wxRichTextListStylePage::ShowToolTips())
354 m_alignmentCentred
->SetToolTip(_("Centre text."));
355 itemBoxSizer44
->Add(m_alignmentCentred
, 0, wxALIGN_LEFT
|wxALL
, 5);
357 m_alignmentIndeterminate
= new wxRadioButton( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE
, _("&Indeterminate"), wxDefaultPosition
, wxDefaultSize
, 0 );
358 m_alignmentIndeterminate
->SetValue(false);
359 m_alignmentIndeterminate
->SetHelpText(_("Use the current alignment setting."));
360 if (wxRichTextListStylePage::ShowToolTips())
361 m_alignmentIndeterminate
->SetToolTip(_("Use the current alignment setting."));
362 itemBoxSizer44
->Add(m_alignmentIndeterminate
, 0, wxALIGN_LEFT
|wxALL
, 5);
364 itemBoxSizer39
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
366 wxStaticLine
* itemStaticLine51
= new wxStaticLine( itemPanel37
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_VERTICAL
);
367 itemBoxSizer39
->Add(itemStaticLine51
, 0, wxGROW
|wxLEFT
|wxBOTTOM
, 5);
369 itemBoxSizer39
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
371 wxBoxSizer
* itemBoxSizer53
= new wxBoxSizer(wxVERTICAL
);
372 itemBoxSizer39
->Add(itemBoxSizer53
, 0, wxGROW
, 5);
373 wxStaticText
* itemStaticText54
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("&Indentation (tenths of a mm)"), wxDefaultPosition
, wxDefaultSize
, 0 );
374 itemBoxSizer53
->Add(itemStaticText54
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
, 5);
376 wxBoxSizer
* itemBoxSizer55
= new wxBoxSizer(wxHORIZONTAL
);
377 itemBoxSizer53
->Add(itemBoxSizer55
, 0, wxALIGN_LEFT
|wxALL
, 5);
378 itemBoxSizer55
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
, 5);
380 wxFlexGridSizer
* itemFlexGridSizer57
= new wxFlexGridSizer(0, 2, 0, 0);
381 itemBoxSizer55
->Add(itemFlexGridSizer57
, 0, wxALIGN_CENTER_VERTICAL
, 5);
382 wxStaticText
* itemStaticText58
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("&Left:"), wxDefaultPosition
, wxDefaultSize
, 0 );
383 itemFlexGridSizer57
->Add(itemStaticText58
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
385 m_indentLeft
= new wxTextCtrl( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT
, wxEmptyString
, wxDefaultPosition
, wxSize(50, -1), 0 );
386 m_indentLeft
->SetHelpText(_("The left indent."));
387 if (wxRichTextListStylePage::ShowToolTips())
388 m_indentLeft
->SetToolTip(_("The left indent."));
389 itemFlexGridSizer57
->Add(m_indentLeft
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
391 wxStaticText
* itemStaticText60
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("Left (&first line):"), wxDefaultPosition
, wxDefaultSize
, 0 );
392 itemFlexGridSizer57
->Add(itemStaticText60
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
394 m_indentLeftFirst
= new wxTextCtrl( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE
, wxEmptyString
, wxDefaultPosition
, wxSize(50, -1), 0 );
395 m_indentLeftFirst
->SetHelpText(_("The first line indent."));
396 if (wxRichTextListStylePage::ShowToolTips())
397 m_indentLeftFirst
->SetToolTip(_("The first line indent."));
398 itemFlexGridSizer57
->Add(m_indentLeftFirst
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
400 wxStaticText
* itemStaticText62
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("&Right:"), wxDefaultPosition
, wxDefaultSize
, 0 );
401 itemFlexGridSizer57
->Add(itemStaticText62
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
403 m_indentRight
= new wxTextCtrl( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT
, wxEmptyString
, wxDefaultPosition
, wxSize(50, -1), 0 );
404 m_indentRight
->SetHelpText(_("The right indent."));
405 if (wxRichTextListStylePage::ShowToolTips())
406 m_indentRight
->SetToolTip(_("The right indent."));
407 itemFlexGridSizer57
->Add(m_indentRight
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
409 itemBoxSizer39
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
411 wxStaticLine
* itemStaticLine65
= new wxStaticLine( itemPanel37
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_VERTICAL
);
412 itemBoxSizer39
->Add(itemStaticLine65
, 0, wxGROW
|wxTOP
|wxBOTTOM
, 5);
414 itemBoxSizer39
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
416 wxBoxSizer
* itemBoxSizer67
= new wxBoxSizer(wxVERTICAL
);
417 itemBoxSizer39
->Add(itemBoxSizer67
, 0, wxGROW
, 5);
418 wxStaticText
* itemStaticText68
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("&Spacing (tenths of a mm)"), wxDefaultPosition
, wxDefaultSize
, 0 );
419 itemBoxSizer67
->Add(itemStaticText68
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
, 5);
421 wxBoxSizer
* itemBoxSizer69
= new wxBoxSizer(wxHORIZONTAL
);
422 itemBoxSizer67
->Add(itemBoxSizer69
, 0, wxALIGN_LEFT
|wxALL
, 5);
423 itemBoxSizer69
->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL
, 5);
425 wxFlexGridSizer
* itemFlexGridSizer71
= new wxFlexGridSizer(0, 2, 0, 0);
426 itemBoxSizer69
->Add(itemFlexGridSizer71
, 0, wxALIGN_CENTER_VERTICAL
, 5);
427 wxStaticText
* itemStaticText72
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("Before a paragraph:"), wxDefaultPosition
, wxDefaultSize
, 0 );
428 itemFlexGridSizer71
->Add(itemStaticText72
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
430 m_spacingBefore
= new wxTextCtrl( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE
, wxEmptyString
, wxDefaultPosition
, wxSize(50, -1), 0 );
431 m_spacingBefore
->SetHelpText(_("The spacing before the paragraph."));
432 if (wxRichTextListStylePage::ShowToolTips())
433 m_spacingBefore
->SetToolTip(_("The spacing before the paragraph."));
434 itemFlexGridSizer71
->Add(m_spacingBefore
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
436 wxStaticText
* itemStaticText74
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("After a paragraph:"), wxDefaultPosition
, wxDefaultSize
, 0 );
437 itemFlexGridSizer71
->Add(itemStaticText74
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
439 m_spacingAfter
= new wxTextCtrl( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER
, wxEmptyString
, wxDefaultPosition
, wxSize(50, -1), 0 );
440 m_spacingAfter
->SetHelpText(_("The spacing after the paragraph."));
441 if (wxRichTextListStylePage::ShowToolTips())
442 m_spacingAfter
->SetToolTip(_("The spacing after the paragraph."));
443 itemFlexGridSizer71
->Add(m_spacingAfter
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
445 wxStaticText
* itemStaticText76
= new wxStaticText( itemPanel37
, wxID_STATIC
, _("Line spacing:"), wxDefaultPosition
, wxDefaultSize
, 0 );
446 itemFlexGridSizer71
->Add(itemStaticText76
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
448 wxArrayString m_spacingLineStrings
;
449 m_spacingLineStrings
.Add(_("(none)"));
450 m_spacingLineStrings
.Add(_("Single"));
451 m_spacingLineStrings
.Add(_("1.1"));
452 m_spacingLineStrings
.Add(_("1.2"));
453 m_spacingLineStrings
.Add(_("1.3"));
454 m_spacingLineStrings
.Add(_("1.4"));
455 m_spacingLineStrings
.Add(_("1.5"));
456 m_spacingLineStrings
.Add(_("1.6"));
457 m_spacingLineStrings
.Add(_("1.7"));
458 m_spacingLineStrings
.Add(_("1.8"));
459 m_spacingLineStrings
.Add(_("1.9"));
460 m_spacingLineStrings
.Add(_("2"));
461 m_spacingLine
= new wxComboBox( itemPanel37
, ID_RICHTEXTLISTSTYLEPAGE_LINESPACING
, _("(none)"), wxDefaultPosition
, wxSize(85, -1), m_spacingLineStrings
, wxCB_READONLY
);
462 m_spacingLine
->SetStringSelection(_("(none)"));
463 m_spacingLine
->SetHelpText(_("The line spacing."));
464 if (wxRichTextListStylePage::ShowToolTips())
465 m_spacingLine
->SetToolTip(_("The line spacing."));
466 itemFlexGridSizer71
->Add(m_spacingLine
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
468 itemNotebook9
->AddPage(itemPanel37
, _("Spacing"));
470 itemBoxSizer3
->Add(itemNotebook9
, 0, wxGROW
|wxALL
, 5);
472 m_previewCtrl
= new wxRichTextCtrl( itemRichTextDialogPage1
, ID_RICHTEXTLISTSTYLEPAGE_RICHTEXTCTRL
, wxEmptyString
, wxDefaultPosition
, wxSize(350, 140), wxBORDER_THEME
|wxVSCROLL
|wxTE_READONLY
);
473 m_previewCtrl
->SetHelpText(_("Shows a preview of the bullet settings."));
474 if (wxRichTextListStylePage::ShowToolTips())
475 m_previewCtrl
->SetToolTip(_("Shows a preview of the bullet settings."));
476 itemBoxSizer3
->Add(m_previewCtrl
, 0, wxGROW
|wxALL
, 5);
478 ////@end wxRichTextListStylePage content construction
482 m_styleListBox
->Append(_("(None)"));
483 m_styleListBox
->Append(_("Arabic"));
484 m_styleListBox
->Append(_("Upper case letters"));
485 m_styleListBox
->Append(_("Lower case letters"));
486 m_styleListBox
->Append(_("Upper case roman numerals"));
487 m_styleListBox
->Append(_("Lower case roman numerals"));
488 m_styleListBox
->Append(_("Numbered outline"));
489 m_styleListBox
->Append(_("Symbol"));
490 m_styleListBox
->Append(_("Bitmap"));
491 m_styleListBox
->Append(_("Standard"));
493 m_symbolCtrl
->Append(_("*"));
494 m_symbolCtrl
->Append(_("-"));
495 m_symbolCtrl
->Append(_(">"));
496 m_symbolCtrl
->Append(_("+"));
497 m_symbolCtrl
->Append(_("~"));
499 wxArrayString standardBulletNames
;
500 if (wxRichTextBuffer::GetRenderer())
501 wxRichTextBuffer::GetRenderer()->EnumerateStandardBulletNames(standardBulletNames
);
503 m_bulletNameCtrl
->Append(standardBulletNames
);
504 wxArrayString facenames
= wxRichTextCtrl::GetAvailableFontNames();
507 m_symbolFontCtrl
->Append(facenames
);
509 m_levelCtrl
->SetValue(m_currentLevel
);
511 m_dontUpdate
= false;
514 /// Updates the font preview
515 void wxRichTextListStylePage::UpdatePreview()
517 static const wxChar
* s_para1
= wxT("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \
518 Nullam ante sapien, vestibulum nonummy, pulvinar sed, luctus ut, lacus.\n");
520 static const wxChar
* s_para2
= wxT("Duis pharetra consequat dui. Nullam vitae justo id mauris lobortis interdum.\n");
522 static const wxChar
* s_para3
= wxT("Integer convallis dolor at augue \
523 iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
525 wxRichTextListStyleDefinition
* def
= wxDynamicCast(wxRichTextFormattingDialog::GetDialogStyleDefinition(this),
526 wxRichTextListStyleDefinition
);
528 wxRichTextStyleSheet
* styleSheet
= wxRichTextFormattingDialog::GetDialog(this)->GetStyleSheet();
530 wxRichTextAttr
attr((const wxRichTextAttr
&)(styleSheet
? def
->GetStyle() : def
->GetStyleMergedWithBase(styleSheet
)));
532 attr
.SetFlags(attr
.GetFlags() &
533 (wxTEXT_ATTR_ALIGNMENT
|wxTEXT_ATTR_LEFT_INDENT
|wxTEXT_ATTR_RIGHT_INDENT
|wxTEXT_ATTR_PARA_SPACING_BEFORE
|wxTEXT_ATTR_PARA_SPACING_AFTER
|
534 wxTEXT_ATTR_LINE_SPACING
|
535 wxTEXT_ATTR_BULLET_STYLE
|wxTEXT_ATTR_BULLET_NUMBER
|wxTEXT_ATTR_BULLET_TEXT
));
537 wxFont
font(m_previewCtrl
->GetFont());
538 font
.SetPointSize(9);
539 m_previewCtrl
->SetFont(font
);
541 wxRichTextAttr normalParaAttr
;
542 normalParaAttr
.SetFont(font
);
543 normalParaAttr
.SetTextColour(wxColour(wxT("LIGHT GREY")));
545 m_previewCtrl
->Freeze();
546 m_previewCtrl
->Clear();
548 m_previewCtrl
->BeginStyle(normalParaAttr
);
549 m_previewCtrl
->WriteText(s_para1
);
550 m_previewCtrl
->EndStyle();
552 m_previewCtrl
->BeginStyle(attr
);
553 long listStart
= m_previewCtrl
->GetInsertionPoint() + 1;
556 for (i
= 0; i
< 10; i
++)
558 wxRichTextAttr levelAttr
= * def
->GetLevelAttributes(i
);
559 levelAttr
.SetBulletNumber(1);
560 m_previewCtrl
->BeginStyle(levelAttr
);
561 m_previewCtrl
->WriteText(wxString::Format(wxT("List level %d. "), i
+1) + s_para2
);
562 m_previewCtrl
->EndStyle();
564 m_previewCtrl
->EndStyle();
565 long listEnd
= m_previewCtrl
->GetInsertionPoint();
567 m_previewCtrl
->BeginStyle(normalParaAttr
);
568 m_previewCtrl
->WriteText(s_para3
);
569 m_previewCtrl
->EndStyle();
571 m_previewCtrl
->NumberList(wxRichTextRange(listStart
, listEnd
), def
);
573 m_previewCtrl
->Thaw();
576 /// Transfer data from/to window
577 bool wxRichTextListStylePage::TransferDataFromWindow()
579 wxPanel::TransferDataFromWindow();
581 m_currentLevel
= m_levelCtrl
->GetValue();
583 wxRichTextAttr
* attr
= GetAttributesForSelection();
585 if (m_alignmentLeft
->GetValue())
586 attr
->SetAlignment(wxTEXT_ALIGNMENT_LEFT
);
587 else if (m_alignmentCentred
->GetValue())
588 attr
->SetAlignment(wxTEXT_ALIGNMENT_CENTRE
);
589 else if (m_alignmentRight
->GetValue())
590 attr
->SetAlignment(wxTEXT_ALIGNMENT_RIGHT
);
591 else if (m_alignmentJustified
->GetValue())
592 attr
->SetAlignment(wxTEXT_ALIGNMENT_JUSTIFIED
);
595 attr
->SetAlignment(wxTEXT_ALIGNMENT_DEFAULT
);
596 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_ALIGNMENT
));
599 wxString
leftIndent(m_indentLeft
->GetValue());
600 wxString
leftFirstIndent(m_indentLeftFirst
->GetValue());
601 if (!leftIndent
.empty())
603 int visualLeftIndent
= wxAtoi(leftIndent
);
604 int visualLeftFirstIndent
= wxAtoi(leftFirstIndent
);
605 int actualLeftIndent
= visualLeftFirstIndent
;
606 int actualLeftSubIndent
= visualLeftIndent
- visualLeftFirstIndent
;
608 attr
->SetLeftIndent(actualLeftIndent
, actualLeftSubIndent
);
611 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_LEFT_INDENT
));
613 wxString
rightIndent(m_indentRight
->GetValue());
614 if (!rightIndent
.empty())
615 attr
->SetRightIndent(wxAtoi(rightIndent
));
617 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_RIGHT_INDENT
));
619 wxString
spacingAfter(m_spacingAfter
->GetValue());
620 if (!spacingAfter
.empty())
621 attr
->SetParagraphSpacingAfter(wxAtoi(spacingAfter
));
623 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_PARA_SPACING_AFTER
));
625 wxString
spacingBefore(m_spacingBefore
->GetValue());
626 if (!spacingBefore
.empty())
627 attr
->SetParagraphSpacingBefore(wxAtoi(spacingBefore
));
629 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_PARA_SPACING_BEFORE
));
631 int spacingIndex
= m_spacingLine
->GetSelection() - 1;
633 if (spacingIndex
> -1)
634 lineSpacing
= 10 + spacingIndex
;
636 if (lineSpacing
== 0)
637 attr
->SetFlags(attr
->GetFlags() & (~wxTEXT_ATTR_LINE_SPACING
));
639 attr
->SetLineSpacing(lineSpacing
);
642 // if (m_hasBulletStyle)
644 long bulletStyle
= 0;
646 int index
= m_styleListBox
->GetSelection();
647 if (index
== wxRICHTEXT_BULLETINDEX_ARABIC
)
648 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_ARABIC
;
650 else if (index
== wxRICHTEXT_BULLETINDEX_UPPER_CASE
)
651 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER
;
653 else if (index
== wxRICHTEXT_BULLETINDEX_LOWER_CASE
)
654 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER
;
656 else if (index
== wxRICHTEXT_BULLETINDEX_UPPER_CASE_ROMAN
)
657 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER
;
659 else if (index
== wxRICHTEXT_BULLETINDEX_LOWER_CASE_ROMAN
)
660 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER
;
662 else if (index
== wxRICHTEXT_BULLETINDEX_OUTLINE
)
663 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_OUTLINE
;
665 else if (index
== wxRICHTEXT_BULLETINDEX_SYMBOL
)
666 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_SYMBOL
;
668 else if (index
== wxRICHTEXT_BULLETINDEX_BITMAP
)
669 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_BITMAP
;
671 else if (index
== wxRICHTEXT_BULLETINDEX_STANDARD
)
673 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_STANDARD
;
674 attr
->SetBulletName(m_bulletNameCtrl
->GetValue());
677 if (m_parenthesesCtrl
->GetValue())
678 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_PARENTHESES
;
679 if (m_rightParenthesisCtrl
->GetValue())
680 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS
;
681 if (m_periodCtrl
->GetValue())
682 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_PERIOD
;
684 if (m_bulletAlignmentCtrl
->GetSelection() == 1)
685 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE
;
686 else if (m_bulletAlignmentCtrl
->GetSelection() == 2)
687 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT
;
690 attr
->SetBulletStyle(bulletStyle
);
693 // if (m_hasBulletSymbol)
695 attr
->SetBulletText(m_symbolCtrl
->GetValue());
696 attr
->SetBulletFont(m_symbolFontCtrl
->GetValue());
702 bool wxRichTextListStylePage::TransferDataToWindow()
704 DoTransferDataToWindow();
710 /// Just transfer to the window
711 void wxRichTextListStylePage::DoTransferDataToWindow()
715 wxPanel::TransferDataToWindow();
717 wxRichTextAttr
* attr
= GetAttributesForSelection();
719 if (attr
->HasAlignment())
721 if (attr
->GetAlignment() == wxTEXT_ALIGNMENT_LEFT
)
722 m_alignmentLeft
->SetValue(true);
723 else if (attr
->GetAlignment() == wxTEXT_ALIGNMENT_RIGHT
)
724 m_alignmentRight
->SetValue(true);
725 else if (attr
->GetAlignment() == wxTEXT_ALIGNMENT_CENTRE
)
726 m_alignmentCentred
->SetValue(true);
727 else if (attr
->GetAlignment() == wxTEXT_ALIGNMENT_JUSTIFIED
)
728 m_alignmentJustified
->SetValue(true);
730 m_alignmentIndeterminate
->SetValue(true);
733 m_alignmentIndeterminate
->SetValue(true);
735 if (attr
->HasLeftIndent())
737 wxString
leftIndent(wxString::Format(wxT("%ld"), attr
->GetLeftIndent() + attr
->GetLeftSubIndent()));
738 wxString
leftFirstIndent(wxString::Format(wxT("%ld"), attr
->GetLeftIndent()));
740 m_indentLeft
->SetValue(leftIndent
);
741 m_indentLeftFirst
->SetValue(leftFirstIndent
);
745 m_indentLeft
->SetValue(wxEmptyString
);
746 m_indentLeftFirst
->SetValue(wxEmptyString
);
749 if (attr
->HasRightIndent())
751 wxString
rightIndent(wxString::Format(wxT("%ld"), attr
->GetRightIndent()));
753 m_indentRight
->SetValue(rightIndent
);
756 m_indentRight
->SetValue(wxEmptyString
);
758 if (attr
->HasParagraphSpacingAfter())
760 wxString
spacingAfter(wxString::Format(wxT("%d"), attr
->GetParagraphSpacingAfter()));
762 m_spacingAfter
->SetValue(spacingAfter
);
765 m_spacingAfter
->SetValue(wxEmptyString
);
767 if (attr
->HasParagraphSpacingBefore())
769 wxString
spacingBefore(wxString::Format(wxT("%d"), attr
->GetParagraphSpacingBefore()));
771 m_spacingBefore
->SetValue(spacingBefore
);
774 m_spacingBefore
->SetValue(wxEmptyString
);
776 if (attr
->HasLineSpacing())
780 int lineSpacing
= attr
->GetLineSpacing();
781 if (lineSpacing
>= 10 && lineSpacing
<= 20)
782 index
= (lineSpacing
- 10) + 1;
786 m_spacingLine
->SetSelection(index
);
789 m_spacingLine
->SetSelection(0);
792 if (attr
->HasBulletStyle())
795 if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ARABIC
)
796 index
= wxRICHTEXT_BULLETINDEX_ARABIC
;
798 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER
)
799 index
= wxRICHTEXT_BULLETINDEX_UPPER_CASE
;
801 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER
)
802 index
= wxRICHTEXT_BULLETINDEX_LOWER_CASE
;
804 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER
)
805 index
= wxRICHTEXT_BULLETINDEX_UPPER_CASE_ROMAN
;
807 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER
)
808 index
= wxRICHTEXT_BULLETINDEX_LOWER_CASE_ROMAN
;
810 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_OUTLINE
)
811 index
= wxRICHTEXT_BULLETINDEX_OUTLINE
;
813 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_SYMBOL
)
814 index
= wxRICHTEXT_BULLETINDEX_SYMBOL
;
816 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_BITMAP
)
817 index
= wxRICHTEXT_BULLETINDEX_BITMAP
;
819 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_STANDARD
)
820 index
= wxRICHTEXT_BULLETINDEX_STANDARD
;
822 m_styleListBox
->SetSelection(index
);
824 if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PARENTHESES
)
825 m_parenthesesCtrl
->SetValue(true);
827 m_parenthesesCtrl
->SetValue(false);
829 if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS
)
830 m_rightParenthesisCtrl
->SetValue(true);
832 m_rightParenthesisCtrl
->SetValue(false);
834 if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PERIOD
)
835 m_periodCtrl
->SetValue(true);
837 m_periodCtrl
->SetValue(false);
839 if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE
)
840 m_bulletAlignmentCtrl
->SetSelection(1);
841 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT
)
842 m_bulletAlignmentCtrl
->SetSelection(2);
844 m_bulletAlignmentCtrl
->SetSelection(0);
848 m_styleListBox
->SetSelection(-1);
849 m_bulletAlignmentCtrl
->SetSelection(-1);
852 if (attr
->HasBulletText())
854 m_symbolCtrl
->SetValue(attr
->GetBulletText());
855 m_symbolFontCtrl
->SetValue(attr
->GetBulletFont());
858 m_symbolCtrl
->SetValue(wxEmptyString
);
860 if (attr
->HasBulletName())
861 m_bulletNameCtrl
->SetValue(attr
->GetBulletName());
863 m_bulletNameCtrl
->SetValue(wxEmptyString
);
865 m_dontUpdate
= false;
868 /// Get attributes for selected level
869 wxRichTextAttr
* wxRichTextListStylePage::GetAttributesForSelection()
871 wxRichTextListStyleDefinition
* def
= wxDynamicCast(wxRichTextFormattingDialog::GetDialogStyleDefinition(this),
872 wxRichTextListStyleDefinition
);
874 int value
= m_levelCtrl
->GetValue();
877 return def
->GetLevelAttributes(value
-1);
882 /// Just transfer from the window and update the preview
883 void wxRichTextListStylePage::TransferAndPreview()
887 TransferDataFromWindow();
894 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
897 void wxRichTextListStylePage::OnLevelUpdated( wxSpinEvent
& WXUNUSED(event
) )
901 m_currentLevel
= m_levelCtrl
->GetValue();
902 TransferDataToWindow();
907 * wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
910 void wxRichTextListStylePage::OnLevelUp( wxSpinEvent
& event
)
914 m_currentLevel
= event
.GetPosition();
915 TransferDataToWindow();
920 * wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
923 void wxRichTextListStylePage::OnLevelDown( wxSpinEvent
& event
)
927 m_currentLevel
= event
.GetPosition();
928 TransferDataToWindow();
933 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
936 void wxRichTextListStylePage::OnLevelTextUpdated( wxCommandEvent
& WXUNUSED(event
) )
938 // Can cause problems
942 m_currentLevel
= event
.GetInt();
943 TransferDataToWindow();
949 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL
952 void wxRichTextListStylePage::OnLevelUIUpdate( wxUpdateUIEvent
& event
)
954 ////@begin wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL in wxRichTextListStylePage.
955 // Before editing this code, remove the block markers.
957 ////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL in wxRichTextListStylePage.
961 * wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_STYLELISTBOX
964 void wxRichTextListStylePage::OnStylelistboxSelected( wxCommandEvent
& WXUNUSED(event
) )
966 TransferAndPreview();
970 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLSTATIC
973 void wxRichTextListStylePage::OnSymbolstaticUpdate( wxUpdateUIEvent
& event
)
975 OnSymbolUpdate(event
);
979 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
982 void wxRichTextListStylePage::OnSymbolctrlSelected( wxCommandEvent
& WXUNUSED(event
) )
984 TransferAndPreview();
988 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
991 void wxRichTextListStylePage::OnSymbolctrlUpdated( wxCommandEvent
& WXUNUSED(event
) )
993 TransferAndPreview();
997 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
1000 void wxRichTextListStylePage::OnSymbolctrlUIUpdate( wxUpdateUIEvent
& event
)
1002 OnSymbolUpdate(event
);
1006 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
1009 void wxRichTextListStylePage::OnChooseSymbolClick( wxCommandEvent
& WXUNUSED(event
) )
1011 int sel
= m_styleListBox
->GetSelection();
1012 if (sel
== wxRICHTEXT_BULLETINDEX_SYMBOL
)
1014 wxString symbol
= m_symbolCtrl
->GetValue();
1015 wxString fontName
= m_symbolFontCtrl
->GetValue();
1016 wxSymbolPickerDialog
dlg(symbol
, fontName
, fontName
, this);
1018 if (dlg
.ShowModal() == wxID_OK
)
1020 m_dontUpdate
= true;
1022 m_symbolCtrl
->SetValue(dlg
.GetSymbol());
1023 m_symbolFontCtrl
->SetValue(dlg
.GetFontName());
1025 TransferAndPreview();
1027 m_dontUpdate
= false;
1033 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
1036 void wxRichTextListStylePage::OnChooseSymbolUpdate( wxUpdateUIEvent
& event
)
1038 OnSymbolUpdate(event
);
1042 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
1045 void wxRichTextListStylePage::OnSymbolfontctrlSelected( wxCommandEvent
& WXUNUSED(event
) )
1047 TransferAndPreview();
1051 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
1054 void wxRichTextListStylePage::OnSymbolfontctrlUpdated( wxCommandEvent
& WXUNUSED(event
) )
1056 TransferAndPreview();
1060 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL
1063 void wxRichTextListStylePage::OnSymbolfontctrlUIUpdate( wxUpdateUIEvent
& event
)
1065 OnSymbolUpdate(event
);
1069 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL
1072 void wxRichTextListStylePage::OnParenthesesctrlClick( wxCommandEvent
& WXUNUSED(event
) )
1074 TransferAndPreview();
1078 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL
1081 void wxRichTextListStylePage::OnParenthesesctrlUpdate( wxUpdateUIEvent
& event
)
1083 int sel
= m_styleListBox
->GetSelection();
1084 event
.Enable((sel
!= wxRICHTEXT_BULLETINDEX_SYMBOL
&&
1085 sel
!= wxRICHTEXT_BULLETINDEX_BITMAP
&&
1086 sel
!= wxRICHTEXT_BULLETINDEX_NONE
));
1090 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
1093 void wxRichTextListStylePage::OnPeriodctrlClick( wxCommandEvent
& WXUNUSED(event
) )
1095 TransferAndPreview();
1099 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL
1102 void wxRichTextListStylePage::OnPeriodctrlUpdate( wxUpdateUIEvent
& event
)
1104 int sel
= m_styleListBox
->GetSelection();
1105 event
.Enable((sel
!= wxRICHTEXT_BULLETINDEX_SYMBOL
&&
1106 sel
!= wxRICHTEXT_BULLETINDEX_BITMAP
&&
1107 sel
!= wxRICHTEXT_BULLETINDEX_NONE
));
1111 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNLEFT
1114 void wxRichTextListStylePage::OnRichtextliststylepageAlignleftSelected( wxCommandEvent
& WXUNUSED(event
) )
1116 TransferAndPreview();
1120 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNRIGHT
1123 void wxRichTextListStylePage::OnRichtextliststylepageAlignrightSelected( wxCommandEvent
& WXUNUSED(event
) )
1125 TransferAndPreview();
1129 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_JUSTIFIED
1132 void wxRichTextListStylePage::OnRichtextliststylepageJustifiedSelected( wxCommandEvent
& WXUNUSED(event
) )
1134 TransferAndPreview();
1138 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_CENTERED
1141 void wxRichTextListStylePage::OnRichtextliststylepageCenteredSelected( wxCommandEvent
& WXUNUSED(event
) )
1143 TransferAndPreview();
1147 * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_ALIGNINDETERMINATE
1150 void wxRichTextListStylePage::OnRichtextliststylepageAlignindeterminateSelected( wxCommandEvent
& WXUNUSED(event
) )
1152 TransferAndPreview();
1156 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT
1159 void wxRichTextListStylePage::OnIndentLeftUpdated( wxCommandEvent
& WXUNUSED(event
) )
1161 TransferAndPreview();
1165 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE
1168 void wxRichTextListStylePage::OnIndentFirstLineUpdated( wxCommandEvent
& WXUNUSED(event
) )
1170 TransferAndPreview();
1174 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT
1177 void wxRichTextListStylePage::OnIndentRightUpdated( wxCommandEvent
& WXUNUSED(event
) )
1179 TransferAndPreview();
1183 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE
1186 void wxRichTextListStylePage::OnSpacingBeforeUpdated( wxCommandEvent
& WXUNUSED(event
) )
1188 TransferAndPreview();
1192 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER
1195 void wxRichTextListStylePage::OnSpacingAfterUpdated( wxCommandEvent
& WXUNUSED(event
) )
1197 TransferAndPreview();
1201 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_LINESPACING
1204 void wxRichTextListStylePage::OnLineSpacingSelected( wxCommandEvent
& WXUNUSED(event
) )
1206 TransferAndPreview();
1210 * Should we show tooltips?
1213 bool wxRichTextListStylePage::ShowToolTips()
1215 return wxRichTextFormattingDialog::ShowToolTips();
1219 * Get bitmap resources
1222 wxBitmap
wxRichTextListStylePage::GetBitmapResource( const wxString
& name
)
1225 ////@begin wxRichTextListStylePage bitmap retrieval
1227 return wxNullBitmap
;
1228 ////@end wxRichTextListStylePage bitmap retrieval
1232 * Get icon resources
1235 wxIcon
wxRichTextListStylePage::GetIconResource( const wxString
& name
)
1238 ////@begin wxRichTextListStylePage icon retrieval
1241 ////@end wxRichTextListStylePage icon retrieval
1244 /// Update for symbol-related controls
1245 void wxRichTextListStylePage::OnSymbolUpdate( wxUpdateUIEvent
& event
)
1247 int sel
= m_styleListBox
->GetSelection();
1248 event
.Enable(sel
== wxRICHTEXT_BULLETINDEX_SYMBOL
);
1251 /// Update for number-related controls
1252 void wxRichTextListStylePage::OnNumberUpdate( wxUpdateUIEvent
& event
)
1254 int sel
= m_styleListBox
->GetSelection();
1255 event
.Enable((sel
!= wxRICHTEXT_BULLETINDEX_SYMBOL
&&
1256 sel
!= wxRICHTEXT_BULLETINDEX_BITMAP
&&
1257 sel
!= wxRICHTEXT_BULLETINDEX_STANDARD
&&
1258 sel
!= wxRICHTEXT_BULLETINDEX_NONE
));
1261 /// Update for standard bullet-related controls
1262 void wxRichTextListStylePage::OnStandardBulletUpdate( wxUpdateUIEvent
& event
)
1264 int sel
= m_styleListBox
->GetSelection();
1265 event
.Enable( sel
== wxRICHTEXT_BULLETINDEX_STANDARD
);
1269 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_CHOOSE_FONT
1272 void wxRichTextListStylePage::OnChooseFontClick( wxCommandEvent
& WXUNUSED(event
) )
1274 wxRichTextAttr
* attr
= GetAttributesForSelection();
1276 int pages
= wxRICHTEXT_FORMAT_FONT
;
1277 wxRichTextFormattingDialog formatDlg
;
1278 formatDlg
.SetStyle(*attr
, false);
1279 formatDlg
.Create(pages
, this);
1281 if (formatDlg
.ShowModal() == wxID_OK
)
1283 (*attr
) = formatDlg
.GetAttributes();
1284 TransferAndPreview();
1288 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMESTATIC
1291 void wxRichTextListStylePage::OnNamestaticUpdate( wxUpdateUIEvent
& event
)
1293 OnStandardBulletUpdate(event
);
1297 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
1300 void wxRichTextListStylePage::OnNamectrlSelected( wxCommandEvent
& WXUNUSED(event
) )
1302 TransferAndPreview();
1306 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
1309 void wxRichTextListStylePage::OnNamectrlUpdated( wxCommandEvent
& WXUNUSED(event
) )
1311 TransferAndPreview();
1315 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_NAMECTRL
1318 void wxRichTextListStylePage::OnNamectrlUIUpdate( wxUpdateUIEvent
& event
)
1320 OnStandardBulletUpdate(event
);
1323 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL
1326 void wxRichTextListStylePage::OnRightParenthesisCtrlClick( wxCommandEvent
& WXUNUSED(event
) )
1328 TransferAndPreview();
1332 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_RIGHTPARENTHESISCTRL
1335 void wxRichTextListStylePage::OnRightParenthesisCtrlUpdate( wxUpdateUIEvent
& event
)
1337 int sel
= m_styleListBox
->GetSelection();
1338 event
.Enable((sel
!= wxRICHTEXT_BULLETINDEX_SYMBOL
&&
1339 sel
!= wxRICHTEXT_BULLETINDEX_BITMAP
&&
1340 sel
!= wxRICHTEXT_BULLETINDEX_NONE
));
1344 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTLISTSTYLEPAGE_BULLETALIGNMENTCTRL
1347 void wxRichTextListStylePage::OnBulletAlignmentCtrlSelected( wxCommandEvent
& WXUNUSED(event
) )
1349 TransferAndPreview();