]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/themes/gtk.cpp
add wxMBConvStrictUTF8 class implementing just UTF-8 conversion, without support...
[wxWidgets.git] / src / univ / themes / gtk.cpp
index 382823ee0403853b2e15849611b3532ab64a901f..0246f9d12a7dc86bc30afe815b9b9a8e85672f4f 100644 (file)
     #pragma hdrstop
 #endif
 
+#include "wx/univ/theme.h"
+
+#if wxUSE_THEME_GTK
+
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
     #include "wx/log.h"
     #include "wx/dcmemory.h"
+    #include "wx/dcclient.h"
     #include "wx/window.h"
 
     #include "wx/menu.h"
@@ -60,9 +65,8 @@
 #include "wx/univ/inpcons.h"
 #include "wx/univ/inphand.h"
 #include "wx/univ/colschem.h"
-#include "wx/univ/theme.h"
 
-class WXDLLEXPORT wxGTKMenuGeometryInfo;
+class wxGTKMenuGeometryInfo;
 
 // ----------------------------------------------------------------------------
 // constants
@@ -81,7 +85,7 @@ public:
     wxGTKRenderer(const wxColourScheme *scheme);
 
     // wxRenderer methods
-    virtual void DrawFocusRect(wxDC& dc, const wxRect& rect);
+    virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0);
     virtual void DrawTextBorder(wxDC& dc,
                                 wxBorder border,
                                 const wxRect& rect,
@@ -115,8 +119,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,46 +190,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,
@@ -236,16 +198,11 @@ public:
     virtual void AdjustSize(wxSize *size, const wxWindow *window);
 
     // geometry and hit testing
+#if wxUSE_SCROLLBAR
     virtual wxSize GetScrollbarArrowSize() const
         { return m_sizeScrollbarArrow; }
-#if wxUSE_SCROLLBAR
-    virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
-                                    wxScrollBar::Element elem,
-                                    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
@@ -253,10 +210,12 @@ 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 GetTextClientArea(const wxTextCtrl *text,
@@ -289,10 +248,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);
@@ -357,26 +312,6 @@ protected:
     // draw inner GTK shadow
     void DrawInnerShadedRect(wxDC& dc, wxRect *rect);
 
-#if wxUSE_SCROLLBAR
-    // returns the size of the arrow for the scrollbar (depends on
-    // orientation)
-    wxSize GetScrollbarArrowSize(const wxScrollBar *scrollbar) const
-    {
-        wxSize size;
-        if ( scrollbar->IsVertical() )
-        {
-            size = m_sizeScrollbarArrow;
-        }
-        else
-        {
-            size.x = m_sizeScrollbarArrow.y;
-            size.y = m_sizeScrollbarArrow.x;
-        }
-
-        return size;
-    }
-#endif // wxUSE_SCROLLBAR
-
     // get the line wrap indicator bitmap
     wxBitmap GetLineWrapBitmap() const;
 
@@ -408,9 +343,12 @@ protected:
     // initialize the combo bitmaps
     void InitComboBitmaps();
 
-private:
-    const wxColourScheme *m_scheme;
+    virtual wxBitmap GetFrameButtonBitmap(FrameButtonType WXUNUSED(type))
+    {
+        return wxNullBitmap;
+    }
 
+private:
     // data
     wxSize m_sizeScrollbarArrow;
 
@@ -604,7 +542,7 @@ wxGTKTheme::~wxGTKTheme()
 {
     delete m_renderer;
     delete m_scheme;
-    wxArtProvider::RemoveProvider(m_artProvider);
+    delete m_artProvider;
 }
 
 wxRenderer *wxGTKTheme::GetRenderer()
@@ -742,6 +680,7 @@ wxColour wxGTKColourScheme::Get(wxGTKColourScheme::StdColour col) const
 {
     switch ( col )
     {
+        case FRAME:
         case WINDOW:            return *wxWHITE;
 
         case SHADOW_DARK:       return *wxBLACK;
@@ -874,7 +813,8 @@ void wxGTKRenderer::DrawSunkenBorder(wxDC& dc, wxRect *rect)
     DrawShadedRect(dc, rect, m_penBlack, m_penLightGrey);
 }
 
-void wxGTKRenderer::DrawFocusRect(wxDC& dc, const wxRect& rect)
+void
+wxGTKRenderer::DrawFocusRect(wxDC& dc, const wxRect& rect, int WXUNUSED(flags))
 {
     dc.SetBrush(*wxTRANSPARENT_BRUSH);
     wxRect rectFocus = rect;
@@ -985,7 +925,7 @@ void wxGTKRenderer::DrawFrameWithLabel(wxDC& dc,
 }
 
 // ----------------------------------------------------------------------------
-// check/radion buttons
+// check/radio buttons
 // ----------------------------------------------------------------------------
 
 void wxGTKRenderer::DrawCheckItemBitmap(wxDC& dc,
@@ -1633,7 +1573,7 @@ void wxGTKRenderer::DrawSliderThumb(wxDC& dc,
 // ----------------------------------------------------------------------------
 
 // wxGTKMenuGeometryInfo: the wxMenuGeometryInfo used by wxGTKRenderer
-class WXDLLEXPORT wxGTKMenuGeometryInfo : public wxMenuGeometryInfo
+class wxGTKMenuGeometryInfo : public wxMenuGeometryInfo
 {
 public:
     virtual wxSize GetSize() const { return m_size; }
@@ -1895,27 +1835,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,29 +2228,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,
-                                       int thumbPos) const
-{
-    // as GTK scrollbars can't be disabled, it makes no sense to remove the
-    // thumb for a scrollbar with range 0 - instead, make it fill the entire
-    // scrollbar shaft
-    if ( (elem == wxScrollBar::Element_Thumb) && !scrollbar->GetRange() )
-    {
-        elem = wxScrollBar::Element_Bar_2;
-    }
-
-    return wxStdRenderer::GetScrollbarRect(scrollbar, elem, thumbPos);
-}
-
-#endif // wxUSE_SCROLLBAR
-
 // ----------------------------------------------------------------------------
 // size adjustments
 // ----------------------------------------------------------------------------
@@ -2382,93 +2278,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
 // ----------------------------------------------------------------------------
@@ -2923,3 +2736,5 @@ bool wxGTKTextCtrlInputHandler::HandleKey(wxInputConsumer *control,
 }
 
 #endif // wxUSE_TEXTCTRL
+
+#endif // wxUSE_THEME_GTK