]>
Commit | Line | Data |
---|---|---|
97ff49b3 | 1 | ///////////////////////////////////////////////////////////////////////////// |
b68603d5 | 2 | // Name: src/richtext/richtextbulletspage.cpp |
97ff49b3 JS |
3 | // Purpose: |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 10/4/2006 10:32:31 AM | |
b68603d5 | 7 | // RCS-ID: $Id$ |
97ff49b3 | 8 | // Copyright: (c) Julian Smart |
b68603d5 | 9 | // Licence: wxWindows licence |
97ff49b3 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
b68603d5 WS |
12 | #if wxUSE_RICHTEXT |
13 | ||
14 | #include "wx/richtext/richtextbulletspage.h" | |
15 | ||
97ff49b3 | 16 | #include "wx/richtext/richtextsymboldlg.h" |
97ff49b3 | 17 | |
97ff49b3 JS |
18 | /*! |
19 | * wxRichTextBulletsPage type definition | |
20 | */ | |
21 | ||
22 | IMPLEMENT_DYNAMIC_CLASS( wxRichTextBulletsPage, wxPanel ) | |
23 | ||
24 | /*! | |
25 | * wxRichTextBulletsPage event table definition | |
26 | */ | |
27 | ||
28 | BEGIN_EVENT_TABLE( wxRichTextBulletsPage, wxPanel ) | |
29 | ||
30 | ////@begin wxRichTextBulletsPage event table entries | |
31 | EVT_LISTBOX( ID_RICHTEXTBULLETSPAGE_STYLELISTBOX, wxRichTextBulletsPage::OnStylelistboxSelected ) | |
32 | ||
f089713f JS |
33 | EVT_CHECKBOX( ID_RICHTEXTBULLETSPAGE_PERIODCTRL, wxRichTextBulletsPage::OnPeriodctrlClick ) |
34 | EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_PERIODCTRL, wxRichTextBulletsPage::OnPeriodctrlUpdate ) | |
35 | ||
36 | EVT_CHECKBOX( ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL, wxRichTextBulletsPage::OnParenthesesctrlClick ) | |
37 | EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL, wxRichTextBulletsPage::OnParenthesesctrlUpdate ) | |
38 | ||
d2d0adc7 JS |
39 | EVT_CHECKBOX( ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL, wxRichTextBulletsPage::OnRightParenthesisCtrlClick ) |
40 | EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL, wxRichTextBulletsPage::OnRightParenthesisCtrlUpdate ) | |
f089713f | 41 | |
d2d0adc7 | 42 | EVT_COMBOBOX( ID_RICHTEXTBULLETSPAGE_BULLETALIGNMENTCTRL, wxRichTextBulletsPage::OnBulletAlignmentCtrlSelected ) |
f089713f | 43 | |
97ff49b3 JS |
44 | EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC, wxRichTextBulletsPage::OnSymbolstaticUpdate ) |
45 | ||
46 | EVT_COMBOBOX( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxRichTextBulletsPage::OnSymbolctrlSelected ) | |
47 | EVT_TEXT( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxRichTextBulletsPage::OnSymbolctrlUpdated ) | |
48 | EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxRichTextBulletsPage::OnSymbolctrlUpdate ) | |
49 | ||
50 | EVT_BUTTON( ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL, wxRichTextBulletsPage::OnChooseSymbolClick ) | |
51 | EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL, wxRichTextBulletsPage::OnChooseSymbolUpdate ) | |
52 | ||
53 | EVT_COMBOBOX( ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, wxRichTextBulletsPage::OnSymbolfontctrlSelected ) | |
54 | EVT_TEXT( ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, wxRichTextBulletsPage::OnSymbolfontctrlUpdated ) | |
55 | EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, wxRichTextBulletsPage::OnSymbolfontctrlUIUpdate ) | |
56 | ||
f089713f | 57 | EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_NAMESTATIC, wxRichTextBulletsPage::OnNamestaticUpdate ) |
97ff49b3 | 58 | |
f089713f JS |
59 | EVT_COMBOBOX( ID_RICHTEXTBULLETSPAGE_NAMECTRL, wxRichTextBulletsPage::OnNamectrlSelected ) |
60 | EVT_TEXT( ID_RICHTEXTBULLETSPAGE_NAMECTRL, wxRichTextBulletsPage::OnNamectrlUpdated ) | |
61 | EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_NAMECTRL, wxRichTextBulletsPage::OnNamectrlUIUpdate ) | |
97ff49b3 | 62 | |
d2d0adc7 JS |
63 | EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC, wxRichTextBulletsPage::OnNumberstaticUpdate ) |
64 | ||
65 | EVT_SPINCTRL( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxRichTextBulletsPage::OnNumberctrlUpdated ) | |
66 | EVT_SPIN_UP( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxRichTextBulletsPage::OnNumberctrlUp ) | |
67 | EVT_SPIN_DOWN( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxRichTextBulletsPage::OnNumberctrlDown ) | |
68 | EVT_TEXT( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxRichTextBulletsPage::OnNumberctrlTextUpdated ) | |
69 | EVT_UPDATE_UI( ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxRichTextBulletsPage::OnNumberctrlUpdate ) | |
70 | ||
97ff49b3 JS |
71 | ////@end wxRichTextBulletsPage event table entries |
72 | ||
73 | END_EVENT_TABLE() | |
74 | ||
75 | /*! | |
76 | * wxRichTextBulletsPage constructors | |
77 | */ | |
78 | ||
79 | wxRichTextBulletsPage::wxRichTextBulletsPage( ) | |
80 | { | |
81 | Init(); | |
82 | } | |
83 | ||
84 | wxRichTextBulletsPage::wxRichTextBulletsPage( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) | |
85 | { | |
86 | Init(); | |
87 | Create(parent, id, pos, size, style); | |
88 | } | |
89 | ||
90 | /*! | |
91 | * Initialise members | |
92 | */ | |
5778b3c8 | 93 | |
97ff49b3 JS |
94 | void wxRichTextBulletsPage::Init() |
95 | { | |
96 | m_hasBulletStyle = false; | |
97 | m_hasBulletNumber = false; | |
98 | m_hasBulletSymbol = false; | |
99 | m_dontUpdate = false; | |
100 | ||
101 | ////@begin wxRichTextBulletsPage member initialisation | |
102 | m_styleListBox = NULL; | |
f089713f JS |
103 | m_periodCtrl = NULL; |
104 | m_parenthesesCtrl = NULL; | |
d2d0adc7 JS |
105 | m_rightParenthesisCtrl = NULL; |
106 | m_bulletAlignmentCtrl = NULL; | |
97ff49b3 JS |
107 | m_symbolCtrl = NULL; |
108 | m_symbolFontCtrl = NULL; | |
f089713f | 109 | m_bulletNameCtrl = NULL; |
d2d0adc7 | 110 | m_numberCtrl = NULL; |
97ff49b3 JS |
111 | m_previewCtrl = NULL; |
112 | ////@end wxRichTextBulletsPage member initialisation | |
113 | } | |
114 | ||
115 | /*! | |
116 | * wxRichTextBulletsPage creator | |
117 | */ | |
118 | ||
119 | bool wxRichTextBulletsPage::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) | |
120 | { | |
121 | ////@begin wxRichTextBulletsPage creation | |
122 | wxPanel::Create( parent, id, pos, size, style ); | |
123 | ||
124 | CreateControls(); | |
125 | if (GetSizer()) | |
126 | { | |
127 | GetSizer()->SetSizeHints(this); | |
128 | } | |
129 | Centre(); | |
130 | ////@end wxRichTextBulletsPage creation | |
131 | return true; | |
132 | } | |
133 | ||
134 | /*! | |
135 | * Control creation for wxRichTextBulletsPage | |
136 | */ | |
137 | ||
138 | void wxRichTextBulletsPage::CreateControls() | |
139 | { | |
140 | ////@begin wxRichTextBulletsPage content construction | |
141 | wxRichTextBulletsPage* itemPanel1 = this; | |
142 | ||
143 | wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); | |
144 | itemPanel1->SetSizer(itemBoxSizer2); | |
145 | ||
146 | wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL); | |
147 | itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5); | |
148 | ||
149 | wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL); | |
150 | itemBoxSizer3->Add(itemBoxSizer4, 0, wxGROW, 5); | |
151 | ||
152 | wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL); | |
153 | itemBoxSizer4->Add(itemBoxSizer5, 0, wxGROW, 5); | |
154 | ||
155 | wxStaticText* itemStaticText6 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Bullet style:"), wxDefaultPosition, wxDefaultSize, 0 ); | |
69ce77e2 | 156 | itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5); |
97ff49b3 JS |
157 | |
158 | wxString* m_styleListBoxStrings = NULL; | |
d2d0adc7 | 159 | m_styleListBox = new wxListBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_STYLELISTBOX, wxDefaultPosition, wxSize(-1, 140), 0, m_styleListBoxStrings, wxLB_SINGLE ); |
dadd4f55 JS |
160 | m_styleListBox->SetHelpText(_("The available bullet styles.")); |
161 | if (ShowToolTips()) | |
162 | m_styleListBox->SetToolTip(_("The available bullet styles.")); | |
f089713f JS |
163 | itemBoxSizer5->Add(m_styleListBox, 1, wxGROW|wxALL, 5); |
164 | ||
165 | wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxHORIZONTAL); | |
166 | itemBoxSizer5->Add(itemBoxSizer8, 0, wxGROW, 5); | |
167 | ||
168 | m_periodCtrl = new wxCheckBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_PERIODCTRL, _("Peri&od"), wxDefaultPosition, wxDefaultSize, 0 ); | |
169 | m_periodCtrl->SetValue(false); | |
170 | m_periodCtrl->SetHelpText(_("Check to add a period after the bullet.")); | |
171 | if (ShowToolTips()) | |
172 | m_periodCtrl->SetToolTip(_("Check to add a period after the bullet.")); | |
173 | itemBoxSizer8->Add(m_periodCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
174 | ||
d2d0adc7 | 175 | m_parenthesesCtrl = new wxCheckBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL, _("(*)"), wxDefaultPosition, wxDefaultSize, 0 ); |
f089713f JS |
176 | m_parenthesesCtrl->SetValue(false); |
177 | m_parenthesesCtrl->SetHelpText(_("Check to enclose the bullet in parentheses.")); | |
178 | if (ShowToolTips()) | |
179 | m_parenthesesCtrl->SetToolTip(_("Check to enclose the bullet in parentheses.")); | |
180 | itemBoxSizer8->Add(m_parenthesesCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
181 | ||
d2d0adc7 JS |
182 | m_rightParenthesisCtrl = new wxCheckBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_RIGHTPARENTHESISCTRL, _("*)"), wxDefaultPosition, wxDefaultSize, 0 ); |
183 | m_rightParenthesisCtrl->SetValue(false); | |
184 | m_rightParenthesisCtrl->SetHelpText(_("Check to add a right parenthesis.")); | |
185 | if (ShowToolTips()) | |
186 | m_rightParenthesisCtrl->SetToolTip(_("Check to add a right parenthesis.")); | |
187 | itemBoxSizer8->Add(m_rightParenthesisCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
f089713f | 188 | |
d2d0adc7 | 189 | itemBoxSizer5->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5); |
f089713f | 190 | |
d2d0adc7 | 191 | wxStaticText* itemStaticText13 = new wxStaticText( itemPanel1, wxID_STATIC, _("Bullet &Alignment:"), wxDefaultPosition, wxDefaultSize, 0 ); |
69ce77e2 | 192 | itemBoxSizer5->Add(itemStaticText13, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5); |
d2d0adc7 JS |
193 | |
194 | wxString m_bulletAlignmentCtrlStrings[] = { | |
195 | _("Left"), | |
196 | _("Centre"), | |
197 | _("Right") | |
198 | }; | |
199 | m_bulletAlignmentCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_BULLETALIGNMENTCTRL, _("Left"), wxDefaultPosition, wxSize(60, -1), 3, m_bulletAlignmentCtrlStrings, wxCB_READONLY ); | |
200 | m_bulletAlignmentCtrl->SetStringSelection(_("Left")); | |
201 | m_bulletAlignmentCtrl->SetHelpText(_("The bullet character.")); | |
f089713f | 202 | if (ShowToolTips()) |
d2d0adc7 JS |
203 | m_bulletAlignmentCtrl->SetToolTip(_("The bullet character.")); |
204 | itemBoxSizer5->Add(m_bulletAlignmentCtrl, 0, wxGROW|wxALL|wxFIXED_MINSIZE, 5); | |
97ff49b3 JS |
205 | |
206 | itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); | |
207 | ||
d2d0adc7 JS |
208 | wxStaticLine* itemStaticLine16 = new wxStaticLine( itemPanel1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); |
209 | itemBoxSizer4->Add(itemStaticLine16, 0, wxGROW|wxLEFT|wxRIGHT, 5); | |
97ff49b3 JS |
210 | |
211 | itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); | |
212 | ||
d2d0adc7 JS |
213 | wxBoxSizer* itemBoxSizer18 = new wxBoxSizer(wxVERTICAL); |
214 | itemBoxSizer4->Add(itemBoxSizer18, 0, wxGROW, 5); | |
97ff49b3 | 215 | |
d2d0adc7 | 216 | wxStaticText* itemStaticText19 = new wxStaticText( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC, _("&Symbol:"), wxDefaultPosition, wxDefaultSize, 0 ); |
69ce77e2 | 217 | itemBoxSizer18->Add(itemStaticText19, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5); |
97ff49b3 | 218 | |
d2d0adc7 JS |
219 | wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL); |
220 | itemBoxSizer18->Add(itemBoxSizer20, 0, wxGROW, 5); | |
97ff49b3 JS |
221 | |
222 | wxString* m_symbolCtrlStrings = NULL; | |
f089713f | 223 | m_symbolCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, _T(""), wxDefaultPosition, wxSize(60, -1), 0, m_symbolCtrlStrings, wxCB_DROPDOWN ); |
dadd4f55 JS |
224 | m_symbolCtrl->SetHelpText(_("The bullet character.")); |
225 | if (ShowToolTips()) | |
226 | m_symbolCtrl->SetToolTip(_("The bullet character.")); | |
d2d0adc7 | 227 | itemBoxSizer20->Add(m_symbolCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxFIXED_MINSIZE, 5); |
97ff49b3 | 228 | |
d2d0adc7 JS |
229 | wxButton* itemButton22 = new wxButton( itemPanel1, ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL, _("Ch&oose..."), wxDefaultPosition, wxDefaultSize, 0 ); |
230 | itemButton22->SetHelpText(_("Click to browse for a symbol.")); | |
dadd4f55 | 231 | if (ShowToolTips()) |
d2d0adc7 JS |
232 | itemButton22->SetToolTip(_("Click to browse for a symbol.")); |
233 | itemBoxSizer20->Add(itemButton22, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
97ff49b3 | 234 | |
d2d0adc7 | 235 | itemBoxSizer18->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5); |
97ff49b3 | 236 | |
d2d0adc7 | 237 | wxStaticText* itemStaticText24 = new wxStaticText( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC, _("Symbol &font:"), wxDefaultPosition, wxDefaultSize, 0 ); |
69ce77e2 | 238 | itemBoxSizer18->Add(itemStaticText24, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5); |
97ff49b3 JS |
239 | |
240 | wxString* m_symbolFontCtrlStrings = NULL; | |
f089713f | 241 | m_symbolFontCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_symbolFontCtrlStrings, wxCB_DROPDOWN ); |
dadd4f55 JS |
242 | m_symbolFontCtrl->SetHelpText(_("Available fonts.")); |
243 | if (ShowToolTips()) | |
244 | m_symbolFontCtrl->SetToolTip(_("Available fonts.")); | |
d2d0adc7 | 245 | itemBoxSizer18->Add(m_symbolFontCtrl, 0, wxGROW|wxALL, 5); |
97ff49b3 | 246 | |
d2d0adc7 | 247 | itemBoxSizer18->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); |
97ff49b3 | 248 | |
d2d0adc7 | 249 | wxStaticText* itemStaticText27 = new wxStaticText( itemPanel1, ID_RICHTEXTBULLETSPAGE_NAMESTATIC, _("S&tandard bullet name:"), wxDefaultPosition, wxDefaultSize, 0 ); |
69ce77e2 | 250 | itemBoxSizer18->Add(itemStaticText27, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5); |
97ff49b3 | 251 | |
f089713f JS |
252 | wxString* m_bulletNameCtrlStrings = NULL; |
253 | m_bulletNameCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_NAMECTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_bulletNameCtrlStrings, wxCB_DROPDOWN ); | |
254 | m_bulletNameCtrl->SetHelpText(_("A standard bullet name.")); | |
dadd4f55 | 255 | if (ShowToolTips()) |
f089713f | 256 | m_bulletNameCtrl->SetToolTip(_("A standard bullet name.")); |
d2d0adc7 JS |
257 | itemBoxSizer18->Add(m_bulletNameCtrl, 0, wxGROW|wxALL, 5); |
258 | ||
259 | itemBoxSizer18->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); | |
260 | ||
261 | wxStaticText* itemStaticText30 = new wxStaticText( itemPanel1, ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC, _("&Number:"), wxDefaultPosition, wxDefaultSize, 0 ); | |
69ce77e2 | 262 | itemBoxSizer18->Add(itemStaticText30, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5); |
d2d0adc7 JS |
263 | |
264 | m_numberCtrl = new wxSpinCtrl( itemPanel1, ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, _T("0"), wxDefaultPosition, wxSize(50, -1), wxSP_ARROW_KEYS, 0, 100000, 0 ); | |
265 | m_numberCtrl->SetHelpText(_("The list item number.")); | |
266 | if (ShowToolTips()) | |
267 | m_numberCtrl->SetToolTip(_("The list item number.")); | |
268 | itemBoxSizer18->Add(m_numberCtrl, 0, wxGROW|wxALL, 5); | |
97ff49b3 JS |
269 | |
270 | itemBoxSizer3->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); | |
271 | ||
272 | m_previewCtrl = new wxRichTextCtrl( itemPanel1, ID_RICHTEXTBULLETSPAGE_PREVIEW_CTRL, wxEmptyString, wxDefaultPosition, wxSize(350, 180), wxSUNKEN_BORDER ); | |
273 | m_previewCtrl->SetHelpText(_("Shows a preview of the bullet settings.")); | |
274 | if (ShowToolTips()) | |
275 | m_previewCtrl->SetToolTip(_("Shows a preview of the bullet settings.")); | |
276 | itemBoxSizer3->Add(m_previewCtrl, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); | |
277 | ||
278 | ////@end wxRichTextBulletsPage content construction | |
279 | ||
280 | m_styleListBox->Append(_("(None)")); | |
281 | m_styleListBox->Append(_("Arabic")); | |
282 | m_styleListBox->Append(_("Upper case letters")); | |
283 | m_styleListBox->Append(_("Lower case letters")); | |
284 | m_styleListBox->Append(_("Upper case roman numerals")); | |
285 | m_styleListBox->Append(_("Lower case roman numerals")); | |
d2d0adc7 | 286 | m_styleListBox->Append(_("Numbered outline")); |
97ff49b3 JS |
287 | m_styleListBox->Append(_("Symbol")); |
288 | m_styleListBox->Append(_("Bitmap")); | |
f089713f | 289 | m_styleListBox->Append(_("Standard")); |
69ce77e2 | 290 | |
97ff49b3 JS |
291 | m_symbolCtrl->Append(_("*")); |
292 | m_symbolCtrl->Append(_("-")); | |
293 | m_symbolCtrl->Append(_(">")); | |
294 | m_symbolCtrl->Append(_("+")); | |
295 | m_symbolCtrl->Append(_("~")); | |
69ce77e2 | 296 | |
d2d0adc7 JS |
297 | wxArrayString standardBulletNames; |
298 | if (wxRichTextBuffer::GetRenderer()) | |
299 | wxRichTextBuffer::GetRenderer()->EnumerateStandardBulletNames(standardBulletNames); | |
300 | ||
301 | m_bulletNameCtrl->Append(standardBulletNames); | |
5778b3c8 | 302 | |
dadd4f55 | 303 | wxArrayString facenames = wxRichTextCtrl::GetAvailableFontNames(); |
97ff49b3 | 304 | facenames.Sort(); |
5778b3c8 | 305 | |
97ff49b3 JS |
306 | m_symbolFontCtrl->Append(facenames); |
307 | } | |
308 | ||
309 | /// Transfer data from/to window | |
310 | bool wxRichTextBulletsPage::TransferDataFromWindow() | |
311 | { | |
312 | wxPanel::TransferDataFromWindow(); | |
313 | ||
314 | wxTextAttrEx* attr = GetAttributes(); | |
315 | ||
316 | if (m_hasBulletStyle) | |
317 | { | |
d2d0adc7 | 318 | long bulletStyle = wxRICHTEXT_BULLETINDEX_NONE; |
97ff49b3 JS |
319 | |
320 | int index = m_styleListBox->GetSelection(); | |
d2d0adc7 | 321 | if (index == wxRICHTEXT_BULLETINDEX_ARABIC) |
97ff49b3 | 322 | bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ARABIC; |
d2d0adc7 JS |
323 | |
324 | else if (index == wxRICHTEXT_BULLETINDEX_UPPER_CASE) | |
97ff49b3 | 325 | bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER; |
d2d0adc7 JS |
326 | |
327 | else if (index == wxRICHTEXT_BULLETINDEX_LOWER_CASE) | |
97ff49b3 | 328 | bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER; |
d2d0adc7 JS |
329 | |
330 | else if (index == wxRICHTEXT_BULLETINDEX_UPPER_CASE_ROMAN) | |
97ff49b3 | 331 | bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER; |
d2d0adc7 JS |
332 | |
333 | else if (index == wxRICHTEXT_BULLETINDEX_LOWER_CASE_ROMAN) | |
97ff49b3 | 334 | bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER; |
d2d0adc7 JS |
335 | |
336 | else if (index == wxRICHTEXT_BULLETINDEX_OUTLINE) | |
337 | bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_OUTLINE; | |
338 | ||
339 | else if (index == wxRICHTEXT_BULLETINDEX_SYMBOL) | |
97ff49b3 | 340 | bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_SYMBOL; |
d2d0adc7 JS |
341 | |
342 | else if (index == wxRICHTEXT_BULLETINDEX_BITMAP) | |
97ff49b3 | 343 | bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_BITMAP; |
d2d0adc7 JS |
344 | |
345 | else if (index == wxRICHTEXT_BULLETINDEX_STANDARD) | |
f089713f JS |
346 | { |
347 | bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_STANDARD; | |
348 | attr->SetBulletName(m_bulletNameCtrl->GetValue()); | |
349 | } | |
97ff49b3 JS |
350 | |
351 | if (m_parenthesesCtrl->GetValue()) | |
352 | bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_PARENTHESES; | |
d2d0adc7 JS |
353 | if (m_rightParenthesisCtrl->GetValue()) |
354 | bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS; | |
97ff49b3 JS |
355 | if (m_periodCtrl->GetValue()) |
356 | bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_PERIOD; | |
69ce77e2 | 357 | |
d2d0adc7 JS |
358 | if (m_bulletAlignmentCtrl->GetSelection() == 1) |
359 | bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE; | |
360 | else if (m_bulletAlignmentCtrl->GetSelection() == 2) | |
361 | bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT; | |
69ce77e2 | 362 | // Left is implied |
97ff49b3 JS |
363 | |
364 | attr->SetBulletStyle(bulletStyle); | |
365 | } | |
366 | ||
367 | if (m_hasBulletNumber) | |
368 | { | |
369 | attr->SetBulletNumber(m_numberCtrl->GetValue()); | |
370 | } | |
371 | ||
372 | if (m_hasBulletSymbol) | |
373 | { | |
d2d0adc7 | 374 | attr->SetBulletText(m_symbolCtrl->GetValue()); |
97ff49b3 JS |
375 | attr->SetBulletFont(m_symbolFontCtrl->GetValue()); |
376 | } | |
69ce77e2 | 377 | |
97ff49b3 JS |
378 | return true; |
379 | } | |
380 | ||
381 | bool wxRichTextBulletsPage::TransferDataToWindow() | |
382 | { | |
383 | m_dontUpdate = true; | |
384 | ||
385 | wxPanel::TransferDataToWindow(); | |
386 | ||
387 | wxTextAttrEx* attr = GetAttributes(); | |
388 | ||
389 | if (attr->HasBulletStyle()) | |
390 | { | |
f089713f | 391 | m_hasBulletStyle = true; |
d2d0adc7 JS |
392 | int index = wxRICHTEXT_BULLETINDEX_NONE; |
393 | ||
97ff49b3 | 394 | if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ARABIC) |
d2d0adc7 JS |
395 | index = wxRICHTEXT_BULLETINDEX_ARABIC; |
396 | ||
97ff49b3 | 397 | else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER) |
d2d0adc7 JS |
398 | index = wxRICHTEXT_BULLETINDEX_UPPER_CASE; |
399 | ||
97ff49b3 | 400 | else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER) |
d2d0adc7 JS |
401 | index = wxRICHTEXT_BULLETINDEX_LOWER_CASE; |
402 | ||
97ff49b3 | 403 | else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER) |
d2d0adc7 JS |
404 | index = wxRICHTEXT_BULLETINDEX_UPPER_CASE_ROMAN; |
405 | ||
97ff49b3 | 406 | else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER) |
d2d0adc7 JS |
407 | index = wxRICHTEXT_BULLETINDEX_LOWER_CASE_ROMAN; |
408 | ||
409 | else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_OUTLINE) | |
410 | index = wxRICHTEXT_BULLETINDEX_OUTLINE; | |
411 | ||
97ff49b3 | 412 | else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_SYMBOL) |
d2d0adc7 JS |
413 | index = wxRICHTEXT_BULLETINDEX_SYMBOL; |
414 | ||
97ff49b3 | 415 | else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_BITMAP) |
d2d0adc7 JS |
416 | index = wxRICHTEXT_BULLETINDEX_BITMAP; |
417 | ||
f089713f | 418 | else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_STANDARD) |
d2d0adc7 JS |
419 | index = wxRICHTEXT_BULLETINDEX_STANDARD; |
420 | ||
97ff49b3 JS |
421 | m_styleListBox->SetSelection(index); |
422 | ||
423 | if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PARENTHESES) | |
424 | m_parenthesesCtrl->SetValue(true); | |
425 | else | |
426 | m_parenthesesCtrl->SetValue(false); | |
427 | ||
d2d0adc7 JS |
428 | if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS) |
429 | m_rightParenthesisCtrl->SetValue(true); | |
430 | else | |
431 | m_rightParenthesisCtrl->SetValue(false); | |
432 | ||
97ff49b3 JS |
433 | if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_PERIOD) |
434 | m_periodCtrl->SetValue(true); | |
435 | else | |
5778b3c8 | 436 | m_periodCtrl->SetValue(false); |
d2d0adc7 JS |
437 | |
438 | if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE) | |
439 | m_bulletAlignmentCtrl->SetSelection(1); | |
440 | else if (attr->GetBulletStyle() & wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT) | |
441 | m_bulletAlignmentCtrl->SetSelection(2); | |
442 | else | |
443 | m_bulletAlignmentCtrl->SetSelection(0); | |
97ff49b3 JS |
444 | } |
445 | else | |
f089713f JS |
446 | { |
447 | m_hasBulletStyle = false; | |
97ff49b3 | 448 | m_styleListBox->SetSelection(-1); |
d2d0adc7 | 449 | m_bulletAlignmentCtrl->SetSelection(-1); |
f089713f | 450 | } |
97ff49b3 | 451 | |
d2d0adc7 | 452 | if (attr->HasBulletText()) |
97ff49b3 | 453 | { |
d2d0adc7 | 454 | m_symbolCtrl->SetValue(attr->GetBulletText()); |
97ff49b3 JS |
455 | m_symbolFontCtrl->SetValue(attr->GetBulletFont()); |
456 | } | |
457 | else | |
458 | m_symbolCtrl->SetValue(wxEmptyString); | |
459 | ||
460 | if (attr->HasBulletNumber()) | |
461 | m_numberCtrl->SetValue(attr->GetBulletNumber()); | |
462 | else | |
463 | m_numberCtrl->SetValue(0); | |
464 | ||
f089713f JS |
465 | if (attr->HasBulletName()) |
466 | m_bulletNameCtrl->SetValue(attr->GetBulletName()); | |
467 | else | |
468 | m_bulletNameCtrl->SetValue(wxEmptyString); | |
469 | ||
97ff49b3 JS |
470 | UpdatePreview(); |
471 | ||
472 | m_dontUpdate = false; | |
473 | ||
474 | return true; | |
475 | } | |
476 | ||
477 | /// Updates the bullet preview | |
478 | void wxRichTextBulletsPage::UpdatePreview() | |
479 | { | |
480 | static const wxChar* s_para1 = wxT("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \ | |
481 | Nullam ante sapien, vestibulum nonummy, pulvinar sed, luctus ut, lacus."); | |
482 | ||
483 | static const wxChar* s_para2 = wxT("\nDuis pharetra consequat dui. Cum sociis natoque penatibus \ | |
484 | et magnis dis parturient montes, nascetur ridiculus mus. Nullam vitae justo id mauris lobortis interdum."); | |
485 | ||
486 | static const wxChar* s_para3 = wxT("\nInteger convallis dolor at augue \ | |
487 | iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n"); | |
488 | ||
489 | TransferDataFromWindow(); | |
490 | wxTextAttrEx attr(*GetAttributes()); | |
491 | attr.SetFlags(attr.GetFlags() & | |
d2d0adc7 | 492 | (wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_TEXT|wxTEXT_ATTR_BULLET_NAME| |
97ff49b3 JS |
493 | wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER| |
494 | wxTEXT_ATTR_LINE_SPACING)); | |
495 | ||
496 | wxFont font(m_previewCtrl->GetFont()); | |
497 | font.SetPointSize(9); | |
498 | m_previewCtrl->SetFont(font); | |
499 | ||
dadd4f55 JS |
500 | wxTextAttrEx normalParaAttr; |
501 | normalParaAttr.SetFont(font); | |
502 | normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY"))); | |
97ff49b3 | 503 | |
dadd4f55 | 504 | m_previewCtrl->Freeze(); |
97ff49b3 JS |
505 | m_previewCtrl->Clear(); |
506 | ||
dadd4f55 | 507 | m_previewCtrl->BeginStyle(normalParaAttr); |
97ff49b3 | 508 | m_previewCtrl->WriteText(s_para1); |
dadd4f55 | 509 | m_previewCtrl->EndStyle(); |
41a85215 | 510 | |
97ff49b3 JS |
511 | m_previewCtrl->BeginStyle(attr); |
512 | m_previewCtrl->WriteText(s_para2); | |
513 | m_previewCtrl->EndStyle(); | |
dadd4f55 JS |
514 | |
515 | m_previewCtrl->BeginStyle(normalParaAttr); | |
97ff49b3 | 516 | m_previewCtrl->WriteText(s_para3); |
dadd4f55 | 517 | m_previewCtrl->EndStyle(); |
69ce77e2 | 518 | |
d2d0adc7 | 519 | m_previewCtrl->NumberList(wxRichTextRange(0, m_previewCtrl->GetLastPosition()+1)); |
dadd4f55 JS |
520 | |
521 | m_previewCtrl->Thaw(); | |
97ff49b3 JS |
522 | } |
523 | ||
524 | wxTextAttrEx* wxRichTextBulletsPage::GetAttributes() | |
525 | { | |
526 | return wxRichTextFormattingDialog::GetDialogAttributes(this); | |
527 | } | |
528 | ||
529 | /*! | |
530 | * Should we show tooltips? | |
531 | */ | |
532 | ||
533 | bool wxRichTextBulletsPage::ShowToolTips() | |
534 | { | |
dadd4f55 | 535 | return wxRichTextFormattingDialog::ShowToolTips(); |
97ff49b3 JS |
536 | } |
537 | ||
538 | /*! | |
539 | * Get bitmap resources | |
540 | */ | |
541 | ||
542 | wxBitmap wxRichTextBulletsPage::GetBitmapResource( const wxString& name ) | |
543 | { | |
544 | // Bitmap retrieval | |
545 | ////@begin wxRichTextBulletsPage bitmap retrieval | |
546 | wxUnusedVar(name); | |
547 | return wxNullBitmap; | |
548 | ////@end wxRichTextBulletsPage bitmap retrieval | |
549 | } | |
550 | ||
551 | /*! | |
552 | * Get icon resources | |
553 | */ | |
554 | ||
555 | wxIcon wxRichTextBulletsPage::GetIconResource( const wxString& name ) | |
556 | { | |
557 | // Icon retrieval | |
558 | ////@begin wxRichTextBulletsPage icon retrieval | |
559 | wxUnusedVar(name); | |
560 | return wxNullIcon; | |
561 | ////@end wxRichTextBulletsPage icon retrieval | |
562 | } | |
563 | ||
564 | /*! | |
565 | * wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_STYLELISTBOX | |
566 | */ | |
567 | ||
568 | void wxRichTextBulletsPage::OnStylelistboxSelected( wxCommandEvent& WXUNUSED(event) ) | |
569 | { | |
570 | if (!m_dontUpdate) | |
571 | { | |
572 | m_hasBulletStyle = true; | |
573 | ||
d2d0adc7 | 574 | if (m_styleListBox->GetSelection() == wxRICHTEXT_BULLETINDEX_SYMBOL) |
97ff49b3 JS |
575 | m_hasBulletSymbol = true; |
576 | ||
577 | UpdatePreview(); | |
578 | } | |
579 | } | |
580 | ||
581 | /*! | |
582 | * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL | |
583 | */ | |
584 | ||
585 | void wxRichTextBulletsPage::OnSymbolctrlSelected( wxCommandEvent& WXUNUSED(event) ) | |
586 | { | |
587 | if (!m_dontUpdate) | |
588 | { | |
589 | m_hasBulletSymbol = true; | |
590 | UpdatePreview(); | |
591 | } | |
592 | } | |
593 | ||
594 | /*! | |
595 | * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL | |
596 | */ | |
597 | ||
598 | void wxRichTextBulletsPage::OnSymbolctrlUpdated( wxCommandEvent& WXUNUSED(event) ) | |
599 | { | |
600 | if (!m_dontUpdate) | |
601 | { | |
602 | m_hasBulletSymbol = true; | |
603 | UpdatePreview(); | |
604 | } | |
605 | } | |
606 | ||
607 | /*! | |
608 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL | |
609 | */ | |
610 | ||
611 | void wxRichTextBulletsPage::OnSymbolctrlUpdate( wxUpdateUIEvent& event ) | |
612 | { | |
613 | OnSymbolUpdate(event); | |
614 | } | |
615 | ||
616 | /*! | |
617 | * wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL | |
618 | */ | |
619 | ||
620 | void wxRichTextBulletsPage::OnNumberctrlUpdated( wxSpinEvent& WXUNUSED(event) ) | |
621 | { | |
622 | if (!m_dontUpdate) | |
623 | { | |
624 | m_hasBulletNumber = true; | |
625 | UpdatePreview(); | |
626 | } | |
627 | } | |
628 | ||
629 | /*! | |
630 | * wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL | |
631 | */ | |
632 | ||
633 | void wxRichTextBulletsPage::OnNumberctrlUp( wxSpinEvent& WXUNUSED(event) ) | |
634 | { | |
635 | if (!m_dontUpdate) | |
636 | { | |
637 | m_hasBulletNumber = true; | |
638 | UpdatePreview(); | |
639 | } | |
640 | } | |
641 | ||
642 | /*! | |
643 | * wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL | |
644 | */ | |
645 | ||
646 | void wxRichTextBulletsPage::OnNumberctrlDown( wxSpinEvent& WXUNUSED(event) ) | |
647 | { | |
648 | if (!m_dontUpdate) | |
649 | { | |
650 | m_hasBulletNumber = true; | |
651 | UpdatePreview(); | |
652 | } | |
653 | } | |
654 | ||
655 | /*! | |
656 | * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL | |
657 | */ | |
658 | ||
659 | void wxRichTextBulletsPage::OnNumberctrlTextUpdated( wxCommandEvent& WXUNUSED(event) ) | |
660 | { | |
661 | if (!m_dontUpdate) | |
662 | { | |
663 | m_hasBulletNumber = true; | |
664 | UpdatePreview(); | |
665 | } | |
666 | } | |
667 | ||
668 | /*! | |
669 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NUMBERCTRL | |
670 | */ | |
671 | ||
672 | void wxRichTextBulletsPage::OnNumberctrlUpdate( wxUpdateUIEvent& event ) | |
673 | { | |
674 | OnNumberUpdate(event); | |
675 | } | |
676 | ||
677 | /*! | |
678 | * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL | |
679 | */ | |
680 | ||
681 | void wxRichTextBulletsPage::OnParenthesesctrlClick( wxCommandEvent& WXUNUSED(event) ) | |
682 | { | |
683 | if (!m_dontUpdate) | |
684 | { | |
685 | m_hasBulletStyle = true; | |
686 | UpdatePreview(); | |
687 | } | |
688 | } | |
689 | ||
690 | /*! | |
691 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_PARENTHESESCTRL | |
692 | */ | |
693 | ||
694 | void wxRichTextBulletsPage::OnParenthesesctrlUpdate( wxUpdateUIEvent& event ) | |
695 | { | |
696 | int sel = m_styleListBox->GetSelection(); | |
d2d0adc7 JS |
697 | event.Enable(m_hasBulletStyle && (sel != wxRICHTEXT_BULLETINDEX_SYMBOL && |
698 | sel != wxRICHTEXT_BULLETINDEX_BITMAP && | |
699 | sel != wxRICHTEXT_BULLETINDEX_NONE)); | |
97ff49b3 JS |
700 | } |
701 | ||
702 | /*! | |
703 | * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_PERIODCTRL | |
704 | */ | |
705 | ||
706 | void wxRichTextBulletsPage::OnPeriodctrlClick( wxCommandEvent& WXUNUSED(event) ) | |
707 | { | |
708 | if (!m_dontUpdate) | |
709 | { | |
710 | m_hasBulletStyle = true; | |
711 | UpdatePreview(); | |
712 | } | |
713 | } | |
714 | ||
715 | /*! | |
716 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_PERIODCTRL | |
717 | */ | |
718 | ||
719 | void wxRichTextBulletsPage::OnPeriodctrlUpdate( wxUpdateUIEvent& event ) | |
720 | { | |
721 | int sel = m_styleListBox->GetSelection(); | |
d2d0adc7 JS |
722 | event.Enable(m_hasBulletStyle && (sel != wxRICHTEXT_BULLETINDEX_SYMBOL && |
723 | sel != wxRICHTEXT_BULLETINDEX_BITMAP && | |
724 | sel != wxRICHTEXT_BULLETINDEX_NONE)); | |
97ff49b3 JS |
725 | } |
726 | ||
727 | /*! | |
728 | * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL | |
729 | */ | |
730 | ||
731 | void wxRichTextBulletsPage::OnChooseSymbolClick( wxCommandEvent& WXUNUSED(event) ) | |
732 | { | |
733 | int sel = m_styleListBox->GetSelection(); | |
d2d0adc7 | 734 | if (m_hasBulletStyle && sel == wxRICHTEXT_BULLETINDEX_SYMBOL) |
97ff49b3 JS |
735 | { |
736 | wxString symbol = m_symbolCtrl->GetValue(); | |
737 | wxString fontName = m_symbolFontCtrl->GetValue(); | |
738 | wxSymbolPickerDialog dlg(symbol, fontName, fontName, this); | |
739 | ||
740 | if (dlg.ShowModal() == wxID_OK) | |
741 | { | |
742 | m_dontUpdate = true; | |
5778b3c8 | 743 | |
97ff49b3 JS |
744 | m_symbolCtrl->SetValue(dlg.GetSymbol()); |
745 | m_symbolFontCtrl->SetValue(dlg.GetFontName()); | |
5778b3c8 | 746 | |
97ff49b3 JS |
747 | UpdatePreview(); |
748 | ||
749 | m_dontUpdate = false; | |
750 | } | |
751 | } | |
752 | } | |
753 | ||
754 | /*! | |
755 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_CHOOSE_SYMBOL | |
756 | */ | |
757 | ||
758 | void wxRichTextBulletsPage::OnChooseSymbolUpdate( wxUpdateUIEvent& event ) | |
759 | { | |
760 | OnSymbolUpdate(event); | |
761 | } | |
762 | /*! | |
763 | * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL | |
764 | */ | |
765 | ||
766 | void wxRichTextBulletsPage::OnSymbolfontctrlSelected( wxCommandEvent& WXUNUSED(event) ) | |
767 | { | |
768 | if (m_dontUpdate) | |
769 | return; | |
770 | UpdatePreview(); | |
771 | } | |
772 | ||
773 | /*! | |
774 | * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL | |
775 | */ | |
776 | ||
777 | void wxRichTextBulletsPage::OnSymbolfontctrlUpdated( wxCommandEvent& WXUNUSED(event) ) | |
778 | { | |
779 | if (m_dontUpdate) | |
780 | return; | |
781 | UpdatePreview(); | |
782 | } | |
783 | ||
784 | ||
785 | /*! | |
786 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL | |
787 | */ | |
788 | ||
789 | void wxRichTextBulletsPage::OnSymbolfontctrlUIUpdate( wxUpdateUIEvent& event ) | |
790 | { | |
791 | OnSymbolUpdate(event); | |
792 | } | |
793 | ||
794 | /// Update for symbol-related controls | |
795 | void wxRichTextBulletsPage::OnSymbolUpdate( wxUpdateUIEvent& event ) | |
796 | { | |
797 | int sel = m_styleListBox->GetSelection(); | |
d2d0adc7 | 798 | event.Enable(m_hasBulletStyle && (sel == wxRICHTEXT_BULLETINDEX_SYMBOL)); |
97ff49b3 JS |
799 | } |
800 | ||
801 | /// Update for number-related controls | |
802 | void wxRichTextBulletsPage::OnNumberUpdate( wxUpdateUIEvent& event ) | |
803 | { | |
804 | int sel = m_styleListBox->GetSelection(); | |
d2d0adc7 JS |
805 | event.Enable( m_hasBulletStyle && (sel != wxRICHTEXT_BULLETINDEX_SYMBOL && |
806 | sel != wxRICHTEXT_BULLETINDEX_BITMAP && | |
807 | sel != wxRICHTEXT_BULLETINDEX_STANDARD && | |
808 | sel != wxRICHTEXT_BULLETINDEX_NONE)); | |
97ff49b3 JS |
809 | } |
810 | ||
f089713f JS |
811 | /// Update for standard bullet-related controls |
812 | void wxRichTextBulletsPage::OnStandardBulletUpdate( wxUpdateUIEvent& event ) | |
813 | { | |
814 | int sel = m_styleListBox->GetSelection(); | |
d2d0adc7 | 815 | event.Enable( sel == wxRICHTEXT_BULLETINDEX_STANDARD ); |
f089713f JS |
816 | } |
817 | ||
818 | ||
97ff49b3 JS |
819 | /*! |
820 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_SYMBOLSTATIC | |
821 | */ | |
822 | ||
823 | void wxRichTextBulletsPage::OnSymbolstaticUpdate( wxUpdateUIEvent& event ) | |
824 | { | |
825 | OnSymbolUpdate(event); | |
826 | } | |
827 | ||
828 | ||
829 | /*! | |
830 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC | |
831 | */ | |
832 | ||
833 | void wxRichTextBulletsPage::OnNumberstaticUpdate( wxUpdateUIEvent& event ) | |
834 | { | |
835 | OnNumberUpdate(event); | |
836 | } | |
837 | ||
f089713f JS |
838 | /*! |
839 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NAMESTATIC | |
840 | */ | |
841 | ||
842 | void wxRichTextBulletsPage::OnNamestaticUpdate( wxUpdateUIEvent& event ) | |
843 | { | |
844 | OnStandardBulletUpdate(event); | |
845 | } | |
846 | ||
847 | ||
848 | /*! | |
849 | * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL | |
850 | */ | |
851 | ||
852 | void wxRichTextBulletsPage::OnNamectrlSelected( wxCommandEvent& WXUNUSED(event) ) | |
853 | { | |
854 | if (m_dontUpdate) | |
855 | return; | |
856 | UpdatePreview(); | |
857 | } | |
858 | ||
859 | /*! | |
860 | * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL | |
861 | */ | |
862 | ||
863 | void wxRichTextBulletsPage::OnNamectrlUpdated( wxCommandEvent& WXUNUSED(event) ) | |
864 | { | |
865 | if (m_dontUpdate) | |
866 | return; | |
867 | UpdatePreview(); | |
868 | } | |
869 | ||
870 | /*! | |
871 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_NAMECTRL | |
872 | */ | |
873 | ||
874 | void wxRichTextBulletsPage::OnNamectrlUIUpdate( wxUpdateUIEvent& event ) | |
875 | { | |
876 | OnStandardBulletUpdate(event); | |
877 | } | |
878 | ||
b68603d5 | 879 | #endif // wxUSE_RICHTEXT |
d2d0adc7 JS |
880 | /*! |
881 | * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTBULLETSPAGE_RIGHT_PARENTHESIS_CTRL | |
882 | */ | |
883 | ||
884 | void wxRichTextBulletsPage::OnRightParenthesisCtrlClick( wxCommandEvent& WXUNUSED(event) ) | |
885 | { | |
886 | if (!m_dontUpdate) | |
887 | { | |
888 | m_hasBulletStyle = true; | |
889 | UpdatePreview(); | |
890 | } | |
891 | } | |
892 | ||
893 | /*! | |
894 | * wxEVT_UPDATE_UI event handler for ID_RICHTEXTBULLETSPAGE_RIGHT_PARENTHESIS_CTRL | |
895 | */ | |
896 | ||
897 | void wxRichTextBulletsPage::OnRightParenthesisCtrlUpdate( wxUpdateUIEvent& event ) | |
898 | { | |
899 | int sel = m_styleListBox->GetSelection(); | |
900 | event.Enable(m_hasBulletStyle && (sel != wxRICHTEXT_BULLETINDEX_SYMBOL && | |
901 | sel != wxRICHTEXT_BULLETINDEX_BITMAP && | |
902 | sel != wxRICHTEXT_BULLETINDEX_NONE)); | |
903 | } | |
904 | ||
905 | /*! | |
906 | * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_COMBOBOX | |
907 | */ | |
908 | ||
909 | void wxRichTextBulletsPage::OnBulletAlignmentCtrlSelected( wxCommandEvent& WXUNUSED(event) ) | |
910 | { | |
911 | if (m_dontUpdate) | |
912 | return; | |
913 | UpdatePreview(); | |
914 | } | |
915 | ||
916 |