Also do LayoutControls from EVT_SIZE handler
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43945 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -212,7 +212,8 @@ protected:
|
|||||||
virtual void OnSearchButton( wxCommandEvent& event );
|
virtual void OnSearchButton( wxCommandEvent& event );
|
||||||
|
|
||||||
void OnSetFocus( wxFocusEvent& event );
|
void OnSetFocus( wxFocusEvent& event );
|
||||||
|
void OnSize( wxSizeEvent& event );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class wxSearchButton;
|
friend class wxSearchButton;
|
||||||
|
|
||||||
|
@@ -167,6 +167,7 @@ END_EVENT_TABLE()
|
|||||||
BEGIN_EVENT_TABLE(wxSearchCtrl, wxSearchCtrlBase)
|
BEGIN_EVENT_TABLE(wxSearchCtrl, wxSearchCtrlBase)
|
||||||
EVT_SEARCHCTRL_SEARCH_BTN(wxID_ANY, wxSearchCtrl::OnSearchButton)
|
EVT_SEARCHCTRL_SEARCH_BTN(wxID_ANY, wxSearchCtrl::OnSearchButton)
|
||||||
EVT_SET_FOCUS(wxSearchCtrl::OnSetFocus)
|
EVT_SET_FOCUS(wxSearchCtrl::OnSetFocus)
|
||||||
|
EVT_SIZE(wxSearchCtrl::OnSize)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxSearchCtrl, wxSearchCtrlBase)
|
IMPLEMENT_DYNAMIC_CLASS(wxSearchCtrl, wxSearchCtrlBase)
|
||||||
@@ -383,6 +384,9 @@ void wxSearchCtrl::DoMoveWindow(int x, int y, int width, int height)
|
|||||||
|
|
||||||
void wxSearchCtrl::LayoutControls(int x, int y, int width, int height)
|
void wxSearchCtrl::LayoutControls(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
|
if ( !m_text )
|
||||||
|
return;
|
||||||
|
|
||||||
wxSize sizeText = m_text->GetBestSize();
|
wxSize sizeText = m_text->GetBestSize();
|
||||||
// make room for the search menu & clear button
|
// make room for the search menu & clear button
|
||||||
int horizontalBorder = 1 + ( sizeText.y - sizeText.y * 14 / 21 ) / 2;
|
int horizontalBorder = 1 + ( sizeText.y - sizeText.y * 14 / 21 ) / 2;
|
||||||
@@ -1054,6 +1058,13 @@ void wxSearchCtrl::OnSetFocus( wxFocusEvent& /*event*/ )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxSearchCtrl::OnSize( wxSizeEvent& event )
|
||||||
|
{
|
||||||
|
int width, height;
|
||||||
|
GetSize(&width, &height);
|
||||||
|
LayoutControls(0, 0, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
void wxSearchCtrl::PopupSearchMenu()
|
void wxSearchCtrl::PopupSearchMenu()
|
||||||
{
|
{
|
||||||
if ( m_menu )
|
if ( m_menu )
|
||||||
|
Reference in New Issue
Block a user