- wxFont fontOld = m_canvas->GetTextFont();
-
- DoChangeFont(
- wxFont(
- fontOld.GetPointSize() + diff,
- fontOld.GetFamily(),
- fontOld.GetStyle(),
- fontOld.GetWeight(),
- fontOld.GetUnderlined(),
- fontOld.GetFaceName(),
- fontOld.GetEncoding()
- )
- );
+ wxFont font = m_canvas->GetTextFont();
+
+ font.SetPointSize(font.GetPointSize() + diff);
+ DoChangeFont(font);
+}
+
+void MyFrame::OnBold(wxCommandEvent& event)
+{
+ wxFont font = m_canvas->GetTextFont();
+
+ font.SetWeight(event.IsChecked() ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL);
+ DoChangeFont(font);
+}
+
+void MyFrame::OnItalic(wxCommandEvent& event)
+{
+ wxFont font = m_canvas->GetTextFont();
+
+ font.SetStyle(event.IsChecked() ? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL);
+ DoChangeFont(font);
+}
+
+void MyFrame::OnUnderline(wxCommandEvent& event)
+{
+ wxFont font = m_canvas->GetTextFont();
+
+ font.SetUnderlined(event.IsChecked());
+ DoChangeFont(font);
+}
+
+void MyFrame::OnwxPointerFont(wxCommandEvent& event)
+{
+ wxFont font;
+
+ switch (event.GetId())
+ {
+ case Font_wxNORMAL_FONT : font = wxFont(*wxNORMAL_FONT); break;
+ case Font_wxSMALL_FONT : font = wxFont(*wxSMALL_FONT); break;
+ case Font_wxITALIC_FONT : font = wxFont(*wxITALIC_FONT); break;
+ case Font_wxSWISS_FONT : font = wxFont(*wxSWISS_FONT); break;
+ default : font = wxFont(*wxNORMAL_FONT); break;
+ }
+
+ GetMenuBar()->Check(Font_Bold, FALSE);
+ GetMenuBar()->Check(Font_Italic, FALSE);
+ GetMenuBar()->Check(Font_Underlined, FALSE);
+
+ DoChangeFont(font);