X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/925e9792d32e353233985f53a4845f154e455a58..55325d01e68cfb071e42699ca72ba84a7071aa2b:/samples/font/font.cpp diff --git a/samples/font/font.cpp b/samples/font/font.cpp index 626a5d8d4e..8203a16d64 100644 --- a/samples/font/font.cpp +++ b/samples/font/font.cpp @@ -32,6 +32,8 @@ #include "wx/splitter.h" #include "wx/textfile.h" +#include "../sample.xpm" + #ifdef __WXMAC__ #undef wxFontDialog #include "wx/mac/fontdlg.h" @@ -234,6 +236,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) { m_fontSize = 12; + SetIcon(wxIcon(sample_xpm)); + // create a menu bar wxMenu *menuFile = new wxMenu; @@ -382,6 +386,7 @@ bool MyFrame::DoEnumerateFamilies(bool fixedWidthOnly, } wxString facename; + if ( silent ) { // choose the first @@ -404,7 +409,7 @@ bool MyFrame::DoEnumerateFamilies(bool fixedWidthOnly, delete [] facenames; } - if ( !facename.IsEmpty() ) + if ( !facename.empty() ) { wxFont font(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, facename, encoding); @@ -467,7 +472,7 @@ void MyFrame::OnCheckNativeToFromString(wxCommandEvent& WXUNUSED(event)) { wxString fontInfo = m_canvas->GetTextFont().GetNativeFontInfoDesc(); - if ( fontInfo.IsEmpty() ) + if ( fontInfo.empty() ) { wxLogError(wxT("Native font info string is empty!")); } @@ -581,6 +586,7 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event)) { +#if wxUSE_FILEDLG // first, choose the file static wxString s_dir, s_file; wxFileDialog dialog(this, wxT("Open an email message file"), @@ -692,6 +698,7 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event)) wxFontMapper::GetEncodingDescription(fontenc).c_str()); } } +#endif // wxUSE_FILEDLG } void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) @@ -737,7 +744,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) fontInfo.Printf(wxT("Font size is %d points, family: %s, encoding: %s"), m_font.GetPointSize(), m_font.GetFamilyString().c_str(), - wxFontMapper::Get()-> + wxFontMapper:: GetEncodingDescription(m_font.GetEncoding()).c_str()); dc.DrawText(fontInfo, x, y);