]> git.saurik.com Git - wxWidgets.git/commitdiff
Only update the size if the parent is a frame and the frame is
authorRobin Dunn <robin@alldunn.com>
Fri, 13 Jan 2006 23:21:57 +0000 (23:21 +0000)
committerRobin Dunn <robin@alldunn.com>
Fri, 13 Jan 2006 23:21:57 +0000 (23:21 +0000)
managing the size of this toolbar, otherwise assume that something
else (like a sizer) is managing the layout of this toolbar and leave
it alone.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36866 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/tbar95.cpp

index f98b8c45d6151ab92bc55523be477dff373ee68b..1b69f1db05b3ac85a5093ca42d09c32dc05080df 100644 (file)
@@ -1231,13 +1231,19 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
 
 void wxToolBar::UpdateSize()
 {
-    // the toolbar size changed
-    ::SendMessage(GetHwnd(), TB_AUTOSIZE, 0, 0);
+    // In case Realize is called after the initial display (IOW the programmer
+    // may have rebuilt the toolbar) give the frame the option of resizing the
+    // toolbar to full width again, but only if the parent is a frame and the
+    // toolbar is managed by the frame.  Otherwise assume that some other
+    // layout mechanism is controlling the toolbar size and leave it alone.
 
-    // we must also refresh the frame after the toolbar size (possibly) changed
     wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
-    if ( frame )
+    if ( frame && frame->GetToolBar() == this )
+    {
+        // the toolbar size changed
+        ::SendMessage(GetHwnd(), TB_AUTOSIZE, 0, 0);
         frame->SendSizeEvent();
+    }
 }
 
 // ----------------------------------------------------------------------------