X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ed7fdb860627d516ad32f9f01d14146012220b4a..b9efe021b554fa3967d1442cf758435c5cd5ae8f:/src/msw/tbar95.cpp diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index 539b71780e..49667ebabe 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -242,31 +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 ) { - // Testing for an active theme appears to be unnecessary (see comments in patch 1204217). - // Disabling the test brings back separator lines. - // However, the separators can look ugly and distracting, especially between controls, - // so I'm restoring the test and removing the separators again - JACS -#if 1 - wxUxThemeEngine *p = wxUxThemeEngine::Get(); - if ( !p || !p->IsThemeActive() ) -#endif - { - 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; } @@ -1246,14 +1235,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 ); }