X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ec184e324214ea06f0c056ab626de5f32bcdad3b..c6aabd1ca9a5590d5dd8e89d83a5fba74c69c931:/samples/widgets/searchctrl.cpp diff --git a/samples/widgets/searchctrl.cpp b/samples/widgets/searchctrl.cpp index 80a95995c8..4031dbd51f 100644 --- a/samples/widgets/searchctrl.cpp +++ b/samples/widgets/searchctrl.cpp @@ -72,6 +72,7 @@ public: virtual ~SearchCtrlWidgetsPage(){}; virtual wxControl *GetWidget() const { return m_srchCtrl; } + virtual wxTextEntryBase *GetTextEntry() const { return m_srchCtrl; } virtual void RecreateWidget() { CreateControl(); } // lazy creation of the content @@ -83,6 +84,8 @@ protected: void OnToggleCancelButton(wxCommandEvent&); void OnToggleSearchMenu(wxCommandEvent&); + void OnSearch(wxCommandEvent& event); + wxMenu* CreateTestMenu(); // (re)create the control @@ -110,6 +113,8 @@ BEGIN_EVENT_TABLE(SearchCtrlWidgetsPage, WidgetsPage) EVT_CHECKBOX(ID_SEARCH_CB, SearchCtrlWidgetsPage::OnToggleSearchButton) EVT_CHECKBOX(ID_CANCEL_CB, SearchCtrlWidgetsPage::OnToggleCancelButton) EVT_CHECKBOX(ID_MENU_CB, SearchCtrlWidgetsPage::OnToggleSearchMenu) + + EVT_SEARCHCTRL_SEARCH_BTN(wxID_ANY, SearchCtrlWidgetsPage::OnSearch) END_EVENT_TABLE() // ============================================================================ @@ -122,7 +127,7 @@ END_EVENT_TABLE() #define FAMILY_CTRLS GENERIC_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(SearchCtrlWidgetsPage, _T("SearchCtrl"), +IMPLEMENT_WIDGETS_PAGE(SearchCtrlWidgetsPage, wxT("SearchCtrl"), FAMILY_CTRLS | EDITABLE_CTRLS | ALL_CTRLS); SearchCtrlWidgetsPage::SearchCtrlWidgetsPage(WidgetsBookCtrl *book, @@ -180,7 +185,7 @@ wxMenu* SearchCtrlWidgetsPage::CreateTestMenu() { wxMenu* menu = new wxMenu; const int SEARCH_MENU_SIZE = 5; - wxMenuItem* menuItem = menu->Append(wxID_ANY, _T("Recent Searches"), wxT(""), wxITEM_NORMAL); + wxMenuItem* menuItem = menu->Append(wxID_ANY, wxT("Recent Searches"), wxT(""), wxITEM_NORMAL); menuItem->Enable(false); for ( int i = 0; i < SEARCH_MENU_SIZE; i++ ) { @@ -221,5 +226,9 @@ void SearchCtrlWidgetsPage::OnToggleSearchMenu(wxCommandEvent&) m_srchCtrl->SetMenu(NULL); } +void SearchCtrlWidgetsPage::OnSearch(wxCommandEvent& event) +{ + wxLogMessage("Search button: search for \"%s\".", event.GetString()); +} #endif // wxUSE_SEARCHCTRL