X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/730d336601a3ece761b56e7c05d1099352670a25..bf354396f61a2e1bd5544b67ecde341b6ff9bf35:/src/msw/tbar95.cpp diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index 7ea83bd343..772c459e3a 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -93,9 +93,6 @@ // these values correspond to those used by comctl32.dll #define DEFAULTBITMAPX 16 #define DEFAULTBITMAPY 15 -#define DEFAULTBUTTONX 24 -#define DEFAULTBUTTONY 24 -#define DEFAULTBARHEIGHT 27 // ---------------------------------------------------------------------------- // wxWin macros @@ -245,25 +242,20 @@ bool wxToolBar::Create(wxWindow *parent, SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); - // workaround for flat toolbar on Windows XP classic style + // workaround for flat toolbar on Windows XP classic style: we have to set + // the style after creating the control, doing it at creation time doesn't + // work #if wxUSE_UXTHEME if ( style & wxTB_FLAT ) { - wxUxThemeEngine *p = wxUxThemeEngine::Get(); - if ( !p || !p->IsThemeActive() ) - { - DWORD dwToolbarStyle; - - dwToolbarStyle = (DWORD)::SendMessage(GetHwnd(), TB_GETSTYLE, 0, 0L ); + LRESULT style = ::SendMessage(GetHwnd(), TB_GETSTYLE, 0, 0L); - if ((dwToolbarStyle & TBSTYLE_FLAT) == 0) - { - dwToolbarStyle |= TBSTYLE_FLAT; - ::SendMessage(GetHwnd(), TB_SETSTYLE, 0, (LPARAM)dwToolbarStyle ); - } + if ( !(style & TBSTYLE_FLAT) ) + { + ::SendMessage(GetHwnd(), TB_SETSTYLE, 0, style | TBSTYLE_FLAT); } } -#endif +#endif // wxUSE_UXTHEME return true; } @@ -378,6 +370,7 @@ wxSize wxToolBar::DoGetBestSize() const sizeBest.y = size.cy; } + CacheBestSize(sizeBest); return sizeBest; } @@ -890,7 +883,7 @@ bool wxToolBar::Realize() wxToolBarToolBase *tool = nodePrev->GetData(); if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO ) break; - + if ( tool->Toggle(false) ) { DoToggleTool(tool, false); @@ -898,7 +891,7 @@ bool wxToolBar::Realize() prevButton.fsState = TBSTATE_ENABLED; nodePrev = nodePrev->GetPrevious(); prevIndex--; - } + } } isRadio = true; @@ -1078,6 +1071,8 @@ bool wxToolBar::Realize() } InvalidateBestSize(); + SetBestFittingSize(); + return true; } @@ -1242,14 +1237,15 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const return (wxToolBarToolBase *)NULL; } - // if comctl32 version < 4.71 wxToolBar95 adds dummy spacers -#if defined(_WIN32_IE) && (_WIN32_IE >= 0x400 ) + // when TB_SETBUTTONINFO is available (both during compile- and run-time), + // we don't use the dummy separators hack +#ifdef TB_SETBUTTONINFO if ( wxApp::GetComCtl32Version() >= 471 ) { return m_tools.Item((size_t)index)->GetData(); } else -#endif +#endif // TB_SETBUTTONINFO { return GetItemSkippingDummySpacers( m_tools, (size_t) index ); }