]> git.saurik.com Git - wxWidgets.git/commitdiff
Also do LayoutControls from EVT_SIZE handler
authorRobin Dunn <robin@alldunn.com>
Tue, 12 Dec 2006 00:53:52 +0000 (00:53 +0000)
committerRobin Dunn <robin@alldunn.com>
Tue, 12 Dec 2006 00:53:52 +0000 (00:53 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43945 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/generic/srchctlg.h
src/generic/srchctlg.cpp

index 84daadaa38cad42118b4cef15658de6310206433..690048098da9483b5ea4117238bc037b94139670 100644 (file)
@@ -212,7 +212,8 @@ protected:
     virtual void OnSearchButton( wxCommandEvent& event );
 
     void OnSetFocus( wxFocusEvent& event );
-
+    void OnSize( wxSizeEvent& event );
+    
 private:
     friend class wxSearchButton;
 
index 0db594490afa690c4ff67f7049a7f1bac7b7be95..e8059422e69c36d9d7b5e63aef239658d558bba1 100644 (file)
@@ -167,6 +167,7 @@ END_EVENT_TABLE()
 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)
@@ -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)
 {
+    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;
@@ -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()
 {
     if ( m_menu )