From f6becba596c63de98a5814baf000684bc96a404a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 9 Jun 2005 20:18:29 +0000 Subject: [PATCH] always set flat toolbar style, even under XP with themes: this is necessary or separators aren't shown at all git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34618 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/msw/tbar95.cpp | 27 ++++++++------------------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index d3ab3fa349..f3fd869472 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -57,6 +57,7 @@ wxMSW: - Fixed ownerdrawn multiline buttons. - wxCheckListBox item background fixed. - Fixed some wxRegKey bugs. +- Separators are now correctly shown in the toolbars under Windows XP wxWinCE: diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index 86713a211b..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; + LRESULT style = ::SendMessage(GetHwnd(), TB_GETSTYLE, 0, 0L); - dwToolbarStyle = (DWORD)::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; } -- 2.47.2