Add wxFont::GetBaseFont().

This can be used to "undo" the result of Bold() ,Underlined() or Italic()
methods and returns an unadorned version of the font.

Closes #11815.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76120 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-03-11 20:48:20 +00:00
parent 8b5d2687db
commit b356d1d3c7
6 changed files with 33 additions and 0 deletions

View File

@@ -96,6 +96,8 @@ public:
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnGetBaseFont(wxCommandEvent& WXUNUSED(event))
{ DoChangeFont(m_canvas->GetTextFont().GetBaseFont()); }
void OnIncFont(wxCommandEvent& WXUNUSED(event)) { DoResizeFont(+2); }
void OnDecFont(wxCommandEvent& WXUNUSED(event)) { DoResizeFont(-2); }
@@ -171,6 +173,8 @@ enum
Font_IncSize,
Font_DecSize,
Font_GetBaseFont,
Font_Bold,
Font_Light,
@@ -222,6 +226,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(Font_ViewMsg, MyFrame::OnViewMsg)
EVT_MENU(Font_About, MyFrame::OnAbout)
EVT_MENU(Font_GetBaseFont, MyFrame::OnGetBaseFont)
EVT_MENU(Font_IncSize, MyFrame::OnIncFont)
EVT_MENU(Font_DecSize, MyFrame::OnDecFont)
@@ -320,6 +325,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
wxMenu *menuFont = new wxMenu;
menuFont->Append(Font_IncSize, wxT("&Increase font size by 2 points\tCtrl-I"));
menuFont->Append(Font_DecSize, wxT("&Decrease font size by 2 points\tCtrl-D"));
menuFont->Append(Font_GetBaseFont, wxT("Use &base version of the font\tCtrl-0"));
menuFont->AppendSeparator();
menuFont->AppendCheckItem(Font_Bold, wxT("&Bold\tCtrl-B"), wxT("Toggle bold state"));
menuFont->AppendCheckItem(Font_Light, wxT("&Light\tCtrl-L"), wxT("Toggle light state"));