]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/themes/gtk.cpp
Fix up NSSlider code to not use class posing and instantiate the proper type (now...
[wxWidgets.git] / src / univ / themes / gtk.cpp
index fe2695813a46f91a6824ab9f18a7b29e11c63006..0246f9d12a7dc86bc30afe815b9b9a8e85672f4f 100644 (file)
@@ -1,12 +1,12 @@
 ///////////////////////////////////////////////////////////////////////////////
-// Name:        univ/themes/gtk.cpp
+// Name:        src/univ/themes/gtk.cpp
 // Purpose:     wxUniversal theme implementing GTK-like LNF
 // Author:      Vadim Zeitlin
 // Modified by:
 // Created:     06.08.00
 // RCS-ID:      $Id$
 // Copyright:   (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 
 // ===========================================================================
     #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"
+
+    #include "wx/bmpbuttn.h"
     #include "wx/button.h"
     #include "wx/checkbox.h"
     #include "wx/listbox.h"
     #include "wx/scrolbar.h"
     #include "wx/slider.h"
     #include "wx/textctrl.h"
+    #include "wx/toolbar.h"
+    #include "wx/statusbr.h"
+
+    #include "wx/settings.h"
+    #include "wx/toplevel.h"
+    #include "wx/image.h"
 #endif // WX_PRECOMP
 
 #include "wx/notebook.h"
 #include "wx/spinbutt.h"
+#include "wx/artprov.h"
+#ifdef wxUSE_TOGGLEBTN
+#include "wx/tglbtn.h"
+#endif // wxUSE_TOGGLEBTN
 
-#include "wx/univ/renderer.h"
+#include "wx/univ/stdrend.h"
+#include "wx/univ/inpcons.h"
 #include "wx/univ/inphand.h"
 #include "wx/univ/colschem.h"
-#include "wx/univ/theme.h"
+
+class wxGTKMenuGeometryInfo;
 
 // ----------------------------------------------------------------------------
-// constants (to be removed, for testing only)
+// constants
 // ----------------------------------------------------------------------------
 
-static const size_t BORDER_THICKNESS = 10;
+// standard border size
+static const int BORDER_THICKNESS = 2;
 
 // ----------------------------------------------------------------------------
 // wxGTKRenderer: draw the GUI elements in GTK style
 // ----------------------------------------------------------------------------
 
-class wxGTKRenderer : public wxRenderer
+class wxGTKRenderer : public wxStdRenderer
 {
 public:
     wxGTKRenderer(const wxColourScheme *scheme);
 
-    // implement the base class pure virtuals
-    virtual void DrawBackground(wxDC& dc,
-                                const wxColour& col,
+    // wxRenderer methods
+    virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0);
+    virtual void DrawTextBorder(wxDC& dc,
+                                wxBorder border,
                                 const wxRect& rect,
-                                int flags = 0);
-    virtual void DrawLabel(wxDC& dc,
-                           const wxString& label,
-                           const wxRect& rect,
-                           int flags = 0,
-                           int alignment = wxALIGN_LEFT | wxALIGN_TOP,
-                           int indexAccel = -1,
-                           wxRect *rectBounds = NULL);
+                                int flags = 0,
+                                wxRect *rectIn = NULL);
     virtual void DrawButtonLabel(wxDC& dc,
                                  const wxString& label,
                                  const wxBitmap& image,
                                  const wxRect& rect,
-                                 int flags = 0,
-                                 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
-                                 int indexAccel = -1,
-                                 wxRect *rectBounds = NULL);
-    virtual void DrawBorder(wxDC& dc,
-                            wxBorder border,
-                            const wxRect& rect,
-                            int flags = 0,
-                            wxRect *rectIn = (wxRect *)NULL);
-    virtual void DrawHorizontalLine(wxDC& dc,
-                                    wxCoord y, wxCoord x1, wxCoord x2);
-    virtual void DrawVerticalLine(wxDC& dc,
-                                  wxCoord x, wxCoord y1, wxCoord y2);
-    virtual void DrawFrame(wxDC& dc,
-                           const wxString& label,
-                           const wxRect& rect,
-                           int flags = 0,
-                           int alignment = wxALIGN_LEFT,
-                           int indexAccel = -1);
-    virtual void DrawTextBorder(wxDC& dc,
-                                wxBorder border,
-                                const wxRect& rect,
-                                int flags = 0,
-                                wxRect *rectIn = (wxRect *)NULL);
+                                 int flags,
+                                 int alignment,
+                                 int indexAccel,
+                                 wxRect *rectBounds);
     virtual void DrawButtonBorder(wxDC& dc,
                                   const wxRect& rect,
                                   int flags = 0,
-                                  wxRect *rectIn = (wxRect *)NULL);
+                                  wxRect *rectIn = NULL);
     virtual void DrawArrow(wxDC& dc,
                            wxDirection dir,
                            const wxRect& rect,
@@ -123,40 +119,22 @@ public:
                                     wxOrientation orient,
                                     const wxRect& rect,
                                     int flags = 0);
-    virtual void DrawScrollCorner(wxDC& dc,
-                                  const wxRect& rect);
-    virtual void DrawItem(wxDC& dc,
-                          const wxString& label,
-                          const wxRect& rect,
-                          int flags = 0);
-    virtual void DrawCheckItem(wxDC& dc,
-                               const wxString& label,
-                               const wxBitmap& bitmap,
-                               const wxRect& rect,
-                               int flags = 0);
-    virtual void DrawCheckButton(wxDC& dc,
-                                 const wxString& label,
-                                 const wxBitmap& bitmap,
-                                 const wxRect& rect,
-                                 int flags = 0,
-                                 wxAlignment align = wxALIGN_LEFT,
-                                 int indexAccel = -1);
 
-    virtual void DrawRadioButton(wxDC& dc,
-                                 const wxString& label,
-                                 const wxBitmap& bitmap,
-                                 const wxRect& rect,
-                                 int flags = 0,
-                                 wxAlignment align = wxALIGN_LEFT,
-                                 int indexAccel = -1);
+#if wxUSE_TOOLBAR
+    virtual void DrawToolBarButton(wxDC& dc,
+                                   const wxString& label,
+                                   const wxBitmap& bitmap,
+                                   const wxRect& rect,
+                                   int flags = 0,
+                                   long style = 0,
+                                   int tbarStyle = 0);
+#endif // wxUSE_TOOLBAR
 
-    virtual void DrawTextLine(wxDC& dc,
-                              const wxString& text,
-                              const wxRect& rect,
-                              int selStart = -1,
-                              int selEnd = -1,
-                              int flags = 0);
+#if wxUSE_TEXTCTRL
     virtual void DrawLineWrapMark(wxDC& dc, const wxRect& rect);
+#endif // wxUSE_TEXTCTRL
+
+#if wxUSE_NOTEBOOK
     virtual void DrawTab(wxDC& dc,
                          const wxRect& rect,
                          wxDirection dir,
@@ -164,27 +142,34 @@ public:
                          const wxBitmap& bitmap = wxNullBitmap,
                          int flags = 0,
                          int indexAccel = -1);
+#endif // wxUSE_NOTEBOOK
 
+#if wxUSE_SLIDER
     virtual void DrawSliderShaft(wxDC& dc,
                                  const wxRect& rect,
+                                 int lenThumb,
                                  wxOrientation orient,
                                  int flags = 0,
+                                 long style = 0,
                                  wxRect *rectShaft = NULL);
     virtual void DrawSliderThumb(wxDC& dc,
                                  const wxRect& rect,
                                  wxOrientation orient,
-                                 int flags = 0);
-    virtual void DrawSliderTicks(wxDC& dc,
-                                 const wxRect& rect,
-                                 const wxSize& sizeThumb,
-                                 wxOrientation orient,
-                                 int start,
-                                 int end,
-                                 int step,
-                                 int flags)
+                                 int flags = 0,
+                                 long style = 0);
+    virtual void DrawSliderTicks(wxDC& WXUNUSED(dc),
+                                 const wxRect& WXUNUSED(rect),
+                                 int WXUNUSED(lenThumb),
+                                 wxOrientation WXUNUSED(orient),
+                                 int WXUNUSED(start),
+                                 int WXUNUSED(end),
+                                 int WXUNUSED(step) = 1,
+                                 int WXUNUSED(flags) = 0,
+                                 long WXUNUSED(style) = 0)
     {
         // we don't have the ticks in GTK version
     }
+#endif // wxUSE_SLIDER
 
 #if wxUSE_MENUS
     virtual void DrawMenuBarItem(wxDC& dc,
@@ -203,30 +188,21 @@ public:
     virtual void DrawMenuSeparator(wxDC& dc,
                                    wxCoord y,
                                    const wxMenuGeometryInfo& geomInfo);
-#endif
+#endif // wxUSE_MENUS
+
     virtual void GetComboBitmaps(wxBitmap *bmpNormal,
                                  wxBitmap *bmpFocus,
                                  wxBitmap *bmpPressed,
                                  wxBitmap *bmpDisabled);
 
     virtual void AdjustSize(wxSize *size, const wxWindow *window);
-    virtual wxRect GetBorderDimensions(wxBorder border) const;
-    virtual bool AreScrollbarsInsideBorder() const;
 
     // geometry and hit testing
+#if wxUSE_SCROLLBAR
     virtual wxSize GetScrollbarArrowSize() const
         { return m_sizeScrollbarArrow; }
-    virtual wxRect GetScrollbarRect(const wxScrollBar *scrollbar,
-                                    wxScrollBar::Element elem,
-                                    int thumbPos = -1) const;
-    virtual wxCoord GetScrollbarSize(const wxScrollBar *scrollbar);
-    virtual wxHitTest HitTestScrollbar(const wxScrollBar *scrollbar,
-                                       const wxPoint& pt) const;
-    virtual wxCoord ScrollbarToPixel(const wxScrollBar *scrollbar,
-                                     int thumbPos = -1);
-    virtual int PixelToScrollbar(const wxScrollBar *scrollbar, wxCoord coord);
-    virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
-        { return fontHeight + 2; }
+#endif // wxUSE_SCROLLBAR
+
     virtual wxSize GetCheckBitmapSize() const
         { return wxSize(10, 10); }
     virtual wxSize GetRadioBitmapSize() const
@@ -234,34 +210,65 @@ public:
     virtual wxCoord GetCheckItemMargin() const
         { return 2; }
 
-    virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
-                                    const wxRect& rect);
+#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,
                                      const wxRect& rect,
-                                     wxCoord *extraSpaceBeyond);
+                                     wxCoord *extraSpaceBeyond) const;
+#endif // wxUSE_TEXTCTRL
 
+#if wxUSE_NOTEBOOK
     virtual wxSize GetTabIndent() const { return wxSize(2, 2); }
     virtual wxSize GetTabPadding() const { return wxSize(6, 6); }
+#endif // wxUSE_NOTEBOOK
 
+#if wxUSE_SLIDER
     virtual wxCoord GetSliderDim() const { return 15; }
     virtual wxCoord GetSliderTickLen() const { return 0; }
     virtual wxRect GetSliderShaftRect(const wxRect& rect,
-                                      wxOrientation orient) const;
+                                      int lenThumb,
+                                      wxOrientation orient,
+                                      long style = 0) const;
     virtual wxSize GetSliderThumbSize(const wxRect& rect,
+                                      int lenThumb,
                                       wxOrientation orient) const;
+#endif // wxUSE_SLIDER
+
     virtual wxSize GetProgressBarStep() const { return wxSize(16, 32); }
-#if wxUSE_MENUS
 
+#if wxUSE_MENUS
     virtual wxSize GetMenuBarItemSize(const wxSize& sizeText) const;
     virtual wxMenuGeometryInfo *GetMenuGeometry(wxWindow *win,
                                                 const wxMenu& menu) const;
-#endif
+#endif // wxUSE_MENUS
+
     // 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:
-    // DrawBackground() helpers
+    // overridden wxStdRenderer methods
+    virtual void DrawSunkenBorder(wxDC& dc, wxRect *rect);
+
+    virtual void DrawFrameWithLabel(wxDC& dc,
+                                    const wxString& label,
+                                    const wxRect& rectFrame,
+                                    const wxRect& rectText,
+                                    int flags,
+                                    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
@@ -274,25 +281,6 @@ protected:
             return wxSCHEME_COLOUR(m_scheme, CONTROL);
     }
 
-    // draw the background with any colour, not only the default one(s)
-    void DoDrawBackground(wxDC& dc,
-                          const wxColour& col,
-                          const wxRect& rect);
-
-    // DrawBorder() helpers: all of them shift and clip the DC after drawing
-    // the border
-
-    // just draw a rectangle with the given pen
-    void DrawRect(wxDC& dc, wxRect *rect, const wxPen& pen);
-
-    // draw the lower left part of rectangle
-    void DrawHalfRect(wxDC& dc, wxRect *rect, const wxPen& pen);
-
-    // draw the rectange using the first brush for the left and top sides and
-    // the second one for the bottom and right ones
-    void DrawShadedRect(wxDC& dc, wxRect *rect,
-                        const wxPen& pen1, const wxPen& pen2);
-
     // as DrawShadedRect() but the pixels in the bottom left and upper right
     // border are drawn with the pen1, not pen2
     void DrawAntiShadedRect(wxDC& dc, wxRect *rect,
@@ -316,39 +304,19 @@ protected:
                          wxRect *rect,
                          wxOrientation orient);
 
-    // draw the normal 3D border
-    void DrawRaisedBorder(wxDC& dc, wxRect *rect);
-
     // just as DrawRaisedBorder() except that the bottom left and up right
     // pixels of the interior rect are drawn in another colour (i.e. the inner
     // rect is drawn with DrawAntiShadedRect() and not DrawShadedRect())
     void DrawAntiRaisedBorder(wxDC& dc, wxRect *rect);
 
-    // 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;
-    }
+    // draw inner GTK shadow
+    void DrawInnerShadedRect(wxDC& dc, wxRect *rect);
 
     // get the line wrap indicator bitmap
-    wxBitmap GetLineWrapBitmap();
-
-    // DrawCheckBitmap and DrawRadioBitmap helpers
+    wxBitmap GetLineWrapBitmap() const;
 
-    // draw the check bitmaps once and cache them for later use
-    wxBitmap GetCheckBitmap(int flags);
+    virtual wxBitmap GetCheckBitmap(int flags);
+    virtual wxBitmap GetRadioBitmap(int flags);
 
     // draw a /\ or \/ line from (x1, y1) to (x2, y1) passing by the point
     // ((x1 + x2)/2, y2)
@@ -362,35 +330,36 @@ 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,
+                        const wxString& label,
+                        int flags,
+                        int indexAccel,
+                        const wxString& accel = wxEmptyString,
+                        const wxBitmap& bitmap = wxNullBitmap,
+                        const wxGTKMenuGeometryInfo *geometryInfo = NULL);
 
     // initialize the combo bitmaps
     void InitComboBitmaps();
 
-private:
-    const wxColourScheme *m_scheme;
+    virtual wxBitmap GetFrameButtonBitmap(FrameButtonType WXUNUSED(type))
+    {
+        return wxNullBitmap;
+    }
 
+private:
     // data
     wxSize m_sizeScrollbarArrow;
 
     // GDI objects
-    wxPen m_penBlack,
-          m_penDarkGrey,
-          m_penGrey,
-          m_penLightGrey,
-          m_penHighlight;
+    wxPen m_penGrey;
 
-    // the checkbox bitmaps: first row is for the normal, second for the
-    // pressed state and the columns are for checked and unchecked status
-    // respectively
-    wxBitmap m_bitmapsCheckbox[2][2];
+    // the checkbox and radio button bitmaps: first row is for the normal,
+    // second for the pressed state and the columns are for checked, unchecked
+    // and undeterminated respectively
+    wxBitmap m_bitmapsCheckbox[IndicatorState_MaxCtrl][IndicatorStatus_Max],
+             m_bitmapsRadiobtn[IndicatorState_MaxCtrl][IndicatorStatus_Max];
 
     // the line wrap bitmap (drawn at the end of wrapped lines)
     wxBitmap m_bmpLineWrap;
@@ -416,19 +385,19 @@ private:
 class wxGTKInputHandler : public wxInputHandler
 {
 public:
-    wxGTKInputHandler(wxGTKRenderer *renderer);
+    wxGTKInputHandler() { }
 
-    virtual bool HandleKey(wxControl *control,
+    virtual bool HandleKey(wxInputConsumer *control,
                            const wxKeyEvent& event,
                            bool pressed);
-    virtual bool HandleMouse(wxControl *control,
+    virtual bool HandleMouse(wxInputConsumer *control,
                              const wxMouseEvent& event);
-    virtual bool HandleMouseMove(wxControl *control, const wxMouseEvent& event);
-
-protected:
-    wxGTKRenderer *m_renderer;
+    virtual bool HandleMouseMove(wxInputConsumer *control,
+                                 const wxMouseEvent& event);
 };
 
+#if wxUSE_SCROLLBAR
+
 class wxGTKScrollBarInputHandler : public wxStdScrollBarInputHandler
 {
 public:
@@ -454,7 +423,8 @@ protected:
         wxStdScrollBarInputHandler::Press(scrollbar, doIt);
     }
 
-    virtual bool IsAllowedButton(int WXUNUSED(button)) { return TRUE; }
+    // any button can be used to drag the scrollbar under GTK+
+    virtual bool IsAllowedButton(int WXUNUSED(button)) const { return true; }
 
     bool IsArrow() const
     {
@@ -463,28 +433,38 @@ protected:
     }
 };
 
-class wxGTKCheckboxInputHandler : public wxStdCheckboxInputHandler
+#endif // wxUSE_SCROLLBAR
+
+#if wxUSE_CHECKBOX
+
+class wxGTKCheckboxInputHandler : public wxStdInputHandler
 {
 public:
     wxGTKCheckboxInputHandler(wxInputHandler *handler)
-        : wxStdCheckboxInputHandler(handler) { }
+        : wxStdInputHandler(handler) { }
 
-    virtual bool HandleKey(wxControl *control,
+    virtual bool HandleKey(wxInputConsumer *control,
                            const wxKeyEvent& event,
                            bool pressed);
 };
 
-class wxGTKTextCtrlInputHandler : public wxStdTextCtrlInputHandler
+#endif // wxUSE_CHECKBOX
+
+#if wxUSE_TEXTCTRL
+
+class wxGTKTextCtrlInputHandler : public wxStdInputHandler
 {
 public:
     wxGTKTextCtrlInputHandler(wxInputHandler *handler)
-        : wxStdTextCtrlInputHandler(handler) { }
+        : wxStdInputHandler(handler) { }
 
-    virtual bool HandleKey(wxControl *control,
+    virtual bool HandleKey(wxInputConsumer *control,
                            const wxKeyEvent& event,
                            bool pressed);
 };
 
+#endif // wxUSE_TEXTCTRL
+
 // ----------------------------------------------------------------------------
 // wxGTKColourScheme: uses the standard GTK colours
 // ----------------------------------------------------------------------------
@@ -496,11 +476,23 @@ public:
     virtual wxColour GetBackground(wxWindow *win) const;
 };
 
+// ----------------------------------------------------------------------------
+// wxGTKArtProvider
+// ----------------------------------------------------------------------------
+
+class wxGTKArtProvider : public wxArtProvider
+{
+protected:
+    virtual wxBitmap CreateBitmap(const wxArtID& id,
+                                  const wxArtClient& client,
+                                  const wxSize& size);
+};
+
 // ----------------------------------------------------------------------------
 // wxGTKTheme
 // ----------------------------------------------------------------------------
 
-WX_DEFINE_ARRAY(wxInputHandler *, wxArrayHandlers);
+WX_DEFINE_ARRAY_PTR(wxInputHandler *, wxArrayHandlers);
 
 class wxGTKTheme : public wxTheme
 {
@@ -508,23 +500,22 @@ public:
     wxGTKTheme();
     virtual ~wxGTKTheme();
 
-    virtual wxRenderer *GetRenderer() { return m_renderer; }
-    virtual wxInputHandler *GetInputHandler(const wxString& control);
-    virtual wxColourScheme *GetColourScheme() { return m_scheme; }
+    virtual wxRenderer *GetRenderer();
+    virtual wxArtProvider *GetArtProvider();
+    virtual wxInputHandler *GetInputHandler(const wxString& control,
+                                            wxInputConsumer *consumer);
+    virtual wxColourScheme *GetColourScheme();
 
 private:
-    // get the default input handler
-    wxInputHandler *GetDefaultInputHandler();
-
     wxGTKRenderer *m_renderer;
 
+    wxGTKArtProvider *m_artProvider;
+
     // the names of the already created handlers and the handlers themselves
     // (these arrays are synchronized)
     wxSortedArrayString m_handlerNames;
     wxArrayHandlers m_handlers;
 
-    wxGTKInputHandler *m_handlerDefault;
-
     wxGTKColourScheme *m_scheme;
 
     WX_DECLARE_THEME(gtk)
@@ -542,83 +533,91 @@ WX_IMPLEMENT_THEME(wxGTKTheme, gtk, wxTRANSLATE("GTK+ theme"));
 
 wxGTKTheme::wxGTKTheme()
 {
-    m_scheme = new wxGTKColourScheme;
-    m_renderer = new wxGTKRenderer(m_scheme);
-    m_handlerDefault = NULL;
+    m_scheme = NULL;
+    m_renderer = NULL;
+    m_artProvider = NULL;
 }
 
 wxGTKTheme::~wxGTKTheme()
 {
-    size_t count = m_handlers.GetCount();
-    for ( size_t n = 0; n < count; n++ )
+    delete m_renderer;
+    delete m_scheme;
+    delete m_artProvider;
+}
+
+wxRenderer *wxGTKTheme::GetRenderer()
+{
+    if ( !m_renderer )
     {
-        if ( m_handlers[n] != m_handlerDefault )
-            delete m_handlers[n];
+        m_renderer = new wxGTKRenderer(GetColourScheme());
     }
 
-    delete m_handlerDefault;
-    delete m_renderer;
-    delete m_scheme;
+    return m_renderer;
 }
 
-wxInputHandler *wxGTKTheme::GetDefaultInputHandler()
+wxArtProvider *wxGTKTheme::GetArtProvider()
 {
-    if ( !m_handlerDefault )
+    if ( !m_artProvider )
     {
-        m_handlerDefault = new wxGTKInputHandler(m_renderer);
+        m_artProvider = new wxGTKArtProvider;
     }
 
-    return m_handlerDefault;
+    return m_artProvider;
 }
 
-wxInputHandler *wxGTKTheme::GetInputHandler(const wxString& control)
+wxColourScheme *wxGTKTheme::GetColourScheme()
 {
-    wxInputHandler *handler;
+    if ( !m_scheme )
+    {
+        m_scheme = new wxGTKColourScheme;
+    }
+    return m_scheme;
+}
+
+wxInputHandler *wxGTKTheme::GetInputHandler(const wxString& control,
+                                            wxInputConsumer *consumer)
+{
+    wxInputHandler *handler = NULL;
     int n = m_handlerNames.Index(control);
     if ( n == wxNOT_FOUND )
     {
+        static wxGTKInputHandler s_handlerDef;
+
+        wxInputHandler * const
+          handlerStd = consumer->DoGetStdInputHandler(&s_handlerDef);
+
         // create a new handler
-        if ( control == wxINP_HANDLER_SCROLLBAR )
-            handler = new wxGTKScrollBarInputHandler(m_renderer,
-                                                     GetDefaultInputHandler());
-#if wxUSE_BUTTON
-        else if ( control == wxINP_HANDLER_BUTTON )
-            handler = new wxStdButtonInputHandler(GetDefaultInputHandler());
-#endif // wxUSE_CHECKBOX
 #if wxUSE_CHECKBOX
-        else if ( control == wxINP_HANDLER_CHECKBOX )
-            handler = new wxGTKCheckboxInputHandler(GetDefaultInputHandler());
+        if ( control == wxINP_HANDLER_CHECKBOX )
+        {
+            static wxGTKCheckboxInputHandler s_handler(handlerStd);
+
+            handler = &s_handler;
+        }
+        else
 #endif // wxUSE_CHECKBOX
-#if wxUSE_COMBOBOX
-        else if ( control == wxINP_HANDLER_COMBOBOX )
-            handler = new wxStdComboBoxInputHandler(GetDefaultInputHandler());
-#endif // wxUSE_COMBOBOX
-#if wxUSE_LISTBOX
-        else if ( control == wxINP_HANDLER_LISTBOX )
-            handler = new wxStdListboxInputHandler(GetDefaultInputHandler());
-#endif // wxUSE_LISTBOX
-#if wxUSE_CHECKLISTBOX
-        else if ( control == wxINP_HANDLER_CHECKLISTBOX )
-            handler = new wxStdCheckListboxInputHandler(GetDefaultInputHandler());
-#endif // wxUSE_CHECKLISTBOX
+#if wxUSE_SCROLLBAR
+        if ( control == wxINP_HANDLER_SCROLLBAR )
+        {
+            static wxGTKScrollBarInputHandler s_handler(m_renderer, handlerStd);
+
+            handler = &s_handler;
+        }
+        else
+#endif // wxUSE_SCROLLBAR
 #if wxUSE_TEXTCTRL
-        else if ( control == wxINP_HANDLER_TEXTCTRL )
-            handler = new wxGTKTextCtrlInputHandler(GetDefaultInputHandler());
-#endif // wxUSE_TEXTCTRL
-#if wxUSE_SLIDER
-        else if ( control == wxINP_HANDLER_SLIDER )
-            handler = new wxStdSliderButtonInputHandler(GetDefaultInputHandler());
-#endif // wxUSE_SLIDER
-#if wxUSE_SPINBTN
-        else if ( control == wxINP_HANDLER_SPINBTN )
-            handler = new wxStdSpinButtonInputHandler(GetDefaultInputHandler());
-#endif // wxUSE_SPINBTN
-#if wxUSE_NOTEBOOK
-        else if ( control == wxINP_HANDLER_NOTEBOOK )
-            handler = new wxStdNotebookInputHandler(GetDefaultInputHandler());
-#endif // wxUSE_NOTEBOOK
+        if ( control == wxINP_HANDLER_TEXTCTRL )
+        {
+            static wxGTKTextCtrlInputHandler s_handler(handlerStd);
+
+            handler = &s_handler;
+        }
         else
-            handler = GetDefaultInputHandler();
+#endif // wxUSE_TEXTCTRL
+        {
+            // no special handler for this control
+            handler = handlerStd;
+        }
 
         n = m_handlerNames.Add(control);
         m_handlers.Insert(handler, n);
@@ -644,7 +643,7 @@ wxColour wxGTKColourScheme::GetBackground(wxWindow *win) const
         col = win->GetBackgroundColour();
     }
 
-    if ( win->IsContainerWindow() )
+    if ( !win->ShouldInheritColours() )
     {
         // doesn't depend on the state
         if ( !col.Ok() )
@@ -660,9 +659,12 @@ wxColour wxGTKColourScheme::GetBackground(wxWindow *win) const
         // and for the states for which we don't have any specific colours
         if ( !col.Ok() || (flags != 0) )
         {
+#if wxUSE_SCROLLBAR
             if ( wxDynamicCast(win, wxScrollBar) )
                 col = Get(SCROLLBAR);
-            else if ( (flags & wxCONTROL_CURRENT) && win->CanBeHighlighted() )
+            else
+#endif //wxUSE_SCROLLBAR
+                 if ( (flags & wxCONTROL_CURRENT) && win->CanBeHighlighted() )
                 col = Get(CONTROL_CURRENT);
             else if ( flags & wxCONTROL_PRESSED )
                 col = Get(CONTROL_PRESSED);
@@ -678,6 +680,7 @@ wxColour wxGTKColourScheme::Get(wxGTKColourScheme::StdColour col) const
 {
     switch ( col )
     {
+        case FRAME:
         case WINDOW:            return *wxWHITE;
 
         case SHADOW_DARK:       return *wxBLACK;
@@ -701,6 +704,16 @@ wxColour wxGTKColourScheme::Get(wxGTKColourScheme::StdColour col) const
         case HIGHLIGHT:         return wxColour(0x9c0000);
         case HIGHLIGHT_TEXT:    return wxColour(0xffffff);
 
+        case GAUGE:             return Get(CONTROL_CURRENT);
+
+        case TITLEBAR:          return wxColour(0xaeaaae);
+        case TITLEBAR_ACTIVE:   return wxColour(0x820300);
+        case TITLEBAR_TEXT:     return wxColour(0xc0c0c0);
+        case TITLEBAR_ACTIVE_TEXT:
+                                return *wxWHITE;
+
+        case DESKTOP:           return *wxBLACK;
+
         case MAX:
         default:
             wxFAIL_MSG(_T("invalid standard colour"));
@@ -717,67 +730,17 @@ wxColour wxGTKColourScheme::Get(wxGTKColourScheme::StdColour col) const
 // ----------------------------------------------------------------------------
 
 wxGTKRenderer::wxGTKRenderer(const wxColourScheme *scheme)
+             : wxStdRenderer(scheme)
 {
-    // init data
-    m_scheme = scheme;
     m_sizeScrollbarArrow = wxSize(15, 14);
 
-    // init pens
-    m_penBlack = wxPen(wxSCHEME_COLOUR(scheme, SHADOW_DARK), 0, wxSOLID);
-    m_penDarkGrey = wxPen(wxSCHEME_COLOUR(scheme, SHADOW_OUT), 0, wxSOLID);
-    m_penGrey = wxPen(wxSCHEME_COLOUR(scheme, SCROLLBAR), 0, wxSOLID);
-    m_penLightGrey = wxPen(wxSCHEME_COLOUR(scheme, SHADOW_IN), 0, wxSOLID);
-    m_penHighlight = wxPen(wxSCHEME_COLOUR(scheme, SHADOW_HIGHLIGHT), 0, wxSOLID);
+    m_penGrey = wxPen(wxSCHEME_COLOUR(scheme, SCROLLBAR));
 }
 
 // ----------------------------------------------------------------------------
 // border stuff
 // ----------------------------------------------------------------------------
 
-void wxGTKRenderer::DrawRect(wxDC& dc, wxRect *rect, const wxPen& pen)
-{
-    // draw
-    dc.SetPen(pen);
-    dc.SetBrush(*wxTRANSPARENT_BRUSH);
-    dc.DrawRectangle(*rect);
-
-    // adjust the rect
-    rect->Inflate(-1);
-}
-
-void wxGTKRenderer::DrawHalfRect(wxDC& dc, wxRect *rect, const wxPen& pen)
-{
-    // draw the bottom and right sides
-    dc.SetPen(pen);
-    dc.DrawLine(rect->GetLeft(), rect->GetBottom(),
-                rect->GetRight() + 1, rect->GetBottom());
-    dc.DrawLine(rect->GetRight(), rect->GetTop(),
-                rect->GetRight(), rect->GetBottom());
-
-    // adjust the rect
-    rect->width--;
-    rect->height--;
-}
-
-void wxGTKRenderer::DrawShadedRect(wxDC& dc, wxRect *rect,
-                                   const wxPen& pen1, const wxPen& pen2)
-{
-    // draw the rectangle
-    dc.SetPen(pen1);
-    dc.DrawLine(rect->GetLeft(), rect->GetTop(),
-                rect->GetLeft(), rect->GetBottom());
-    dc.DrawLine(rect->GetLeft() + 1, rect->GetTop(),
-                rect->GetRight(), rect->GetTop());
-    dc.SetPen(pen2);
-    dc.DrawLine(rect->GetRight(), rect->GetTop(),
-                rect->GetRight(), rect->GetBottom());
-    dc.DrawLine(rect->GetLeft(), rect->GetBottom(),
-                rect->GetRight() + 1, rect->GetBottom());
-
-    // adjust the rect
-    rect->Inflate(-1);
-}
-
 void wxGTKRenderer::DrawAntiShadedRectSide(wxDC& dc,
                                            const wxRect& rect,
                                            const wxPen& pen1,
@@ -832,10 +795,10 @@ void wxGTKRenderer::DrawAntiShadedRect(wxDC& dc, wxRect *rect,
     rect->Inflate(-1);
 }
 
-void wxGTKRenderer::DrawRaisedBorder(wxDC& dc, wxRect *rect)
+void wxGTKRenderer::DrawInnerShadedRect(wxDC& dc, wxRect *rect)
 {
-    DrawShadedRect(dc, rect, m_penHighlight, m_penBlack);
-    DrawShadedRect(dc, rect, m_penLightGrey, m_penDarkGrey);
+    DrawAntiShadedRect(dc, rect, m_penDarkGrey, m_penHighlight);
+    DrawAntiShadedRect(dc, rect, m_penBlack, m_penHighlight);
 }
 
 void wxGTKRenderer::DrawAntiRaisedBorder(wxDC& dc, wxRect *rect)
@@ -844,108 +807,20 @@ void wxGTKRenderer::DrawAntiRaisedBorder(wxDC& dc, wxRect *rect)
     DrawAntiShadedRect(dc, rect, m_penLightGrey, m_penDarkGrey);
 }
 
-void wxGTKRenderer::DrawBorder(wxDC& dc,
-                               wxBorder border,
-                               const wxRect& rectTotal,
-                               int flags,
-                               wxRect *rectIn)
-{
-    size_t width;
-
-    wxRect rect = rectTotal;
-
-    switch ( border )
-    {
-        case wxBORDER_SUNKEN:
-            for ( width = 0; width < BORDER_THICKNESS; width++ )
-            {
-                DrawAntiShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
-                DrawShadedRect(dc, &rect, m_penBlack, m_penLightGrey);
-            }
-            break;
-
-        case wxBORDER_STATIC:
-            DrawShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
-            break;
-
-        case wxBORDER_RAISED:
-            for ( width = 0; width < BORDER_THICKNESS; width++ )
-            {
-                DrawRaisedBorder(dc, &rect);
-            }
-            break;
-
-        case wxBORDER_DOUBLE:
-            DrawShadedRect(dc, &rect, m_penLightGrey, m_penBlack);
-            DrawShadedRect(dc, &rect, m_penHighlight, m_penDarkGrey);
-            DrawRect(dc, &rect, m_penLightGrey);
-            break;
-
-        case wxBORDER_SIMPLE:
-            DrawRect(dc, &rect, m_penBlack);
-            break;
-
-        default:
-            wxFAIL_MSG(_T("unknown border type"));
-            // fall through
-
-        case wxBORDER_DEFAULT:
-        case wxBORDER_NONE:
-            break;
-    }
-
-    if ( rectIn )
-        *rectIn = rect;
-}
-
-wxRect wxGTKRenderer::GetBorderDimensions(wxBorder border) const
+void wxGTKRenderer::DrawSunkenBorder(wxDC& dc, wxRect *rect)
 {
-    wxCoord width;
-    switch ( border )
-    {
-        case wxBORDER_RAISED:
-        case wxBORDER_SUNKEN:
-            width = 2*BORDER_THICKNESS;
-            break;
-
-        case wxBORDER_SIMPLE:
-        case wxBORDER_STATIC:
-            width = 1;
-            break;
-
-        case wxBORDER_DOUBLE:
-            width = 3;
-            break;
-
-        default:
-            wxFAIL_MSG(_T("unknown border type"));
-            // fall through
-
-        case wxBORDER_DEFAULT:
-        case wxBORDER_NONE:
-            width = 0;
-            break;
-    }
-
-    wxRect rect;
-    rect.x =
-    rect.y =
-    rect.width =
-    rect.height = width;
-
-    return rect;
+    DrawAntiShadedRect(dc, rect, m_penDarkGrey, m_penHighlight);
+    DrawShadedRect(dc, rect, m_penBlack, m_penLightGrey);
 }
 
-bool wxGTKRenderer::AreScrollbarsInsideBorder() const
+void
+wxGTKRenderer::DrawFocusRect(wxDC& dc, const wxRect& rect, int WXUNUSED(flags))
 {
-    // no, the scrollbars are outside the border in GTK+
-    return FALSE;
+    dc.SetBrush(*wxTRANSPARENT_BRUSH);
+    wxRect rectFocus = rect;
+    DrawRect(dc, &rectFocus, m_penBlack);
 }
 
-// ----------------------------------------------------------------------------
-// special borders
-// ----------------------------------------------------------------------------
-
 void wxGTKRenderer::DrawTextBorder(wxDC& dc,
                                    wxBorder border,
                                    const wxRect& rectOrig,
@@ -954,21 +829,37 @@ void wxGTKRenderer::DrawTextBorder(wxDC& dc,
 {
     wxRect rect = rectOrig;
 
-    if ( flags & wxCONTROL_FOCUSED )
-    {
-        DrawRect(dc, &rect, m_penBlack);
-        DrawAntiShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
-    }
-    else // !focused
+    if ( border != wxBORDER_NONE )
     {
-        DrawAntiShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
-        DrawAntiShadedRect(dc, &rect, m_penBlack, m_penHighlight);
+        if ( flags & wxCONTROL_FOCUSED )
+        {
+            DrawRect(dc, &rect, m_penBlack);
+            DrawAntiShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
+        }
+        else // !focused
+        {
+            DrawInnerShadedRect(dc, &rect);
+        }
     }
 
     if ( rectIn )
         *rectIn = rect;
 }
 
+void wxGTKRenderer::DrawButtonLabel(wxDC& dc,
+                                    const wxString& label,
+                                    const wxBitmap& image,
+                                    const wxRect& rect,
+                                    int flags,
+                                    int alignment,
+                                    int indexAccel,
+                                    wxRect *rectBounds)
+{
+    // no focus rect around buttons label in GTK+
+    wxStdRenderer::DrawButtonLabel(dc, label, image, rect, flags,
+                                   alignment, indexAccel, rectBounds);
+}
+
 void wxGTKRenderer::DrawButtonBorder(wxDC& dc,
                                      const wxRect& rectTotal,
                                      int flags,
@@ -980,13 +871,11 @@ void wxGTKRenderer::DrawButtonBorder(wxDC& dc,
     {
         // button pressed: draw a black border around it and an inward shade
         DrawRect(dc, &rect, m_penBlack);
-        DrawAntiShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
-        DrawAntiShadedRect(dc, &rect, m_penBlack, m_penDarkGrey);
+
+        DrawInnerShadedRect(dc, &rect);
     }
-    else
+    else // button not pressed
     {
-        // button not pressed
-
         if ( flags & wxCONTROL_ISDEFAULT )
         {
             // TODO
@@ -1000,193 +889,83 @@ void wxGTKRenderer::DrawButtonBorder(wxDC& dc,
 
         // now draw a normal button
         DrawShadedRect(dc, &rect, m_penHighlight, m_penBlack);
-        DrawAntiShadedRect(dc, &rect,
-                           wxPen(GetBackgroundColour(flags), 0, wxSOLID),
-                           m_penDarkGrey);
+        DrawAntiShadedRect(dc, &rect, GetBackgroundColour(flags), m_penDarkGrey);
     }
 
     if ( rectIn )
-    {
         *rectIn = rect;
-    }
 }
 
 // ----------------------------------------------------------------------------
 // lines and frames
 // ----------------------------------------------------------------------------
 
-void wxGTKRenderer::DrawHorizontalLine(wxDC& dc,
-                                       wxCoord y, wxCoord x1, wxCoord x2)
+void wxGTKRenderer::DrawFrameWithLabel(wxDC& dc,
+                                       const wxString& label,
+                                       const wxRect& rectFrame,
+                                       const wxRect& rectTextOrig,
+                                       int flags,
+                                       int alignment,
+                                       int indexAccel)
 {
-    dc.SetPen(m_penDarkGrey);
-    dc.DrawLine(x1, y, x2 + 1, y);
-    dc.SetPen(m_penHighlight);
-    y++;
-    dc.DrawLine(x1, y, x2 + 1, y);
-}
-
-void wxGTKRenderer::DrawVerticalLine(wxDC& dc,
-                                     wxCoord x, wxCoord y1, wxCoord y2)
-{
-    dc.SetPen(m_penDarkGrey);
-    dc.DrawLine(x, y1, x, y2 + 1);
-    dc.SetPen(m_penHighlight);
-    x++;
-    dc.DrawLine(x, y1, x, y2 + 1);
-}
-
-void wxGTKRenderer::DrawFrame(wxDC& dc,
-                              const wxString& label,
-                              const wxRect& rect,
-                              int flags,
-                              int alignment,
-                              int indexAccel)
-{
-    wxCoord height = 0; // of the label
-    wxRect rectFrame = rect;
-    if ( !label.empty() )
-    {
-        // the text should touch the top border of the rect, so the frame
-        // itself should be lower
-        dc.GetTextExtent(label, NULL, &height);
-        rectFrame.y += height / 2;
-        rectFrame.height -= height / 2;
-
-        // TODO: the +4 should be customizable
+    wxRect rectText(rectTextOrig);
+    rectText.Inflate(1, 0);
 
-        wxRect rectText;
-        rectText.x = rectFrame.x + 4;
-        rectText.y = rect.y;
-        rectText.width = rectFrame.width - 8;
-        rectText.height = height;
-
-        wxRect rectLabel;
-        DrawLabel(dc, label, rectText, flags, alignment, indexAccel, &rectLabel);
-        rectLabel.x -= 1;
-        rectLabel.width += 2;
+    wxRect rectLabel;
+    DrawLabel(dc, label, rectText, flags, alignment, indexAccel, &rectLabel);
+    rectLabel.x -= 1;
+    rectLabel.width += 2;
 
-        StandardDrawFrame(dc, rectFrame, rectLabel);
+    DrawFrameWithoutLabel(dc, rectFrame, rectLabel);
 
-        // GTK+ does it like this
-        dc.SetPen(m_penHighlight);
-        dc.DrawPoint(rectText.x, rectFrame.y);
-        dc.DrawPoint(rectText.x + rectLabel.width - 3, rectFrame.y);
-    }
-    else
-    {
-        // just draw the complete frame
-        DrawShadedRect(dc, &rectFrame, m_penDarkGrey, m_penHighlight);
-        DrawShadedRect(dc, &rectFrame, m_penHighlight, m_penDarkGrey);
-    }
+    // GTK+ does it like this
+    dc.SetPen(m_penHighlight);
+    dc.DrawPoint(rectText.x, rectFrame.y);
+    dc.DrawPoint(rectText.x + rectLabel.width - 3, rectFrame.y);
 }
 
 // ----------------------------------------------------------------------------
-// label
+// check/radio buttons
 // ----------------------------------------------------------------------------
 
-void wxGTKRenderer::DrawLabel(wxDC& dc,
-                              const wxString& label,
-                              const wxRect& rect,
-                              int flags,
-                              int alignment,
-                              int indexAccel,
-                              wxRect *rectBounds)
-{
-    DrawButtonLabel(dc, label, wxNullBitmap, rect, flags,
-                    alignment, indexAccel, rectBounds);
-}
-
-void wxGTKRenderer::DrawButtonLabel(wxDC& dc,
-                                    const wxString& label,
-                                    const wxBitmap& image,
-                                    const wxRect& rect,
-                                    int flags,
-                                    int alignment,
-                                    int indexAccel,
-                                    wxRect *rectBounds)
+void wxGTKRenderer::DrawCheckItemBitmap(wxDC& dc,
+                                        const wxBitmap& bitmap,
+                                        const wxRect& rect,
+                                        int flags)
 {
-    if ( flags & wxCONTROL_DISABLED )
-    {
-        // make the text grey and draw a shade for it
-        dc.SetTextForeground(*wxWHITE); // FIXME hardcoded colour
-        wxRect rectShadow = rect;
-        rectShadow.x++;
-        rectShadow.y++;
-        dc.DrawLabel(label, rectShadow, alignment, indexAccel);
-        dc.SetTextForeground(wxSCHEME_COLOUR(m_scheme, CONTROL_TEXT_DISABLED));
-    }
-
-    dc.DrawLabel(label, image, rect, alignment, indexAccel, rectBounds);
+    // never draw the focus rect around the check indicators here
+    DrawCheckButton(dc, wxEmptyString, bitmap, rect, flags & ~wxCONTROL_FOCUSED);
 }
 
-void wxGTKRenderer::DrawItem(wxDC& dc,
-                             const wxString& label,
-                             const wxRect& rect,
-                             int flags)
+void wxGTKRenderer::DrawUndeterminedBitmap(wxDC& dc,
+                                           const wxRect& rectTotal,
+                                           bool isPressed)
 {
-    wxLogTrace(_T("listbox"), _T("drawing item '%s' at (%d, %d)-(%d, %d)"),
-               label.c_str(),
-               rect.x, rect.y,
-               rect.x + rect.width, rect.y + rect.height);
-
-    wxColour colFg;
-    if ( flags & wxCONTROL_SELECTED )
-    {
-        dc.SetBrush(wxBrush(wxSCHEME_COLOUR(m_scheme, HIGHLIGHT), wxSOLID));
-        dc.SetPen(*wxTRANSPARENT_PEN);
-        dc.DrawRectangle(rect);
-
-        colFg = dc.GetTextForeground();
-        dc.SetTextForeground(wxSCHEME_COLOUR(m_scheme, HIGHLIGHT_TEXT));
-    }
-
-    if ( flags & wxCONTROL_FOCUSED )
-    {
-        dc.SetBrush(*wxTRANSPARENT_BRUSH);
-        wxRect rectFocus = rect;
-        DrawRect(dc, &rectFocus, m_penBlack);
-    }
+    // FIXME: For sure it is not GTK look but it is better than nothing.
+    // Show me correct look and I will immediatelly make it better (ABX)
+    wxRect rect = rectTotal;
 
-    wxRect rectText = rect;
-    rectText.x += 2;
-    rectText.y++;
-    dc.DrawLabel(label, wxNullBitmap, rectText);
+    wxColour col1, col2;
 
-    if ( flags & wxCONTROL_SELECTED )
+    if ( isPressed )
     {
-        dc.SetBackgroundMode(wxTRANSPARENT);
+        col1 = wxSCHEME_COLOUR(m_scheme, SHADOW_DARK);
+        col2 = wxSCHEME_COLOUR(m_scheme, CONTROL_PRESSED);
     }
-
-    // restore the text colour
-    if ( colFg.Ok() )
+    else
     {
-        dc.SetTextForeground(colFg);
+        col1 = wxSCHEME_COLOUR(m_scheme, SHADOW_DARK);
+        col2 = wxSCHEME_COLOUR(m_scheme, SHADOW_IN);
     }
-}
 
-void wxGTKRenderer::DrawCheckItem(wxDC& dc,
-                                  const wxString& label,
-                                  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, _T(""), 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);
+    dc.SetPen(*wxTRANSPARENT_PEN);
+    dc.SetBrush(col1);
+    dc.DrawRectangle(rect);
+    rect.Deflate(1);
+    dc.SetBrush(col2);
+    dc.DrawRectangle(rect);
 }
 
-// ----------------------------------------------------------------------------
-// check/radion buttons
-// ----------------------------------------------------------------------------
-
 void wxGTKRenderer::DrawUncheckBitmap(wxDC& dc,
                                       const wxRect& rectTotal,
                                       bool isPressed)
@@ -1195,7 +974,7 @@ void wxGTKRenderer::DrawUncheckBitmap(wxDC& dc,
     DrawAntiRaisedBorder(dc, &rect);
 
     wxColour col = wxSCHEME_COLOUR(m_scheme, SHADOW_IN);
-    dc.SetPen(wxPen(col, 0, wxSOLID));
+    dc.SetPen(wxPen(col));
     dc.DrawPoint(rect.GetRight() - 1, rect.GetBottom() - 1);
 
     if ( isPressed )
@@ -1203,7 +982,7 @@ void wxGTKRenderer::DrawUncheckBitmap(wxDC& dc,
     //else: it is SHADOW_IN, leave as is
 
     dc.SetPen(*wxTRANSPARENT_PEN);
-    dc.SetBrush(wxBrush(col, wxSOLID));
+    dc.SetBrush(col);
     dc.DrawRectangle(rect);
 }
 
@@ -1214,7 +993,7 @@ void wxGTKRenderer::DrawCheckBitmap(wxDC& dc, const wxRect& rectTotal)
     DrawShadedRect(dc, &rect, m_penBlack, m_penLightGrey);
 
     dc.SetPen(*wxTRANSPARENT_PEN);
-    dc.SetBrush(wxBrush(wxSCHEME_COLOUR(m_scheme, CONTROL_PRESSED), wxSOLID));
+    dc.SetBrush(wxSCHEME_COLOUR(m_scheme, CONTROL_PRESSED));
     dc.DrawRectangle(rect);
 }
 
@@ -1229,31 +1008,18 @@ void wxGTKRenderer::DrawRadioBitmap(wxDC& dc,
 
     wxCoord yMid = (y + yBottom) / 2;
 
-    // this looks ugly when the background colour of the control is not the
-    // same ours - radiobox is not transparent as it should be
-#if 0
-    // first fill the middle: as FloodFill() is not implemented on all
-    // platforms, this is the only thing to do
-    wxColour colBg = flags & wxCONTROL_CURRENT
-                        ? wxSCHEME_COLOUR(m_scheme, CONTROL_CURRENT)
-                        : wxSCHEME_COLOUR(m_scheme, SHADOW_IN);
-    dc.SetBrush(wxBrush(colBg, wxSOLID));
-    dc.SetPen(*wxTRANSPARENT_PEN);
-    dc.DrawRectangle(rect);
-#endif // 0
-
     // then draw the upper half
     dc.SetPen(flags & wxCONTROL_CHECKED ? m_penDarkGrey : m_penHighlight);
     DrawUpZag(dc, x, xRight, yMid, y);
     DrawUpZag(dc, x + 1, xRight - 1, yMid, y + 1);
 
-    bool drawIt = TRUE;
+    bool drawIt = true;
     if ( flags & wxCONTROL_CHECKED )
         dc.SetPen(m_penBlack);
     else if ( flags & wxCONTROL_PRESSED )
-        dc.SetPen(wxPen(wxSCHEME_COLOUR(m_scheme, CONTROL_PRESSED), 0, wxSOLID));
+        dc.SetPen(wxPen(wxSCHEME_COLOUR(m_scheme, CONTROL_PRESSED)));
     else // unchecked and unpressed
-        drawIt = FALSE;
+        drawIt = false;
 
     if ( drawIt )
         DrawUpZag(dc, x + 2, xRight - 2, yMid, y + 2);
@@ -1266,14 +1032,14 @@ void wxGTKRenderer::DrawRadioBitmap(wxDC& dc,
     DrawDownZag(dc, x + 1, xRight - 1, yMid, yBottom - 1);
 
     if ( !(flags & wxCONTROL_CHECKED) )
-        drawIt = TRUE; // with the same pen
+        drawIt = true; // with the same pen
     else if ( flags & wxCONTROL_PRESSED )
     {
-        dc.SetPen(wxPen(wxSCHEME_COLOUR(m_scheme, CONTROL_PRESSED), 0, wxSOLID));
-        drawIt = TRUE;
+        dc.SetPen(wxPen(wxSCHEME_COLOUR(m_scheme, CONTROL_PRESSED)));
+        drawIt = true;
     }
     else // checked and unpressed
-        drawIt = FALSE;
+        drawIt = false;
 
     if ( drawIt )
         DrawDownZag(dc, x + 2, xRight - 2, yMid, yBottom - 2);
@@ -1312,7 +1078,7 @@ wxBitmap wxGTKRenderer::GetCheckBitmap(int flags)
         rect.height = size.y;
         for ( int i = 0; i < 2; i++ )
         {
-            for ( int j = 0; j < 2; j++ )
+            for ( int j = 0; j < 3; j++ )
                 m_bitmapsCheckbox[i][j].Create(rect.width, rect.height);
         }
 
@@ -1324,23 +1090,57 @@ wxBitmap wxGTKRenderer::GetCheckBitmap(int flags)
 
         // normal unchecked
         dc.SelectObject(m_bitmapsCheckbox[0][1]);
-        DrawUncheckBitmap(dc, rect, FALSE);
+        DrawUncheckBitmap(dc, rect, false);
+
+        // normal undeterminated
+        dc.SelectObject(m_bitmapsCheckbox[0][2]);
+        DrawUndeterminedBitmap(dc, rect, false);
+
+        // pressed checked
+        m_bitmapsCheckbox[1][0] = m_bitmapsCheckbox[0][0];
+
+        // pressed unchecked
+        dc.SelectObject(m_bitmapsCheckbox[1][1]);
+        DrawUncheckBitmap(dc, rect, true);
+
+        // pressed undeterminated
+        dc.SelectObject(m_bitmapsCheckbox[1][2]);
+        DrawUndeterminedBitmap(dc, rect, true);
+    }
+
+    IndicatorState state;
+    IndicatorStatus status;
+    GetIndicatorsFromFlags(flags, state, status);
+
+    // disabled looks the same as normal
+    if ( state == IndicatorState_Disabled )
+        state = IndicatorState_Normal;
+
+    return m_bitmapsCheckbox[state][status];
+}
+
+wxBitmap wxGTKRenderer::GetRadioBitmap(int flags)
+{
+    IndicatorState state;
+    IndicatorStatus status;
+    GetIndicatorsFromFlags(flags, state, status);
+
+    wxBitmap& bmp = m_bitmapsRadiobtn[state][status];
+    if ( !bmp.Ok() )
+    {
+        const wxSize size = GetRadioBitmapSize();
 
-        // pressed checked
-        m_bitmapsCheckbox[1][0] = m_bitmapsCheckbox[0][0];
+        wxMemoryDC dc;
+        bmp.Create(size.x, size.y);
+        dc.SelectObject(bmp);
 
-        // pressed unchecked
-        dc.SelectObject(m_bitmapsCheckbox[1][1]);
-        DrawUncheckBitmap(dc, rect, TRUE);
+        DrawRadioBitmap(dc, size, flags);
     }
 
-    int row = flags & wxCONTROL_PRESSED ? 1 : 0;
-    int col = flags & wxCONTROL_CHECKED ? 0 : 1;
-
-    return m_bitmapsCheckbox[row][col];
+    return bmp;
 }
 
-wxBitmap wxGTKRenderer::GetLineWrapBitmap()
+wxBitmap wxGTKRenderer::GetLineWrapBitmap() const
 {
     if ( !m_bmpLineWrap.Ok() )
     {
@@ -1359,135 +1159,74 @@ wxBitmap wxGTKRenderer::GetLineWrapBitmap()
         }
         else
         {
-            m_bmpLineWrap = bmpLineWrap;
+            wxConstCast(this, wxGTKRenderer)->m_bmpLineWrap = bmpLineWrap;
         }
     }
 
     return m_bmpLineWrap;
 }
 
-void wxGTKRenderer::DrawCheckButton(wxDC& dc,
-                                    const wxString& label,
-                                    const wxBitmap& bitmapOrig,
-                                    const wxRect& rectTotal,
-                                    int flags,
-                                    wxAlignment align,
-                                    int indexAccel)
-{
-    wxBitmap bitmap;
-    if ( bitmapOrig.Ok() )
-    {
-        bitmap = bitmapOrig;
-    }
-    else
-    {
-        bitmap = GetCheckBitmap(flags);
-    }
-
-    DoDrawCheckOrRadioBitmap(dc, label, bitmap, rectTotal,
-                             flags, align, indexAccel);
-}
-
-void wxGTKRenderer::DoDrawCheckOrRadioBitmap(wxDC& dc,
-                                             const wxString& label,
-                                             const wxBitmap& bitmap,
-                                             const wxRect& rectTotal,
-                                             int flags,
-                                             wxAlignment align,
-                                             int indexAccel)
+#if wxUSE_TOOLBAR
+void wxGTKRenderer::DrawToolBarButton(wxDC& dc,
+                                      const wxString& label,
+                                      const wxBitmap& bitmap,
+                                      const wxRect& rectOrig,
+                                      int flags,
+                                      long WXUNUSED(style),
+                                      int tbarStyle)
 {
-    wxRect rect = rectTotal;
-
-    if ( flags & wxCONTROL_FOCUSED )
-    {
-        // draw the focus border around everything
-        DrawRect(dc, &rect, m_penBlack);
-    }
-    else
+    // we don't draw the separators at all
+    if ( !label.empty() || bitmap.Ok() )
     {
-        // the border does not offset the string under GTK
-        rect.Inflate(-1);
-    }
-
-    // calculate the position of the bitmap and of the label
-    wxCoord xBmp,
-            yBmp = rect.y + (rect.height - bitmap.GetHeight()) / 2;
+        wxRect rect = rectOrig;
+        rect.Deflate(BORDER_THICKNESS);
 
-    wxRect rectLabel;
-    dc.GetMultiLineTextExtent(label, NULL, &rectLabel.height);
-    rectLabel.y = rect.y + (rect.height - rectLabel.height) / 2;
-
-    if ( align == wxALIGN_RIGHT )
-    {
-        xBmp = rect.GetRight() - bitmap.GetWidth();
-        rectLabel.x = rect.x + 2;
-        rectLabel.SetRight(xBmp);
-    }
-    else // normal (checkbox to the left of the text) case
-    {
-        xBmp = rect.x + 2;
-        rectLabel.x = xBmp + bitmap.GetWidth() + 4;
-        rectLabel.SetRight(rect.GetRight());
-    }
+        if ( flags & wxCONTROL_PRESSED )
+        {
+            DrawBorder(dc, wxBORDER_SUNKEN, rect, flags, &rect);
 
-    dc.DrawBitmap(bitmap, xBmp, yBmp, TRUE /* use mask */);
+            DrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL_PRESSED), rect);
+        }
+        else if ( flags & wxCONTROL_CURRENT )
+        {
+            DrawBorder(dc, wxBORDER_RAISED, rect, flags, &rect);
 
-    DrawLabel(dc, label, rectLabel, flags,
-              wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL, indexAccel);
-}
+            DrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL_CURRENT), rect);
+        }
 
-void wxGTKRenderer::DrawRadioButton(wxDC& dc,
-                                    const wxString& label,
-                                    const wxBitmap& bitmapOrig,
-                                    const wxRect& rectTotal,
-                                    int flags,
-                                    wxAlignment align,
-                                    int indexAccel)
-{
-    wxBitmap bitmap;
-    if ( bitmapOrig.Ok() )
-    {
-        bitmap = bitmapOrig;
-    }
-    else
-    {
-        wxRect rect;
-        wxSize size = GetRadioBitmapSize();
-        rect.width = size.x;
-        rect.height = size.y;
-        bitmap.Create(rect.width, rect.height);
-        wxMemoryDC dc;
-        dc.SelectObject(bitmap);
-        dc.SetBackground(*wxLIGHT_GREY_BRUSH);
-        dc.Clear();
-        DrawRadioBitmap(dc, rect, flags);
-        bitmap.SetMask(new wxMask(bitmap, *wxLIGHT_GREY));
+        if(tbarStyle & wxTB_TEXT)
+        {
+            if(tbarStyle & wxTB_HORIZONTAL)
+            {
+                dc.DrawLabel(label, bitmap, rect, wxALIGN_CENTRE);
+            }
+            else
+            {
+                dc.DrawLabel(label, bitmap, rect, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
+            }
+        }
+        else
+        {
+            int xpoint = (rect.GetLeft() + rect.GetRight() + 1 - bitmap.GetWidth()) / 2;
+            int ypoint = (rect.GetTop() + rect.GetBottom() + 1 - bitmap.GetHeight()) / 2;
+            dc.DrawBitmap(bitmap, xpoint, ypoint);
+        }
     }
-
-    DoDrawCheckOrRadioBitmap(dc, label, bitmap, rectTotal,
-                             flags, align, indexAccel);
 }
+#endif // wxUSE_TOOLBAR
 
 // ----------------------------------------------------------------------------
 // text control
 // ----------------------------------------------------------------------------
 
-static const int TEXT_BORDER = 2;
-
-wxRect wxGTKRenderer::GetTextTotalArea(const wxTextCtrl *text,
-                                       const wxRect& rect)
-{
-    wxRect rectTotal = rect;
-    rectTotal.Inflate(TEXT_BORDER);
-    return rectTotal;
-}
+#if wxUSE_TEXTCTRL
 
 wxRect wxGTKRenderer::GetTextClientArea(const wxTextCtrl *text,
                                         const wxRect& rect,
-                                        wxCoord *extraSpaceBeyond)
+                                        wxCoord *extraSpaceBeyond) const
 {
-    wxRect rectText = rect;
-    rectText.Inflate(-TEXT_BORDER);
+    wxRect
+      rectText = wxStdRenderer::GetTextClientArea(text, rect, extraSpaceBeyond);
 
     if ( text->WrapLines() )
     {
@@ -1503,18 +1242,6 @@ wxRect wxGTKRenderer::GetTextClientArea(const wxTextCtrl *text,
     return rectText;
 }
 
-void wxGTKRenderer::DrawTextLine(wxDC& dc,
-                                 const wxString& text,
-                                 const wxRect& rect,
-                                 int selStart,
-                                 int selEnd,
-                                 int flags)
-{
-    // TODO: GTK+ draws selection even for unfocused controls, just with
-    //       different colours
-    StandardDrawTextLine(dc, text, rect, selStart, selEnd, flags);
-}
-
 void wxGTKRenderer::DrawLineWrapMark(wxDC& dc, const wxRect& rect)
 {
     wxBitmap bmpLineWrap = GetLineWrapBitmap();
@@ -1540,10 +1267,14 @@ void wxGTKRenderer::DrawLineWrapMark(wxDC& dc, const wxRect& rect)
     }
 }
 
+#endif // wxUSE_TEXTCTRL
+
 // ----------------------------------------------------------------------------
 // notebook
 // ----------------------------------------------------------------------------
 
+#if wxUSE_NOTEBOOK
+
 void wxGTKRenderer::DrawTab(wxDC& dc,
                             const wxRect& rectOrig,
                             wxDirection dir,
@@ -1552,13 +1283,23 @@ void wxGTKRenderer::DrawTab(wxDC& dc,
                             int flags,
                             int indexAccel)
 {
+    #define SELECT_FOR_VERTICAL(X,Y) ( isVertical ? Y : X )
+    #define REVERSE_FOR_VERTICAL(X,Y) \
+        SELECT_FOR_VERTICAL(X,Y)      \
+        ,                             \
+        SELECT_FOR_VERTICAL(Y,X)
+
     wxRect rect = rectOrig;
 
+    bool isVertical = ( dir == wxLEFT ) || ( dir == wxRIGHT );
+
     // the current tab is drawn indented (to the top for default case) and
     // bigger than the other ones
     const wxSize indent = GetTabIndent();
     if ( flags & wxCONTROL_SELECTED )
     {
+        rect.Inflate( SELECT_FOR_VERTICAL( indent.x , 0),
+                      SELECT_FOR_VERTICAL( 0, indent.y ));
         switch ( dir )
         {
             default:
@@ -1566,19 +1307,17 @@ void wxGTKRenderer::DrawTab(wxDC& dc,
                 // fall through
 
             case wxTOP:
-                rect.Inflate(indent.x, 0);
                 rect.y -= indent.y;
-                rect.height += indent.y;
-                break;
-
+                // fall through
             case wxBOTTOM:
-                rect.Inflate(indent.x, 0);
                 rect.height += indent.y;
                 break;
 
             case wxLEFT:
+                rect.x -= indent.x;
+                // fall through
             case wxRIGHT:
-                wxFAIL_MSG(_T("TODO"));
+                rect.width += indent.x;
                 break;
         }
     }
@@ -1587,7 +1326,7 @@ void wxGTKRenderer::DrawTab(wxDC& dc,
     wxColour col = flags & wxCONTROL_SELECTED
                         ? wxSCHEME_COLOUR(m_scheme, SHADOW_IN)
                         : wxSCHEME_COLOUR(m_scheme, SCROLLBAR);
-    DoDrawBackground(dc, col, rect);
+    DrawSolidRect(dc, col, rect);
 
     if ( flags & wxCONTROL_FOCUSED )
     {
@@ -1596,102 +1335,159 @@ void wxGTKRenderer::DrawTab(wxDC& dc,
         rectBorder.Deflate(4, 3);
         if ( dir == wxBOTTOM )
             rectBorder.Offset(0, -1);
+        if ( dir == wxRIGHT )
+            rectBorder.Offset(-1, 0);
 
         DrawRect(dc, &rectBorder, m_penBlack);
     }
 
     // draw the text, image and the focus around them (if necessary)
-    wxRect rectLabel = rect;
+    wxRect rectLabel( REVERSE_FOR_VERTICAL(rect.x,rect.y),
+                      REVERSE_FOR_VERTICAL(rect.width,rect.height)
+                    );
     rectLabel.Deflate(1, 1);
-    dc.DrawLabel(label, bitmap, rectLabel, wxALIGN_CENTRE, indexAccel);
+    if ( isVertical )
+    {
+        // draw it horizontally into memory and rotate for screen
+        wxMemoryDC dcMem;
+        wxBitmap bitmapRotated,
+                 bitmapMem( rectLabel.x + rectLabel.width,
+                            rectLabel.y + rectLabel.height );
+        dcMem.SelectObject(bitmapMem);
+        dcMem.SetBackground(dc.GetBackground());
+        dcMem.SetFont(dc.GetFont());
+        dcMem.SetTextForeground(dc.GetTextForeground());
+        dcMem.Clear();
+        bitmapRotated =
+#if wxUSE_IMAGE
+                        wxBitmap( wxImage( bitmap.ConvertToImage() ).Rotate90(dir==wxLEFT) )
+#else
+                        bitmap
+#endif // wxUSE_IMAGE
+                        ;
+        dcMem.DrawLabel(label, bitmapRotated, rectLabel, wxALIGN_CENTRE, indexAccel);
+        dcMem.SelectObject(wxNullBitmap);
+        bitmapMem = bitmapMem.GetSubBitmap(rectLabel);
+#if wxUSE_IMAGE
+        bitmapMem = wxBitmap(wxImage(bitmapMem.ConvertToImage()).Rotate90(dir==wxRIGHT))
+#endif
+                    ;
+
+        dc.DrawBitmap(bitmapMem, rectLabel.y, rectLabel.x, false);
+    }
+    else
+    {
+        dc.DrawLabel(label, bitmap, rectLabel, wxALIGN_CENTRE, indexAccel);
+    }
 
     // now draw the tab itself
-    wxCoord x = rect.x,
-            y = rect.y,
-            x2 = rect.GetRight(),
-            y2 = rect.GetBottom();
+    wxCoord x = SELECT_FOR_VERTICAL(rect.x,rect.y),
+            y = SELECT_FOR_VERTICAL(rect.y,rect.x),
+            x2 = SELECT_FOR_VERTICAL(rect.GetRight(),rect.GetBottom()),
+            y2 = SELECT_FOR_VERTICAL(rect.GetBottom(),rect.GetRight());
     switch ( dir )
     {
         default:
+            // default is top
+        case wxLEFT:
+            // left orientation looks like top but IsVertical makes x and y reversed
         case wxTOP:
+            // top is not vertical so use coordinates in written order
             dc.SetPen(m_penHighlight);
-            dc.DrawLine(x, y2, x, y);
-            dc.DrawLine(x + 1, y, x2, y);
+            dc.DrawLine(REVERSE_FOR_VERTICAL(x, y2),
+                        REVERSE_FOR_VERTICAL(x, y));
+            dc.DrawLine(REVERSE_FOR_VERTICAL(x + 1, y),
+                        REVERSE_FOR_VERTICAL(x2, y));
 
             dc.SetPen(m_penBlack);
-            dc.DrawLine(x2, y2, x2, y);
+            dc.DrawLine(REVERSE_FOR_VERTICAL(x2, y2),
+                        REVERSE_FOR_VERTICAL(x2, y));
 
             dc.SetPen(m_penDarkGrey);
-            dc.DrawLine(x2 - 1, y2, x2 - 1, y + 1);
+            dc.DrawLine(REVERSE_FOR_VERTICAL(x2 - 1, y2),
+                        REVERSE_FOR_VERTICAL(x2 - 1, y + 1));
 
             if ( flags & wxCONTROL_SELECTED )
             {
                 dc.SetPen(m_penLightGrey);
 
                 // overwrite the part of the border below this tab
-                dc.DrawLine(x + 1, y2 + 1, x2 - 1, y2 + 1);
+                dc.DrawLine(REVERSE_FOR_VERTICAL(x + 1, y2 + 1),
+                            REVERSE_FOR_VERTICAL(x2 - 1, y2 + 1));
 
                 // and the shadow of the tab to the left of us
-                dc.DrawLine(x + 1, y + 2, x + 1, y2 + 1);
+                dc.DrawLine(REVERSE_FOR_VERTICAL(x + 1, y + 2),
+                            REVERSE_FOR_VERTICAL(x + 1, y2 + 1));
             }
             break;
 
+        case wxRIGHT:
+            // right orientation looks like bottom but IsVertical makes x and y reversed
         case wxBOTTOM:
+            // bottom is not vertical so use coordinates in written order
             dc.SetPen(m_penHighlight);
 
             // we need to continue one pixel further to overwrite the corner of
             // the border for the selected tab
-            dc.DrawLine(x, y - (flags & wxCONTROL_SELECTED ? 1 : 0),
-                        x, y2);
+            dc.DrawLine(REVERSE_FOR_VERTICAL(x, y - (flags & wxCONTROL_SELECTED ? 1 : 0)),
+                        REVERSE_FOR_VERTICAL(x, y2));
 
             // it doesn't work like this (TODO: implement it properly)
 #if 0
             // erase the corner of the tab to the right
             dc.SetPen(m_penLightGrey);
-            dc.DrawPoint(x2 - 1, y - 2);
-            dc.DrawPoint(x2 - 2, y - 2);
-            dc.DrawPoint(x2 - 2, y - 1);
+            dc.DrawPoint(REVERSE_FOR_VERTICAL(x2 - 1, y - 2));
+            dc.DrawPoint(REVERSE_FOR_VERTICAL(x2 - 2, y - 2));
+            dc.DrawPoint(REVERSE_FOR_VERTICAL(x2 - 2, y - 1));
 #endif // 0
 
             dc.SetPen(m_penBlack);
-            dc.DrawLine(x + 1, y2, x2, y2);
-            dc.DrawLine(x2, y, x2, y2);
+            dc.DrawLine(REVERSE_FOR_VERTICAL(x + 1, y2),
+                        REVERSE_FOR_VERTICAL(x2, y2));
+            dc.DrawLine(REVERSE_FOR_VERTICAL(x2, y),
+                        REVERSE_FOR_VERTICAL(x2, y2));
 
             dc.SetPen(m_penDarkGrey);
-            dc.DrawLine(x + 2, y2 - 1, x2 - 1, y2 - 1);
-            dc.DrawLine(x2 - 1, y, x2 - 1, y2);
+            dc.DrawLine(REVERSE_FOR_VERTICAL(x + 2, y2 - 1),
+                        REVERSE_FOR_VERTICAL(x2 - 1, y2 - 1));
+            dc.DrawLine(REVERSE_FOR_VERTICAL(x2 - 1, y),
+                        REVERSE_FOR_VERTICAL(x2 - 1, y2));
 
             if ( flags & wxCONTROL_SELECTED )
             {
                 dc.SetPen(m_penLightGrey);
 
                 // overwrite the part of the (double!) border above this tab
-                dc.DrawLine(x + 1, y - 1, x2 - 1, y - 1);
-                dc.DrawLine(x + 1, y - 2, x2 - 1, y - 2);
+                dc.DrawLine(REVERSE_FOR_VERTICAL(x + 1, y - 1),
+                            REVERSE_FOR_VERTICAL(x2 - 1, y - 1));
+                dc.DrawLine(REVERSE_FOR_VERTICAL(x + 1, y - 2),
+                            REVERSE_FOR_VERTICAL(x2 - 1, y - 2));
 
                 // and the shadow of the tab to the left of us
-                dc.DrawLine(x + 1, y2 - 1, x + 1, y - 1);
+                dc.DrawLine(REVERSE_FOR_VERTICAL(x + 1, y2 - 1),
+                            REVERSE_FOR_VERTICAL(x + 1, y - 1));
             }
             break;
-
-        case wxLEFT:
-        case wxRIGHT:
-            wxFAIL_MSG(_T("TODO"));
     }
 }
 
+#endif // wxUSE_NOTEBOOK
+
 // ----------------------------------------------------------------------------
 // slider
 // ----------------------------------------------------------------------------
 
+#if wxUSE_SLIDER
+
 wxSize wxGTKRenderer::GetSliderThumbSize(const wxRect& rect,
+                                         int lenThumb,
                                          wxOrientation orient) const
 {
     static const wxCoord SLIDER_THUMB_LENGTH = 30;
 
     wxSize size;
 
-    wxRect rectShaft = GetSliderShaftRect(rect, orient);
+    wxRect rectShaft = GetSliderShaftRect(rect, lenThumb, orient);
     if ( orient == wxHORIZONTAL )
     {
         size.x = wxMin(SLIDER_THUMB_LENGTH, rectShaft.width);
@@ -1707,15 +1503,19 @@ wxSize wxGTKRenderer::GetSliderThumbSize(const wxRect& rect,
 }
 
 wxRect wxGTKRenderer::GetSliderShaftRect(const wxRect& rect,
-                                         wxOrientation WXUNUSED(orient)) const
+                                         int WXUNUSED(lenThumb),
+                                         wxOrientation WXUNUSED(orient),
+                                         long WXUNUSED(style)) const
 {
     return rect.Deflate(2*BORDER_THICKNESS, 2*BORDER_THICKNESS);
 }
 
 void wxGTKRenderer::DrawSliderShaft(wxDC& dc,
                                     const wxRect& rectOrig,
-                                    wxOrientation orient,
+                                    int WXUNUSED(lenThumb),
+                                    wxOrientation WXUNUSED(orient),
                                     int flags,
+                                    long WXUNUSED(style),
                                     wxRect *rectShaft)
 {
     wxRect rect = rectOrig;
@@ -1724,16 +1524,16 @@ void wxGTKRenderer::DrawSliderShaft(wxDC& dc,
     if ( flags & wxCONTROL_FOCUSED )
     {
         DrawRect(dc, &rect, m_penBlack);
-        DrawAntiShadedRect(dc, &rect, m_penBlack, m_penLightGrey);
     }
     else // not focused, normal
     {
         DrawAntiShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
-        DrawAntiShadedRect(dc, &rect, m_penBlack, m_penLightGrey);
     }
 
+    DrawAntiShadedRect(dc, &rect, m_penBlack, m_penLightGrey);
+
     // and the background
-    DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, SCROLLBAR), rect);
+    DrawSolidRect(dc, wxSCHEME_COLOUR(m_scheme, SCROLLBAR), rect);
 
     if ( rectShaft )
         *rectShaft = rect;
@@ -1742,7 +1542,8 @@ void wxGTKRenderer::DrawSliderShaft(wxDC& dc,
 void wxGTKRenderer::DrawSliderThumb(wxDC& dc,
                                     const wxRect& rectOrig,
                                     wxOrientation orient,
-                                    int flags)
+                                    int WXUNUSED(flags),
+                                    long WXUNUSED(style))
 {
     // draw the thumb border
     wxRect rect = rectOrig;
@@ -1763,51 +1564,275 @@ void wxGTKRenderer::DrawSliderThumb(wxDC& dc,
     DrawShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
 }
 
+#endif // wxUSE_SLIDER
+
 #if wxUSE_MENUS
+
 // ----------------------------------------------------------------------------
 // menu and menubar
 // ----------------------------------------------------------------------------
 
+// wxGTKMenuGeometryInfo: the wxMenuGeometryInfo used by wxGTKRenderer
+class wxGTKMenuGeometryInfo : public wxMenuGeometryInfo
+{
+public:
+    virtual wxSize GetSize() const { return m_size; }
+
+    wxCoord GetLabelOffset() const { return m_ofsLabel; }
+    wxCoord GetAccelOffset() const { return m_ofsAccel; }
+
+    wxCoord GetItemHeight() const { return m_heightItem; }
+
+private:
+    // the total size of the menu
+    wxSize m_size;
+
+    // the offset of the start of the menu item label
+    wxCoord m_ofsLabel;
+
+    // the offset of the start of the accel label
+    wxCoord m_ofsAccel;
+
+    // the height of a normal (not separator) item
+    wxCoord m_heightItem;
+
+    friend wxMenuGeometryInfo *
+        wxGTKRenderer::GetMenuGeometry(wxWindow *, const wxMenu&) const;
+};
+
+// FIXME: all constants are hardcoded but shouldn't be
+static const wxCoord MENU_LEFT_MARGIN = 9;
+static const wxCoord MENU_RIGHT_MARGIN = 6;
+
+static const wxCoord MENU_HORZ_MARGIN = 6;
+static const wxCoord MENU_VERT_MARGIN = 3;
+
+// the margin around bitmap/check marks (on each side)
+static const wxCoord MENU_BMP_MARGIN = 2;
+
+// the margin between the labels and accel strings
+static const wxCoord MENU_ACCEL_MARGIN = 8;
+
+// the separator height in pixels: in fact, strangely enough, the real height
+// is 2 but Windows adds one extra pixel in the bottom margin, so take it into
+// account here
+static const wxCoord MENU_SEPARATOR_HEIGHT = 3;
+
+// the size of the standard checkmark bitmap
+static const wxCoord MENU_CHECK_SIZE = 9;
+
 void wxGTKRenderer::DrawMenuBarItem(wxDC& dc,
                                     const wxRect& rect,
                                     const wxString& label,
                                     int flags,
                                     int indexAccel)
 {
-    DrawLabel(dc, label, rect, flags, wxALIGN_CENTRE, indexAccel);
+    DoDrawMenuItem(dc, rect, label, flags, indexAccel);
 }
 
 void wxGTKRenderer::DrawMenuItem(wxDC& dc,
                                  wxCoord y,
-                                 const wxMenuGeometryInfo& geometryInfo,
+                                 const wxMenuGeometryInfo& gi,
                                  const wxString& label,
                                  const wxString& accel,
                                  const wxBitmap& bitmap,
                                  int flags,
                                  int indexAccel)
 {
-    wxFAIL_MSG(_T("TODO"));
+    const wxGTKMenuGeometryInfo& geomInfo = (const wxGTKMenuGeometryInfo&)gi;
+
+    wxRect rect;
+    rect.x = 0;
+    rect.y = y;
+    rect.width = geomInfo.GetSize().x;
+    rect.height = geomInfo.GetItemHeight();
+
+    DoDrawMenuItem(dc, rect, label, flags, indexAccel, accel, bitmap, &geomInfo);
+}
+
+void wxGTKRenderer::DoDrawMenuItem(wxDC& dc,
+                                   const wxRect& rectOrig,
+                                   const wxString& label,
+                                   int flags,
+                                   int indexAccel,
+                                   const wxString& accel,
+                                   const wxBitmap& bitmap,
+                                   const wxGTKMenuGeometryInfo *geometryInfo)
+{
+    wxRect rect = rectOrig;
+
+    // draw the selected item specially
+    if ( flags & wxCONTROL_SELECTED )
+    {
+        wxRect rectIn;
+        DrawBorder(dc, wxBORDER_RAISED, rect, flags, &rectIn);
+
+        DrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL_CURRENT), rectIn);
+    }
+
+    rect.Deflate(MENU_HORZ_MARGIN, MENU_VERT_MARGIN);
+
+    // draw the bitmap: use the bitmap provided or the standard checkmark for
+    // the checkable items
+    if ( geometryInfo )
+    {
+        wxBitmap bmp = bitmap;
+        if ( !bmp.Ok() && (flags & wxCONTROL_CHECKABLE) )
+        {
+            bmp = GetCheckBitmap(flags);
+        }
+
+        if ( bmp.Ok() )
+        {
+            rect.SetRight(geometryInfo->GetLabelOffset());
+            wxControlRenderer::DrawBitmap(dc, bmp, rect);
+        }
+    }
+    //else: menubar items don't have bitmaps
+
+    // draw the label
+    if ( geometryInfo )
+    {
+        rect.x = geometryInfo->GetLabelOffset();
+        rect.SetRight(geometryInfo->GetAccelOffset());
+    }
+
+    DrawLabel(dc, label, rect, flags, wxALIGN_CENTRE_VERTICAL, indexAccel);
+
+    // draw the accel string
+    if ( !accel.empty() )
+    {
+        // menubar items shouldn't have them
+        wxCHECK_RET( geometryInfo, _T("accel strings only valid for menus") );
+
+        rect.x = geometryInfo->GetAccelOffset();
+        rect.SetRight(geometryInfo->GetSize().x);
+
+        // NB: no accel index here
+        DrawLabel(dc, accel, rect, flags, wxALIGN_CENTRE_VERTICAL);
+    }
+
+    // draw the submenu indicator
+    if ( flags & wxCONTROL_ISSUBMENU )
+    {
+        wxCHECK_RET( geometryInfo, _T("wxCONTROL_ISSUBMENU only valid for menus") );
+
+        rect.x = geometryInfo->GetSize().x - MENU_RIGHT_MARGIN;
+        rect.width = MENU_RIGHT_MARGIN;
+
+        DrawArrow(dc, wxRIGHT, rect, flags);
+    }
 }
 
 void wxGTKRenderer::DrawMenuSeparator(wxDC& dc,
                                       wxCoord y,
                                       const wxMenuGeometryInfo& geomInfo)
 {
-    wxFAIL_MSG(_T("TODO"));
+    DrawHorizontalLine(dc, y + MENU_VERT_MARGIN, 0, geomInfo.GetSize().x);
 }
 
 wxSize wxGTKRenderer::GetMenuBarItemSize(const wxSize& sizeText) const
 {
-    return sizeText;
+    wxSize size = sizeText;
+
+    // TODO: make this configurable
+    size.x += 2*MENU_HORZ_MARGIN;
+    size.y += 2*MENU_VERT_MARGIN;
+
+    return size;
 }
 
 wxMenuGeometryInfo *wxGTKRenderer::GetMenuGeometry(wxWindow *win,
                                                    const wxMenu& menu) const
 {
-    wxFAIL_MSG(_T("TODO"));
+    // prepare the dc: for now we draw all the items with the system font
+    wxClientDC dc(win);
+    dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
+
+    // the height of a normal item
+    wxCoord heightText = dc.GetCharHeight();
+
+    // the total height
+    wxCoord height = 0;
+
+    // the max length of label and accel strings: the menu width is the sum of
+    // them, even if they're for different items (as the accels should be
+    // aligned)
+    //
+    // the max length of the bitmap is never 0 as Windows always leaves enough
+    // space for a check mark indicator
+    wxCoord widthLabelMax = 0,
+            widthAccelMax = 0,
+            widthBmpMax = MENU_LEFT_MARGIN;
+
+    for ( wxMenuItemList::compatibility_iterator node = menu.GetMenuItems().GetFirst();
+          node;
+          node = node->GetNext() )
+    {
+        // height of this item
+        wxCoord h;
+
+        wxMenuItem *item = node->GetData();
+        if ( item->IsSeparator() )
+        {
+            h = MENU_SEPARATOR_HEIGHT;
+        }
+        else // not separator
+        {
+            h = heightText;
+
+            wxCoord widthLabel;
+            dc.GetTextExtent(item->GetLabel(), &widthLabel, NULL);
+            if ( widthLabel > widthLabelMax )
+            {
+                widthLabelMax = widthLabel;
+            }
+
+            wxCoord widthAccel;
+            dc.GetTextExtent(item->GetAccelString(), &widthAccel, NULL);
+            if ( widthAccel > widthAccelMax )
+            {
+                widthAccelMax = widthAccel;
+            }
+
+            const wxBitmap& bmp = item->GetBitmap();
+            if ( bmp.Ok() )
+            {
+                wxCoord widthBmp = bmp.GetWidth();
+                if ( widthBmp > widthBmpMax )
+                    widthBmpMax = widthBmp;
+            }
+            //else if ( item->IsCheckable() ): no need to check for this as
+            // MENU_LEFT_MARGIN is big enough to show the check mark
+        }
+
+        h += 2*MENU_VERT_MARGIN;
+
+        // remember the item position and height
+        item->SetGeometry(height, h);
+
+        height += h;
+    }
+
+    // bundle the metrics into a struct and return it
+    wxGTKMenuGeometryInfo *gi = new wxGTKMenuGeometryInfo;
+
+    gi->m_ofsLabel = widthBmpMax + 2*MENU_BMP_MARGIN;
+    gi->m_ofsAccel = gi->m_ofsLabel + widthLabelMax;
+    if ( widthAccelMax > 0 )
+    {
+        // if we actually have any accesl, add a margin
+        gi->m_ofsAccel += MENU_ACCEL_MARGIN;
+    }
+
+    gi->m_heightItem = heightText + 2*MENU_VERT_MARGIN;
 
-    return NULL;
+    gi->m_size.x = gi->m_ofsAccel + widthAccelMax + MENU_RIGHT_MARGIN;
+    gi->m_size.y = height;
+
+    return gi;
 }
+
 #endif // wxUSE_MENUS
 
 // ----------------------------------------------------------------------------
@@ -1835,7 +1860,7 @@ void wxGTKRenderer::InitComboBitmaps()
         wxCONTROL_DISABLED,
     };
 
-    wxRect rect(wxPoint(0, 0), sizeArrow);
+    wxRect rect(sizeArrow);
 
     wxMemoryDC dc;
     for ( n = ComboState_Normal; n < ComboState_Max; n++ )
@@ -1843,7 +1868,7 @@ void wxGTKRenderer::InitComboBitmaps()
         int flags = comboButtonFlags[n];
 
         dc.SelectObject(m_bitmapsCombo[n]);
-        DoDrawBackground(dc, GetBackgroundColour(flags), rect);
+        DrawSolidRect(dc, GetBackgroundColour(flags), rect);
         DrawArrow(dc, wxDOWN, rect, flags);
     }
 }
@@ -1868,29 +1893,6 @@ void wxGTKRenderer::GetComboBitmaps(wxBitmap *bmpNormal,
         *bmpDisabled = m_bitmapsCombo[ComboState_Disabled];
 }
 
-// ----------------------------------------------------------------------------
-// background
-// ----------------------------------------------------------------------------
-
-void wxGTKRenderer::DoDrawBackground(wxDC& dc,
-                                     const wxColour& col,
-                                     const wxRect& rect)
-{
-    wxBrush brush(col, wxSOLID);
-    dc.SetBrush(brush);
-    dc.SetPen(*wxTRANSPARENT_PEN);
-    dc.DrawRectangle(rect);
-}
-
-void wxGTKRenderer::DrawBackground(wxDC& dc,
-                                   const wxColour& col,
-                                   const wxRect& rect,
-                                   int flags)
-{
-    wxColour colBg = col.Ok() ? col : GetBackgroundColour(flags);
-    DoDrawBackground(dc, colBg, rect);
-}
-
 // ----------------------------------------------------------------------------
 // scrollbar
 // ----------------------------------------------------------------------------
@@ -1912,7 +1914,7 @@ void wxGTKRenderer::DrawArrowBorder(wxDC& dc,
     rect2.Inflate(-1);
     rectInner.Inflate(-2);
 
-    DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, SCROLLBAR), *rect);
+    DrawSolidRect(dc, wxSCHEME_COLOUR(m_scheme, SCROLLBAR), *rect);
 
     // find the side not to draw and also adjust the rectangles to compensate
     // for it
@@ -2044,7 +2046,7 @@ void wxGTKRenderer::DrawArrow(wxDC& dc,
 
     // draw the arrow interior
     dc.SetPen(*wxTRANSPARENT_PEN);
-    dc.SetBrush(wxBrush(colInside, wxSOLID));
+    dc.SetBrush(colInside);
 
     switch ( dir )
     {
@@ -2219,59 +2221,11 @@ void wxGTKRenderer::DrawScrollbarThumb(wxDC& dc,
 void wxGTKRenderer::DrawScrollbarShaft(wxDC& dc,
                                        wxOrientation orient,
                                        const wxRect& rect,
-                                       int flags)
+                                       int WXUNUSED(flags))
 {
     wxRect rectBar = rect;
     DrawThumbBorder(dc, &rectBar, orient);
-    DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, SCROLLBAR), rectBar);
-}
-
-void wxGTKRenderer::DrawScrollCorner(wxDC& dc, const wxRect& rect)
-{
-    DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect);
-}
-
-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 StandardGetScrollbarRect(scrollbar, elem,
-                                    thumbPos,
-                                    GetScrollbarArrowSize(scrollbar));
-}
-
-wxCoord wxGTKRenderer::GetScrollbarSize(const wxScrollBar *scrollbar)
-{
-    return StandardScrollBarSize(scrollbar, GetScrollbarArrowSize(scrollbar));
-}
-
-wxHitTest wxGTKRenderer::HitTestScrollbar(const wxScrollBar *scrollbar,
-                                          const wxPoint& pt) const
-{
-    return StandardHitTestScrollbar(scrollbar, pt,
-                                    GetScrollbarArrowSize(scrollbar));
-}
-
-wxCoord wxGTKRenderer::ScrollbarToPixel(const wxScrollBar *scrollbar,
-                                        int thumbPos)
-{
-    return StandardScrollbarToPixel(scrollbar, thumbPos,
-                                    GetScrollbarArrowSize(scrollbar));
-}
-
-int wxGTKRenderer::PixelToScrollbar(const wxScrollBar *scrollbar,
-                                    wxCoord coord)
-{
-    return StandardPixelToScrollbar(scrollbar, coord,
-                                    GetScrollbarArrowSize(scrollbar));
+    DrawSolidRect(dc, wxSCHEME_COLOUR(m_scheme, SCROLLBAR), rectBar);
 }
 
 // ----------------------------------------------------------------------------
@@ -2280,7 +2234,22 @@ int wxGTKRenderer::PixelToScrollbar(const wxScrollBar *scrollbar,
 
 void wxGTKRenderer::AdjustSize(wxSize *size, const wxWindow *window)
 {
-    if ( wxDynamicCast(window, wxButton) )
+#if wxUSE_BMPBUTTON
+    if ( wxDynamicCast(window, wxBitmapButton) )
+    {
+        size->x += 4;
+        size->y += 4;
+    } else
+#endif // wxUSE_BMPBUTTON
+#if wxUSE_BUTTON || wxUSE_TOGGLEBTN
+    if ( 0
+#  if wxUSE_BUTTON
+         || wxDynamicCast(window, wxButton)
+#  endif // wxUSE_BUTTON
+#  if wxUSE_TOGGLEBTN
+         || wxDynamicCast(window, wxToggleButton)
+#  endif // wxUSE_TOGGLEBTN
+        )
     {
         if ( !(window->GetWindowStyle() & wxBU_EXACTFIT) )
         {
@@ -2293,8 +2262,10 @@ void wxGTKRenderer::AdjustSize(wxSize *size, const wxWindow *window)
             // button border width
             size->y += 4;
         }
-    }
-    else if ( wxDynamicCast(window, wxScrollBar) )
+    } else
+#endif // wxUSE_BUTTON || wxUSE_TOGGLEBTN
+#if wxUSE_SCROLLBAR
+    if ( wxDynamicCast(window, wxScrollBar) )
     {
         // we only set the width of vert scrollbars and height of the
         // horizontal ones
@@ -2304,14 +2275,296 @@ void wxGTKRenderer::AdjustSize(wxSize *size, const wxWindow *window)
             size->x = m_sizeScrollbarArrow.x;
     }
     else
+#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);
     }
 }
 
+// ----------------------------------------------------------------------------
+// standard icons
+// ----------------------------------------------------------------------------
+
+/* Copyright (c) Julian Smart */
+static const char *error_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"48 48 4 1",
+"  c None",
+"X c #242424",
+"o c #DCDF00",
+". c #C00000",
+/* pixels */
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                    .....                       ",
+"                .............                   ",
+"              .................                 ",
+"             ...................                ",
+"           .......................              ",
+"          .........................             ",
+"         ...........................            ",
+"         ...........................X           ",
+"        .............................X          ",
+"       ...............................          ",
+"       ...............................X         ",
+"      .................................X        ",
+"      .................................X        ",
+"      .................................XX       ",
+"      ...ooooooooooooooooooooooooooo...XX       ",
+"     ....ooooooooooooooooooooooooooo....X       ",
+"     ....ooooooooooooooooooooooooooo....X       ",
+"     ....ooooooooooooooooooooooooooo....XX      ",
+"     ....ooooooooooooooooooooooooooo....XX      ",
+"     ....ooooooooooooooooooooooooooo....XX      ",
+"      ...ooooooooooooooooooooooooooo...XXX      ",
+"      ...ooooooooooooooooooooooooooo...XXX      ",
+"      .................................XX       ",
+"      .................................XX       ",
+"       ...............................XXX       ",
+"       ...............................XXX       ",
+"        .............................XXX        ",
+"         ...........................XXXX        ",
+"         ...........................XXX         ",
+"          .........................XXX          ",
+"           .......................XXXX          ",
+"            X...................XXXXX           ",
+"             X.................XXXXX            ",
+"               X.............XXXXX              ",
+"                XXXX.....XXXXXXXX               ",
+"                  XXXXXXXXXXXXX                 ",
+"                      XXXXX                     ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                "
+};
+
+/* Copyright (c) Julian Smart */
+static const char *info_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"48 48 9 1",
+"$ c Black",
+"O c #FFFFFF",
+"@ c #808080",
+"+ c #000080",
+"o c #E8EB01",
+"  c None",
+"X c #FFFF40",
+"# c #C0C0C0",
+". c #ABAD01",
+/* pixels */
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                     .....                      ",
+"                   ..XXXXX..                    ",
+"                 ..XXXXXXXXo..                  ",
+"                .XXXOXXXXXXXoo.                 ",
+"                .XOOXXX+XXXXXo.                 ",
+"               .XOOOXX+++XXXXoo.                ",
+"               .XOOXXX+++XXXXXo.                ",
+"              .XOOOXXX+++XXXXXXo.               ",
+"              .XOOXXXX+++XXXXXXo.               ",
+"              .XXXXXXX+++XXXXXXX.               ",
+"              .XXXXXXX+++XXXXXXo.               ",
+"              .XXXXXXX+++XXXXXoo.               ",
+"               .XXXXXX+++XXXXXo.                ",
+"               .XXXXXXX+XXXXXXo.                ",
+"                .XXXXXXXXXXXXo.                 ",
+"                .XXXXX+++XXXoo.                 ",
+"                 .XXXX+++XXoo.                  ",
+"                  .XXXXXXXXo.                   ",
+"                  ..XXXXXXo..                   ",
+"                   .XXXXXo..                    ",
+"                   @#######@                    ",
+"                   @@@@@@@@@                    ",
+"                   @#######@                    ",
+"                   @@@@@@@@@                    ",
+"                   @#######@                    ",
+"                    @@@@@@@                     ",
+"                      ###                       ",
+"                      $$$                       ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                "
+};
+
+/* Copyright (c) Julian Smart */
+static const char *warning_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"48 48 9 1",
+"@ c Black",
+"o c #A6A800",
+"+ c #8A8C00",
+"$ c #B8BA00",
+"  c None",
+"O c #6E7000",
+"X c #DCDF00",
+". c #C00000",
+"# c #373800",
+/* pixels */
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                      .                         ",
+"                     ...                        ",
+"                     ...                        ",
+"                    .....                       ",
+"                   ...X..                       ",
+"                   ..XXX..                      ",
+"                  ...XXX...                     ",
+"                  ..XXXXX..                     ",
+"                 ..XXXXXX...                    ",
+"                ...XXoO+XX..                    ",
+"                ..XXXO@#XXX..                   ",
+"               ..XXXXO@#XXX...                  ",
+"              ...XXXXO@#XXXX..                  ",
+"              ..XXXXXO@#XXXX...                 ",
+"             ...XXXXXo@OXXXXX..                 ",
+"            ...XXXXXXo@OXXXXXX..                ",
+"            ..XXXXXXX$@OXXXXXX...               ",
+"           ...XXXXXXXX@XXXXXXXX..               ",
+"          ...XXXXXXXXXXXXXXXXXX...              ",
+"          ..XXXXXXXXXXOXXXXXXXXX..              ",
+"         ...XXXXXXXXXO@#XXXXXXXXX..             ",
+"         ..XXXXXXXXXXX#XXXXXXXXXX...            ",
+"        ...XXXXXXXXXXXXXXXXXXXXXXX..            ",
+"       ...XXXXXXXXXXXXXXXXXXXXXXXX...           ",
+"       ..............................           ",
+"       ..............................           ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                "
+};
+
+/* Copyright (c) Julian Smart */
+static const char *question_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"48 48 21 1",
+". c Black",
+"> c #696969",
+"O c #1F1F00",
+"+ c #181818",
+"o c #F6F900",
+"; c #3F3F00",
+"$ c #111111",
+"  c None",
+"& c #202020",
+"X c #AAAA00",
+"@ c #949400",
+": c #303030",
+"1 c #383838",
+"% c #2A2A00",
+", c #404040",
+"= c #B4B400",
+"- c #484848",
+"# c #151500",
+"< c #9F9F00",
+"2 c #6A6A00",
+"* c #353500",
+/* pixels */
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                   .........                    ",
+"                 ...XXXXXXX..                   ",
+"               ..XXXXoooooXXXO+                 ",
+"             ..XXooooooooooooX@..               ",
+"            ..XoooooooooooooooXX#.              ",
+"           $%XoooooooooooooooooXX#.             ",
+"          &.XoooooooXXXXXXooooooXX..            ",
+"          .XooooooXX.$...$XXoooooX*.            ",
+"         $.XoooooX%.$     .*oooooo=..           ",
+"         .XooooooX..      -.XoooooX..           ",
+"         .XoooooX..+       .XoooooX;.           ",
+"         ...XXXX..:        .XoooooX;.           ",
+"          ........        >.XoooooX;.           ",
+"                          +.XoooooX..           ",
+"                         ,.Xoooooo<..           ",
+"                        1#XooooooXO..           ",
+"                       &#XooooooX2..            ",
+"                      $%XooooooXX..             ",
+"                     $%XooooooXX..              ",
+"                    $%XooooooXX..               ",
+"                   &.XooooooXX..                ",
+"                   .XooooooXX..                 ",
+"                  &.XoooooXX..                  ",
+"                  ..XooooXX..                   ",
+"                  ..XooooX...                   ",
+"                  ..XXooXX..&                   ",
+"                  ...XXXXX..                    ",
+"                   ........                     ",
+"                                                ",
+"                                                ",
+"                   .......                      ",
+"                  ..XXXXX..                     ",
+"                 ..XXoooXX..                    ",
+"                 ..XoooooX..                    ",
+"                 ..XoooooX..                    ",
+"                 ..XXoooXX..                    ",
+"                  ..XXXXX..                     ",
+"                   .......                      ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                "
+};
+
+wxBitmap wxGTKArtProvider::CreateBitmap(const wxArtID& id,
+                                        const wxArtClient& WXUNUSED(client),
+                                        const wxSize& WXUNUSED(size))
+{
+    if ( id == wxART_INFORMATION )
+        return wxBitmap(info_xpm);
+    if ( id == wxART_ERROR )
+        return wxBitmap(error_xpm);
+    if ( id == wxART_WARNING )
+        return wxBitmap(warning_xpm);
+    if ( id == wxART_QUESTION )
+        return wxBitmap(question_xpm);
+    return wxNullBitmap;
+}
+
+
 // ============================================================================
 // wxInputHandler
 // ============================================================================
@@ -2320,56 +2573,53 @@ void wxGTKRenderer::AdjustSize(wxSize *size, const wxWindow *window)
 // wxGTKInputHandler
 // ----------------------------------------------------------------------------
 
-wxGTKInputHandler::wxGTKInputHandler(wxGTKRenderer *renderer)
+bool wxGTKInputHandler::HandleKey(wxInputConsumer * WXUNUSED(control),
+                                  const wxKeyEvent& WXUNUSED(event),
+                                  bool WXUNUSED(pressed))
 {
-    m_renderer = renderer;
+    return false;
 }
 
-bool wxGTKInputHandler::HandleKey(wxControl *control,
-                                  const wxKeyEvent& event,
-                                  bool pressed)
-{
-    return FALSE;
-}
-
-bool wxGTKInputHandler::HandleMouse(wxControl *control,
+bool wxGTKInputHandler::HandleMouse(wxInputConsumer *control,
                                     const wxMouseEvent& event)
 {
     // clicking on the control gives it focus
-    if ( event.ButtonDown() )
+    if ( event.ButtonDown() && wxWindow::FindFocus() != control->GetInputWindow() )
     {
-        control->SetFocus();
+        control->GetInputWindow()->SetFocus();
 
-        return TRUE;
+        return true;
     }
 
-    return FALSE;
+    return false;
 }
 
-bool wxGTKInputHandler::HandleMouseMove(wxControl *control,
+bool wxGTKInputHandler::HandleMouseMove(wxInputConsumer *control,
                                         const wxMouseEvent& event)
 {
     if ( event.Entering() )
     {
-        control->SetCurrent(TRUE);
+        control->GetInputWindow()->SetCurrent(true);
     }
     else if ( event.Leaving() )
     {
-        control->SetCurrent(FALSE);
+        control->GetInputWindow()->SetCurrent(false);
     }
     else
     {
-        return FALSE;
+        return false;
     }
 
-    return TRUE;
+    return true;
 }
 
+#if wxUSE_CHECKBOX
+
 // ----------------------------------------------------------------------------
 // wxGTKCheckboxInputHandler
 // ----------------------------------------------------------------------------
 
-bool wxGTKCheckboxInputHandler::HandleKey(wxControl *control,
+bool wxGTKCheckboxInputHandler::HandleKey(wxInputConsumer *control,
                                           const wxKeyEvent& event,
                                           bool pressed)
 {
@@ -2380,18 +2630,22 @@ bool wxGTKCheckboxInputHandler::HandleKey(wxControl *control,
         {
             control->PerformAction(wxACTION_CHECKBOX_TOGGLE);
 
-            return TRUE;
+            return true;
         }
     }
 
-    return FALSE;
+    return false;
 }
 
+#endif // wxUSE_CHECKBOX
+
+#if wxUSE_TEXTCTRL
+
 // ----------------------------------------------------------------------------
 // wxGTKTextCtrlInputHandler
 // ----------------------------------------------------------------------------
 
-bool wxGTKTextCtrlInputHandler::HandleKey(wxControl *control,
+bool wxGTKTextCtrlInputHandler::HandleKey(wxInputConsumer *control,
                                           const wxKeyEvent& event,
                                           bool pressed)
 {
@@ -2474,9 +2728,13 @@ bool wxGTKTextCtrlInputHandler::HandleKey(wxControl *control,
         {
             control->PerformAction(action);
 
-            return TRUE;
+            return true;
         }
     }
 
-    return wxStdTextCtrlInputHandler::HandleKey(control, event, pressed);
+    return wxStdInputHandler::HandleKey(control, event, pressed);
 }
+
+#endif // wxUSE_TEXTCTRL
+
+#endif // wxUSE_THEME_GTK