]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: src/richtext/richtextfontpage.cpp | |
3 | // Purpose: Font page for wxRichTextFormattingDialog | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 2006-10-02 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include "wx/richtext/richtextfontpage.h" | |
13 | ||
14 | /*! | |
15 | * wxRichTextFontPage type definition | |
16 | */ | |
17 | ||
18 | IMPLEMENT_DYNAMIC_CLASS( wxRichTextFontPage, wxRichTextDialogPage ) | |
19 | ||
20 | /*! | |
21 | * wxRichTextFontPage event table definition | |
22 | */ | |
23 | ||
24 | BEGIN_EVENT_TABLE( wxRichTextFontPage, wxRichTextDialogPage ) | |
25 | EVT_LISTBOX( ID_RICHTEXTFONTPAGE_FACELISTBOX, wxRichTextFontPage::OnFaceListBoxSelected ) | |
26 | EVT_BUTTON( ID_RICHTEXTFONTPAGE_COLOURCTRL, wxRichTextFontPage::OnColourClicked ) | |
27 | EVT_BUTTON( ID_RICHTEXTFONTPAGE_BGCOLOURCTRL, wxRichTextFontPage::OnColourClicked ) | |
28 | ||
29 | ////@begin wxRichTextFontPage event table entries | |
30 | EVT_TEXT( ID_RICHTEXTFONTPAGE_FACETEXTCTRL, wxRichTextFontPage::OnFaceTextCtrlUpdated ) | |
31 | ||
32 | EVT_TEXT( ID_RICHTEXTFONTPAGE_SIZETEXTCTRL, wxRichTextFontPage::OnSizeTextCtrlUpdated ) | |
33 | ||
34 | EVT_LISTBOX( ID_RICHTEXTFONTPAGE_SIZELISTBOX, wxRichTextFontPage::OnSizeListBoxSelected ) | |
35 | ||
36 | EVT_COMBOBOX( ID_RICHTEXTFONTPAGE_STYLECTRL, wxRichTextFontPage::OnStyleCtrlSelected ) | |
37 | ||
38 | EVT_COMBOBOX( ID_RICHTEXTFONTPAGE_WEIGHTCTRL, wxRichTextFontPage::OnWeightCtrlSelected ) | |
39 | ||
40 | EVT_COMBOBOX( ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL, wxRichTextFontPage::OnUnderliningCtrlSelected ) | |
41 | ||
42 | EVT_CHECKBOX( ID_RICHTEXTFONTPAGE_COLOURCTRL_LABEL, wxRichTextFontPage::OnUnderliningCtrlSelected ) | |
43 | ||
44 | EVT_CHECKBOX( ID_RICHTEXTFONTPAGE_BGCOLOURCTRL_LABEL, wxRichTextFontPage::OnUnderliningCtrlSelected ) | |
45 | ||
46 | EVT_CHECKBOX( ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL, wxRichTextFontPage::OnStrikethroughctrlClick ) | |
47 | ||
48 | EVT_CHECKBOX( ID_RICHTEXTFONTPAGE_CAPSCTRL, wxRichTextFontPage::OnCapsctrlClick ) | |
49 | ||
50 | EVT_CHECKBOX( ID_RICHTEXTFONTPAGE_SUPERSCRIPT, wxRichTextFontPage::OnRichtextfontpageSuperscriptClick ) | |
51 | ||
52 | EVT_CHECKBOX( ID_RICHTEXTFONTPAGE_SUBSCRIPT, wxRichTextFontPage::OnRichtextfontpageSubscriptClick ) | |
53 | ||
54 | ////@end wxRichTextFontPage event table entries | |
55 | ||
56 | END_EVENT_TABLE() | |
57 | ||
58 | IMPLEMENT_HELP_PROVISION(wxRichTextFontPage) | |
59 | /*! | |
60 | * wxRichTextFontPage constructors | |
61 | */ | |
62 | ||
63 | wxRichTextFontPage::wxRichTextFontPage( ) | |
64 | { | |
65 | Init(); | |
66 | } | |
67 | ||
68 | wxRichTextFontPage::wxRichTextFontPage( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) | |
69 | { | |
70 | Init(); | |
71 | Create(parent, id, pos, size, style); | |
72 | } | |
73 | ||
74 | /*! | |
75 | * Initialise members | |
76 | */ | |
77 | ||
78 | void wxRichTextFontPage::Init() | |
79 | { | |
80 | m_dontUpdate = false; | |
81 | m_colourPresent = false; | |
82 | m_bgColourPresent = false; | |
83 | ||
84 | ////@begin wxRichTextFontPage member initialisation | |
85 | m_faceTextCtrl = NULL; | |
86 | m_faceListBox = NULL; | |
87 | m_sizeTextCtrl = NULL; | |
88 | m_sizeListBox = NULL; | |
89 | m_styleCtrl = NULL; | |
90 | m_weightCtrl = NULL; | |
91 | m_underliningCtrl = NULL; | |
92 | m_textColourLabel = NULL; | |
93 | m_colourCtrl = NULL; | |
94 | m_bgColourLabel = NULL; | |
95 | m_bgColourCtrl = NULL; | |
96 | m_strikethroughCtrl = NULL; | |
97 | m_capitalsCtrl = NULL; | |
98 | m_superscriptCtrl = NULL; | |
99 | m_subscriptCtrl = NULL; | |
100 | m_previewCtrl = NULL; | |
101 | ////@end wxRichTextFontPage member initialisation | |
102 | } | |
103 | ||
104 | /*! | |
105 | * wxRichTextFontPage creator | |
106 | */ | |
107 | ||
108 | bool wxRichTextFontPage::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) | |
109 | { | |
110 | ////@begin wxRichTextFontPage creation | |
111 | wxRichTextDialogPage::Create( parent, id, pos, size, style ); | |
112 | ||
113 | CreateControls(); | |
114 | if (GetSizer()) | |
115 | { | |
116 | GetSizer()->SetSizeHints(this); | |
117 | } | |
118 | Centre(); | |
119 | ////@end wxRichTextFontPage creation | |
120 | return true; | |
121 | } | |
122 | ||
123 | /*! | |
124 | * Control creation for wxRichTextFontPage | |
125 | */ | |
126 | ||
127 | void wxRichTextFontPage::CreateControls() | |
128 | { | |
129 | ////@begin wxRichTextFontPage content construction | |
130 | wxRichTextFontPage* itemRichTextDialogPage1 = this; | |
131 | ||
132 | wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); | |
133 | itemRichTextDialogPage1->SetSizer(itemBoxSizer2); | |
134 | ||
135 | wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL); | |
136 | itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5); | |
137 | ||
138 | wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL); | |
139 | itemBoxSizer3->Add(itemBoxSizer4, 1, wxGROW, 5); | |
140 | ||
141 | wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL); | |
142 | itemBoxSizer4->Add(itemBoxSizer5, 1, wxGROW, 5); | |
143 | ||
144 | wxStaticText* itemStaticText6 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Font:"), wxDefaultPosition, wxDefaultSize, 0 ); | |
145 | itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5); | |
146 | ||
147 | m_faceTextCtrl = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_FACETEXTCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); | |
148 | m_faceTextCtrl->SetHelpText(_("Type a font name.")); | |
149 | if (wxRichTextFontPage::ShowToolTips()) | |
150 | m_faceTextCtrl->SetToolTip(_("Type a font name.")); | |
151 | itemBoxSizer5->Add(m_faceTextCtrl, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5); | |
152 | ||
153 | m_faceListBox = new wxRichTextFontListBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_FACELISTBOX, wxDefaultPosition, wxSize(200, 100), 0 ); | |
154 | m_faceListBox->SetHelpText(_("Lists the available fonts.")); | |
155 | if (wxRichTextFontPage::ShowToolTips()) | |
156 | m_faceListBox->SetToolTip(_("Lists the available fonts.")); | |
157 | itemBoxSizer5->Add(m_faceListBox, 1, wxGROW|wxALL|wxFIXED_MINSIZE, 5); | |
158 | ||
159 | wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxVERTICAL); | |
160 | itemBoxSizer4->Add(itemBoxSizer9, 0, wxGROW, 5); | |
161 | ||
162 | wxStaticText* itemStaticText10 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Size:"), wxDefaultPosition, wxDefaultSize, 0 ); | |
163 | itemBoxSizer9->Add(itemStaticText10, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5); | |
164 | ||
165 | m_sizeTextCtrl = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_SIZETEXTCTRL, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 ); | |
166 | m_sizeTextCtrl->SetHelpText(_("Type a size in points.")); | |
167 | if (wxRichTextFontPage::ShowToolTips()) | |
168 | m_sizeTextCtrl->SetToolTip(_("Type a size in points.")); | |
169 | itemBoxSizer9->Add(m_sizeTextCtrl, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5); | |
170 | ||
171 | wxArrayString m_sizeListBoxStrings; | |
172 | m_sizeListBox = new wxListBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_SIZELISTBOX, wxDefaultPosition, wxSize(50, -1), m_sizeListBoxStrings, wxLB_SINGLE ); | |
173 | m_sizeListBox->SetHelpText(_("Lists font sizes in points.")); | |
174 | if (wxRichTextFontPage::ShowToolTips()) | |
175 | m_sizeListBox->SetToolTip(_("Lists font sizes in points.")); | |
176 | itemBoxSizer9->Add(m_sizeListBox, 1, wxALIGN_CENTER_HORIZONTAL|wxALL|wxFIXED_MINSIZE, 5); | |
177 | ||
178 | wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxHORIZONTAL); | |
179 | itemBoxSizer3->Add(itemBoxSizer13, 0, wxGROW, 5); | |
180 | ||
181 | wxBoxSizer* itemBoxSizer14 = new wxBoxSizer(wxVERTICAL); | |
182 | itemBoxSizer13->Add(itemBoxSizer14, 0, wxGROW, 5); | |
183 | ||
184 | wxStaticText* itemStaticText15 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Font st&yle:"), wxDefaultPosition, wxDefaultSize, 0 ); | |
185 | itemBoxSizer14->Add(itemStaticText15, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5); | |
186 | ||
187 | wxArrayString m_styleCtrlStrings; | |
188 | m_styleCtrl = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_STYLECTRL, wxEmptyString, wxDefaultPosition, wxSize(110, -1), m_styleCtrlStrings, wxCB_READONLY ); | |
189 | m_styleCtrl->SetHelpText(_("Select regular or italic style.")); | |
190 | if (wxRichTextFontPage::ShowToolTips()) | |
191 | m_styleCtrl->SetToolTip(_("Select regular or italic style.")); | |
192 | itemBoxSizer14->Add(m_styleCtrl, 0, wxGROW|wxALL, 5); | |
193 | ||
194 | wxBoxSizer* itemBoxSizer17 = new wxBoxSizer(wxVERTICAL); | |
195 | itemBoxSizer13->Add(itemBoxSizer17, 0, wxGROW, 5); | |
196 | ||
197 | wxStaticText* itemStaticText18 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Font &weight:"), wxDefaultPosition, wxDefaultSize, 0 ); | |
198 | itemBoxSizer17->Add(itemStaticText18, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5); | |
199 | ||
200 | wxArrayString m_weightCtrlStrings; | |
201 | m_weightCtrl = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_WEIGHTCTRL, wxEmptyString, wxDefaultPosition, wxSize(110, -1), m_weightCtrlStrings, wxCB_READONLY ); | |
202 | m_weightCtrl->SetHelpText(_("Select regular or bold.")); | |
203 | if (wxRichTextFontPage::ShowToolTips()) | |
204 | m_weightCtrl->SetToolTip(_("Select regular or bold.")); | |
205 | itemBoxSizer17->Add(m_weightCtrl, 0, wxGROW|wxALL, 5); | |
206 | ||
207 | wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxVERTICAL); | |
208 | itemBoxSizer13->Add(itemBoxSizer20, 0, wxGROW, 5); | |
209 | ||
210 | wxStaticText* itemStaticText21 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Underlining:"), wxDefaultPosition, wxDefaultSize, 0 ); | |
211 | itemBoxSizer20->Add(itemStaticText21, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5); | |
212 | ||
213 | wxArrayString m_underliningCtrlStrings; | |
214 | m_underliningCtrl = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL, wxEmptyString, wxDefaultPosition, wxSize(110, -1), m_underliningCtrlStrings, wxCB_READONLY ); | |
215 | m_underliningCtrl->SetHelpText(_("Select underlining or no underlining.")); | |
216 | if (wxRichTextFontPage::ShowToolTips()) | |
217 | m_underliningCtrl->SetToolTip(_("Select underlining or no underlining.")); | |
218 | itemBoxSizer20->Add(m_underliningCtrl, 0, wxGROW|wxALL, 5); | |
219 | ||
220 | itemBoxSizer13->Add(0, 0, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5); | |
221 | ||
222 | wxBoxSizer* itemBoxSizer24 = new wxBoxSizer(wxVERTICAL); | |
223 | itemBoxSizer13->Add(itemBoxSizer24, 0, wxGROW, 5); | |
224 | ||
225 | m_textColourLabel = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_COLOURCTRL_LABEL, _("&Colour:"), wxDefaultPosition, wxDefaultSize, 0 ); | |
226 | m_textColourLabel->SetValue(false); | |
227 | itemBoxSizer24->Add(m_textColourLabel, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxTOP, 5); | |
228 | ||
229 | m_colourCtrl = new wxRichTextColourSwatchCtrl( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_COLOURCTRL, wxDefaultPosition, wxSize(40, 20), 0 ); | |
230 | m_colourCtrl->SetHelpText(_("Click to change the text colour.")); | |
231 | if (wxRichTextFontPage::ShowToolTips()) | |
232 | m_colourCtrl->SetToolTip(_("Click to change the text colour.")); | |
233 | itemBoxSizer24->Add(m_colourCtrl, 0, wxGROW|wxALL, 5); | |
234 | ||
235 | wxBoxSizer* itemBoxSizer27 = new wxBoxSizer(wxVERTICAL); | |
236 | itemBoxSizer13->Add(itemBoxSizer27, 0, wxGROW, 5); | |
237 | ||
238 | m_bgColourLabel = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_BGCOLOURCTRL_LABEL, _("&Bg colour:"), wxDefaultPosition, wxDefaultSize, 0 ); | |
239 | m_bgColourLabel->SetValue(false); | |
240 | itemBoxSizer27->Add(m_bgColourLabel, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxTOP, 5); | |
241 | ||
242 | m_bgColourCtrl = new wxRichTextColourSwatchCtrl( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_BGCOLOURCTRL, wxDefaultPosition, wxSize(40, 20), 0 ); | |
243 | m_bgColourCtrl->SetHelpText(_("Click to change the text background colour.")); | |
244 | if (wxRichTextFontPage::ShowToolTips()) | |
245 | m_bgColourCtrl->SetToolTip(_("Click to change the text background colour.")); | |
246 | itemBoxSizer27->Add(m_bgColourCtrl, 0, wxGROW|wxALL, 5); | |
247 | ||
248 | wxBoxSizer* itemBoxSizer30 = new wxBoxSizer(wxHORIZONTAL); | |
249 | itemBoxSizer3->Add(itemBoxSizer30, 0, wxGROW, 5); | |
250 | ||
251 | m_strikethroughCtrl = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL, _("&Strikethrough"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE ); | |
252 | m_strikethroughCtrl->SetValue(false); | |
253 | m_strikethroughCtrl->SetHelpText(_("Check to show a line through the text.")); | |
254 | if (wxRichTextFontPage::ShowToolTips()) | |
255 | m_strikethroughCtrl->SetToolTip(_("Check to show a line through the text.")); | |
256 | itemBoxSizer30->Add(m_strikethroughCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
257 | ||
258 | m_capitalsCtrl = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_CAPSCTRL, _("Ca&pitals"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE ); | |
259 | m_capitalsCtrl->SetValue(false); | |
260 | m_capitalsCtrl->SetHelpText(_("Check to show the text in capitals.")); | |
261 | if (wxRichTextFontPage::ShowToolTips()) | |
262 | m_capitalsCtrl->SetToolTip(_("Check to show the text in capitals.")); | |
263 | itemBoxSizer30->Add(m_capitalsCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
264 | ||
265 | m_superscriptCtrl = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_SUPERSCRIPT, _("Supe&rscript"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE ); | |
266 | m_superscriptCtrl->SetValue(false); | |
267 | m_superscriptCtrl->SetHelpText(_("Check to show the text in superscript.")); | |
268 | if (wxRichTextFontPage::ShowToolTips()) | |
269 | m_superscriptCtrl->SetToolTip(_("Check to show the text in superscript.")); | |
270 | itemBoxSizer30->Add(m_superscriptCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
271 | ||
272 | m_subscriptCtrl = new wxCheckBox( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_SUBSCRIPT, _("Subscrip&t"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE ); | |
273 | m_subscriptCtrl->SetValue(false); | |
274 | m_subscriptCtrl->SetHelpText(_("Check to show the text in subscript.")); | |
275 | if (wxRichTextFontPage::ShowToolTips()) | |
276 | m_subscriptCtrl->SetToolTip(_("Check to show the text in subscript.")); | |
277 | itemBoxSizer30->Add(m_subscriptCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); | |
278 | ||
279 | itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5); | |
280 | ||
281 | m_previewCtrl = new wxRichTextFontPreviewCtrl( itemRichTextDialogPage1, ID_RICHTEXTFONTPAGE_PREVIEWCTRL, wxDefaultPosition, wxSize(100, 60), 0 ); | |
282 | m_previewCtrl->SetHelpText(_("Shows a preview of the font settings.")); | |
283 | if (wxRichTextFontPage::ShowToolTips()) | |
284 | m_previewCtrl->SetToolTip(_("Shows a preview of the font settings.")); | |
285 | itemBoxSizer3->Add(m_previewCtrl, 0, wxGROW|wxALL, 5); | |
286 | ||
287 | ////@end wxRichTextFontPage content construction | |
288 | ||
289 | m_faceListBox->UpdateFonts(); | |
290 | ||
291 | m_styleCtrl->Append(_("(none)")); | |
292 | m_styleCtrl->Append(_("Regular")); | |
293 | m_styleCtrl->Append(_("Italic")); | |
294 | ||
295 | m_weightCtrl->Append(_("(none)")); | |
296 | m_weightCtrl->Append(_("Regular")); | |
297 | m_weightCtrl->Append(_("Bold")); | |
298 | ||
299 | m_underliningCtrl->Append(_("(none)")); | |
300 | m_underliningCtrl->Append(_("Not underlined")); | |
301 | m_underliningCtrl->Append(_("Underlined")); | |
302 | ||
303 | wxString nStr; | |
304 | int i; | |
305 | for (i = 8; i < 40; i++) | |
306 | { | |
307 | nStr.Printf(wxT("%d"), i); | |
308 | m_sizeListBox->Append(nStr); | |
309 | } | |
310 | m_sizeListBox->Append(wxT("48")); | |
311 | m_sizeListBox->Append(wxT("72")); | |
312 | } | |
313 | ||
314 | /// Transfer data from/to window | |
315 | bool wxRichTextFontPage::TransferDataFromWindow() | |
316 | { | |
317 | wxPanel::TransferDataFromWindow(); | |
318 | ||
319 | wxRichTextAttr* attr = GetAttributes(); | |
320 | ||
321 | if (!m_faceTextCtrl->GetValue().IsEmpty()) | |
322 | { | |
323 | wxString faceName = m_faceTextCtrl->GetValue(); | |
324 | attr->SetFontFaceName(faceName); | |
325 | } | |
326 | else | |
327 | attr->SetFlags(attr->GetFlags() & (~ wxTEXT_ATTR_FONT_FACE)); | |
328 | ||
329 | wxString strSize = m_sizeTextCtrl->GetValue(); | |
330 | if (!strSize.IsEmpty()) | |
331 | { | |
332 | int sz = wxAtoi(strSize); | |
333 | if (sz > 0) | |
334 | { | |
335 | attr->SetFontSize(sz); | |
336 | } | |
337 | } | |
338 | else | |
339 | attr->SetFlags(attr->GetFlags() & (~ wxTEXT_ATTR_FONT_SIZE)); | |
340 | ||
341 | if (m_styleCtrl->GetSelection() != wxNOT_FOUND && m_styleCtrl->GetSelection() != 0) | |
342 | { | |
343 | wxFontStyle style; | |
344 | if (m_styleCtrl->GetSelection() == 2) | |
345 | style = wxFONTSTYLE_ITALIC; | |
346 | else | |
347 | style = wxFONTSTYLE_NORMAL; | |
348 | ||
349 | attr->SetFontStyle(style); | |
350 | } | |
351 | else | |
352 | attr->SetFlags(attr->GetFlags() & (~ wxTEXT_ATTR_FONT_ITALIC)); | |
353 | ||
354 | if (m_weightCtrl->GetSelection() != wxNOT_FOUND && m_weightCtrl->GetSelection() != 0) | |
355 | { | |
356 | wxFontWeight weight; | |
357 | if (m_weightCtrl->GetSelection() == 2) | |
358 | weight = wxFONTWEIGHT_BOLD; | |
359 | else | |
360 | weight = wxFONTWEIGHT_NORMAL; | |
361 | ||
362 | attr->SetFontWeight(weight); | |
363 | } | |
364 | else | |
365 | attr->SetFlags(attr->GetFlags() & (~ wxTEXT_ATTR_FONT_WEIGHT)); | |
366 | ||
367 | if (m_underliningCtrl->GetSelection() != wxNOT_FOUND && m_underliningCtrl->GetSelection() != 0) | |
368 | { | |
369 | bool underlined; | |
370 | if (m_underliningCtrl->GetSelection() == 2) | |
371 | underlined = true; | |
372 | else | |
373 | underlined = false; | |
374 | ||
375 | attr->SetFontUnderlined(underlined); | |
376 | } | |
377 | else | |
378 | attr->SetFlags(attr->GetFlags() & (~ wxTEXT_ATTR_FONT_UNDERLINE)); | |
379 | ||
380 | if (m_textColourLabel->GetValue()) | |
381 | { | |
382 | attr->SetTextColour(m_colourCtrl->GetColour()); | |
383 | } | |
384 | else | |
385 | attr->SetFlags(attr->GetFlags() & (~ wxTEXT_ATTR_TEXT_COLOUR)); | |
386 | ||
387 | if (m_bgColourLabel->GetValue()) | |
388 | { | |
389 | attr->SetBackgroundColour(m_bgColourCtrl->GetColour()); | |
390 | } | |
391 | else | |
392 | attr->SetFlags(attr->GetFlags() & (~ wxTEXT_ATTR_BACKGROUND_COLOUR)); | |
393 | ||
394 | if (m_strikethroughCtrl->Get3StateValue() != wxCHK_UNDETERMINED) | |
395 | { | |
396 | attr->SetTextEffectFlags(attr->GetTextEffectFlags() | wxTEXT_ATTR_EFFECT_STRIKETHROUGH); | |
397 | ||
398 | if (m_strikethroughCtrl->Get3StateValue() == wxCHK_CHECKED) | |
399 | attr->SetTextEffects(attr->GetTextEffects() | wxTEXT_ATTR_EFFECT_STRIKETHROUGH); | |
400 | else | |
401 | attr->SetTextEffects(attr->GetTextEffects() & ~wxTEXT_ATTR_EFFECT_STRIKETHROUGH); | |
402 | } | |
403 | ||
404 | if (m_capitalsCtrl->Get3StateValue() != wxCHK_UNDETERMINED) | |
405 | { | |
406 | attr->SetTextEffectFlags(attr->GetTextEffectFlags() | wxTEXT_ATTR_EFFECT_CAPITALS); | |
407 | ||
408 | if (m_capitalsCtrl->Get3StateValue() == wxCHK_CHECKED) | |
409 | attr->SetTextEffects(attr->GetTextEffects() | wxTEXT_ATTR_EFFECT_CAPITALS); | |
410 | else | |
411 | attr->SetTextEffects(attr->GetTextEffects() & ~wxTEXT_ATTR_EFFECT_CAPITALS); | |
412 | } | |
413 | ||
414 | if (m_superscriptCtrl->Get3StateValue() == wxCHK_CHECKED) | |
415 | { | |
416 | attr->SetTextEffectFlags(attr->GetTextEffectFlags() | wxTEXT_ATTR_EFFECT_SUPERSCRIPT); | |
417 | attr->SetTextEffects(attr->GetTextEffects() | wxTEXT_ATTR_EFFECT_SUPERSCRIPT); | |
418 | attr->SetTextEffects(attr->GetTextEffects() & ~wxTEXT_ATTR_EFFECT_SUBSCRIPT); | |
419 | } | |
420 | else if (m_subscriptCtrl->Get3StateValue() == wxCHK_CHECKED) | |
421 | { | |
422 | attr->SetTextEffectFlags(attr->GetTextEffectFlags() | wxTEXT_ATTR_EFFECT_SUBSCRIPT); | |
423 | attr->SetTextEffects(attr->GetTextEffects() | wxTEXT_ATTR_EFFECT_SUBSCRIPT); | |
424 | attr->SetTextEffects(attr->GetTextEffects() & ~wxTEXT_ATTR_EFFECT_SUPERSCRIPT); | |
425 | } | |
426 | else | |
427 | { | |
428 | // If they are undetermined, we don't want to include these flags in the text effects - the objects | |
429 | // should retain their original style. | |
430 | attr->SetTextEffectFlags(attr->GetTextEffectFlags() & ~(wxTEXT_ATTR_EFFECT_SUBSCRIPT|wxTEXT_ATTR_EFFECT_SUPERSCRIPT) ); | |
431 | } | |
432 | ||
433 | return true; | |
434 | } | |
435 | ||
436 | bool wxRichTextFontPage::TransferDataToWindow() | |
437 | { | |
438 | wxPanel::TransferDataToWindow(); | |
439 | ||
440 | m_dontUpdate = true; | |
441 | wxRichTextAttr* attr = GetAttributes(); | |
442 | ||
443 | if (attr->HasFontFaceName()) | |
444 | { | |
445 | m_faceTextCtrl->SetValue(attr->GetFontFaceName()); | |
446 | m_faceListBox->SetFaceNameSelection(attr->GetFont().GetFaceName()); | |
447 | } | |
448 | else | |
449 | { | |
450 | m_faceTextCtrl->SetValue(wxEmptyString); | |
451 | m_faceListBox->SetFaceNameSelection(wxEmptyString); | |
452 | } | |
453 | ||
454 | if (attr->HasFontSize()) | |
455 | { | |
456 | wxString strSize = wxString::Format(wxT("%d"), attr->GetFontSize()); | |
457 | m_sizeTextCtrl->SetValue(strSize); | |
458 | if (m_sizeListBox->FindString(strSize) != wxNOT_FOUND) | |
459 | m_sizeListBox->SetStringSelection(strSize); | |
460 | } | |
461 | else | |
462 | { | |
463 | m_sizeTextCtrl->SetValue(wxEmptyString); | |
464 | m_sizeListBox->SetSelection(wxNOT_FOUND); | |
465 | } | |
466 | ||
467 | if (attr->HasFontWeight()) | |
468 | { | |
469 | if (attr->GetFontWeight() == wxBOLD) | |
470 | m_weightCtrl->SetSelection(2); | |
471 | else | |
472 | m_weightCtrl->SetSelection(1); | |
473 | } | |
474 | else | |
475 | { | |
476 | m_weightCtrl->SetSelection(0); | |
477 | } | |
478 | ||
479 | if (attr->HasFontItalic()) | |
480 | { | |
481 | if (attr->GetFontStyle() == wxITALIC) | |
482 | m_styleCtrl->SetSelection(2); | |
483 | else | |
484 | m_styleCtrl->SetSelection(1); | |
485 | } | |
486 | else | |
487 | { | |
488 | m_styleCtrl->SetSelection(0); | |
489 | } | |
490 | ||
491 | if (attr->HasFontUnderlined()) | |
492 | { | |
493 | if (attr->GetFontUnderlined()) | |
494 | m_underliningCtrl->SetSelection(2); | |
495 | else | |
496 | m_underliningCtrl->SetSelection(1); | |
497 | } | |
498 | else | |
499 | { | |
500 | m_underliningCtrl->SetSelection(0); | |
501 | } | |
502 | ||
503 | if (attr->HasTextColour()) | |
504 | { | |
505 | m_colourCtrl->SetColour(attr->GetTextColour()); | |
506 | m_textColourLabel->SetValue(true); | |
507 | m_colourPresent = true; | |
508 | } | |
509 | else | |
510 | { | |
511 | m_colourCtrl->SetColour(*wxBLACK); | |
512 | m_textColourLabel->SetValue(false); | |
513 | } | |
514 | ||
515 | if (attr->HasBackgroundColour()) | |
516 | { | |
517 | m_bgColourCtrl->SetColour(attr->GetBackgroundColour()); | |
518 | m_bgColourLabel->SetValue(true); | |
519 | m_bgColourPresent = true; | |
520 | } | |
521 | else | |
522 | { | |
523 | m_bgColourCtrl->SetColour(*wxWHITE); | |
524 | m_bgColourLabel->SetValue(false); | |
525 | } | |
526 | ||
527 | if (attr->HasTextEffects()) | |
528 | { | |
529 | if (attr->GetTextEffectFlags() & wxTEXT_ATTR_EFFECT_STRIKETHROUGH) | |
530 | { | |
531 | if (attr->GetTextEffects() & wxTEXT_ATTR_EFFECT_STRIKETHROUGH) | |
532 | m_strikethroughCtrl->Set3StateValue(wxCHK_CHECKED); | |
533 | else | |
534 | m_strikethroughCtrl->Set3StateValue(wxCHK_UNCHECKED); | |
535 | } | |
536 | else | |
537 | m_strikethroughCtrl->Set3StateValue(wxCHK_UNDETERMINED); | |
538 | ||
539 | if (attr->GetTextEffectFlags() & wxTEXT_ATTR_EFFECT_CAPITALS) | |
540 | { | |
541 | if (attr->GetTextEffects() & wxTEXT_ATTR_EFFECT_CAPITALS) | |
542 | m_capitalsCtrl->Set3StateValue(wxCHK_CHECKED); | |
543 | else | |
544 | m_capitalsCtrl->Set3StateValue(wxCHK_UNCHECKED); | |
545 | } | |
546 | else | |
547 | m_capitalsCtrl->Set3StateValue(wxCHK_UNDETERMINED); | |
548 | ||
549 | if ( attr->GetTextEffectFlags() & (wxTEXT_ATTR_EFFECT_SUPERSCRIPT | wxTEXT_ATTR_EFFECT_SUBSCRIPT) ) | |
550 | { | |
551 | if (attr->GetTextEffects() & wxTEXT_ATTR_EFFECT_SUPERSCRIPT) | |
552 | { | |
553 | m_superscriptCtrl->Set3StateValue(wxCHK_CHECKED); | |
554 | m_subscriptCtrl->Set3StateValue(wxCHK_UNCHECKED); | |
555 | } | |
556 | else if (attr->GetTextEffects() & wxTEXT_ATTR_EFFECT_SUBSCRIPT) | |
557 | { | |
558 | m_superscriptCtrl->Set3StateValue(wxCHK_UNCHECKED); | |
559 | m_subscriptCtrl->Set3StateValue(wxCHK_CHECKED); | |
560 | } | |
561 | else | |
562 | { | |
563 | m_superscriptCtrl->Set3StateValue(wxCHK_UNCHECKED); | |
564 | m_subscriptCtrl->Set3StateValue(wxCHK_UNCHECKED); | |
565 | } | |
566 | } | |
567 | else | |
568 | { | |
569 | m_superscriptCtrl->Set3StateValue(wxCHK_UNDETERMINED); | |
570 | m_subscriptCtrl->Set3StateValue(wxCHK_UNDETERMINED); | |
571 | } | |
572 | } | |
573 | else | |
574 | { | |
575 | m_strikethroughCtrl->Set3StateValue(wxCHK_UNDETERMINED); | |
576 | m_capitalsCtrl->Set3StateValue(wxCHK_UNDETERMINED); | |
577 | m_superscriptCtrl->Set3StateValue(wxCHK_UNDETERMINED); | |
578 | m_subscriptCtrl->Set3StateValue(wxCHK_UNDETERMINED); | |
579 | } | |
580 | ||
581 | UpdatePreview(); | |
582 | ||
583 | m_dontUpdate = false; | |
584 | ||
585 | return true; | |
586 | } | |
587 | ||
588 | wxRichTextAttr* wxRichTextFontPage::GetAttributes() | |
589 | { | |
590 | return wxRichTextFormattingDialog::GetDialogAttributes(this); | |
591 | } | |
592 | ||
593 | /// Updates the font preview | |
594 | void wxRichTextFontPage::UpdatePreview() | |
595 | { | |
596 | wxRichTextAttr attr; | |
597 | ||
598 | if (m_textColourLabel->GetValue()) | |
599 | m_previewCtrl->SetForegroundColour(m_colourCtrl->GetColour()); | |
600 | else | |
601 | { | |
602 | m_previewCtrl->SetForegroundColour(*wxBLACK); | |
603 | if (!(m_colourCtrl->GetColour() == *wxBLACK)) | |
604 | { | |
605 | m_colourCtrl->SetColour(*wxBLACK); | |
606 | m_colourCtrl->Refresh(); | |
607 | } | |
608 | } | |
609 | ||
610 | if (m_bgColourLabel->GetValue()) | |
611 | m_previewCtrl->SetBackgroundColour(m_bgColourCtrl->GetColour()); | |
612 | else | |
613 | { | |
614 | m_previewCtrl->SetBackgroundColour(*wxWHITE); | |
615 | ||
616 | if (!(m_bgColourCtrl->GetColour() == *wxWHITE)) | |
617 | { | |
618 | m_bgColourCtrl->SetColour(*wxWHITE); | |
619 | m_bgColourCtrl->Refresh(); | |
620 | } | |
621 | } | |
622 | ||
623 | if (m_faceListBox->GetSelection() != wxNOT_FOUND) | |
624 | { | |
625 | wxString faceName = m_faceListBox->GetFaceName(m_faceListBox->GetSelection()); | |
626 | attr.SetFontFaceName(faceName); | |
627 | } | |
628 | ||
629 | wxString strSize = m_sizeTextCtrl->GetValue(); | |
630 | if (!strSize.IsEmpty()) | |
631 | { | |
632 | int sz = wxAtoi(strSize); | |
633 | if (sz > 0) | |
634 | attr.SetFontSize(sz); | |
635 | } | |
636 | ||
637 | if (m_styleCtrl->GetSelection() != wxNOT_FOUND && m_styleCtrl->GetSelection() != 0) | |
638 | { | |
639 | wxFontStyle style; | |
640 | if (m_styleCtrl->GetSelection() == 2) | |
641 | style = wxFONTSTYLE_ITALIC; | |
642 | else | |
643 | style = wxFONTSTYLE_NORMAL; | |
644 | ||
645 | attr.SetFontStyle(style); | |
646 | } | |
647 | ||
648 | if (m_weightCtrl->GetSelection() != wxNOT_FOUND && m_weightCtrl->GetSelection() != 0) | |
649 | { | |
650 | wxFontWeight weight; | |
651 | if (m_weightCtrl->GetSelection() == 2) | |
652 | weight = wxFONTWEIGHT_BOLD; | |
653 | else | |
654 | weight = wxFONTWEIGHT_NORMAL; | |
655 | ||
656 | attr.SetFontWeight(weight); | |
657 | } | |
658 | ||
659 | if (m_underliningCtrl->GetSelection() != wxNOT_FOUND && m_underliningCtrl->GetSelection() != 0) | |
660 | { | |
661 | bool underlined; | |
662 | if (m_underliningCtrl->GetSelection() == 2) | |
663 | underlined = true; | |
664 | else | |
665 | underlined = false; | |
666 | ||
667 | attr.SetFontUnderlined(underlined); | |
668 | } | |
669 | ||
670 | int textEffects = 0; | |
671 | ||
672 | if (m_strikethroughCtrl->Get3StateValue() == wxCHK_CHECKED) | |
673 | { | |
674 | textEffects |= wxTEXT_ATTR_EFFECT_STRIKETHROUGH; | |
675 | } | |
676 | ||
677 | if (m_capitalsCtrl->Get3StateValue() == wxCHK_CHECKED) | |
678 | { | |
679 | textEffects |= wxTEXT_ATTR_EFFECT_CAPITALS; | |
680 | } | |
681 | ||
682 | if ( m_superscriptCtrl->Get3StateValue() == wxCHK_CHECKED ) | |
683 | textEffects |= wxTEXT_ATTR_EFFECT_SUPERSCRIPT; | |
684 | else if ( m_subscriptCtrl->Get3StateValue() == wxCHK_CHECKED ) | |
685 | textEffects |= wxTEXT_ATTR_EFFECT_SUBSCRIPT; | |
686 | ||
687 | wxFont font = attr.GetFont(); | |
688 | m_previewCtrl->SetFont(font); | |
689 | m_previewCtrl->SetTextEffects(textEffects); | |
690 | m_previewCtrl->Refresh(); | |
691 | } | |
692 | ||
693 | /*! | |
694 | * Should we show tooltips? | |
695 | */ | |
696 | ||
697 | bool wxRichTextFontPage::ShowToolTips() | |
698 | { | |
699 | return wxRichTextFormattingDialog::ShowToolTips(); | |
700 | } | |
701 | ||
702 | /*! | |
703 | * Get bitmap resources | |
704 | */ | |
705 | ||
706 | wxBitmap wxRichTextFontPage::GetBitmapResource( const wxString& name ) | |
707 | { | |
708 | // Bitmap retrieval | |
709 | ////@begin wxRichTextFontPage bitmap retrieval | |
710 | wxUnusedVar(name); | |
711 | return wxNullBitmap; | |
712 | ////@end wxRichTextFontPage bitmap retrieval | |
713 | } | |
714 | ||
715 | /*! | |
716 | * Get icon resources | |
717 | */ | |
718 | ||
719 | wxIcon wxRichTextFontPage::GetIconResource( const wxString& name ) | |
720 | { | |
721 | // Icon retrieval | |
722 | ////@begin wxRichTextFontPage icon retrieval | |
723 | wxUnusedVar(name); | |
724 | return wxNullIcon; | |
725 | ////@end wxRichTextFontPage icon retrieval | |
726 | } | |
727 | ||
728 | /*! | |
729 | * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTFONTPAGE_FACETEXTCTRL | |
730 | */ | |
731 | ||
732 | void wxRichTextFontPage::OnFaceTextCtrlUpdated( wxCommandEvent& WXUNUSED(event) ) | |
733 | { | |
734 | if (m_dontUpdate) | |
735 | return; | |
736 | ||
737 | wxString facename = m_faceTextCtrl->GetValue(); | |
738 | if (!facename.IsEmpty()) | |
739 | { | |
740 | if (m_faceListBox->HasFaceName(facename)) | |
741 | { | |
742 | m_faceListBox->SetFaceNameSelection(facename); | |
743 | UpdatePreview(); | |
744 | } | |
745 | else | |
746 | { | |
747 | // Try to find a partial match | |
748 | const wxArrayString& arr = m_faceListBox->GetFaceNames(); | |
749 | size_t i; | |
750 | for (i = 0; i < arr.GetCount(); i++) | |
751 | { | |
752 | if (arr[i].Mid(0, facename.Length()).Lower() == facename.Lower()) | |
753 | { | |
754 | m_faceListBox->ScrollToRow(i); | |
755 | break; | |
756 | } | |
757 | } | |
758 | } | |
759 | } | |
760 | } | |
761 | ||
762 | ||
763 | /*! | |
764 | * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTFONTPAGE_SIZETEXTCTRL | |
765 | */ | |
766 | ||
767 | void wxRichTextFontPage::OnSizeTextCtrlUpdated( wxCommandEvent& WXUNUSED(event) ) | |
768 | { | |
769 | if (m_dontUpdate) | |
770 | return; | |
771 | ||
772 | wxString strSize = m_sizeTextCtrl->GetValue(); | |
773 | if (!strSize.IsEmpty() && m_sizeListBox->FindString(strSize) != wxNOT_FOUND) | |
774 | m_sizeListBox->SetStringSelection(strSize); | |
775 | UpdatePreview(); | |
776 | } | |
777 | ||
778 | ||
779 | /*! | |
780 | * wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_SIZELISTBOX | |
781 | */ | |
782 | ||
783 | void wxRichTextFontPage::OnSizeListBoxSelected( wxCommandEvent& event ) | |
784 | { | |
785 | bool oldDontUpdate = m_dontUpdate; | |
786 | m_dontUpdate = true; | |
787 | ||
788 | m_sizeTextCtrl->SetValue(event.GetString()); | |
789 | ||
790 | m_dontUpdate = oldDontUpdate; | |
791 | ||
792 | if (m_dontUpdate) | |
793 | return; | |
794 | ||
795 | UpdatePreview(); | |
796 | } | |
797 | ||
798 | /*! | |
799 | * wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_FACELISTBOX | |
800 | */ | |
801 | ||
802 | void wxRichTextFontPage::OnFaceListBoxSelected( wxCommandEvent& WXUNUSED(event) ) | |
803 | { | |
804 | bool oldDontUpdate = m_dontUpdate; | |
805 | m_dontUpdate = true; | |
806 | ||
807 | m_faceTextCtrl->SetValue(m_faceListBox->GetFaceName(m_faceListBox->GetSelection())); | |
808 | ||
809 | m_dontUpdate = oldDontUpdate; | |
810 | ||
811 | if (m_dontUpdate) | |
812 | return; | |
813 | ||
814 | UpdatePreview(); | |
815 | } | |
816 | ||
817 | /*! | |
818 | * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_STYLECTRL | |
819 | */ | |
820 | ||
821 | void wxRichTextFontPage::OnStyleCtrlSelected( wxCommandEvent& WXUNUSED(event) ) | |
822 | { | |
823 | if (m_dontUpdate) | |
824 | return; | |
825 | ||
826 | UpdatePreview(); | |
827 | } | |
828 | ||
829 | ||
830 | /*! | |
831 | * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL | |
832 | */ | |
833 | ||
834 | void wxRichTextFontPage::OnUnderliningCtrlSelected( wxCommandEvent& WXUNUSED(event) ) | |
835 | { | |
836 | if (m_dontUpdate) | |
837 | return; | |
838 | ||
839 | UpdatePreview(); | |
840 | } | |
841 | ||
842 | ||
843 | /*! | |
844 | * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_WEIGHTCTRL | |
845 | */ | |
846 | ||
847 | void wxRichTextFontPage::OnWeightCtrlSelected( wxCommandEvent& WXUNUSED(event) ) | |
848 | { | |
849 | if (m_dontUpdate) | |
850 | return; | |
851 | ||
852 | UpdatePreview(); | |
853 | } | |
854 | ||
855 | void wxRichTextFontPage::OnColourClicked( wxCommandEvent& event ) | |
856 | { | |
857 | if (event.GetId() == m_colourCtrl->GetId()) | |
858 | m_colourPresent = true; | |
859 | else if (event.GetId() == m_bgColourCtrl->GetId()) | |
860 | m_bgColourPresent = true; | |
861 | ||
862 | m_dontUpdate = true; | |
863 | ||
864 | if (event.GetId() == m_colourCtrl->GetId()) | |
865 | { | |
866 | m_textColourLabel->SetValue(true); | |
867 | } | |
868 | else if (event.GetId() == m_bgColourCtrl->GetId()) | |
869 | { | |
870 | m_bgColourLabel->SetValue(true); | |
871 | } | |
872 | ||
873 | m_dontUpdate = false; | |
874 | ||
875 | UpdatePreview(); | |
876 | } | |
877 | /*! | |
878 | * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL | |
879 | */ | |
880 | ||
881 | void wxRichTextFontPage::OnStrikethroughctrlClick( wxCommandEvent& WXUNUSED(event) ) | |
882 | { | |
883 | if (m_dontUpdate) | |
884 | return; | |
885 | ||
886 | UpdatePreview(); | |
887 | } | |
888 | ||
889 | /*! | |
890 | * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_CAPSCTRL | |
891 | */ | |
892 | ||
893 | void wxRichTextFontPage::OnCapsctrlClick( wxCommandEvent& WXUNUSED(event) ) | |
894 | { | |
895 | if (m_dontUpdate) | |
896 | return; | |
897 | ||
898 | UpdatePreview(); | |
899 | } | |
900 | ||
901 | /*! | |
902 | * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_SUPERSCRIPT | |
903 | */ | |
904 | ||
905 | void wxRichTextFontPage::OnRichtextfontpageSuperscriptClick( wxCommandEvent& WXUNUSED(event) ) | |
906 | { | |
907 | if (m_dontUpdate) | |
908 | return; | |
909 | ||
910 | if ( m_superscriptCtrl->Get3StateValue() == wxCHK_CHECKED) | |
911 | m_subscriptCtrl->Set3StateValue( wxCHK_UNCHECKED ); | |
912 | ||
913 | UpdatePreview(); | |
914 | } | |
915 | ||
916 | /*! | |
917 | * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_SUBSCRIPT | |
918 | */ | |
919 | ||
920 | void wxRichTextFontPage::OnRichtextfontpageSubscriptClick( wxCommandEvent& WXUNUSED(event) ) | |
921 | { | |
922 | if (m_dontUpdate) | |
923 | return; | |
924 | ||
925 | if ( m_subscriptCtrl->Get3StateValue() == wxCHK_CHECKED) | |
926 | m_superscriptCtrl->Set3StateValue( wxCHK_UNCHECKED ); | |
927 | ||
928 | UpdatePreview(); | |
929 | } |