+ if (IsVertical())
+ {
+ xMin = heightTool + 2*m_xMargin;
+ yMin = widthTool + 2*m_xMargin;
+ }
+ else
+ {
+ xMin = maxWidthTool + 2*m_xMargin;
+ yMin = heightTool + 2*m_xMargin;
+ }
+ }
+
+ m_maxWidth = x < xMin ? xMin : x;
+ m_maxHeight = y < yMin ? yMin : y;
+}
+
+wxSize wxToolBar::DoGetBestClientSize() const
+{
+ return wxSize(m_maxWidth, m_maxHeight);
+}
+
+void wxToolBar::DoSetSize(int x, int y, int width, int height, int sizeFlags)
+{
+ int old_width, old_height;
+ GetSize(&old_width, &old_height);
+
+ wxToolBarBase::DoSetSize(x, y, width, height, sizeFlags);
+
+ // Correct width and height if needed.
+ if ( width == wxDefaultCoord || height == wxDefaultCoord )
+ {
+ int tmp_width, tmp_height;
+ GetSize(&tmp_width, &tmp_height);
+
+ if ( width == wxDefaultCoord )
+ width = tmp_width;
+ if ( height == wxDefaultCoord )
+ height = tmp_height;
+ }
+
+ // We must refresh the frame size when the toolbar changes size
+ // otherwise the toolbar can be shown incorrectly
+ if ( old_width != width || old_height != height )
+ {
+ SendSizeEventToParent();
+ }
+}
+
+// ----------------------------------------------------------------------------
+// wxToolBar drawing
+// ----------------------------------------------------------------------------
+
+void wxToolBar::RefreshTool(wxToolBarToolBase *tool)
+{
+ RefreshRect(GetToolRect(tool));
+}
+
+void wxToolBar::GetRectLimits(const wxRect& rect,
+ wxCoord *start,
+ wxCoord *end) const
+{
+ wxCHECK_RET( start && end, wxT("NULL pointer in GetRectLimits") );
+
+ if ( IsVertical() )
+ {
+ *start = rect.GetTop();
+ *end = rect.GetBottom();
+ }
+ else // horizontal
+ {
+ *start = rect.GetLeft();
+ *end = rect.GetRight();
+ }
+}
+
+void wxToolBar::DoDraw(wxControlRenderer *renderer)
+{
+ // prepare the variables used below
+ wxDC& dc = renderer->GetDC();
+ wxRenderer *rend = renderer->GetRenderer();
+ dc.SetFont(GetFont());
+
+ // draw the border separating us from the menubar (if there is no menubar
+ // we probably shouldn't draw it?)
+ if ( !IsVertical() )
+ {
+ rend->DrawHorizontalLine(dc, 0, 0, GetClientSize().x);