X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/97071cdbffd14256c3ea75256f95e8e82757cddc..233387bdcbb1c4f31c54b0fe6b3f03e8d261cab1:/src/msw/tbar95.cpp diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index d091e383e1..04141cf01f 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -315,7 +315,6 @@ void wxToolBar::Recreate() } Realize(); - UpdateSize(); } wxToolBar::~wxToolBar() @@ -544,8 +543,9 @@ bool wxToolBar::Realize() #ifndef __WXWINCE__ int remapValue = (-1); - if (wxSystemOptions::HasOption(wxT("msw.remap"))) - remapValue = wxSystemOptions::GetOptionInt(wxT("msw.remap")); + const wxChar *remapOptionStr = wxT("msw.remap"); + if (wxSystemOptions::HasOption( remapOptionStr )) + remapValue = wxSystemOptions::GetOptionInt( remapOptionStr ); doTransparent = (remapValue == 2); if (!doTransparent) @@ -590,7 +590,7 @@ bool wxToolBar::Realize() wx_truncate_cast(wxCoord, nTools), totalBitmapHeight = m_defaultHeight; - // Create a bitmap and copy all the tool bitmaps to it + // Create a bitmap and copy all the tool bitmaps into it wxMemoryDC dcAllButtons; wxBitmap bitmap(totalBitmapWidth, totalBitmapHeight); dcAllButtons.SelectObject(bitmap); @@ -656,7 +656,7 @@ bool wxToolBar::Realize() if ( m_disabledImgList ) { wxBitmap bmpDisabled = tool->GetDisabledBitmap(); -#if wxUSE_IMAGE +#if wxUSE_IMAGE && wxUSE_WXDIB if ( !bmpDisabled.Ok() ) { // no disabled bitmap specified but we still need to @@ -1050,6 +1050,7 @@ bool wxToolBar::Realize() InvalidateBestSize(); SetBestFittingSize(); + UpdateSize(); return true; } @@ -1230,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(); + } } // ----------------------------------------------------------------------------