#include "wx/toolbar.h"
#ifndef WX_PRECOMP
+ #include "wx/msw/wrapcctl.h" // include <commctrl.h> "properly"
#include "wx/dynarray.h"
#include "wx/frame.h"
#include "wx/log.h"
#include "wx/dcmemory.h"
#include "wx/control.h"
#include "wx/app.h" // for GetComCtl32Version
+ #include "wx/image.h"
#endif
#include "wx/sysopt.h"
-#include "wx/image.h"
#include "wx/msw/private.h"
#include "wx/msw/uxtheme.h"
#endif
-// include <commctrl.h> "properly"
-#include "wx/msw/wrapcctl.h"
-
// this define controls whether the code for button colours remapping (only
// useful for 16 or 256 colour images) is active at all, it's always turned off
// for CE where it doesn't compile (and is probably not needed anyhow) and may
DECLARE_NO_COPY_CLASS(wxToolBarTool)
};
-
// ============================================================================
// implementation
// ============================================================================
#if wxUSE_UXTHEME
if ( style & wxTB_FLAT )
{
- LRESULT style = ::SendMessage(GetHwnd(), TB_GETSTYLE, 0, 0L);
+ LRESULT style = GetMSWToolbarStyle();
if ( !(style & TBSTYLE_FLAT) )
::SendMessage(GetHwnd(), TB_SETSTYLE, 0, style | TBSTYLE_FLAT);
if ( style & (wxTB_FLAT | wxTB_HORZ_LAYOUT) )
{
// static as it doesn't change during the program lifetime
- static int s_verComCtl = wxApp::GetComCtl32Version();
+ static const int s_verComCtl = wxApp::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
if ( style & wxTB_VERTICAL )
msStyle |= CCS_VERT;
+ if( style & wxTB_BOTTOM )
+ msStyle |= CCS_BOTTOM;
+
return msStyle;
}
// toolbar styles
// ---------------------------------------------------------------------------
+// get the TBSTYLE of the given toolbar window
+long wxToolBar::GetMSWToolbarStyle() const
+{
+ return ::SendMessage(GetHwnd(), TB_GETSTYLE, 0, 0L);
+}
+
void wxToolBar::SetWindowStyleFlag(long style)
{
// the style bits whose changes force us to recreate the toolbar
RECT rect = wxGetClientRect(GetHwnd());
HDC hdc = GetHdcOf((*event.GetDC()));
- if ( UseBgCol() )
+#if wxUSE_UXTHEME
+ // we may need to draw themed colour so that we appear correctly on
+ // e.g. notebook page under XP with themes but only do it if the parent
+ // draws themed background itself
+ if ( !UseBgCol() && !GetParent()->UseBgCol() )
+ {
+ wxUxThemeEngine *theme = wxUxThemeEngine::GetIfActive();
+ if ( theme )
+ {
+ HRESULT
+ hr = theme->DrawThemeParentBackground(GetHwnd(), hdc, &rect);
+ if ( hr == S_OK )
+ return;
+
+ // it can also return S_FALSE which seems to simply say that it
+ // didn't draw anything but no error really occurred
+ if ( FAILED(hr) )
+ wxLogApiError(_T("DrawThemeParentBackground(toolbar)"), hr);
+ }
+ }
+#endif // wxUSE_UXTHEME
+
+ if ( UseBgCol() || (GetMSWToolbarStyle() & TBSTYLE_TRANSPARENT) )
{
// do draw our background
//
}
else // we have no non default background colour
{
-#if wxUSE_UXTHEME
- // we may need to draw themed colour so that we appear correctly on
- // e.g. notebook page under XP with themes but only do it if the parent
- // draws themed background itself
- if ( !GetParent()->UseBgCol() )
- {
- wxUxThemeEngine *theme = wxUxThemeEngine::GetIfActive();
- if ( theme )
- {
- HRESULT
- hr = theme->DrawThemeParentBackground(GetHwnd(), hdc, &rect);
- if ( hr == S_OK )
- return;
-
- // it can also return S_FALSE which seems to simply say that it
- // didn't draw anything but no error really occurred
- if ( FAILED(hr) )
- wxLogApiError(_T("DrawThemeParentBackground(toolbar)"), hr);
- }
- }
-#endif // wxUSE_UXTHEME
-
+ // let the system do it for us
event.Skip();
- return;
}
}