virtual void OnSearchButton( wxCommandEvent& event );
void OnSetFocus( wxFocusEvent& event );
-
+ void OnSize( wxSizeEvent& event );
+
private:
friend class wxSearchButton;
BEGIN_EVENT_TABLE(wxSearchCtrl, wxSearchCtrlBase)
EVT_SEARCHCTRL_SEARCH_BTN(wxID_ANY, wxSearchCtrl::OnSearchButton)
EVT_SET_FOCUS(wxSearchCtrl::OnSetFocus)
+ EVT_SIZE(wxSearchCtrl::OnSize)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxSearchCtrl, wxSearchCtrlBase)
void wxSearchCtrl::LayoutControls(int x, int y, int width, int height)
{
+ if ( !m_text )
+ return;
+
wxSize sizeText = m_text->GetBestSize();
// make room for the search menu & clear button
int horizontalBorder = 1 + ( sizeText.y - sizeText.y * 14 / 21 ) / 2;
}
}
+void wxSearchCtrl::OnSize( wxSizeEvent& event )
+{
+ int width, height;
+ GetSize(&width, &height);
+ LayoutControls(0, 0, width, height);
+}
+
void wxSearchCtrl::PopupSearchMenu()
{
if ( m_menu )