]> git.saurik.com Git - wxWidgets.git/commitdiff
move generic part of AdjustSize() and status bar methods to the base class
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 20 Sep 2006 17:24:29 +0000 (17:24 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 20 Sep 2006 17:24:29 +0000 (17:24 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41328 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/univ/stdrend.h
src/univ/stdrend.cpp
src/univ/themes/gtk.cpp
src/univ/themes/win32.cpp

index 9acd6e31bf33f141834244372f8b2a252d79177d..a78452202ea2cae8c5fa2351431d4441736aa9d8 100644 (file)
@@ -132,6 +132,10 @@ public:
 
     virtual bool AreScrollbarsInsideBorder() const;
 
+    virtual void AdjustSize(wxSize *size, const wxWindow *window);
+
+    virtual wxCoord GetListboxItemHeight(wxCoord fontHeight);
+
 #if wxUSE_SCROLLBAR
     virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
                                     wxScrollBar::Element elem,
@@ -147,6 +151,17 @@ public:
     virtual int PixelToScrollbar(const wxScrollBar *scrollbar, wxCoord coord);
 #endif // wxUSE_SCROLLBAR
 
+#if wxUSE_STATUSBAR
+    virtual void DrawStatusField(wxDC& dc,
+                                 const wxRect& rect,
+                                 const wxString& label,
+                                 int flags = 0, int style = 0);
+
+    virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const;
+#endif // wxUSE_STATUSBAR
+
+    virtual wxCoord GetCheckItemMargin() const { return 0; }
+
 protected:
     // various constants
     enum ArrowDirection
index 14e2395353e109cf50e4e6e23dfeab07993fc4e0..488231c4733103d0600161974dd52a9eb476497d 100644 (file)
@@ -441,11 +441,24 @@ wxRect wxStdRenderer::GetBorderDimensions(wxBorder border) const
     return rect;
 }
 
+void wxStdRenderer::AdjustSize(wxSize *size, const wxWindow *window)
+{
+    // take into account the border width
+    wxRect rectBorder = GetBorderDimensions(window->GetBorder());
+    size->x += rectBorder.x + rectBorder.width;
+    size->y += rectBorder.y + rectBorder.height;
+}
+
 bool wxStdRenderer::AreScrollbarsInsideBorder() const
 {
     return false;
 }
 
+wxCoord wxStdRenderer::GetListboxItemHeight(wxCoord fontHeight)
+{
+    return fontHeight + 2;
+}
+
 void wxStdRenderer::DrawTextBorder(wxDC& dc,
                                    wxBorder border,
                                    const wxRect& rect,
@@ -1047,3 +1060,37 @@ int wxStdRenderer::PixelToScrollbar(const wxScrollBar *scrollbar, wxCoord coord)
 
 #endif // wxUSE_SCROLLBAR
 
+// ----------------------------------------------------------------------------
+// status bar
+// ----------------------------------------------------------------------------
+
+#if wxUSE_STATUSBAR
+
+wxSize wxStdRenderer::GetStatusBarBorders(wxCoord *borderBetweenFields) const
+{
+    if ( borderBetweenFields )
+        *borderBetweenFields = 2;
+
+    return wxSize(2, 2);
+}
+
+void wxStdRenderer::DrawStatusField(wxDC& dc,
+                                    const wxRect& rect,
+                                    const wxString& label,
+                                    int flags,
+                                    int style)
+{
+    wxRect rectIn;
+
+    if ( style == wxSB_RAISED )
+        DrawBorder(dc, wxBORDER_RAISED, rect, flags, &rectIn);
+    else if ( style != wxSB_FLAT )
+        DrawBorder(dc, wxBORDER_STATIC, rect, flags, &rectIn);
+
+    rectIn.Deflate(GetStatusBarBorders(NULL));
+
+    wxDCClipper clipper(dc, rectIn);
+    DrawLabel(dc, label, rectIn, flags, wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
+}
+
+#endif // wxUSE_STATUSBAR
index 382823ee0403853b2e15849611b3532ab64a901f..ef2860b0b0147cc6b80e66895ae8d757f365978c 100644 (file)
@@ -115,8 +115,6 @@ public:
                                     wxOrientation orient,
                                     const wxRect& rect,
                                     int flags = 0);
-    virtual void DrawScrollCorner(wxDC& dc,
-                                  const wxRect& rect);
 
 #if wxUSE_TOOLBAR
     virtual void DrawToolBarButton(wxDC& dc,
@@ -188,13 +186,6 @@ public:
                                    const wxMenuGeometryInfo& geomInfo);
 #endif // wxUSE_MENUS
 
-#if wxUSE_STATUSBAR
-    virtual void DrawStatusField(wxDC& dc,
-                                 const wxRect& rect,
-                                 const wxString& label,
-                                 int flags = 0, int style = 0);
-#endif // wxUSE_STATUSBAR
-
     virtual void DrawFrameTitleBar(wxDC& dc,
                                    const wxRect& rect,
                                    const wxString& title,
@@ -244,8 +235,6 @@ public:
                                     int thumbPos = -1) const;
 #endif // wxUSE_SCROLLBAR
 
-    virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
-        { return fontHeight + 2; }
     virtual wxSize GetCheckBitmapSize() const
         { return wxSize(10, 10); }
     virtual wxSize GetRadioBitmapSize() const
@@ -289,10 +278,6 @@ public:
                                                 const wxMenu& menu) const;
 #endif // wxUSE_MENUS
 
-#if wxUSE_STATUSBAR
-    virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const;
-#endif // wxUSE_STATUSBAR
-
     // helpers for "wxBitmap wxColourScheme::Get()"
     void DrawCheckBitmap(wxDC& dc, const wxRect& rect);
     void DrawUncheckBitmap(wxDC& dc, const wxRect& rect, bool isPressed);
@@ -1895,27 +1880,6 @@ wxMenuGeometryInfo *wxGTKRenderer::GetMenuGeometry(wxWindow *win,
 
 #endif // wxUSE_MENUS
 
-#if wxUSE_STATUSBAR
-
-// ----------------------------------------------------------------------------
-// status bar
-// ----------------------------------------------------------------------------
-
-wxSize
-wxGTKRenderer::GetStatusBarBorders(wxCoord * WXUNUSED(borderBetweenFields)) const
-{
-    return wxSize(0,0);
-}
-
-void wxGTKRenderer::DrawStatusField(wxDC& WXUNUSED(dc),
-                                    const wxRect& WXUNUSED(rect),
-                                    const wxString& WXUNUSED(label),
-                                    int WXUNUSED(flags), int WXUNUSED(style))
-{
-}
-
-#endif // wxUSE_STATUSBAR
-
 // ----------------------------------------------------------------------------
 // combobox
 // ----------------------------------------------------------------------------
@@ -2309,11 +2273,6 @@ void wxGTKRenderer::DrawScrollbarShaft(wxDC& dc,
     DrawSolidRect(dc, wxSCHEME_COLOUR(m_scheme, SCROLLBAR), rectBar);
 }
 
-void wxGTKRenderer::DrawScrollCorner(wxDC& dc, const wxRect& rect)
-{
-    DrawSolidRect(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect);
-}
-
 #if wxUSE_SCROLLBAR
 wxRect wxGTKRenderer::GetScrollbarRect(const wxScrollBar *scrollbar,
                                        wxScrollBar::Element elem,
@@ -2382,9 +2341,7 @@ void wxGTKRenderer::AdjustSize(wxSize *size, const wxWindow *window)
 #endif // wxUSE_SCROLLBAR
     {
         // take into account the border width
-        wxRect rectBorder = GetBorderDimensions(window->GetBorder());
-        size->x += rectBorder.x + rectBorder.width;
-        size->y += rectBorder.y + rectBorder.height;
+        wxStdRenderer::AdjustSize(size, window);
     }
 }
 
index cca5284673b955d370ccf7c6a03cfbd63ed40ccc..351f9f0955389719f4418cc12132e44c0f1e0390 100644 (file)
@@ -258,8 +258,6 @@ public:
     virtual wxSize GetScrollbarArrowSize() const
         { return m_sizeScrollbarArrow; }
 
-    virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
-        { return fontHeight + 2; }
     virtual wxSize GetCheckBitmapSize() const
         { return wxSize(13, 13); }
     virtual wxSize GetRadioBitmapSize() const
@@ -306,10 +304,6 @@ public:
                                                 const wxMenu& menu) const;
 #endif // wxUSE_MENUS
 
-#if wxUSE_STATUSBAR
-    virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const;
-#endif // wxUSE_STATUSBAR
-
 protected:
     // overridden wxStdRenderer methods
     virtual void DrawFrameWithLabel(wxDC& dc,
@@ -2615,25 +2609,15 @@ wxMenuGeometryInfo *wxWin32Renderer::GetMenuGeometry(wxWindow *win,
 // status bar
 // ----------------------------------------------------------------------------
 
-static const wxCoord STATBAR_BORDER_X = 2;
-static const wxCoord STATBAR_BORDER_Y = 2;
-
-wxSize wxWin32Renderer::GetStatusBarBorders(wxCoord *borderBetweenFields) const
-{
-    if ( borderBetweenFields )
-        *borderBetweenFields = 2;
-
-    return wxSize(STATBAR_BORDER_X, STATBAR_BORDER_Y);
-}
-
 void wxWin32Renderer::DrawStatusField(wxDC& dc,
                                       const wxRect& rect,
                                       const wxString& label,
-                                      int flags, int style /*=0*/)
+                                      int flags,
+                                      int style)
 {
     wxRect rectIn;
 
-    if ( flags & wxCONTROL_ISDEFAULT )
+    if ( flags & wxCONTROL_SIZEGRIP )
     {
         // draw the size grip: it is a normal rect except that in the lower
         // right corner we have several bands which may be used for dragging
@@ -2688,19 +2672,12 @@ void wxWin32Renderer::DrawStatusField(wxDC& dc,
         rectIn.Deflate(1);
 
         rectIn.width -= STATUSBAR_GRIP_SIZE;
-    }
-    else // normal pane
-    {
-        if (style == wxSB_RAISED)
-            DrawBorder(dc, wxBORDER_RAISED, rect, flags, &rectIn);
-        else if (style != wxSB_FLAT)
-            DrawBorder(dc, wxBORDER_STATIC, rect, flags, &rectIn);
-    }
 
-    rectIn.Deflate(STATBAR_BORDER_X, STATBAR_BORDER_Y);
+        // this will prevent the standard version from drawing any borders
+        style = wxSB_FLAT;
+    }
 
-    wxDCClipper clipper(dc, rectIn);
-    DrawLabel(dc, label, rectIn, flags, wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
+    DrawStatusField(dc, rect, label, flags, style);
 }
 
 #endif // wxUSE_STATUSBAR
@@ -3599,10 +3576,7 @@ void wxWin32Renderer::AdjustSize(wxSize *size, const wxWindow *window)
     }
 #endif // wxUSE_BUTTON || wxUSE_TOGGLEBTN
 
-    // take into account the border width
-    wxRect rectBorder = GetBorderDimensions(window->GetBorder());
-    size->x += rectBorder.x + rectBorder.width;
-    size->y += rectBorder.y + rectBorder.height;
+    wxStdRenderer::AdjustSize(size, window);
 }
 
 // ============================================================================