X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/90c1530adf4014047991d04edf1f097808a88027..61aa560b2d217d4ae0a6d5c35c22317a3f65fe5d:/src/msw/tbar95.cpp diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index 758426c5a5..af6e2fae7f 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -94,9 +94,11 @@ #ifndef TBSTYLE_FLAT #define TBSTYLE_LIST 0x1000 #define TBSTYLE_FLAT 0x0800 +#endif + +#ifndef TBSTYLE_TRANSPARENT #define TBSTYLE_TRANSPARENT 0x8000 #endif - // use TBSTYLE_TRANSPARENT if you use TBSTYLE_FLAT // Messages #ifndef TB_GETSTYLE @@ -232,8 +234,17 @@ bool wxToolBar::Create(wxWindow *parent, if (style & wxTB_FLAT) { - if (wxTheApp->GetComCtl32Version() > 400) - msflags |= TBSTYLE_FLAT; + // static as it doesn't change during the program lifetime + static int s_verComCtl = wxTheApp->GetComCtl32Version(); + + // comctl32.dll 4.00 doesn't support the flat toolbars and using this + // style with 6.00 (part of Windows XP) leads to the toolbar with + // incorrect background colour - and not using it still results in the + // correct (flat) toolbar, so don't use it there + if ( s_verComCtl > 400 && s_verComCtl < 600 ) + { + msflags |= TBSTYLE_FLAT | TBSTYLE_TRANSPARENT; + } } // MSW-specific initialisation @@ -244,9 +255,7 @@ bool wxToolBar::Create(wxWindow *parent, ::SendMessage(GetHwnd(), TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); // set up the colors and fonts - wxRGBToColour(m_backgroundColour, GetSysColor(COLOR_BTNFACE)); - m_foregroundColour = *wxBLACK; - + SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR)); SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); // position it