X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/15cdc3414964bf024625c67497b2cd5db8934908..a0ef88bde8e4e0b9f6268b9b0001eb6b6beca708:/samples/widgets/textctrl.cpp diff --git a/samples/widgets/textctrl.cpp b/samples/widgets/textctrl.cpp index e9282d977f..0d2e8e293c 100644 --- a/samples/widgets/textctrl.cpp +++ b/samples/widgets/textctrl.cpp @@ -53,7 +53,7 @@ // control ids enum { - TextPage_Reset = 100, + TextPage_Reset = wxID_HIGHEST, TextPage_Set, TextPage_Add, @@ -132,10 +132,14 @@ class TextWidgetsPage : public WidgetsPage { public: // ctor(s) and dtor - TextWidgetsPage(wxBookCtrl *book, wxImageList *imaglist); + TextWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); virtual ~TextWidgetsPage(){}; virtual wxControl *GetWidget() const { return m_text; } + virtual void RecreateWidget() { CreateText(); } + + // lazy creation of the content + virtual void CreateContent(); protected: // create an info text contorl @@ -328,17 +332,25 @@ END_EVENT_TABLE() // implementation // ============================================================================ -IMPLEMENT_WIDGETS_PAGE(TextWidgetsPage, _T("Text")); +#if defined(__WXX11__) + #define FAMILY_CTRLS NATIVE_CTRLS +#elif defined(__WXUNIVERSAL__) + #define FAMILY_CTRLS UNIVERSAL_CTRLS +#else + #define FAMILY_CTRLS NATIVE_CTRLS +#endif + +IMPLEMENT_WIDGETS_PAGE(TextWidgetsPage, _T("Text"), + FAMILY_CTRLS | EDITABLE_CTRLS + ); // ---------------------------------------------------------------------------- // TextWidgetsPage creation // ---------------------------------------------------------------------------- -TextWidgetsPage::TextWidgetsPage(wxBookCtrl *book, wxImageList *imaglist) - : WidgetsPage(book) +TextWidgetsPage::TextWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) + : WidgetsPage(book, imaglist, text_xpm) { - imaglist->Add(wxBitmap(text_xpm)); - // init everything #ifdef __WXMSW__ m_radioKind = @@ -365,7 +377,10 @@ TextWidgetsPage::TextWidgetsPage(wxBookCtrl *book, wxImageList *imaglist) m_posLast = m_selFrom = m_selTo = -2; // not -1 which means "no selection" +} +void TextWidgetsPage::CreateContent() +{ // left pane static const wxString modes[] = { @@ -599,7 +614,7 @@ void TextWidgetsPage::Reset() void TextWidgetsPage::CreateText() { - int flags = 0; + int flags = ms_defaultFlags; switch ( m_radioTextLines->GetSelection() ) { default: @@ -633,7 +648,7 @@ void TextWidgetsPage::CreateText() break; case WrapStyle_Char: - flags |= wxTE_LINEWRAP; + flags |= wxTE_CHARWRAP; break; case WrapStyle_Best: @@ -891,7 +906,7 @@ void TextWidgetsPage::OnStreamRedirector(wxCommandEvent& WXUNUSED(event)) #if wxHAS_TEXT_WINDOW_STREAM wxStreamToTextRedirector redirect(m_text); wxString str( _T("Outputed to cout, appears in wxTextCtrl!") ); - cout << str << endl; + wxSTD cout << str << wxSTD endl; #else wxMessageBox(_T("This wxWidgets build does not support wxStreamToTextRedirector")); #endif