+wxSize wxToolBar::DoGetBestSize() const
+{
+ wxSize sizeBest = GetToolSize();
+ sizeBest.x *= GetToolsCount();
+
+ // reverse horz and vertical components if necessary
+ return HasFlag(wxTB_VERTICAL) ? wxSize(sizeBest.y, sizeBest.x) : sizeBest;
+}
+
+WXDWORD wxToolBar::MSWGetStyle(long style, WXDWORD *exstyle) const
+{
+ // toolbars never have border, giving one to them results in broken
+ // appearance
+ WXDWORD msStyle = wxControl::MSWGetStyle
+ (
+ (style & ~wxBORDER_MASK) | wxBORDER_NONE, exstyle
+ );
+
+ // always include this one, it never hurts and setting it later only if we
+ // do have tooltips wouldn't work
+ msStyle |= TBSTYLE_TOOLTIPS;
+
+ if ( style & wxTB_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 )
+ {
+ msStyle |= TBSTYLE_FLAT | TBSTYLE_TRANSPARENT;
+ }
+ }
+
+ if ( style & wxTB_NODIVIDER )
+ msStyle |= CCS_NODIVIDER;
+
+ if ( style & wxTB_NOALIGN )
+ msStyle |= CCS_NOPARENTALIGN;
+
+ return msStyle;
+}
+