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