1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/richtext/richtextbulletspage.cpp
4 // Author: Julian Smart
6 // Created: 10/4/2006 10:32:31 AM
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
14 #include "wx/richtext/richtextbulletspage.h"
16 #include "wx/richtext/richtextsymboldlg.h"
19 * wxRichTextBulletsPage type definition
22 IMPLEMENT_DYNAMIC_CLASS( wxRichTextBulletsPage
, wxPanel
)
25 * wxRichTextBulletsPage event table definition
28 BEGIN_EVENT_TABLE( wxRichTextBulletsPage
, wxPanel
)
30 ////@begin wxRichTextBulletsPage event table entries
31 EVT_LISTBOX( ID_RICHTEXTBULLETSPAGE_STYLELISTBOX
, wxRichTextBulletsPage::OnStylelistboxSelected
)
33 EVT_CHECKBOX( ID_RICHTEXTBULLETSPAGE_PERIODCTRL
, wxRichTextBulletsPage::OnPeriodctrlClick
)
34 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_PERIODCTRL
, wxRichTextBulletsPage::OnPeriodctrlUpdate
)
36 EVT_CHECKBOX( ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL
, wxRichTextBulletsPage::OnParenthesesctrlClick
)
37 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL
, wxRichTextBulletsPage::OnParenthesesctrlUpdate
)
39 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC
, wxRichTextBulletsPage::OnNumberstaticUpdate
)
41 EVT_SPINCTRL( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
, wxRichTextBulletsPage::OnNumberctrlUpdated
)
42 EVT_SPIN_UP( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
, wxRichTextBulletsPage::OnNumberctrlUp
)
43 EVT_SPIN_DOWN( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
, wxRichTextBulletsPage::OnNumberctrlDown
)
44 EVT_TEXT( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
, wxRichTextBulletsPage::OnNumberctrlTextUpdated
)
45 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
, wxRichTextBulletsPage::OnNumberctrlUpdate
)
47 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC
, wxRichTextBulletsPage::OnSymbolstaticUpdate
)
49 EVT_COMBOBOX( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
, wxRichTextBulletsPage::OnSymbolctrlSelected
)
50 EVT_TEXT( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
, wxRichTextBulletsPage::OnSymbolctrlUpdated
)
51 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
, wxRichTextBulletsPage::OnSymbolctrlUpdate
)
53 EVT_BUTTON( ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
, wxRichTextBulletsPage::OnChooseSymbolClick
)
54 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
, wxRichTextBulletsPage::OnChooseSymbolUpdate
)
56 EVT_COMBOBOX( ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
, wxRichTextBulletsPage::OnSymbolfontctrlSelected
)
57 EVT_TEXT( ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
, wxRichTextBulletsPage::OnSymbolfontctrlUpdated
)
58 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
, wxRichTextBulletsPage::OnSymbolfontctrlUIUpdate
)
60 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_NAMESTATIC
, wxRichTextBulletsPage::OnNamestaticUpdate
)
62 EVT_COMBOBOX( ID_RICHTEXTBULLETSPAGE_NAMECTRL
, wxRichTextBulletsPage::OnNamectrlSelected
)
63 EVT_TEXT( ID_RICHTEXTBULLETSPAGE_NAMECTRL
, wxRichTextBulletsPage::OnNamectrlUpdated
)
64 EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_NAMECTRL
, wxRichTextBulletsPage::OnNamectrlUIUpdate
)
66 ////@end wxRichTextBulletsPage event table entries
71 * wxRichTextBulletsPage constructors
74 wxRichTextBulletsPage::wxRichTextBulletsPage( )
79 wxRichTextBulletsPage::wxRichTextBulletsPage( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
82 Create(parent
, id
, pos
, size
, style
);
89 void wxRichTextBulletsPage::Init()
91 m_hasBulletStyle
= false;
92 m_hasBulletNumber
= false;
93 m_hasBulletSymbol
= false;
96 ////@begin wxRichTextBulletsPage member initialisation
97 m_styleListBox
= NULL
;
99 m_parenthesesCtrl
= NULL
;
102 m_symbolFontCtrl
= NULL
;
103 m_bulletNameCtrl
= NULL
;
104 m_previewCtrl
= NULL
;
105 ////@end wxRichTextBulletsPage member initialisation
109 * wxRichTextBulletsPage creator
112 bool wxRichTextBulletsPage::Create( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
114 ////@begin wxRichTextBulletsPage creation
115 wxPanel::Create( parent
, id
, pos
, size
, style
);
120 GetSizer()->SetSizeHints(this);
123 ////@end wxRichTextBulletsPage creation
128 * Control creation for wxRichTextBulletsPage
131 void wxRichTextBulletsPage::CreateControls()
133 ////@begin wxRichTextBulletsPage content construction
134 wxRichTextBulletsPage
* itemPanel1
= this;
136 wxBoxSizer
* itemBoxSizer2
= new wxBoxSizer(wxVERTICAL
);
137 itemPanel1
->SetSizer(itemBoxSizer2
);
139 wxBoxSizer
* itemBoxSizer3
= new wxBoxSizer(wxVERTICAL
);
140 itemBoxSizer2
->Add(itemBoxSizer3
, 1, wxGROW
|wxALL
, 5);
142 wxBoxSizer
* itemBoxSizer4
= new wxBoxSizer(wxHORIZONTAL
);
143 itemBoxSizer3
->Add(itemBoxSizer4
, 0, wxGROW
, 5);
145 wxBoxSizer
* itemBoxSizer5
= new wxBoxSizer(wxVERTICAL
);
146 itemBoxSizer4
->Add(itemBoxSizer5
, 0, wxGROW
, 5);
148 wxStaticText
* itemStaticText6
= new wxStaticText( itemPanel1
, wxID_STATIC
, _("&Bullet style:"), wxDefaultPosition
, wxDefaultSize
, 0 );
149 itemBoxSizer5
->Add(itemStaticText6
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
|wxADJUST_MINSIZE
, 5);
151 wxString
* m_styleListBoxStrings
= NULL
;
152 m_styleListBox
= new wxListBox( itemPanel1
, ID_RICHTEXTBULLETSPAGE_STYLELISTBOX
, wxDefaultPosition
, wxSize(-1, 130), 0, m_styleListBoxStrings
, wxLB_SINGLE
);
153 m_styleListBox
->SetHelpText(_("The available bullet styles."));
155 m_styleListBox
->SetToolTip(_("The available bullet styles."));
156 itemBoxSizer5
->Add(m_styleListBox
, 1, wxGROW
|wxALL
, 5);
158 wxBoxSizer
* itemBoxSizer8
= new wxBoxSizer(wxHORIZONTAL
);
159 itemBoxSizer5
->Add(itemBoxSizer8
, 0, wxGROW
, 5);
161 m_periodCtrl
= new wxCheckBox( itemPanel1
, ID_RICHTEXTBULLETSPAGE_PERIODCTRL
, _("Peri&od"), wxDefaultPosition
, wxDefaultSize
, 0 );
162 m_periodCtrl
->SetValue(false);
163 m_periodCtrl
->SetHelpText(_("Check to add a period after the bullet."));
165 m_periodCtrl
->SetToolTip(_("Check to add a period after the bullet."));
166 itemBoxSizer8
->Add(m_periodCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
168 m_parenthesesCtrl
= new wxCheckBox( itemPanel1
, ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL
, _("&Parentheses"), wxDefaultPosition
, wxDefaultSize
, 0 );
169 m_parenthesesCtrl
->SetValue(false);
170 m_parenthesesCtrl
->SetHelpText(_("Check to enclose the bullet in parentheses."));
172 m_parenthesesCtrl
->SetToolTip(_("Check to enclose the bullet in parentheses."));
173 itemBoxSizer8
->Add(m_parenthesesCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
175 itemBoxSizer5
->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL
, 5);
177 wxStaticText
* itemStaticText12
= new wxStaticText( itemPanel1
, ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC
, _("&Number:"), wxDefaultPosition
, wxDefaultSize
, 0 );
178 itemBoxSizer5
->Add(itemStaticText12
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
|wxADJUST_MINSIZE
, 5);
180 m_numberCtrl
= new wxSpinCtrl( itemPanel1
, ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
, _T("0"), wxDefaultPosition
, wxSize(50, -1), wxSP_ARROW_KEYS
, 0, 100000, 0 );
181 m_numberCtrl
->SetHelpText(_("The list item number."));
183 m_numberCtrl
->SetToolTip(_("The list item number."));
184 itemBoxSizer5
->Add(m_numberCtrl
, 0, wxGROW
|wxALL
, 5);
186 itemBoxSizer4
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
188 wxStaticLine
* itemStaticLine15
= new wxStaticLine( itemPanel1
, wxID_STATIC
, wxDefaultPosition
, wxDefaultSize
, wxLI_VERTICAL
);
189 itemBoxSizer4
->Add(itemStaticLine15
, 0, wxGROW
|wxLEFT
|wxRIGHT
, 5);
191 itemBoxSizer4
->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
, 5);
193 wxBoxSizer
* itemBoxSizer17
= new wxBoxSizer(wxVERTICAL
);
194 itemBoxSizer4
->Add(itemBoxSizer17
, 0, wxGROW
, 5);
196 wxStaticText
* itemStaticText18
= new wxStaticText( itemPanel1
, ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC
, _("&Symbol:"), wxDefaultPosition
, wxDefaultSize
, 0 );
197 itemBoxSizer17
->Add(itemStaticText18
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
|wxADJUST_MINSIZE
, 5);
199 wxBoxSizer
* itemBoxSizer19
= new wxBoxSizer(wxHORIZONTAL
);
200 itemBoxSizer17
->Add(itemBoxSizer19
, 0, wxGROW
, 5);
202 wxString
* m_symbolCtrlStrings
= NULL
;
203 m_symbolCtrl
= new wxComboBox( itemPanel1
, ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
, _T(""), wxDefaultPosition
, wxSize(60, -1), 0, m_symbolCtrlStrings
, wxCB_DROPDOWN
);
204 m_symbolCtrl
->SetHelpText(_("The bullet character."));
206 m_symbolCtrl
->SetToolTip(_("The bullet character."));
207 itemBoxSizer19
->Add(m_symbolCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
|wxFIXED_MINSIZE
, 5);
209 wxButton
* itemButton21
= new wxButton( itemPanel1
, ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
, _("Ch&oose..."), wxDefaultPosition
, wxDefaultSize
, 0 );
210 itemButton21
->SetHelpText(_("Click to browse for a symbol."));
212 itemButton21
->SetToolTip(_("Click to browse for a symbol."));
213 itemBoxSizer19
->Add(itemButton21
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
215 itemBoxSizer17
->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL
, 5);
217 wxStaticText
* itemStaticText23
= new wxStaticText( itemPanel1
, ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC
, _("Symbol &font:"), wxDefaultPosition
, wxDefaultSize
, 0 );
218 itemBoxSizer17
->Add(itemStaticText23
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
|wxADJUST_MINSIZE
, 5);
220 wxString
* m_symbolFontCtrlStrings
= NULL
;
221 m_symbolFontCtrl
= new wxComboBox( itemPanel1
, ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
, _T(""), wxDefaultPosition
, wxDefaultSize
, 0, m_symbolFontCtrlStrings
, wxCB_DROPDOWN
);
222 m_symbolFontCtrl
->SetHelpText(_("Available fonts."));
224 m_symbolFontCtrl
->SetToolTip(_("Available fonts."));
225 itemBoxSizer17
->Add(m_symbolFontCtrl
, 0, wxGROW
|wxALL
, 5);
227 itemBoxSizer17
->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL
|wxALL
, 5);
229 wxStaticText
* itemStaticText26
= new wxStaticText( itemPanel1
, ID_RICHTEXTBULLETSPAGE_NAMESTATIC
, _("S&tandard bullet name:"), wxDefaultPosition
, wxDefaultSize
, 0 );
230 itemBoxSizer17
->Add(itemStaticText26
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
|wxADJUST_MINSIZE
, 5);
232 wxString
* m_bulletNameCtrlStrings
= NULL
;
233 m_bulletNameCtrl
= new wxComboBox( itemPanel1
, ID_RICHTEXTBULLETSPAGE_NAMECTRL
, _T(""), wxDefaultPosition
, wxDefaultSize
, 0, m_bulletNameCtrlStrings
, wxCB_DROPDOWN
);
234 m_bulletNameCtrl
->SetHelpText(_("A standard bullet name."));
236 m_bulletNameCtrl
->SetToolTip(_("A standard bullet name."));
237 itemBoxSizer17
->Add(m_bulletNameCtrl
, 0, wxGROW
|wxALL
, 5);
239 itemBoxSizer3
->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL
|wxALL
, 5);
241 m_previewCtrl
= new wxRichTextCtrl( itemPanel1
, ID_RICHTEXTBULLETSPAGE_PREVIEW_CTRL
, wxEmptyString
, wxDefaultPosition
, wxSize(350, 180), wxSUNKEN_BORDER
);
242 m_previewCtrl
->SetHelpText(_("Shows a preview of the bullet settings."));
244 m_previewCtrl
->SetToolTip(_("Shows a preview of the bullet settings."));
245 itemBoxSizer3
->Add(m_previewCtrl
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALL
, 5);
247 ////@end wxRichTextBulletsPage content construction
249 m_styleListBox
->Append(_("(None)"));
250 m_styleListBox
->Append(_("Arabic"));
251 m_styleListBox
->Append(_("Upper case letters"));
252 m_styleListBox
->Append(_("Lower case letters"));
253 m_styleListBox
->Append(_("Upper case roman numerals"));
254 m_styleListBox
->Append(_("Lower case roman numerals"));
255 m_styleListBox
->Append(_("Symbol"));
256 m_styleListBox
->Append(_("Bitmap"));
257 m_styleListBox
->Append(_("Standard"));
259 m_symbolCtrl
->Append(_("*"));
260 m_symbolCtrl
->Append(_("-"));
261 m_symbolCtrl
->Append(_(">"));
262 m_symbolCtrl
->Append(_("+"));
263 m_symbolCtrl
->Append(_("~"));
265 m_bulletNameCtrl
->Append(_("standard/round"));
266 m_bulletNameCtrl
->Append(_("standard/square"));
268 wxArrayString facenames
= wxRichTextCtrl::GetAvailableFontNames();
271 m_symbolFontCtrl
->Append(facenames
);
274 /// Transfer data from/to window
275 bool wxRichTextBulletsPage::TransferDataFromWindow()
277 wxPanel::TransferDataFromWindow();
279 wxTextAttrEx
* attr
= GetAttributes();
281 if (m_hasBulletStyle
)
283 long bulletStyle
= 0;
285 int index
= m_styleListBox
->GetSelection();
287 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_ARABIC
;
289 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER
;
291 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER
;
293 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER
;
295 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER
;
297 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_SYMBOL
;
299 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_BITMAP
;
302 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_STANDARD
;
303 attr
->SetBulletName(m_bulletNameCtrl
->GetValue());
306 if (m_parenthesesCtrl
->GetValue())
307 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_PARENTHESES
;
308 if (m_periodCtrl
->GetValue())
309 bulletStyle
|= wxTEXT_ATTR_BULLET_STYLE_PERIOD
;
311 attr
->SetBulletStyle(bulletStyle
);
314 if (m_hasBulletNumber
)
316 attr
->SetBulletNumber(m_numberCtrl
->GetValue());
319 if (m_hasBulletSymbol
)
322 if (m_symbolCtrl
->GetValue().length() > 0)
323 c
= m_symbolCtrl
->GetValue()[0];
324 attr
->SetBulletSymbol(c
);
325 attr
->SetBulletFont(m_symbolFontCtrl
->GetValue());
330 bool wxRichTextBulletsPage::TransferDataToWindow()
334 wxPanel::TransferDataToWindow();
336 wxTextAttrEx
* attr
= GetAttributes();
338 if (attr
->HasBulletStyle())
340 m_hasBulletStyle
= true;
342 if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ARABIC
)
344 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER
)
346 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER
)
348 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER
)
350 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER
)
352 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_SYMBOL
)
354 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_BITMAP
)
356 else if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_STANDARD
)
358 m_styleListBox
->SetSelection(index
);
360 if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PARENTHESES
)
361 m_parenthesesCtrl
->SetValue(true);
363 m_parenthesesCtrl
->SetValue(false);
365 if (attr
->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PERIOD
)
366 m_periodCtrl
->SetValue(true);
368 m_periodCtrl
->SetValue(false);
372 m_hasBulletStyle
= false;
373 m_styleListBox
->SetSelection(-1);
376 if (attr
->HasBulletSymbol())
378 wxChar c
= attr
->GetBulletSymbol();
381 m_symbolCtrl
->SetValue(s
);
382 m_symbolFontCtrl
->SetValue(attr
->GetBulletFont());
385 m_symbolCtrl
->SetValue(wxEmptyString
);
387 if (attr
->HasBulletNumber())
388 m_numberCtrl
->SetValue(attr
->GetBulletNumber());
390 m_numberCtrl
->SetValue(0);
392 if (attr
->HasBulletName())
393 m_bulletNameCtrl
->SetValue(attr
->GetBulletName());
395 m_bulletNameCtrl
->SetValue(wxEmptyString
);
399 m_dontUpdate
= false;
404 /// Updates the bullet preview
405 void wxRichTextBulletsPage::UpdatePreview()
407 static const wxChar
* s_para1
= wxT("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \
408 Nullam ante sapien, vestibulum nonummy, pulvinar sed, luctus ut, lacus.");
410 static const wxChar
* s_para2
= wxT("\nDuis pharetra consequat dui. Cum sociis natoque penatibus \
411 et magnis dis parturient montes, nascetur ridiculus mus. Nullam vitae justo id mauris lobortis interdum.");
413 static const wxChar
* s_para3
= wxT("\nInteger convallis dolor at augue \
414 iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
416 TransferDataFromWindow();
417 wxTextAttrEx
attr(*GetAttributes());
418 attr
.SetFlags(attr
.GetFlags() &
419 (wxTEXT_ATTR_BULLET_STYLE
|wxTEXT_ATTR_BULLET_NUMBER
|wxTEXT_ATTR_BULLET_SYMBOL
|wxTEXT_ATTR_BULLET_NAME
|
420 wxTEXT_ATTR_ALIGNMENT
|wxTEXT_ATTR_LEFT_INDENT
|wxTEXT_ATTR_RIGHT_INDENT
|wxTEXT_ATTR_PARA_SPACING_BEFORE
|wxTEXT_ATTR_PARA_SPACING_AFTER
|
421 wxTEXT_ATTR_LINE_SPACING
));
423 wxFont
font(m_previewCtrl
->GetFont());
424 font
.SetPointSize(9);
425 m_previewCtrl
->SetFont(font
);
427 wxTextAttrEx normalParaAttr
;
428 normalParaAttr
.SetFont(font
);
429 normalParaAttr
.SetTextColour(wxColour(wxT("LIGHT GREY")));
431 m_previewCtrl
->Freeze();
432 m_previewCtrl
->Clear();
434 m_previewCtrl
->BeginStyle(normalParaAttr
);
435 m_previewCtrl
->WriteText(s_para1
);
436 m_previewCtrl
->EndStyle();
438 m_previewCtrl
->BeginStyle(attr
);
439 m_previewCtrl
->WriteText(s_para2
);
440 m_previewCtrl
->EndStyle();
442 m_previewCtrl
->BeginStyle(normalParaAttr
);
443 m_previewCtrl
->WriteText(s_para3
);
444 m_previewCtrl
->EndStyle();
446 m_previewCtrl
->Thaw();
449 wxTextAttrEx
* wxRichTextBulletsPage::GetAttributes()
451 return wxRichTextFormattingDialog::GetDialogAttributes(this);
455 * Should we show tooltips?
458 bool wxRichTextBulletsPage::ShowToolTips()
460 return wxRichTextFormattingDialog::ShowToolTips();
464 * Get bitmap resources
467 wxBitmap
wxRichTextBulletsPage::GetBitmapResource( const wxString
& name
)
470 ////@begin wxRichTextBulletsPage bitmap retrieval
473 ////@end wxRichTextBulletsPage bitmap retrieval
480 wxIcon
wxRichTextBulletsPage::GetIconResource( const wxString
& name
)
483 ////@begin wxRichTextBulletsPage icon retrieval
486 ////@end wxRichTextBulletsPage icon retrieval
490 * wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_STYLELISTBOX
493 void wxRichTextBulletsPage::OnStylelistboxSelected( wxCommandEvent
& WXUNUSED(event
) )
497 m_hasBulletStyle
= true;
499 if (m_styleListBox
->GetSelection() == 6)
500 m_hasBulletSymbol
= true;
507 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
510 void wxRichTextBulletsPage::OnSymbolctrlSelected( wxCommandEvent
& WXUNUSED(event
) )
514 m_hasBulletSymbol
= true;
520 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
523 void wxRichTextBulletsPage::OnSymbolctrlUpdated( wxCommandEvent
& WXUNUSED(event
) )
527 m_hasBulletSymbol
= true;
533 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL
536 void wxRichTextBulletsPage::OnSymbolctrlUpdate( wxUpdateUIEvent
& event
)
538 OnSymbolUpdate(event
);
542 * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
545 void wxRichTextBulletsPage::OnNumberctrlUpdated( wxSpinEvent
& WXUNUSED(event
) )
549 m_hasBulletNumber
= true;
555 * wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
558 void wxRichTextBulletsPage::OnNumberctrlUp( wxSpinEvent
& WXUNUSED(event
) )
562 m_hasBulletNumber
= true;
568 * wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
571 void wxRichTextBulletsPage::OnNumberctrlDown( wxSpinEvent
& WXUNUSED(event
) )
575 m_hasBulletNumber
= true;
581 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
584 void wxRichTextBulletsPage::OnNumberctrlTextUpdated( wxCommandEvent
& WXUNUSED(event
) )
588 m_hasBulletNumber
= true;
594 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL
597 void wxRichTextBulletsPage::OnNumberctrlUpdate( wxUpdateUIEvent
& event
)
599 OnNumberUpdate(event
);
603 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL
606 void wxRichTextBulletsPage::OnParenthesesctrlClick( wxCommandEvent
& WXUNUSED(event
) )
610 m_hasBulletStyle
= true;
616 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL
619 void wxRichTextBulletsPage::OnParenthesesctrlUpdate( wxUpdateUIEvent
& event
)
621 int sel
= m_styleListBox
->GetSelection();
622 event
.Enable(m_hasBulletStyle
&& (sel
!= 6 && sel
!= 7 && sel
!= 0));
626 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_PERIODCTRL
629 void wxRichTextBulletsPage::OnPeriodctrlClick( wxCommandEvent
& WXUNUSED(event
) )
633 m_hasBulletStyle
= true;
639 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_PERIODCTRL
642 void wxRichTextBulletsPage::OnPeriodctrlUpdate( wxUpdateUIEvent
& event
)
644 int sel
= m_styleListBox
->GetSelection();
645 event
.Enable(m_hasBulletStyle
&& (sel
!= 6 && sel
!= 7 && sel
!= 0));
649 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
652 void wxRichTextBulletsPage::OnChooseSymbolClick( wxCommandEvent
& WXUNUSED(event
) )
654 int sel
= m_styleListBox
->GetSelection();
655 if (m_hasBulletStyle
&& sel
== 6)
657 wxString symbol
= m_symbolCtrl
->GetValue();
658 wxString fontName
= m_symbolFontCtrl
->GetValue();
659 wxSymbolPickerDialog
dlg(symbol
, fontName
, fontName
, this);
661 if (dlg
.ShowModal() == wxID_OK
)
665 m_symbolCtrl
->SetValue(dlg
.GetSymbol());
666 m_symbolFontCtrl
->SetValue(dlg
.GetFontName());
670 m_dontUpdate
= false;
676 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL
679 void wxRichTextBulletsPage::OnChooseSymbolUpdate( wxUpdateUIEvent
& event
)
681 OnSymbolUpdate(event
);
684 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
687 void wxRichTextBulletsPage::OnSymbolfontctrlSelected( wxCommandEvent
& WXUNUSED(event
) )
695 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
698 void wxRichTextBulletsPage::OnSymbolfontctrlUpdated( wxCommandEvent
& WXUNUSED(event
) )
707 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL
710 void wxRichTextBulletsPage::OnSymbolfontctrlUIUpdate( wxUpdateUIEvent
& event
)
712 OnSymbolUpdate(event
);
715 /// Update for symbol-related controls
716 void wxRichTextBulletsPage::OnSymbolUpdate( wxUpdateUIEvent
& event
)
718 int sel
= m_styleListBox
->GetSelection();
719 event
.Enable(m_hasBulletStyle
&& (sel
== 6));
722 /// Update for number-related controls
723 void wxRichTextBulletsPage::OnNumberUpdate( wxUpdateUIEvent
& event
)
725 int sel
= m_styleListBox
->GetSelection();
726 event
.Enable( m_hasBulletStyle
&& (sel
!= 6 && sel
!= 7 && sel
!= 8 && sel
!= 0));
729 /// Update for standard bullet-related controls
730 void wxRichTextBulletsPage::OnStandardBulletUpdate( wxUpdateUIEvent
& event
)
732 int sel
= m_styleListBox
->GetSelection();
733 event
.Enable( sel
== 8 );
738 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC
741 void wxRichTextBulletsPage::OnSymbolstaticUpdate( wxUpdateUIEvent
& event
)
743 OnSymbolUpdate(event
);
748 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC
751 void wxRichTextBulletsPage::OnNumberstaticUpdate( wxUpdateUIEvent
& event
)
753 OnNumberUpdate(event
);
757 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NAMESTATIC
760 void wxRichTextBulletsPage::OnNamestaticUpdate( wxUpdateUIEvent
& event
)
762 OnStandardBulletUpdate(event
);
767 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL
770 void wxRichTextBulletsPage::OnNamectrlSelected( wxCommandEvent
& WXUNUSED(event
) )
778 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL
781 void wxRichTextBulletsPage::OnNamectrlUpdated( wxCommandEvent
& WXUNUSED(event
) )
789 * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL
792 void wxRichTextBulletsPage::OnNamectrlUIUpdate( wxUpdateUIEvent
& event
)
794 OnStandardBulletUpdate(event
);
797 #endif // wxUSE_RICHTEXT