]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed SetToolBar(NULL) behaviour -- don't leave a hole from toolbar
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 5 Jul 2002 13:20:54 +0000 (13:20 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 5 Jul 2002 13:20:54 +0000 (13:20 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16044 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/frame.cpp
src/gtk1/frame.cpp

index 1b4e646433b44a7c99818d330623a95b2fc13218..48b191aaa0963f3da30680438ad65be25e81d848 100644 (file)
@@ -605,9 +605,11 @@ wxToolBar* wxFrame::CreateToolBar( long style, wxWindowID id, const wxString& na
 
 void wxFrame::SetToolBar(wxToolBar *toolbar)
 {
+    bool hadTbar = m_frameToolBar != NULL;
+
     wxFrameBase::SetToolBar(toolbar);
 
-    if (m_frameToolBar)
+    if ( m_frameToolBar )
     {
         // insert into toolbar area if not already there
         if ((m_frameToolBar->m_widget->parent) &&
@@ -619,6 +621,14 @@ void wxFrame::SetToolBar(wxToolBar *toolbar)
             GtkUpdateSize();
         }
     }
+    else // toolbar unset
+    {
+        // still need to update size if it had been there before
+        if ( hadTbar )
+        {
+            GtkUpdateSize();
+        }
+    }
 }
 
 #endif // wxUSE_TOOLBAR
index 1b4e646433b44a7c99818d330623a95b2fc13218..48b191aaa0963f3da30680438ad65be25e81d848 100644 (file)
@@ -605,9 +605,11 @@ wxToolBar* wxFrame::CreateToolBar( long style, wxWindowID id, const wxString& na
 
 void wxFrame::SetToolBar(wxToolBar *toolbar)
 {
+    bool hadTbar = m_frameToolBar != NULL;
+
     wxFrameBase::SetToolBar(toolbar);
 
-    if (m_frameToolBar)
+    if ( m_frameToolBar )
     {
         // insert into toolbar area if not already there
         if ((m_frameToolBar->m_widget->parent) &&
@@ -619,6 +621,14 @@ void wxFrame::SetToolBar(wxToolBar *toolbar)
             GtkUpdateSize();
         }
     }
+    else // toolbar unset
+    {
+        // still need to update size if it had been there before
+        if ( hadTbar )
+        {
+            GtkUpdateSize();
+        }
+    }
 }
 
 #endif // wxUSE_TOOLBAR