X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/92c01615ecb4afeb325e5148554b443fed830534..840a5948c7023a650b3b8427991654e12c3427c1:/samples/text/text.cpp diff --git a/samples/text/text.cpp b/samples/text/text.cpp index 40a25e533f..48a1106ce0 100644 --- a/samples/text/text.cpp +++ b/samples/text/text.cpp @@ -45,6 +45,10 @@ #include "wx/numdlg.h" #include "wx/tokenzr.h" +#ifndef __WXMSW__ + #include "../sample.xpm" +#endif + //---------------------------------------------------------------------- // class definitions //---------------------------------------------------------------------- @@ -194,6 +198,12 @@ public: } #endif // wxUSE_CLIPBOARD + void OnAddTextLine(wxCommandEvent& WXUNUSED(event)) + { + static int s_n = 0; + m_panel->m_textrich->AppendText(wxString::Format("Line %d\n", ++s_n)); + } + void OnAddTextFreeze( wxCommandEvent& WXUNUSED(event) ) { DoAddText(true); } void OnAddText( wxCommandEvent& WXUNUSED(event) ) @@ -395,6 +405,7 @@ enum // text menu TEXT_ADD_SOME = 400, TEXT_ADD_FREEZE, + TEXT_ADD_LINE, TEXT_MOVE_ENDTEXT, TEXT_MOVE_ENDENTRY, TEXT_SET_EDITABLE, @@ -476,6 +487,7 @@ bool MyApp::OnInit() wxMenu *menuText = new wxMenu; menuText->Append(TEXT_ADD_SOME, _T("&Append some text\tCtrl-A")); menuText->Append(TEXT_ADD_FREEZE, _T("&Append text with freeze/thaw\tShift-Ctrl-A")); + menuText->Append(TEXT_ADD_LINE, _T("Append a new &line\tAlt-Shift-A")); menuText->Append(TEXT_REMOVE, _T("&Remove first 10 characters\tCtrl-Y")); menuText->Append(TEXT_REPLACE, _T("&Replace characters 4 to 8 with ABC\tCtrl-R")); menuText->Append(TEXT_SELECT, _T("&Select characters 4 to 8\tCtrl-I")); @@ -1080,7 +1092,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) (*m_multitext) << _T(" Appended."); m_multitext->SetInsertionPoint(0); m_multitext->WriteText( _T("Prepended. ") ); - m_multitext->SetForegroundColour(*wxRED); + m_multitext->SetForegroundColour(*wxYELLOW); m_multitext->SetBackgroundColour(*wxLIGHT_GREY); #if wxUSE_TOOLTIPS @@ -1337,6 +1349,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(TEXT_SELECT, MyFrame::OnSelectText) EVT_MENU(TEXT_ADD_SOME, MyFrame::OnAddText) EVT_MENU(TEXT_ADD_FREEZE, MyFrame::OnAddTextFreeze) + EVT_MENU(TEXT_ADD_LINE, MyFrame::OnAddTextLine) EVT_MENU(TEXT_MOVE_ENDTEXT, MyFrame::OnMoveToEndOfText) EVT_MENU(TEXT_MOVE_ENDENTRY, MyFrame::OnMoveToEndOfEntry) @@ -1360,6 +1373,8 @@ END_EVENT_TABLE() MyFrame::MyFrame(wxFrame *frame, const wxChar *title, int x, int y, int w, int h) : wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h) ) { + SetIcon(wxICON(sample)); + #if wxUSE_STATUSBAR CreateStatusBar(2); #endif // wxUSE_STATUSBAR