X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/da0d2c78ce4e8879989f050175923240a42e9133..914f51576275c0f5411db2eed52099c71a7489a3:/samples/richtext/richtext.cpp diff --git a/samples/richtext/richtext.cpp b/samples/richtext/richtext.cpp index 20f0fa7576..2c8d0a3df6 100644 --- a/samples/richtext/richtext.cpp +++ b/samples/richtext/richtext.cpp @@ -35,7 +35,10 @@ #include "wx/sstream.h" #include "wx/html/htmlwin.h" -#include "bitmaps/sample.xpm" +#ifndef __WXMSW__ + #include "../sample.xpm" +#endif + #include "bitmaps/smiley.xpm" // #include "bitmaps/idea.xpm" #include "bitmaps/zebra.xpm" @@ -312,6 +315,20 @@ void MyApp::CreateStyles() m_styleSheet->AddParagraphStyle(indentedPara); + wxRichTextParagraphStyleDefinition* indentedPara2 = new wxRichTextParagraphStyleDefinition(wxT("Red Bold Indented")); + wxRichTextAttr indentedAttr2; + indentedAttr2.SetFontFaceName(romanFont.GetFaceName()); + indentedAttr2.SetFontSize(12); + indentedAttr2.SetFontWeight(wxBOLD); + indentedAttr2.SetTextColour(*wxRED); + indentedAttr2.SetFontSize(12); + indentedAttr2.SetLeftIndent(100, 0); + // We want to affect indentation, font and text colour + indentedAttr2.SetFlags(wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_FONT|wxTEXT_ATTR_TEXT_COLOUR); + indentedPara2->SetStyle(indentedAttr2); + + m_styleSheet->AddParagraphStyle(indentedPara2); + wxRichTextParagraphStyleDefinition* flIndentedPara = new wxRichTextParagraphStyleDefinition(wxT("First Line Indented")); wxRichTextAttr flIndentedAttr; flIndentedAttr.SetFontFaceName(swissFont.GetFaceName()); @@ -370,7 +387,7 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos, : wxFrame(NULL, id, title, pos, size, style) { // set the frame icon - SetIcon(sample_xpm); + SetIcon(wxICON(sample)); // create a menu bar wxMenu *fileMenu = new wxMenu; @@ -437,9 +454,15 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos, SetMenuBar(menuBar); // create a status bar just for fun (by default with 1 pane only) + // but don't create it on limited screen space (WinCE) + bool is_pda = wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA; + #if wxUSE_STATUSBAR - CreateStatusBar(2); - SetStatusText(_T("Welcome to wxRichTextCtrl!")); + if ( !is_pda ) + { + CreateStatusBar(2); + SetStatusText(_T("Welcome to wxRichTextCtrl!")); + } #endif wxToolBar* toolBar = CreateToolBar(); @@ -475,13 +498,22 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos, wxFont boldFont = wxFont(12, wxROMAN, wxNORMAL, wxBOLD); wxFont italicFont = wxFont(12, wxROMAN, wxITALIC, wxNORMAL); - m_richTextCtrl = new wxRichTextCtrl(splitter, wxID_ANY, wxDefaultPosition, wxSize(200, 200), wxVSCROLL|wxHSCROLL|wxNO_BORDER|wxWANTS_CHARS); + m_richTextCtrl = new wxRichTextCtrl(splitter, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200, 200), wxVSCROLL|wxHSCROLL|wxNO_BORDER|wxWANTS_CHARS); wxFont font(12, wxROMAN, wxNORMAL, wxNORMAL); m_richTextCtrl->SetFont(font); wxRichTextStyleListBox* styleListBox = new wxRichTextStyleListBox(splitter, wxID_ANY); - splitter->SplitVertically(m_richTextCtrl, styleListBox, 400); + + wxSize display = wxGetDisplaySize(); + if ( is_pda && ( display.GetWidth() < display.GetHeight() ) ) + { + splitter->SplitHorizontally(m_richTextCtrl, styleListBox); + } + else + { + splitter->SplitVertically(m_richTextCtrl, styleListBox, 400); + } splitter->UpdateSize(); @@ -609,7 +641,7 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos, attr.SetFlags(wxTEXT_ATTR_TABS); attr.SetTabs(tabs); r.SetDefaultStyle(attr); - + r.Newline(); r.WriteText(wxT("This line contains tabs:\tFirst tab\tSecond tab\tThird tab"));