]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/themes/gtk.cpp
1. deprecate redundantly sounding wxArtProvider::FooProvider() to just Foo()
[wxWidgets.git] / src / univ / themes / gtk.cpp
index e70e9c409efa1abc6b68f0888f3fc678c9eafd49..e0fd1f8fe1a4cbf2c761a319efce5e0d93125b86 100644 (file)
@@ -115,13 +115,6 @@ public:
                                     wxOrientation orient,
                                     const wxRect& rect,
                                     int flags = 0);
-    virtual void DrawScrollCorner(wxDC& dc,
-                                  const wxRect& rect);
-    virtual void DrawCheckItem(wxDC& dc,
-                               const wxString& label,
-                               const wxBitmap& bitmap,
-                               const wxRect& rect,
-                               int flags = 0);
 
 #if wxUSE_TOOLBAR
     virtual void DrawToolBarButton(wxDC& dc,
@@ -193,46 +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,
-                                   const wxIcon& icon,
-                                   int flags,
-                                   int specialButton = 0,
-                                   int specialButtonFlag = 0);
-    virtual void DrawFrameBorder(wxDC& dc,
-                                 const wxRect& rect,
-                                 int flags);
-    virtual void DrawFrameBackground(wxDC& dc,
-                                     const wxRect& rect,
-                                     int flags);
-    virtual void DrawFrameTitle(wxDC& dc,
-                                const wxRect& rect,
-                                const wxString& title,
-                                int flags);
-    virtual void DrawFrameIcon(wxDC& dc,
-                               const wxRect& rect,
-                               const wxIcon& icon,
-                               int flags);
-    virtual void DrawFrameButton(wxDC& dc,
-                                 wxCoord x, wxCoord y,
-                                 int button,
-                                 int flags = 0);
-
-    // titlebars
-    virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const;
-    virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const;
-    virtual wxSize GetFrameMinSize(int flags) const;
-    virtual wxSize GetFrameIconSize() const;
-    virtual int HitTestFrame(const wxRect& rect, const wxPoint& pt, int flags) const;
-
     virtual void GetComboBitmaps(wxBitmap *bmpNormal,
                                  wxBitmap *bmpFocus,
                                  wxBitmap *bmpPressed,
@@ -249,8 +202,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
@@ -258,14 +209,14 @@ public:
     virtual wxCoord GetCheckItemMargin() const
         { return 2; }
 
+#if wxUSE_TOOLBAR
     virtual wxSize GetToolBarButtonSize(wxCoord *separator) const
         { if ( separator ) *separator = 5; return wxSize(16, 15); }
     virtual wxSize GetToolBarMargin() const
         { return wxSize(6, 6); }
+#endif // wxUSE_TOOLBAR
 
 #if wxUSE_TEXTCTRL
-    virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
-                                    const wxRect& rect) const;
     virtual wxRect GetTextClientArea(const wxTextCtrl *text,
                                      const wxRect& rect,
                                      wxCoord *extraSpaceBeyond) const;
@@ -296,16 +247,13 @@ 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);
     void DrawUndeterminedBitmap(wxDC& dc, const wxRect& rect, bool isPressed);
 
 protected:
+    // overridden wxStdRenderer methods
     virtual void DrawSunkenBorder(wxDC& dc, wxRect *rect);
 
     virtual void DrawFrameWithLabel(wxDC& dc,
@@ -316,6 +264,11 @@ protected:
                                     int alignment,
                                     int indexAccel);
 
+    virtual void DrawCheckItemBitmap(wxDC& dc,
+                                     const wxBitmap& bitmap,
+                                     const wxRect& rect,
+                                     int flags);
+
     // get the colour to use for background
     wxColour GetBackgroundColour(int flags) const
     {
@@ -396,15 +349,6 @@ protected:
     // draw the radio button bitmap for the given state
     void DrawRadioBitmap(wxDC& dc, const wxRect& rect, int flags);
 
-    // draw check/radio - the bitmap must be a valid one by now
-    void DoDrawCheckOrRadioBitmap(wxDC& dc,
-                                  const wxString& label,
-                                  const wxBitmap& bitmap,
-                                  const wxRect& rectTotal,
-                                  int flags,
-                                  wxAlignment align,
-                                  int indexAccel);
-
     // common part of DrawMenuItem() and DrawMenuBarItem()
     void DoDrawMenuItem(wxDC& dc,
                         const wxRect& rect,
@@ -418,6 +362,11 @@ protected:
     // initialize the combo bitmaps
     void InitComboBitmaps();
 
+    virtual wxBitmap GetFrameButtonBitmap(FrameButtonType WXUNUSED(type))
+    {
+        return wxNullBitmap;
+    }
+
 private:
     const wxColourScheme *m_scheme;
 
@@ -588,8 +537,6 @@ private:
     wxSortedArrayString m_handlerNames;
     wxArrayHandlers m_handlers;
 
-    wxGTKInputHandler *m_handlerDefault;
-
     wxGTKColourScheme *m_scheme;
 
     WX_DECLARE_THEME(gtk)
@@ -609,23 +556,14 @@ wxGTKTheme::wxGTKTheme()
 {
     m_scheme = NULL;
     m_renderer = NULL;
-    m_handlerDefault = NULL;
     m_artProvider = NULL;
 }
 
 wxGTKTheme::~wxGTKTheme()
 {
-    size_t count = m_handlers.GetCount();
-    for ( size_t n = 0; n < count; n++ )
-    {
-        if ( m_handlers[n] != m_handlerDefault )
-            delete m_handlers[n];
-    }
-
-    delete m_handlerDefault;
     delete m_renderer;
     delete m_scheme;
-    wxArtProvider::RemoveProvider(m_artProvider);
+    delete m_artProvider;
 }
 
 wxRenderer *wxGTKTheme::GetRenderer()
@@ -1006,33 +944,18 @@ void wxGTKRenderer::DrawFrameWithLabel(wxDC& dc,
 }
 
 // ----------------------------------------------------------------------------
-// label
+// check/radion buttons
 // ----------------------------------------------------------------------------
 
-void wxGTKRenderer::DrawCheckItem(wxDC& dc,
-                                  const wxString& label,
-                                  const wxBitmap& bitmap,
-                                  const wxRect& rect,
-                                  int flags)
+void wxGTKRenderer::DrawCheckItemBitmap(wxDC& dc,
+                                        const wxBitmap& bitmap,
+                                        const wxRect& rect,
+                                        int flags)
 {
-    wxRect rectBitmap = rect;
-    rectBitmap.x -= 1;
-    rectBitmap.width = GetCheckBitmapSize().x;
-
     // never draw the focus rect around the check indicators here
-    DrawCheckButton(dc, wxEmptyString, bitmap, rectBitmap, flags & ~wxCONTROL_FOCUSED);
-
-    wxRect rectLabel = rect;
-    wxCoord shift = rectBitmap.width + 2*GetCheckItemMargin();
-    rectLabel.x += shift;
-    rectLabel.width -= shift;
-    DrawItem(dc, label, rectLabel, flags);
+    DrawCheckButton(dc, wxEmptyString, bitmap, rect, flags & ~wxCONTROL_FOCUSED);
 }
 
-// ----------------------------------------------------------------------------
-// check/radion buttons
-// ----------------------------------------------------------------------------
-
 void wxGTKRenderer::DrawUndeterminedBitmap(wxDC& dc,
                                            const wxRect& rectTotal,
                                            bool isPressed)
@@ -1317,20 +1240,12 @@ void wxGTKRenderer::DrawToolBarButton(wxDC& dc,
 
 #if wxUSE_TEXTCTRL
 
-wxRect wxGTKRenderer::GetTextTotalArea(const wxTextCtrl * WXUNUSED(text),
-                                       const wxRect& rect) const
-{
-    wxRect rectTotal = rect;
-    rectTotal.Inflate(2*BORDER_THICKNESS);
-    return rectTotal;
-}
-
 wxRect wxGTKRenderer::GetTextClientArea(const wxTextCtrl *text,
                                         const wxRect& rect,
                                         wxCoord *extraSpaceBeyond) const
 {
-    wxRect rectText = rect;
-    rectText.Deflate(2*BORDER_THICKNESS);
+    wxRect
+      rectText = wxStdRenderer::GetTextClientArea(text, rect, extraSpaceBeyond);
 
     if ( text->WrapLines() )
     {
@@ -1346,8 +1261,6 @@ wxRect wxGTKRenderer::GetTextClientArea(const wxTextCtrl *text,
     return rectText;
 }
 
-#endif // wxUSE_TEXTCTRL
-
 void wxGTKRenderer::DrawLineWrapMark(wxDC& dc, const wxRect& rect)
 {
     wxBitmap bmpLineWrap = GetLineWrapBitmap();
@@ -1373,6 +1286,8 @@ void wxGTKRenderer::DrawLineWrapMark(wxDC& dc, const wxRect& rect)
     }
 }
 
+#endif // wxUSE_TEXTCTRL
+
 // ----------------------------------------------------------------------------
 // notebook
 // ----------------------------------------------------------------------------
@@ -1939,27 +1854,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
 // ----------------------------------------------------------------------------
@@ -2353,11 +2247,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,
@@ -2426,93 +2315,10 @@ 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);
     }
 }
 
-// ----------------------------------------------------------------------------
-// top level windows
-// ----------------------------------------------------------------------------
-
-void wxGTKRenderer::DrawFrameTitleBar(wxDC& WXUNUSED(dc),
-                                      const wxRect& WXUNUSED(rect),
-                                      const wxString& WXUNUSED(title),
-                                      const wxIcon& WXUNUSED(icon),
-                                      int WXUNUSED(flags),
-                                      int WXUNUSED(specialButton),
-                                      int WXUNUSED(specialButtonFlag))
-{
-}
-
-void wxGTKRenderer::DrawFrameBorder(wxDC& WXUNUSED(dc),
-                                    const wxRect& WXUNUSED(rect),
-                                    int WXUNUSED(flags))
-{
-}
-
-void wxGTKRenderer::DrawFrameBackground(wxDC& WXUNUSED(dc),
-                                        const wxRect& WXUNUSED(rect),
-                                        int WXUNUSED(flags))
-{
-}
-
-void wxGTKRenderer::DrawFrameTitle(wxDC& WXUNUSED(dc),
-                                   const wxRect& WXUNUSED(rect),
-                                   const wxString& WXUNUSED(title),
-                                   int WXUNUSED(flags))
-{
-}
-
-void wxGTKRenderer::DrawFrameIcon(wxDC& WXUNUSED(dc),
-                                  const wxRect& WXUNUSED(rect),
-                                  const wxIcon& WXUNUSED(icon),
-                                  int WXUNUSED(flags))
-{
-}
-
-void wxGTKRenderer::DrawFrameButton(wxDC& WXUNUSED(dc),
-                                    wxCoord WXUNUSED(x),
-                                    wxCoord WXUNUSED(y),
-                                    int WXUNUSED(button),
-                                    int WXUNUSED(flags))
-{
-}
-
-wxRect
-wxGTKRenderer::GetFrameClientArea(const wxRect& rect,
-                                  int WXUNUSED(flags)) const
-{
-    return rect;
-}
-
-wxSize
-wxGTKRenderer::GetFrameTotalSize(const wxSize& clientSize,
-                                 int WXUNUSED(flags)) const
-{
-    return clientSize;
-}
-
-wxSize wxGTKRenderer::GetFrameMinSize(int WXUNUSED(flags)) const
-{
-    return wxSize(0,0);
-}
-
-wxSize wxGTKRenderer::GetFrameIconSize() const
-{
-    return wxSize(wxDefaultCoord, wxDefaultCoord);
-}
-
-int
-wxGTKRenderer::HitTestFrame(const wxRect& WXUNUSED(rect),
-                            const wxPoint& WXUNUSED(pt),
-                            int WXUNUSED(flags)) const
-{
-    return wxHT_TOPLEVEL_CLIENT_AREA;
-}
-
-
 // ----------------------------------------------------------------------------
 // standard icons
 // ----------------------------------------------------------------------------