// Author: Robin Dunn
// Created: 9-Dec-2006
// Id: $Id$
-// Copyright: (c) 2006
-// License: wxWindows license
+// Copyright: (c) 2006
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
virtual wxControl *GetWidget() const { return m_srchCtrl; }
virtual wxTextEntryBase *GetTextEntry() const { return m_srchCtrl; }
- virtual void RecreateWidget() { CreateControl(); }
+ virtual void RecreateWidget();
// lazy creation of the content
virtual void CreateContent();
void OnToggleCancelButton(wxCommandEvent&);
void OnToggleSearchMenu(wxCommandEvent&);
+ void OnSearch(wxCommandEvent& event);
+
wxMenu* CreateTestMenu();
-
+
// (re)create the control
void CreateControl();
- // reset the control parameters
- void Reset();
-
-
+
wxSearchCtrl* m_srchCtrl;
wxCheckBox* m_searchBtnCheck;
wxCheckBox* m_cancelBtnCheck;
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()
// ============================================================================
{
m_srchCtrl = NULL;
- Reset();
CreateControl();
m_menuBtnCheck = new wxCheckBox(this, ID_MENU_CB, wxT("Search menu"));
m_searchBtnCheck->SetValue(true);
-
+
box->Add(m_searchBtnCheck, 0, wxALL, 5);
box->Add(m_cancelBtnCheck, 0, wxALL, 5);
box->Add(m_menuBtnCheck, 0, wxALL, 5);
m_srchCtrl->Destroy();
int style = 0;
-
+
m_srchCtrl = new wxSearchCtrl(this, -1, wxEmptyString, wxDefaultPosition,
wxSize(150, -1), style);
}
-void SearchCtrlWidgetsPage::Reset()
-{
-}
+void SearchCtrlWidgetsPage::RecreateWidget()
+{
+ CreateControl();
+ GetSizer()->Add(m_srchCtrl, wxSizerFlags().Centre().TripleBorder());
+
+ Layout();
+}
wxMenu* SearchCtrlWidgetsPage::CreateTestMenu()
{
wxString tipText = wxString::Format(wxT("tip %i"),i);
menu->Append(ID_SEARCHMENU+i, itemText, tipText, wxITEM_NORMAL);
}
-// target->Connect(
+// target->Connect(
// ID_SEARCHMENU,
// ID_SEARCHMENU+SEARCH_MENU_SIZE,
// wxEVT_COMMAND_MENU_SELECTED,
void SearchCtrlWidgetsPage::OnToggleCancelButton(wxCommandEvent&)
{
m_srchCtrl->ShowCancelButton( m_cancelBtnCheck->GetValue() );
-
+
}
void SearchCtrlWidgetsPage::OnToggleSearchMenu(wxCommandEvent&)
m_srchCtrl->SetMenu(NULL);
}
+void SearchCtrlWidgetsPage::OnSearch(wxCommandEvent& event)
+{
+ wxLogMessage("Search button: search for \"%s\".", event.GetString());
+}
#endif // wxUSE_SEARCHCTRL