always send TB_AUTOSIZE in UpdateSize(), even if we're not attached to a frame

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37367 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-02-07 00:39:17 +00:00
parent d141b21808
commit 93489fc8f1

View File

@@ -1230,17 +1230,16 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
void wxToolBar::UpdateSize() void wxToolBar::UpdateSize()
{ {
::SendMessage(GetHwnd(), TB_AUTOSIZE, 0, 0);
// In case Realize is called after the initial display (IOW the programmer // 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 // 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 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 // toolbar is managed by the frame. Otherwise assume that some other
// layout mechanism is controlling the toolbar size and leave it alone. // layout mechanism is controlling the toolbar size and leave it alone.
wxFrame *frame = wxDynamicCast(GetParent(), wxFrame); wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
if ( frame && frame->GetToolBar() == this ) if ( frame && frame->GetToolBar() == this )
{ {
// the toolbar size changed
::SendMessage(GetHwnd(), TB_AUTOSIZE, 0, 0);
frame->SendSizeEvent(); frame->SendSizeEvent();
} }
} }