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