1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/richtext/richeditfontpage.cpp
3 // Purpose: Font page for wxRichTextFormattingDialog
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/richtext/richtextfontpage.h"
15 * wxRichTextFontPage type definition
18 IMPLEMENT_DYNAMIC_CLASS( wxRichTextFontPage
, wxPanel
)
21 * wxRichTextFontPage event table definition
24 BEGIN_EVENT_TABLE( wxRichTextFontPage
, wxPanel
)
25 EVT_LISTBOX( ID_RICHTEXTFONTPAGE_FACELISTBOX
, wxRichTextFontPage::OnFaceListBoxSelected
)
26 EVT_BUTTON( ID_RICHTEXTFONTPAGE_COLOURCTRL
, wxRichTextFontPage::OnColourClicked
)
28 ////@begin wxRichTextFontPage event table entries
29 EVT_TEXT( ID_RICHTEXTFONTPAGE_FACETEXTCTRL
, wxRichTextFontPage::OnFaceTextCtrlUpdated
)
31 EVT_TEXT( ID_RICHTEXTFONTPAGE_SIZETEXTCTRL
, wxRichTextFontPage::OnSizeTextCtrlUpdated
)
33 EVT_LISTBOX( ID_RICHTEXTFONTPAGE_SIZELISTBOX
, wxRichTextFontPage::OnSizeListBoxSelected
)
35 EVT_COMBOBOX( ID_RICHTEXTFONTPAGE_STYLECTRL
, wxRichTextFontPage::OnStyleCtrlSelected
)
37 EVT_COMBOBOX( ID_RICHTEXTFONTPAGE_WEIGHTCTRL
, wxRichTextFontPage::OnWeightCtrlSelected
)
39 EVT_COMBOBOX( ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL
, wxRichTextFontPage::OnUnderliningCtrlSelected
)
41 EVT_CHECKBOX( ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL
, wxRichTextFontPage::OnStrikethroughctrlClick
)
43 EVT_CHECKBOX( ID_RICHTEXTFONTPAGE_CAPSCTRL
, wxRichTextFontPage::OnCapsctrlClick
)
45 ////@end wxRichTextFontPage event table entries
50 * wxRichTextFontPage constructors
53 wxRichTextFontPage::wxRichTextFontPage( )
58 wxRichTextFontPage::wxRichTextFontPage( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
61 Create(parent
, id
, pos
, size
, style
);
68 void wxRichTextFontPage::Init()
71 m_colourPresent
= false;
73 ////@begin wxRichTextFontPage member initialisation
74 m_faceTextCtrl
= NULL
;
76 m_sizeTextCtrl
= NULL
;
80 m_underliningCtrl
= NULL
;
82 m_strikethroughCtrl
= NULL
;
83 m_capitalsCtrl
= NULL
;
85 ////@end wxRichTextFontPage member initialisation
89 * wxRichTextFontPage creator
92 bool wxRichTextFontPage::Create( wxWindow
* parent
, wxWindowID id
, const wxPoint
& pos
, const wxSize
& size
, long style
)
94 ////@begin wxRichTextFontPage creation
95 wxPanel::Create( parent
, id
, pos
, size
, style
);
100 GetSizer()->SetSizeHints(this);
103 ////@end wxRichTextFontPage creation
108 * Control creation for wxRichTextFontPage
111 void wxRichTextFontPage::CreateControls()
113 ////@begin wxRichTextFontPage content construction
114 wxRichTextFontPage
* itemPanel1
= this;
116 wxBoxSizer
* itemBoxSizer2
= new wxBoxSizer(wxVERTICAL
);
117 itemPanel1
->SetSizer(itemBoxSizer2
);
119 wxBoxSizer
* itemBoxSizer3
= new wxBoxSizer(wxVERTICAL
);
120 itemBoxSizer2
->Add(itemBoxSizer3
, 1, wxGROW
|wxALL
, 5);
122 wxBoxSizer
* itemBoxSizer4
= new wxBoxSizer(wxHORIZONTAL
);
123 itemBoxSizer3
->Add(itemBoxSizer4
, 1, wxGROW
, 5);
125 wxBoxSizer
* itemBoxSizer5
= new wxBoxSizer(wxVERTICAL
);
126 itemBoxSizer4
->Add(itemBoxSizer5
, 1, wxGROW
, 5);
128 wxStaticText
* itemStaticText6
= new wxStaticText( itemPanel1
, wxID_STATIC
, _("&Font:"), wxDefaultPosition
, wxDefaultSize
, 0 );
129 itemBoxSizer5
->Add(itemStaticText6
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
, 5);
131 m_faceTextCtrl
= new wxTextCtrl( itemPanel1
, ID_RICHTEXTFONTPAGE_FACETEXTCTRL
, _T(""), wxDefaultPosition
, wxDefaultSize
, 0 );
132 m_faceTextCtrl
->SetHelpText(_("Type a font name."));
133 if (wxRichTextFontPage::ShowToolTips())
134 m_faceTextCtrl
->SetToolTip(_("Type a font name."));
135 itemBoxSizer5
->Add(m_faceTextCtrl
, 0, wxGROW
|wxLEFT
|wxRIGHT
|wxTOP
, 5);
137 m_faceListBox
= new wxRichTextFontListBox( itemPanel1
, ID_RICHTEXTFONTPAGE_FACELISTBOX
, wxDefaultPosition
, wxSize(200, 100), 0 );
138 m_faceListBox
->SetHelpText(_("Lists the available fonts."));
139 if (wxRichTextFontPage::ShowToolTips())
140 m_faceListBox
->SetToolTip(_("Lists the available fonts."));
141 itemBoxSizer5
->Add(m_faceListBox
, 1, wxGROW
|wxALL
|wxFIXED_MINSIZE
, 5);
143 wxBoxSizer
* itemBoxSizer9
= new wxBoxSizer(wxVERTICAL
);
144 itemBoxSizer4
->Add(itemBoxSizer9
, 0, wxGROW
, 5);
146 wxStaticText
* itemStaticText10
= new wxStaticText( itemPanel1
, wxID_STATIC
, _("&Size:"), wxDefaultPosition
, wxDefaultSize
, 0 );
147 itemBoxSizer9
->Add(itemStaticText10
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
, 5);
149 m_sizeTextCtrl
= new wxTextCtrl( itemPanel1
, ID_RICHTEXTFONTPAGE_SIZETEXTCTRL
, _T(""), wxDefaultPosition
, wxSize(50, -1), 0 );
150 m_sizeTextCtrl
->SetHelpText(_("Type a size in points."));
151 if (wxRichTextFontPage::ShowToolTips())
152 m_sizeTextCtrl
->SetToolTip(_("Type a size in points."));
153 itemBoxSizer9
->Add(m_sizeTextCtrl
, 0, wxGROW
|wxLEFT
|wxRIGHT
|wxTOP
, 5);
155 wxArrayString m_sizeListBoxStrings
;
156 m_sizeListBox
= new wxListBox( itemPanel1
, ID_RICHTEXTFONTPAGE_SIZELISTBOX
, wxDefaultPosition
, wxSize(50, -1), m_sizeListBoxStrings
, wxLB_SINGLE
);
157 m_sizeListBox
->SetHelpText(_("Lists font sizes in points."));
158 if (wxRichTextFontPage::ShowToolTips())
159 m_sizeListBox
->SetToolTip(_("Lists font sizes in points."));
160 itemBoxSizer9
->Add(m_sizeListBox
, 1, wxALIGN_CENTER_HORIZONTAL
|wxALL
|wxFIXED_MINSIZE
, 5);
162 wxBoxSizer
* itemBoxSizer13
= new wxBoxSizer(wxHORIZONTAL
);
163 itemBoxSizer3
->Add(itemBoxSizer13
, 0, wxGROW
, 5);
165 wxBoxSizer
* itemBoxSizer14
= new wxBoxSizer(wxVERTICAL
);
166 itemBoxSizer13
->Add(itemBoxSizer14
, 1, wxGROW
, 5);
168 wxStaticText
* itemStaticText15
= new wxStaticText( itemPanel1
, wxID_STATIC
, _("Font st&yle:"), wxDefaultPosition
, wxDefaultSize
, 0 );
169 itemBoxSizer14
->Add(itemStaticText15
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
, 5);
171 wxArrayString m_styleCtrlStrings
;
172 m_styleCtrl
= new wxComboBox( itemPanel1
, ID_RICHTEXTFONTPAGE_STYLECTRL
, _T(""), wxDefaultPosition
, wxDefaultSize
, m_styleCtrlStrings
, wxCB_READONLY
);
173 m_styleCtrl
->SetHelpText(_("Select regular or italic style."));
174 if (wxRichTextFontPage::ShowToolTips())
175 m_styleCtrl
->SetToolTip(_("Select regular or italic style."));
176 itemBoxSizer14
->Add(m_styleCtrl
, 0, wxGROW
|wxALL
, 5);
178 wxBoxSizer
* itemBoxSizer17
= new wxBoxSizer(wxVERTICAL
);
179 itemBoxSizer13
->Add(itemBoxSizer17
, 1, wxGROW
, 5);
181 wxStaticText
* itemStaticText18
= new wxStaticText( itemPanel1
, wxID_STATIC
, _("Font &weight:"), wxDefaultPosition
, wxDefaultSize
, 0 );
182 itemBoxSizer17
->Add(itemStaticText18
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
, 5);
184 wxArrayString m_weightCtrlStrings
;
185 m_weightCtrl
= new wxComboBox( itemPanel1
, ID_RICHTEXTFONTPAGE_WEIGHTCTRL
, _T(""), wxDefaultPosition
, wxDefaultSize
, m_weightCtrlStrings
, wxCB_READONLY
);
186 m_weightCtrl
->SetHelpText(_("Select regular or bold."));
187 if (wxRichTextFontPage::ShowToolTips())
188 m_weightCtrl
->SetToolTip(_("Select regular or bold."));
189 itemBoxSizer17
->Add(m_weightCtrl
, 0, wxGROW
|wxALL
, 5);
191 wxBoxSizer
* itemBoxSizer20
= new wxBoxSizer(wxVERTICAL
);
192 itemBoxSizer13
->Add(itemBoxSizer20
, 1, wxGROW
, 5);
194 wxStaticText
* itemStaticText21
= new wxStaticText( itemPanel1
, wxID_STATIC
, _("&Underlining:"), wxDefaultPosition
, wxDefaultSize
, 0 );
195 itemBoxSizer20
->Add(itemStaticText21
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
, 5);
197 wxArrayString m_underliningCtrlStrings
;
198 m_underliningCtrl
= new wxComboBox( itemPanel1
, ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL
, _T(""), wxDefaultPosition
, wxDefaultSize
, m_underliningCtrlStrings
, wxCB_READONLY
);
199 m_underliningCtrl
->SetHelpText(_("Select underlining or no underlining."));
200 if (wxRichTextFontPage::ShowToolTips())
201 m_underliningCtrl
->SetToolTip(_("Select underlining or no underlining."));
202 itemBoxSizer20
->Add(m_underliningCtrl
, 0, wxGROW
|wxALL
, 5);
204 wxBoxSizer
* itemBoxSizer23
= new wxBoxSizer(wxVERTICAL
);
205 itemBoxSizer13
->Add(itemBoxSizer23
, 0, wxGROW
, 5);
207 wxStaticText
* itemStaticText24
= new wxStaticText( itemPanel1
, wxID_STATIC
, _("&Colour:"), wxDefaultPosition
, wxDefaultSize
, 0 );
208 itemBoxSizer23
->Add(itemStaticText24
, 0, wxALIGN_LEFT
|wxLEFT
|wxRIGHT
|wxTOP
, 5);
210 m_colourCtrl
= new wxRichTextColourSwatchCtrl( itemPanel1
, ID_RICHTEXTFONTPAGE_COLOURCTRL
, wxDefaultPosition
, wxSize(40, 20), wxSIMPLE_BORDER
);
211 m_colourCtrl
->SetHelpText(_("Click to change the text colour."));
212 if (wxRichTextFontPage::ShowToolTips())
213 m_colourCtrl
->SetToolTip(_("Click to change the text colour."));
214 itemBoxSizer23
->Add(m_colourCtrl
, 0, wxALIGN_LEFT
|wxALL
, 5);
216 wxBoxSizer
* itemBoxSizer26
= new wxBoxSizer(wxHORIZONTAL
);
217 itemBoxSizer3
->Add(itemBoxSizer26
, 0, wxGROW
, 5);
219 m_strikethroughCtrl
= new wxCheckBox( itemPanel1
, ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL
, _("&Strikethrough"), wxDefaultPosition
, wxDefaultSize
, wxCHK_3STATE
);
220 m_strikethroughCtrl
->SetValue(false);
221 m_strikethroughCtrl
->SetHelpText(_("Check to show a line through the text."));
222 if (wxRichTextFontPage::ShowToolTips())
223 m_strikethroughCtrl
->SetToolTip(_("Check to show a line through the text."));
224 itemBoxSizer26
->Add(m_strikethroughCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
226 m_capitalsCtrl
= new wxCheckBox( itemPanel1
, ID_RICHTEXTFONTPAGE_CAPSCTRL
, _("Ca&pitals"), wxDefaultPosition
, wxDefaultSize
, wxCHK_3STATE
);
227 m_capitalsCtrl
->SetValue(false);
228 m_capitalsCtrl
->SetHelpText(_("Check to show the text in capitals."));
229 if (wxRichTextFontPage::ShowToolTips())
230 m_capitalsCtrl
->SetToolTip(_("Check to show the text in capitals."));
231 itemBoxSizer26
->Add(m_capitalsCtrl
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
233 itemBoxSizer3
->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL
, 5);
235 m_previewCtrl
= new wxRichTextFontPreviewCtrl( itemPanel1
, ID_RICHTEXTFONTPAGE_PREVIEWCTRL
, wxDefaultPosition
, wxSize(100, 60), 0 );
236 m_previewCtrl
->SetHelpText(_("Shows a preview of the font settings."));
237 if (wxRichTextFontPage::ShowToolTips())
238 m_previewCtrl
->SetToolTip(_("Shows a preview of the font settings."));
239 itemBoxSizer3
->Add(m_previewCtrl
, 0, wxGROW
|wxALL
, 5);
241 ////@end wxRichTextFontPage content construction
243 m_faceListBox
->UpdateFonts();
245 m_styleCtrl
->Append(_("Regular"));
246 m_styleCtrl
->Append(_("Italic"));
248 m_weightCtrl
->Append(_("Regular"));
249 m_weightCtrl
->Append(_("Bold"));
251 m_underliningCtrl
->Append(_("Not underlined"));
252 m_underliningCtrl
->Append(_("Underlined"));
256 for (i
= 8; i
< 40; i
++)
258 nStr
.Printf(wxT("%d"), i
);
259 m_sizeListBox
->Append(nStr
);
261 m_sizeListBox
->Append(wxT("48"));
262 m_sizeListBox
->Append(wxT("72"));
265 /// Transfer data from/to window
266 bool wxRichTextFontPage::TransferDataFromWindow()
268 wxPanel::TransferDataFromWindow();
270 wxTextAttr
* attr
= GetAttributes();
272 if (m_faceListBox
->GetSelection() != wxNOT_FOUND
)
274 wxString faceName
= m_faceListBox
->GetFaceName(m_faceListBox
->GetSelection());
275 if (!faceName
.IsEmpty())
277 attr
->SetFontFaceName(faceName
);
281 attr
->SetFlags(attr
->GetFlags() & (~ wxTEXT_ATTR_FONT_FACE
));
283 wxString strSize
= m_sizeTextCtrl
->GetValue();
284 if (!strSize
.IsEmpty())
286 int sz
= wxAtoi(strSize
);
289 attr
->SetFontSize(sz
);
293 attr
->SetFlags(attr
->GetFlags() & (~ wxTEXT_ATTR_FONT_SIZE
));
295 if (m_styleCtrl
->GetSelection() != wxNOT_FOUND
)
298 if (m_styleCtrl
->GetStringSelection() == _("Italic"))
303 attr
->SetFontStyle(style
);
306 attr
->SetFlags(attr
->GetFlags() & (~ wxTEXT_ATTR_FONT_ITALIC
));
308 if (m_weightCtrl
->GetSelection() != wxNOT_FOUND
)
311 if (m_weightCtrl
->GetStringSelection() == _("Bold"))
316 attr
->SetFontWeight(weight
);
319 attr
->SetFlags(attr
->GetFlags() & (~ wxTEXT_ATTR_FONT_WEIGHT
));
321 if (m_underliningCtrl
->GetSelection() != wxNOT_FOUND
)
324 if (m_underliningCtrl
->GetStringSelection() == _("Underlined"))
329 attr
->SetFontUnderlined(underlined
);
332 attr
->SetFlags(attr
->GetFlags() & (~ wxTEXT_ATTR_FONT_UNDERLINE
));
336 attr
->SetTextColour(m_colourCtrl
->GetBackgroundColour());
339 attr
->SetFlags(attr
->GetFlags() & (~ wxTEXT_ATTR_TEXT_COLOUR
));
341 if (m_strikethroughCtrl
->Get3StateValue() != wxCHK_UNDETERMINED
)
343 attr
->SetTextEffectFlags(attr
->GetTextEffectFlags() | wxTEXT_ATTR_EFFECT_STRIKETHROUGH
);
345 if (m_strikethroughCtrl
->Get3StateValue() == wxCHK_CHECKED
)
346 attr
->SetTextEffects(attr
->GetTextEffects() | wxTEXT_ATTR_EFFECT_STRIKETHROUGH
);
348 attr
->SetTextEffects(attr
->GetTextEffects() & ~wxTEXT_ATTR_EFFECT_STRIKETHROUGH
);
351 if (m_capitalsCtrl
->Get3StateValue() != wxCHK_UNDETERMINED
)
353 attr
->SetTextEffectFlags(attr
->GetTextEffectFlags() | wxTEXT_ATTR_EFFECT_CAPITALS
);
355 if (m_capitalsCtrl
->Get3StateValue() == wxCHK_CHECKED
)
356 attr
->SetTextEffects(attr
->GetTextEffects() | wxTEXT_ATTR_EFFECT_CAPITALS
);
358 attr
->SetTextEffects(attr
->GetTextEffects() & ~wxTEXT_ATTR_EFFECT_CAPITALS
);
364 bool wxRichTextFontPage::TransferDataToWindow()
366 wxPanel::TransferDataToWindow();
369 wxTextAttr
* attr
= GetAttributes();
371 if (attr
->HasFontFaceName())
373 m_faceTextCtrl
->SetValue(attr
->GetFontFaceName());
374 m_faceListBox
->SetFaceNameSelection(attr
->GetFont().GetFaceName());
378 m_faceTextCtrl
->SetValue(wxEmptyString
);
379 m_faceListBox
->SetFaceNameSelection(wxEmptyString
);
382 if (attr
->HasFontSize())
384 wxString strSize
= wxString::Format(wxT("%d"), attr
->GetFontSize());
385 m_sizeTextCtrl
->SetValue(strSize
);
386 if (m_sizeListBox
->FindString(strSize
) != wxNOT_FOUND
)
387 m_sizeListBox
->SetStringSelection(strSize
);
391 m_sizeTextCtrl
->SetValue(wxEmptyString
);
392 m_sizeListBox
->SetSelection(wxNOT_FOUND
);
395 if (attr
->HasFontWeight())
397 if (attr
->GetFontWeight() == wxBOLD
)
398 m_weightCtrl
->SetSelection(1);
400 m_weightCtrl
->SetSelection(0);
404 m_weightCtrl
->SetSelection(wxNOT_FOUND
);
407 if (attr
->HasFontItalic())
409 if (attr
->GetFontStyle() == wxITALIC
)
410 m_styleCtrl
->SetSelection(1);
412 m_styleCtrl
->SetSelection(0);
416 m_styleCtrl
->SetSelection(wxNOT_FOUND
);
419 if (attr
->HasFontUnderlined())
421 if (attr
->GetFontUnderlined())
422 m_underliningCtrl
->SetSelection(1);
424 m_underliningCtrl
->SetSelection(0);
428 m_underliningCtrl
->SetSelection(wxNOT_FOUND
);
431 if (attr
->HasTextColour())
433 m_colourCtrl
->SetColour(attr
->GetTextColour());
434 m_colourPresent
= true;
437 if (attr
->HasTextEffects())
439 if (attr
->GetTextEffectFlags() & wxTEXT_ATTR_EFFECT_STRIKETHROUGH
)
441 if (attr
->GetTextEffects() & wxTEXT_ATTR_EFFECT_STRIKETHROUGH
)
442 m_strikethroughCtrl
->Set3StateValue(wxCHK_CHECKED
);
444 m_strikethroughCtrl
->Set3StateValue(wxCHK_UNCHECKED
);
447 m_strikethroughCtrl
->Set3StateValue(wxCHK_UNDETERMINED
);
449 if (attr
->GetTextEffectFlags() & wxTEXT_ATTR_EFFECT_CAPITALS
)
451 if (attr
->GetTextEffects() & wxTEXT_ATTR_EFFECT_CAPITALS
)
452 m_capitalsCtrl
->Set3StateValue(wxCHK_CHECKED
);
454 m_capitalsCtrl
->Set3StateValue(wxCHK_UNCHECKED
);
457 m_capitalsCtrl
->Set3StateValue(wxCHK_UNDETERMINED
);
461 m_strikethroughCtrl
->Set3StateValue(wxCHK_UNDETERMINED
);
462 m_capitalsCtrl
->Set3StateValue(wxCHK_UNDETERMINED
);
467 m_dontUpdate
= false;
472 wxTextAttr
* wxRichTextFontPage::GetAttributes()
474 return wxRichTextFormattingDialog::GetDialogAttributes(this);
477 /// Updates the font preview
478 void wxRichTextFontPage::UpdatePreview()
480 wxFont
font(*wxNORMAL_FONT
);
483 m_previewCtrl
->SetForegroundColour(m_colourCtrl
->GetBackgroundColour());
485 if (m_faceListBox
->GetSelection() != wxNOT_FOUND
)
487 wxString faceName
= m_faceListBox
->GetFaceName(m_faceListBox
->GetSelection());
488 font
.SetFaceName(faceName
);
491 wxString strSize
= m_sizeTextCtrl
->GetValue();
492 if (!strSize
.IsEmpty())
494 int sz
= wxAtoi(strSize
);
496 font
.SetPointSize(sz
);
499 if (m_styleCtrl
->GetSelection() != wxNOT_FOUND
)
502 if (m_styleCtrl
->GetStringSelection() == _("Italic"))
507 font
.SetStyle(style
);
510 if (m_weightCtrl
->GetSelection() != wxNOT_FOUND
)
513 if (m_weightCtrl
->GetStringSelection() == _("Bold"))
518 font
.SetWeight(weight
);
521 if (m_underliningCtrl
->GetSelection() != wxNOT_FOUND
)
524 if (m_underliningCtrl
->GetStringSelection() == _("Underlined"))
529 font
.SetUnderlined(underlined
);
534 if (m_strikethroughCtrl
->Get3StateValue() == wxCHK_CHECKED
)
536 textEffects
|= wxTEXT_ATTR_EFFECT_STRIKETHROUGH
;
539 if (m_capitalsCtrl
->Get3StateValue() == wxCHK_CHECKED
)
541 textEffects
|= wxTEXT_ATTR_EFFECT_CAPITALS
;
544 m_previewCtrl
->SetFont(font
);
545 m_previewCtrl
->SetTextEffects(textEffects
);
546 m_previewCtrl
->Refresh();
550 * Should we show tooltips?
553 bool wxRichTextFontPage::ShowToolTips()
555 return wxRichTextFormattingDialog::ShowToolTips();
559 * Get bitmap resources
562 wxBitmap
wxRichTextFontPage::GetBitmapResource( const wxString
& name
)
565 ////@begin wxRichTextFontPage bitmap retrieval
568 ////@end wxRichTextFontPage bitmap retrieval
575 wxIcon
wxRichTextFontPage::GetIconResource( const wxString
& name
)
578 ////@begin wxRichTextFontPage icon retrieval
581 ////@end wxRichTextFontPage icon retrieval
585 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTFONTPAGE_FACETEXTCTRL
588 void wxRichTextFontPage::OnFaceTextCtrlUpdated( wxCommandEvent
& WXUNUSED(event
) )
593 wxString facename
= m_faceTextCtrl
->GetValue();
594 if (!facename
.IsEmpty())
596 if (m_faceListBox
->HasFaceName(facename
))
598 m_faceListBox
->SetFaceNameSelection(facename
);
603 // Try to find a partial match
604 const wxArrayString
& arr
= m_faceListBox
->GetFaceNames();
606 for (i
= 0; i
< arr
.GetCount(); i
++)
608 if (arr
[i
].Mid(0, facename
.Length()).Lower() == facename
.Lower())
610 m_faceListBox
->ScrollToRow(i
);
620 * wxEVT_COMMAND_TEXT_UPDATED event handler for ID_RICHTEXTFONTPAGE_SIZETEXTCTRL
623 void wxRichTextFontPage::OnSizeTextCtrlUpdated( wxCommandEvent
& WXUNUSED(event
) )
628 wxString strSize
= m_sizeTextCtrl
->GetValue();
629 if (!strSize
.IsEmpty() && m_sizeListBox
->FindString(strSize
) != wxNOT_FOUND
)
630 m_sizeListBox
->SetStringSelection(strSize
);
636 * wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_SIZELISTBOX
639 void wxRichTextFontPage::OnSizeListBoxSelected( wxCommandEvent
& event
)
643 m_sizeTextCtrl
->SetValue(event
.GetString());
645 m_dontUpdate
= false;
651 * wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_FACELISTBOX
654 void wxRichTextFontPage::OnFaceListBoxSelected( wxCommandEvent
& WXUNUSED(event
) )
658 m_faceTextCtrl
->SetValue(m_faceListBox
->GetFaceName(m_faceListBox
->GetSelection()));
660 m_dontUpdate
= false;
666 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_STYLECTRL
669 void wxRichTextFontPage::OnStyleCtrlSelected( wxCommandEvent
& WXUNUSED(event
) )
676 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL
679 void wxRichTextFontPage::OnUnderliningCtrlSelected( wxCommandEvent
& WXUNUSED(event
) )
686 * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTFONTPAGE_WEIGHTCTRL
689 void wxRichTextFontPage::OnWeightCtrlSelected( wxCommandEvent
& WXUNUSED(event
) )
694 void wxRichTextFontPage::OnColourClicked( wxCommandEvent
& WXUNUSED(event
) )
696 m_colourPresent
= true;
701 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL
704 void wxRichTextFontPage::OnStrikethroughctrlClick( wxCommandEvent
& WXUNUSED(event
) )
710 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_RICHTEXTFONTPAGE_CAPSCTRL
713 void wxRichTextFontPage::OnCapsctrlClick( wxCommandEvent
& WXUNUSED(event
) )