]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/themes/win32.cpp
adding the GetEventHandler() indirection
[wxWidgets.git] / src / univ / themes / win32.cpp
index a7f5f68051354785f93b92decbdef8ba0f663002..0c22469e903c650e693a2dfd8229b5d5d2038d92 100644 (file)
     #pragma hdrstop
 #endif
 
     #pragma hdrstop
 #endif
 
+#include "wx/univ/theme.h"
+
+#if wxUSE_THEME_WIN32
+
 #ifndef WX_PRECOMP
     #include "wx/timer.h"
     #include "wx/intl.h"
 #ifndef WX_PRECOMP
     #include "wx/timer.h"
     #include "wx/intl.h"
@@ -31,6 +35,7 @@
     #include "wx/window.h"
 
     #include "wx/dcmemory.h"
     #include "wx/window.h"
 
     #include "wx/dcmemory.h"
+    #include "wx/dcclient.h"
 
     #include "wx/button.h"
     #include "wx/bmpbuttn.h"
 
     #include "wx/button.h"
     #include "wx/bmpbuttn.h"
@@ -65,7 +70,6 @@
 #include "wx/univ/inpcons.h"
 #include "wx/univ/inphand.h"
 #include "wx/univ/colschem.h"
 #include "wx/univ/inpcons.h"
 #include "wx/univ/inphand.h"
 #include "wx/univ/colschem.h"
-#include "wx/univ/theme.h"
 
 // ----------------------------------------------------------------------------
 // constants
 
 // ----------------------------------------------------------------------------
 // constants
 
 static const int BORDER_THICKNESS = 2;
 
 
 static const int BORDER_THICKNESS = 2;
 
-// the offset between the label and focus rect around it
-static const int FOCUS_RECT_OFFSET_X = 1;
-static const int FOCUS_RECT_OFFSET_Y = 1;
-
-static const int FRAME_BORDER_THICKNESS            = 3;
-static const int RESIZEABLE_FRAME_BORDER_THICKNESS = 4;
-static const int FRAME_TITLEBAR_HEIGHT             = 18;
-static const int FRAME_BUTTON_WIDTH                = 16;
-static const int FRAME_BUTTON_HEIGHT               = 14;
-
 static const size_t NUM_STATUSBAR_GRIP_BANDS = 3;
 static const size_t WIDTH_STATUSBAR_GRIP_BAND = 4;
 static const size_t STATUSBAR_GRIP_SIZE =
 static const size_t NUM_STATUSBAR_GRIP_BANDS = 3;
 static const size_t WIDTH_STATUSBAR_GRIP_BAND = 4;
 static const size_t STATUSBAR_GRIP_SIZE =
@@ -98,36 +92,6 @@ static const wxCoord SLIDER_TICK_LENGTH = 6;
 class wxWin32Renderer : public wxStdRenderer
 {
 public:
 class wxWin32Renderer : public wxStdRenderer
 {
 public:
-    // constants
-    enum wxArrowDirection
-    {
-        Arrow_Left,
-        Arrow_Right,
-        Arrow_Up,
-        Arrow_Down,
-        Arrow_Max
-    };
-
-    enum wxArrowStyle
-    {
-        Arrow_Normal,
-        Arrow_Disabled,
-        Arrow_Pressed,
-        Arrow_Inverted,
-        Arrow_InvertedDisabled,
-        Arrow_StateMax
-    };
-
-    enum wxFrameButtonType
-    {
-        FrameButton_Close,
-        FrameButton_Minimize,
-        FrameButton_Maximize,
-        FrameButton_Restore,
-        FrameButton_Help,
-        FrameButton_Max
-    };
-
     // ctor
     wxWin32Renderer(const wxColourScheme *scheme);
 
     // ctor
     wxWin32Renderer(const wxColourScheme *scheme);
 
@@ -151,15 +115,11 @@ public:
                                   const wxRect& rect,
                                   int flags = 0,
                                   wxRect *rectIn = NULL);
                                   const wxRect& rect,
                                   int flags = 0,
                                   wxRect *rectIn = NULL);
+
     virtual void DrawArrow(wxDC& dc,
                            wxDirection dir,
                            const wxRect& rect,
                            int flags = 0);
     virtual void DrawArrow(wxDC& dc,
                            wxDirection dir,
                            const wxRect& rect,
                            int flags = 0);
-    virtual void DrawScrollbarArrow(wxDC& dc,
-                                    wxDirection dir,
-                                    const wxRect& rect,
-                                    int flags = 0)
-        { DrawArrow(dc, dir, rect, flags); }
     virtual void DrawScrollbarThumb(wxDC& dc,
                                     wxOrientation orient,
                                     const wxRect& rect,
     virtual void DrawScrollbarThumb(wxDC& dc,
                                     wxOrientation orient,
                                     const wxRect& rect,
@@ -168,13 +128,6 @@ public:
                                     wxOrientation orient,
                                     const wxRect& rect,
                                     int flags = 0);
                                     wxOrientation orient,
                                     const wxRect& rect,
                                     int flags = 0);
-    virtual void DrawScrollCorner(wxDC& dc,
-                                  const wxRect& rect);
-    virtual void DrawCheckItem(wxDC& dc,
-                               const wxString& label,
-                               const wxBitmap& bitmap,
-                               const wxRect& rect,
-                               int flags = 0);
 
 #if wxUSE_TOOLBAR
     virtual void DrawToolBarButton(wxDC& dc,
 
 #if wxUSE_TOOLBAR
     virtual void DrawToolBarButton(wxDC& dc,
@@ -186,6 +139,7 @@ public:
                                    int tbarStyle = 0);
 #endif // wxUSE_TOOLBAR
 
                                    int tbarStyle = 0);
 #endif // wxUSE_TOOLBAR
 
+#if wxUSE_NOTEBOOK
     virtual void DrawTab(wxDC& dc,
                          const wxRect& rect,
                          wxDirection dir,
     virtual void DrawTab(wxDC& dc,
                          const wxRect& rect,
                          wxDirection dir,
@@ -193,6 +147,7 @@ public:
                          const wxBitmap& bitmap = wxNullBitmap,
                          int flags = 0,
                          int indexAccel = -1);
                          const wxBitmap& bitmap = wxNullBitmap,
                          int flags = 0,
                          int indexAccel = -1);
+#endif // wxUSE_NOTEBOOK
 
 #if wxUSE_SLIDER
     virtual void DrawSliderShaft(wxDC& dc,
 
 #if wxUSE_SLIDER
     virtual void DrawSliderShaft(wxDC& dc,
@@ -244,38 +199,6 @@ public:
                                  int flags = 0, int style = 0);
 #endif // wxUSE_STATUSBAR
 
                                  int flags = 0, int style = 0);
 #endif // wxUSE_STATUSBAR
 
-    // titlebars
-    virtual void DrawFrameTitleBar(wxDC& dc,
-                                   const wxRect& rect,
-                                   const wxString& title,
-                                   const wxIcon& icon,
-                                   int flags,
-                                   int specialButton = 0,
-                                   int specialButtonFlags = 0);
-    virtual void DrawFrameBorder(wxDC& dc,
-                                 const wxRect& rect,
-                                 int flags);
-    virtual void DrawFrameBackground(wxDC& dc,
-                                     const wxRect& rect,
-                                     int flags);
-    virtual void DrawFrameTitle(wxDC& dc,
-                                const wxRect& rect,
-                                const wxString& title,
-                                int flags);
-    virtual void DrawFrameIcon(wxDC& dc,
-                               const wxRect& rect,
-                               const wxIcon& icon,
-                               int flags);
-    virtual void DrawFrameButton(wxDC& dc,
-                                 wxCoord x, wxCoord y,
-                                 int button,
-                                 int flags = 0);
-    virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const;
-    virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const;
-    virtual wxSize GetFrameMinSize(int flags) const;
-    virtual wxSize GetFrameIconSize() const;
-    virtual int HitTestFrame(const wxRect& rect, const wxPoint& pt, int flags) const;
-
     virtual void GetComboBitmaps(wxBitmap *bmpNormal,
                                  wxBitmap *bmpFocus,
                                  wxBitmap *bmpPressed,
     virtual void GetComboBitmaps(wxBitmap *bmpNormal,
                                  wxBitmap *bmpFocus,
                                  wxBitmap *bmpPressed,
@@ -287,8 +210,6 @@ public:
     virtual wxSize GetScrollbarArrowSize() const
         { return m_sizeScrollbarArrow; }
 
     virtual wxSize GetScrollbarArrowSize() const
         { return m_sizeScrollbarArrow; }
 
-    virtual wxCoord GetListboxItemHeight(wxCoord fontHeight)
-        { return fontHeight + 2; }
     virtual wxSize GetCheckBitmapSize() const
         { return wxSize(13, 13); }
     virtual wxSize GetRadioBitmapSize() const
     virtual wxSize GetCheckBitmapSize() const
         { return wxSize(13, 13); }
     virtual wxSize GetRadioBitmapSize() const
@@ -296,10 +217,12 @@ public:
     virtual wxCoord GetCheckItemMargin() const
         { return 0; }
 
     virtual wxCoord GetCheckItemMargin() const
         { return 0; }
 
+#if wxUSE_TOOLBAR
     virtual wxSize GetToolBarButtonSize(wxCoord *separator) const
         { if ( separator ) *separator = 5; return wxSize(16, 15); }
     virtual wxSize GetToolBarMargin() const
         { return wxSize(4, 4); }
     virtual wxSize GetToolBarButtonSize(wxCoord *separator) const
         { if ( separator ) *separator = 5; return wxSize(16, 15); }
     virtual wxSize GetToolBarMargin() const
         { return wxSize(4, 4); }
+#endif // wxUSE_TOOLBAR
 
 #if wxUSE_TEXTCTRL
     virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
 
 #if wxUSE_TEXTCTRL
     virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
@@ -309,8 +232,10 @@ public:
                                      wxCoord *extraSpaceBeyond) const;
 #endif // wxUSE_TEXTCTRL
 
                                      wxCoord *extraSpaceBeyond) const;
 #endif // wxUSE_TEXTCTRL
 
+#if wxUSE_NOTEBOOK
     virtual wxSize GetTabIndent() const { return wxSize(2, 2); }
     virtual wxSize GetTabPadding() const { return wxSize(6, 5); }
     virtual wxSize GetTabIndent() const { return wxSize(2, 2); }
     virtual wxSize GetTabPadding() const { return wxSize(6, 5); }
+#endif // wxUSE_NOTEBOOK
 
 #if wxUSE_SLIDER
 
 
 #if wxUSE_SLIDER
 
@@ -333,11 +258,8 @@ public:
                                                 const wxMenu& menu) const;
 #endif // wxUSE_MENUS
 
                                                 const wxMenu& menu) const;
 #endif // wxUSE_MENUS
 
-#if wxUSE_STATUSBAR
-    virtual wxSize GetStatusBarBorders(wxCoord *borderBetweenFields) const;
-#endif // wxUSE_STATUSBAR
-
 protected:
 protected:
+    // overridden wxStdRenderer methods
     virtual void DrawFrameWithLabel(wxDC& dc,
                                     const wxString& label,
                                     const wxRect& rectFrame,
     virtual void DrawFrameWithLabel(wxDC& dc,
                                     const wxString& label,
                                     const wxRect& rectFrame,
@@ -346,28 +268,23 @@ protected:
                                     int alignment,
                                     int indexAccel);
 
                                     int alignment,
                                     int indexAccel);
 
+    virtual void DrawCheckItemBitmap(wxDC& dc,
+                                     const wxBitmap& bitmap,
+                                     const wxRect& rect,
+                                     int flags);
+
 
     // draw the border used for scrollbar arrows
     void DrawArrowBorder(wxDC& dc, wxRect *rect, bool isPressed = false);
 
     // public DrawArrow()s helper
     void DrawArrow(wxDC& dc, const wxRect& rect,
 
     // draw the border used for scrollbar arrows
     void DrawArrowBorder(wxDC& dc, wxRect *rect, bool isPressed = false);
 
     // public DrawArrow()s helper
     void DrawArrow(wxDC& dc, const wxRect& rect,
-                   wxArrowDirection arrowDir, wxArrowStyle arrowStyle);
+                   ArrowDirection arrowDir, ArrowStyle arrowStyle);
 
     // DrawArrowButton is used by DrawScrollbar and DrawComboButton
     void DrawArrowButton(wxDC& dc, const wxRect& rect,
 
     // DrawArrowButton is used by DrawScrollbar and DrawComboButton
     void DrawArrowButton(wxDC& dc, const wxRect& rect,
-                         wxArrowDirection arrowDir,
-                         wxArrowStyle arrowStyle);
-
-    // DrawCheckButton helper
-    void DrawCheckOrRadioButton(wxDC& dc,
-                                const wxString& label,
-                                const wxBitmap& bitmap,
-                                const wxRect& rect,
-                                int flags,
-                                wxAlignment align,
-                                int indexAccel,
-                                wxCoord focusOffsetY);
+                         ArrowDirection arrowDir,
+                         ArrowStyle arrowStyle);
 
     // draw a normal or transposed line (useful for using the same code fo both
     // horizontal and vertical widgets)
 
     // draw a normal or transposed line (useful for using the same code fo both
     // horizontal and vertical widgets)
@@ -384,18 +301,18 @@ protected:
 
     // get the standard check/radio button bitmap
     wxBitmap GetIndicator(IndicatorType indType, int flags);
 
     // get the standard check/radio button bitmap
     wxBitmap GetIndicator(IndicatorType indType, int flags);
-    wxBitmap GetCheckBitmap(int flags)
+    virtual wxBitmap GetCheckBitmap(int flags)
         { return GetIndicator(IndicatorType_Check, flags); }
         { return GetIndicator(IndicatorType_Check, flags); }
-    wxBitmap GetRadioBitmap(int flags)
+    virtual wxBitmap GetRadioBitmap(int flags)
         { return GetIndicator(IndicatorType_Radio, flags); }
 
         { return GetIndicator(IndicatorType_Radio, flags); }
 
+    virtual wxBitmap GetFrameButtonBitmap(FrameButtonType type);
+
 private:
     // the sizing parameters (TODO make them changeable)
     wxSize m_sizeScrollbarArrow;
 
 private:
     // the sizing parameters (TODO make them changeable)
     wxSize m_sizeScrollbarArrow;
 
-    wxFont m_titlebarFont;
-
-    // the checked and unchecked bitmaps for DrawCheckItem()
+    // the checked and unchecked bitmaps for DrawCheckItemBitmap()
     wxBitmap m_bmpCheckBitmaps[IndicatorStatus_Max];
 
     // the bitmaps returned by GetIndicator()
     wxBitmap m_bmpCheckBitmaps[IndicatorStatus_Max];
 
     // the bitmaps returned by GetIndicator()
@@ -403,14 +320,15 @@ private:
                             [IndicatorState_MaxMenu]
                             [IndicatorStatus_Max];
 
                             [IndicatorState_MaxMenu]
                             [IndicatorStatus_Max];
 
-    // standard defaults for m_bmpCheckBitmaps and m_bmpIndicators
+    // titlebar icons:
+    wxBitmap m_bmpFrameButtons[FrameButton_Max];
+
+    // standard defaults for the above bitmaps
     static const char **ms_xpmChecked[IndicatorStatus_Max];
     static const char **ms_xpmIndicators[IndicatorType_Max]
                                         [IndicatorState_MaxMenu]
                                         [IndicatorStatus_Max];
     static const char **ms_xpmChecked[IndicatorStatus_Max];
     static const char **ms_xpmIndicators[IndicatorType_Max]
                                         [IndicatorState_MaxMenu]
                                         [IndicatorStatus_Max];
-
-    // titlebar icons:
-    wxBitmap m_bmpFrameButtons[FrameButton_Max];
+    static const char **ms_xpmFrameButtons[FrameButton_Max];
 
     // first row is for the normal state, second - for the disabled
     wxBitmap m_bmpArrows[Arrow_StateMax][Arrow_Max];
 
     // first row is for the normal state, second - for the disabled
     wxBitmap m_bmpArrows[Arrow_StateMax][Arrow_Max];
@@ -530,7 +448,7 @@ public:
     virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
 
 #if wxUSE_MENUS
     virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
 
 #if wxUSE_MENUS
-    void PopupSystemMenu(wxTopLevelWindow *window, const wxPoint& pos) const;
+    void PopupSystemMenu(wxTopLevelWindow *window) const;
 #endif // wxUSE_MENUS
 
 private:
 #endif // wxUSE_MENUS
 
 private:
@@ -599,56 +517,55 @@ private:
 // ----------------------------------------------------------------------------
 
 // frame buttons bitmaps
 // ----------------------------------------------------------------------------
 
 // frame buttons bitmaps
-
 static const char *frame_button_close_xpm[] = {
 "12 10 2 1",
 "         c None",
 static const char *frame_button_close_xpm[] = {
 "12 10 2 1",
 "         c None",
-".        c black",
+"X        c black",
 "            ",
 "            ",
-"  ..    ..  ",
-"   ..  ..   ",
-"    ....    ",
-"     ..     ",
-"    ....    ",
-"   ..  ..   ",
-"  ..    ..  ",
+"  XX    XX  ",
+"   XX  XX   ",
+"    XXXX    ",
+"     XX     ",
+"    XXXX    ",
+"   XX  XX   ",
+"  XX    XX  ",
 "            ",
 "            "};
 
 static const char *frame_button_help_xpm[] = {
 "12 10 2 1",
 "         c None",
 "            ",
 "            "};
 
 static const char *frame_button_help_xpm[] = {
 "12 10 2 1",
 "         c None",
-".        c #000000",
-"    ....    ",
-"   ..  ..   ",
-"   ..  ..   ",
-"      ..    ",
-"     ..     ",
-"     ..     ",
+"X        c #000000",
+"    XXXX    ",
+"   XX  XX   ",
+"   XX  XX   ",
+"      XX    ",
+"     XX     ",
+"     XX     ",
 "            ",
 "            ",
-"     ..     ",
-"     ..     ",
+"     XX     ",
+"     XX     ",
 "            "};
 
 static const char *frame_button_maximize_xpm[] = {
 "12 10 2 1",
 "         c None",
 "            "};
 
 static const char *frame_button_maximize_xpm[] = {
 "12 10 2 1",
 "         c None",
-".        c #000000",
-" .........  ",
-" .........  ",
-" .       .  ",
-" .       .  ",
-" .       .  ",
-" .       .  ",
-" .       .  ",
-" .       .  ",
-" .........  ",
+"X        c #000000",
+" XXXXXXXXX  ",
+" XXXXXXXXX  ",
+" X       X  ",
+" X       X  ",
+" X       X  ",
+" X       X  ",
+" X       X  ",
+" X       X  ",
+" XXXXXXXXX  ",
 "            "};
 
 static const char *frame_button_minimize_xpm[] = {
 "12 10 2 1",
 "         c None",
 "            "};
 
 static const char *frame_button_minimize_xpm[] = {
 "12 10 2 1",
 "         c None",
-".        c #000000",
+"X        c #000000",
 "            ",
 "            ",
 "            ",
 "            ",
 "            ",
 "            ",
@@ -656,25 +573,34 @@ static const char *frame_button_minimize_xpm[] = {
 "            ",
 "            ",
 "            ",
 "            ",
 "            ",
 "            ",
-"  ......    ",
-"  ......    ",
+"  XXXXXX    ",
+"  XXXXXX    ",
 "            "};
 
 static const char *frame_button_restore_xpm[] = {
 "12 10 2 1",
 "         c None",
 "            "};
 
 static const char *frame_button_restore_xpm[] = {
 "12 10 2 1",
 "         c None",
-".        c #000000",
-"   ......   ",
-"   ......   ",
-"   .    .   ",
-" ...... .   ",
-" ...... .   ",
-" .    ...   ",
-" .    .     ",
-" .    .     ",
-" ......     ",
+"X        c #000000",
+"   XXXXXX   ",
+"   XXXXXX   ",
+"   X    X   ",
+" XXXXXX X   ",
+" XXXXXX X   ",
+" X    XXX   ",
+" X    X     ",
+" X    X     ",
+" XXXXXX     ",
 "            "};
 
 "            "};
 
+const char **wxWin32Renderer::ms_xpmFrameButtons[FrameButton_Max] =
+{
+    frame_button_close_xpm,
+    frame_button_minimize_xpm,
+    frame_button_maximize_xpm,
+    frame_button_restore_xpm,
+    frame_button_help_xpm,
+};
+
 // menu bitmaps
 
 static const char *checked_menu_xpm[] = {
 // menu bitmaps
 
 static const char *checked_menu_xpm[] = {
@@ -1147,7 +1073,7 @@ wxWin32Theme::~wxWin32Theme()
 {
     delete m_renderer;
     delete m_scheme;
 {
     delete m_renderer;
     delete m_scheme;
-    wxArtProvider::RemoveProvider(m_artProvider);
+    delete m_artProvider;
 }
 
 wxRenderer *wxWin32Theme::GetRenderer()
 }
 
 wxRenderer *wxWin32Theme::GetRenderer()
@@ -1358,6 +1284,7 @@ wxColour wxWin32ColourScheme::Get(wxWin32ColourScheme::StdColour col) const
         case TITLEBAR_ACTIVE_TEXT: return wxColour(GetSysColor(COLOR_CAPTIONTEXT));
 
         case DESKTOP:           return wxColour(0x808000);
         case TITLEBAR_ACTIVE_TEXT: return wxColour(GetSysColor(COLOR_CAPTIONTEXT));
 
         case DESKTOP:           return wxColour(0x808000);
+        case FRAME:             return wxColour(GetSysColor(COLOR_APPWORKSPACE));
 #else // !__WXMSW__
         // use the standard Windows colours elsewhere
         case WINDOW:            return *wxWHITE;
 #else // !__WXMSW__
         // use the standard Windows colours elsewhere
         case WINDOW:            return *wxWHITE;
@@ -1390,6 +1317,7 @@ wxColour wxWin32ColourScheme::Get(wxWin32ColourScheme::StdColour col) const
         case TITLEBAR_ACTIVE_TEXT:return *wxWHITE;
 
         case DESKTOP:           return wxColour(0x808000);
         case TITLEBAR_ACTIVE_TEXT:return *wxWHITE;
 
         case DESKTOP:           return wxColour(0x808000);
+        case FRAME:             return wxColour(0x808080);
 #endif // __WXMSW__
 
         case GAUGE:             return Get(HIGHLIGHT);
 #endif // __WXMSW__
 
         case GAUGE:             return Get(HIGHLIGHT);
@@ -1415,9 +1343,6 @@ wxWin32Renderer::wxWin32Renderer(const wxColourScheme *scheme)
     // init data
     m_sizeScrollbarArrow = wxSize(16, 16);
 
     // init data
     m_sizeScrollbarArrow = wxSize(16, 16);
 
-    m_titlebarFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
-    m_titlebarFont.SetWeight(wxFONTWEIGHT_BOLD);
-
     // init the arrow bitmaps
     static const size_t ARROW_WIDTH = 7;
     static const size_t ARROW_LENGTH = 4;
     // init the arrow bitmaps
     static const size_t ARROW_WIDTH = 7;
     static const size_t ARROW_LENGTH = 4;
@@ -1587,13 +1512,6 @@ wxWin32Renderer::wxWin32Renderer(const wxColourScheme *scheme)
 
         m_bmpArrows[Arrow_Pressed][n] = m_bmpArrows[Arrow_Normal][n];
     }
 
         m_bmpArrows[Arrow_Pressed][n] = m_bmpArrows[Arrow_Normal][n];
     }
-
-    // init the frame buttons bitmaps
-    m_bmpFrameButtons[FrameButton_Close] = wxBitmap(frame_button_close_xpm);
-    m_bmpFrameButtons[FrameButton_Minimize] = wxBitmap(frame_button_minimize_xpm);
-    m_bmpFrameButtons[FrameButton_Maximize] = wxBitmap(frame_button_maximize_xpm);
-    m_bmpFrameButtons[FrameButton_Restore] = wxBitmap(frame_button_restore_xpm);
-    m_bmpFrameButtons[FrameButton_Help] = wxBitmap(frame_button_help_xpm);
 }
 
 bool wxWin32Renderer::AreScrollbarsInsideBorder() const
 }
 
 bool wxWin32Renderer::AreScrollbarsInsideBorder() const
@@ -1711,11 +1629,10 @@ void wxWin32Renderer::DrawButtonBorder(wxDC& dc,
 // (check)listbox items
 // ----------------------------------------------------------------------------
 
 // (check)listbox items
 // ----------------------------------------------------------------------------
 
-void wxWin32Renderer::DrawCheckItem(wxDC& dc,
-                                    const wxString& label,
-                                    const wxBitmap& bitmap,
-                                    const wxRect& rect,
-                                    int flags)
+void wxWin32Renderer::DrawCheckItemBitmap(wxDC& dc,
+                                          const wxBitmap& bitmap,
+                                          const wxRect& rect,
+                                          int flags)
 {
     wxBitmap bmp;
     if ( bitmap.Ok() )
 {
     wxBitmap bmp;
     if ( bitmap.Ok() )
@@ -1738,13 +1655,6 @@ void wxWin32Renderer::DrawCheckItem(wxDC& dc,
 
     dc.DrawBitmap(bmp, rect.x, rect.y + (rect.height - bmp.GetHeight()) / 2 - 1,
                   true /* use mask */);
 
     dc.DrawBitmap(bmp, rect.x, rect.y + (rect.height - bmp.GetHeight()) / 2 - 1,
                   true /* use mask */);
-
-    wxRect rectLabel = rect;
-    int bmpWidth = bmp.GetWidth();
-    rectLabel.x += bmpWidth;
-    rectLabel.width -= bmpWidth;
-
-    DrawItem(dc, label, rectLabel, flags);
 }
 
 // ----------------------------------------------------------------------------
 }
 
 // ----------------------------------------------------------------------------
@@ -1757,7 +1667,7 @@ wxBitmap wxWin32Renderer::GetIndicator(IndicatorType indType, int flags)
     IndicatorStatus indStatus;
     GetIndicatorsFromFlags(flags, indState, indStatus);
 
     IndicatorStatus indStatus;
     GetIndicatorsFromFlags(flags, indState, indStatus);
 
-    wxBitmap bmp = m_bmpIndicators[indType][indState][indStatus];
+    wxBitmap& bmp = m_bmpIndicators[indType][indState][indStatus];
     if ( !bmp.Ok() )
     {
         const char **xpm = ms_xpmIndicators[indType][indState][indStatus];
     if ( !bmp.Ok() )
     {
         const char **xpm = ms_xpmIndicators[indType][indState][indStatus];
@@ -1765,13 +1675,16 @@ wxBitmap wxWin32Renderer::GetIndicator(IndicatorType indType, int flags)
         {
             // create and cache it
             bmp = wxBitmap(xpm);
         {
             // create and cache it
             bmp = wxBitmap(xpm);
-            m_bmpIndicators[indType][indState][indStatus] = bmp;
         }
     }
 
     return bmp;
 }
 
         }
     }
 
     return bmp;
 }
 
+// ----------------------------------------------------------------------------
+// toolbar stuff
+// ----------------------------------------------------------------------------
+
 #if wxUSE_TOOLBAR
 void wxWin32Renderer::DrawToolBarButton(wxDC& dc,
                                         const wxString& label,
 #if wxUSE_TOOLBAR
 void wxWin32Renderer::DrawToolBarButton(wxDC& dc,
                                         const wxString& label,
@@ -1810,7 +1723,7 @@ void wxWin32Renderer::DrawToolBarButton(wxDC& dc,
         {
             int xpoint = (rect.GetLeft() + rect.GetRight() + 1 - bitmap.GetWidth()) / 2;
             int ypoint = (rect.GetTop() + rect.GetBottom() + 1 - bitmap.GetHeight()) / 2;
         {
             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);
+            dc.DrawBitmap(bitmap, xpoint, ypoint, bitmap.GetMask() != NULL);
         }
     }
     else if (style == wxTOOL_STYLE_SEPARATOR)
         }
     }
     else if (style == wxTOOL_STYLE_SEPARATOR)
@@ -1840,6 +1753,8 @@ void wxWin32Renderer::DrawToolBarButton(wxDC& dc,
 // notebook
 // ----------------------------------------------------------------------------
 
 // notebook
 // ----------------------------------------------------------------------------
 
+#if wxUSE_NOTEBOOK
+
 void wxWin32Renderer::DrawTab(wxDC& dc,
                               const wxRect& rectOrig,
                               wxDirection dir,
 void wxWin32Renderer::DrawTab(wxDC& dc,
                               const wxRect& rectOrig,
                               wxDirection dir,
@@ -2022,6 +1937,8 @@ void wxWin32Renderer::DrawTab(wxDC& dc,
     #undef REVERSE_FOR_VERTICAL
 }
 
     #undef REVERSE_FOR_VERTICAL
 }
 
+#endif // wxUSE_NOTEBOOK
+
 #if wxUSE_SLIDER
 
 // ----------------------------------------------------------------------------
 #if wxUSE_SLIDER
 
 // ----------------------------------------------------------------------------
@@ -2136,7 +2053,7 @@ void wxWin32Renderer::DrawSliderShaft(wxDC& dc,
     */
 
     if (flags & wxCONTROL_FOCUSED) {
     */
 
     if (flags & wxCONTROL_FOCUSED) {
-        DrawFocusRect(dc, rectOrig);
+        DrawFocusRect(NULL, dc, rectOrig);
     }
 
     wxRect rect = GetSliderShaftRect(rectOrig, lenThumb, orient, style);
     }
 
     wxRect rect = GetSliderShaftRect(rectOrig, lenThumb, orient, style);
@@ -2517,7 +2434,7 @@ void wxWin32Renderer::DrawMenuItem(wxDC& dc,
         rect.x = geometryInfo.GetSize().x - MENU_RIGHT_MARGIN;
         rect.width = MENU_RIGHT_MARGIN;
 
         rect.x = geometryInfo.GetSize().x - MENU_RIGHT_MARGIN;
         rect.width = MENU_RIGHT_MARGIN;
 
-        wxArrowStyle arrowStyle;
+        ArrowStyle arrowStyle;
         if ( flags & wxCONTROL_DISABLED )
             arrowStyle = flags & wxCONTROL_SELECTED ? Arrow_InvertedDisabled
                                                     : Arrow_Disabled;
         if ( flags & wxCONTROL_DISABLED )
             arrowStyle = flags & wxCONTROL_SELECTED ? Arrow_InvertedDisabled
                                                     : Arrow_Disabled;
@@ -2588,7 +2505,7 @@ wxMenuGeometryInfo *wxWin32Renderer::GetMenuGeometry(wxWindow *win,
             h = heightText;
 
             wxCoord widthLabel;
             h = heightText;
 
             wxCoord widthLabel;
-            dc.GetTextExtent(item->GetLabel(), &widthLabel, NULL);
+            dc.GetTextExtent(item->GetItemLabelText(), &widthLabel, NULL);
             if ( widthLabel > widthLabelMax )
             {
                 widthLabelMax = widthLabel;
             if ( widthLabel > widthLabelMax )
             {
                 widthLabelMax = widthLabel;
@@ -2647,25 +2564,15 @@ wxMenuGeometryInfo *wxWin32Renderer::GetMenuGeometry(wxWindow *win,
 // status bar
 // ----------------------------------------------------------------------------
 
 // status bar
 // ----------------------------------------------------------------------------
 
-static const wxCoord STATBAR_BORDER_X = 2;
-static const wxCoord STATBAR_BORDER_Y = 2;
-
-wxSize wxWin32Renderer::GetStatusBarBorders(wxCoord *borderBetweenFields) const
-{
-    if ( borderBetweenFields )
-        *borderBetweenFields = 2;
-
-    return wxSize(STATBAR_BORDER_X, STATBAR_BORDER_Y);
-}
-
 void wxWin32Renderer::DrawStatusField(wxDC& dc,
                                       const wxRect& rect,
                                       const wxString& label,
 void wxWin32Renderer::DrawStatusField(wxDC& dc,
                                       const wxRect& rect,
                                       const wxString& label,
-                                      int flags, int style /*=0*/)
+                                      int flags,
+                                      int style)
 {
     wxRect rectIn;
 
 {
     wxRect rectIn;
 
-    if ( flags & wxCONTROL_ISDEFAULT )
+    if ( flags & wxCONTROL_SIZEGRIP )
     {
         // draw the size grip: it is a normal rect except that in the lower
         // right corner we have several bands which may be used for dragging
     {
         // draw the size grip: it is a normal rect except that in the lower
         // right corner we have several bands which may be used for dragging
@@ -2720,19 +2627,12 @@ void wxWin32Renderer::DrawStatusField(wxDC& dc,
         rectIn.Deflate(1);
 
         rectIn.width -= STATUSBAR_GRIP_SIZE;
         rectIn.Deflate(1);
 
         rectIn.width -= STATUSBAR_GRIP_SIZE;
-    }
-    else // normal pane
-    {
-        if (style == wxSB_RAISED)
-            DrawBorder(dc, wxBORDER_RAISED, rect, flags, &rectIn);
-        else if (style != wxSB_FLAT)
-            DrawBorder(dc, wxBORDER_STATIC, rect, flags, &rectIn);
-    }
 
 
-    rectIn.Deflate(STATBAR_BORDER_X, STATBAR_BORDER_Y);
+        // this will prevent the standard version from drawing any borders
+        style = wxSB_FLAT;
+    }
 
 
-    wxDCClipper clipper(dc, rectIn);
-    DrawLabel(dc, label, rectIn, flags, wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
+    wxStdRenderer::DrawStatusField(dc, rect, label, flags, style);
 }
 
 #endif // wxUSE_STATUSBAR
 }
 
 #endif // wxUSE_STATUSBAR
@@ -2805,21 +2705,7 @@ void wxWin32Renderer::DrawArrow(wxDC& dc,
                                 const wxRect& rect,
                                 int flags)
 {
                                 const wxRect& rect,
                                 int flags)
 {
-    // get the bitmap for this arrow
-    wxArrowDirection arrowDir;
-    switch ( dir )
-    {
-        case wxLEFT:    arrowDir = Arrow_Left; break;
-        case wxRIGHT:   arrowDir = Arrow_Right; break;
-        case wxUP:      arrowDir = Arrow_Up; break;
-        case wxDOWN:    arrowDir = Arrow_Down; break;
-
-        default:
-            wxFAIL_MSG(_T("unknown arrow direction"));
-            return;
-    }
-
-    wxArrowStyle arrowStyle;
+    ArrowStyle arrowStyle;
     if ( flags & wxCONTROL_PRESSED )
     {
         // can't be pressed and disabled
     if ( flags & wxCONTROL_PRESSED )
     {
         // can't be pressed and disabled
@@ -2830,13 +2716,13 @@ void wxWin32Renderer::DrawArrow(wxDC& dc,
         arrowStyle = flags & wxCONTROL_DISABLED ? Arrow_Disabled : Arrow_Normal;
     }
 
         arrowStyle = flags & wxCONTROL_DISABLED ? Arrow_Disabled : Arrow_Normal;
     }
 
-    DrawArrowButton(dc, rect, arrowDir, arrowStyle);
+    DrawArrowButton(dc, rect, GetArrowDirection(dir), arrowStyle);
 }
 
 void wxWin32Renderer::DrawArrow(wxDC& dc,
                                 const wxRect& rect,
 }
 
 void wxWin32Renderer::DrawArrow(wxDC& dc,
                                 const wxRect& rect,
-                                wxArrowDirection arrowDir,
-                                wxArrowStyle arrowStyle)
+                                ArrowDirection arrowDir,
+                                ArrowStyle arrowStyle)
 {
     const wxBitmap& bmp = m_bmpArrows[arrowStyle][arrowDir];
 
 {
     const wxBitmap& bmp = m_bmpArrows[arrowStyle][arrowDir];
 
@@ -2855,8 +2741,8 @@ void wxWin32Renderer::DrawArrow(wxDC& dc,
 
 void wxWin32Renderer::DrawArrowButton(wxDC& dc,
                                       const wxRect& rectAll,
 
 void wxWin32Renderer::DrawArrowButton(wxDC& dc,
                                       const wxRect& rectAll,
-                                      wxArrowDirection arrowDir,
-                                      wxArrowStyle arrowStyle)
+                                      ArrowDirection arrowDir,
+                                      ArrowStyle arrowStyle)
 {
     wxRect rect = rectAll;
     DrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect);
 {
     wxRect rect = rectAll;
     DrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect);
@@ -2886,387 +2772,12 @@ void wxWin32Renderer::DrawScrollbarShaft(wxDC& dc,
     DrawBackground(dc, m_scheme->Get(col), rectBar);
 }
 
     DrawBackground(dc, m_scheme->Get(col), rectBar);
 }
 
-void wxWin32Renderer::DrawScrollCorner(wxDC& dc, const wxRect& rect)
-{
-    DrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect);
-}
-
-// ----------------------------------------------------------------------------
-// top level windows
-// ----------------------------------------------------------------------------
-
-int wxWin32Renderer::HitTestFrame(const wxRect& rect, const wxPoint& pt, int flags) const
-{
-    wxRect client = GetFrameClientArea(rect, flags);
-
-    if ( client.Contains(pt) )
-        return wxHT_TOPLEVEL_CLIENT_AREA;
-
-    if ( flags & wxTOPLEVEL_TITLEBAR )
-    {
-        wxRect client = GetFrameClientArea(rect, flags & ~wxTOPLEVEL_TITLEBAR);
-
-        if ( flags & wxTOPLEVEL_ICON )
-        {
-            if ( wxRect(client.GetPosition(), GetFrameIconSize()).Contains(pt) )
-                return wxHT_TOPLEVEL_ICON;
-        }
-
-        wxRect btnRect(client.GetRight() - 2 - FRAME_BUTTON_WIDTH,
-                       client.GetTop() + (FRAME_TITLEBAR_HEIGHT-FRAME_BUTTON_HEIGHT)/2,
-                       FRAME_BUTTON_WIDTH, FRAME_BUTTON_HEIGHT);
-
-        if ( flags & wxTOPLEVEL_BUTTON_CLOSE )
-        {
-            if ( btnRect.Contains(pt) )
-                return wxHT_TOPLEVEL_BUTTON_CLOSE;
-            btnRect.x -= FRAME_BUTTON_WIDTH + 2;
-        }
-        if ( flags & wxTOPLEVEL_BUTTON_MAXIMIZE )
-        {
-            if ( btnRect.Contains(pt) )
-                return wxHT_TOPLEVEL_BUTTON_MAXIMIZE;
-            btnRect.x -= FRAME_BUTTON_WIDTH;
-        }
-        if ( flags & wxTOPLEVEL_BUTTON_RESTORE )
-        {
-            if ( btnRect.Contains(pt) )
-                return wxHT_TOPLEVEL_BUTTON_RESTORE;
-            btnRect.x -= FRAME_BUTTON_WIDTH;
-        }
-        if ( flags & wxTOPLEVEL_BUTTON_ICONIZE )
-        {
-            if ( btnRect.Contains(pt) )
-                return wxHT_TOPLEVEL_BUTTON_ICONIZE;
-            btnRect.x -= FRAME_BUTTON_WIDTH;
-        }
-        if ( flags & wxTOPLEVEL_BUTTON_HELP )
-        {
-            if ( btnRect.Contains(pt) )
-                return wxHT_TOPLEVEL_BUTTON_HELP;
-            btnRect.x -= FRAME_BUTTON_WIDTH;
-        }
-
-        if ( pt.y >= client.y && pt.y < client.y + FRAME_TITLEBAR_HEIGHT )
-            return wxHT_TOPLEVEL_TITLEBAR;
-    }
-
-    if ( (flags & wxTOPLEVEL_BORDER) && !(flags & wxTOPLEVEL_MAXIMIZED) )
-    {
-        // we are certainly at one of borders, lets decide which one:
-
-        int border = 0;
-        // dirty trick, relies on the way wxHT_TOPLEVEL_XXX are defined!
-        if ( pt.x < client.x )
-            border |= wxHT_TOPLEVEL_BORDER_W;
-        else if ( pt.x >= client.width + client.x )
-            border |= wxHT_TOPLEVEL_BORDER_E;
-        if ( pt.y < client.y )
-            border |= wxHT_TOPLEVEL_BORDER_N;
-        else if ( pt.y >= client.height + client.y )
-            border |= wxHT_TOPLEVEL_BORDER_S;
-        return border;
-    }
-
-    return wxHT_NOWHERE;
-}
-
-void wxWin32Renderer::DrawFrameTitleBar(wxDC& dc,
-                                        const wxRect& rect,
-                                        const wxString& title,
-                                        const wxIcon& icon,
-                                        int flags,
-                                        int specialButton,
-                                        int specialButtonFlags)
-{
-    if ( (flags & wxTOPLEVEL_BORDER) && !(flags & wxTOPLEVEL_MAXIMIZED) )
-    {
-        DrawFrameBorder(dc, rect, flags);
-    }
-    if ( flags & wxTOPLEVEL_TITLEBAR )
-    {
-        DrawFrameBackground(dc, rect, flags);
-        if ( flags & wxTOPLEVEL_ICON )
-            DrawFrameIcon(dc, rect, icon, flags);
-        DrawFrameTitle(dc, rect, title, flags);
-
-        wxRect client = GetFrameClientArea(rect, flags & ~wxTOPLEVEL_TITLEBAR);
-        wxCoord x,y;
-        x = client.GetRight() - 2 - FRAME_BUTTON_WIDTH;
-        y = client.GetTop() + (FRAME_TITLEBAR_HEIGHT-FRAME_BUTTON_HEIGHT)/2;
-
-        if ( flags & wxTOPLEVEL_BUTTON_CLOSE )
-        {
-            DrawFrameButton(dc, x, y, wxTOPLEVEL_BUTTON_CLOSE,
-                            (specialButton == wxTOPLEVEL_BUTTON_CLOSE) ?
-                            specialButtonFlags : 0);
-            x -= FRAME_BUTTON_WIDTH + 2;
-        }
-        if ( flags & wxTOPLEVEL_BUTTON_MAXIMIZE )
-        {
-            DrawFrameButton(dc, x, y, wxTOPLEVEL_BUTTON_MAXIMIZE,
-                            (specialButton == wxTOPLEVEL_BUTTON_MAXIMIZE) ?
-                            specialButtonFlags : 0);
-            x -= FRAME_BUTTON_WIDTH;
-        }
-        if ( flags & wxTOPLEVEL_BUTTON_RESTORE )
-        {
-            DrawFrameButton(dc, x, y, wxTOPLEVEL_BUTTON_RESTORE,
-                            (specialButton == wxTOPLEVEL_BUTTON_RESTORE) ?
-                            specialButtonFlags : 0);
-            x -= FRAME_BUTTON_WIDTH;
-        }
-        if ( flags & wxTOPLEVEL_BUTTON_ICONIZE )
-        {
-            DrawFrameButton(dc, x, y, wxTOPLEVEL_BUTTON_ICONIZE,
-                            (specialButton == wxTOPLEVEL_BUTTON_ICONIZE) ?
-                            specialButtonFlags : 0);
-            x -= FRAME_BUTTON_WIDTH;
-        }
-        if ( flags & wxTOPLEVEL_BUTTON_HELP )
-        {
-            DrawFrameButton(dc, x, y, wxTOPLEVEL_BUTTON_HELP,
-                            (specialButton == wxTOPLEVEL_BUTTON_HELP) ?
-                            specialButtonFlags : 0);
-        }
-    }
-}
-
-void wxWin32Renderer::DrawFrameBorder(wxDC& dc,
-                                      const wxRect& rect,
-                                      int flags)
-{
-    if ( !(flags & wxTOPLEVEL_BORDER) ) return;
-
-    wxRect r(rect);
-
-    DrawShadedRect(dc, &r, m_penLightGrey, m_penBlack);
-    DrawShadedRect(dc, &r, m_penHighlight, m_penDarkGrey);
-    DrawShadedRect(dc, &r, m_penLightGrey, m_penLightGrey);
-    if ( flags & wxTOPLEVEL_RESIZEABLE )
-        DrawShadedRect(dc, &r, m_penLightGrey, m_penLightGrey);
-}
-
-void wxWin32Renderer::DrawFrameBackground(wxDC& dc,
-                                          const wxRect& rect,
-                                          int flags)
-{
-    if ( !(flags & wxTOPLEVEL_TITLEBAR) ) return;
-
-    wxColour col = (flags & wxTOPLEVEL_ACTIVE) ?
-                   wxSCHEME_COLOUR(m_scheme, TITLEBAR_ACTIVE) :
-                   wxSCHEME_COLOUR(m_scheme, TITLEBAR);
-
-    wxRect r = GetFrameClientArea(rect, flags & ~wxTOPLEVEL_TITLEBAR);
-    r.height = FRAME_TITLEBAR_HEIGHT;
-
-    DrawBackground(dc, col, r);
-}
-
-void wxWin32Renderer::DrawFrameTitle(wxDC& dc,
-                                     const wxRect& rect,
-                                     const wxString& title,
-                                     int flags)
-{
-    wxColour col = (flags & wxTOPLEVEL_ACTIVE) ?
-                   wxSCHEME_COLOUR(m_scheme, TITLEBAR_ACTIVE_TEXT) :
-                   wxSCHEME_COLOUR(m_scheme, TITLEBAR_TEXT);
-
-    wxRect r = GetFrameClientArea(rect, flags & ~wxTOPLEVEL_TITLEBAR);
-    r.height = FRAME_TITLEBAR_HEIGHT;
-    if ( flags & wxTOPLEVEL_ICON )
-    {
-        r.x += FRAME_TITLEBAR_HEIGHT;
-        r.width -= FRAME_TITLEBAR_HEIGHT + 2;
-    }
-    else
-    {
-        r.x += 1;
-        r.width -= 3;
-    }
-
-    if ( flags & wxTOPLEVEL_BUTTON_CLOSE )
-        r.width -= FRAME_BUTTON_WIDTH + 2;
-    if ( flags & wxTOPLEVEL_BUTTON_MAXIMIZE )
-        r.width -= FRAME_BUTTON_WIDTH;
-    if ( flags & wxTOPLEVEL_BUTTON_RESTORE )
-        r.width -= FRAME_BUTTON_WIDTH;
-    if ( flags & wxTOPLEVEL_BUTTON_ICONIZE )
-        r.width -= FRAME_BUTTON_WIDTH;
-    if ( flags & wxTOPLEVEL_BUTTON_HELP )
-        r.width -= FRAME_BUTTON_WIDTH;
-
-    dc.SetFont(m_titlebarFont);
-    dc.SetTextForeground(col);
-
-    wxCoord textW;
-    dc.GetTextExtent(title, &textW, NULL);
-    if ( textW > r.width )
-    {
-        // text is too big, let's shorten it and add "..." after it:
-        size_t len = title.length();
-        wxCoord WSoFar, letterW;
-
-        dc.GetTextExtent(wxT("..."), &WSoFar, NULL);
-        if ( WSoFar > r.width )
-        {
-            // not enough space to draw anything
-            return;
-        }
-
-        wxString s;
-        s.Alloc(len);
-        for (size_t i = 0; i < len; i++)
-        {
-            dc.GetTextExtent(title[i], &letterW, NULL);
-            if ( letterW + WSoFar > r.width )
-                break;
-            WSoFar += letterW;
-            s << title[i];
-        }
-        s << wxT("...");
-        dc.DrawLabel(s, wxNullBitmap, r,
-                     wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
-    }
-    else
-        dc.DrawLabel(title, wxNullBitmap, r,
-                     wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
-}
-
-void wxWin32Renderer::DrawFrameIcon(wxDC& dc,
-                                    const wxRect& rect,
-                                    const wxIcon& icon,
-                                    int flags)
-{
-    if ( icon.Ok() )
-    {
-        wxRect r = GetFrameClientArea(rect, flags & ~wxTOPLEVEL_TITLEBAR);
-        dc.DrawIcon(icon, r.x, r.y);
-    }
-}
-
-void wxWin32Renderer::DrawFrameButton(wxDC& dc,
-                                      wxCoord x, wxCoord y,
-                                      int button,
-                                      int flags)
-{
-    wxRect r(x, y, FRAME_BUTTON_WIDTH, FRAME_BUTTON_HEIGHT);
-
-    size_t idx = 0;
-    switch (button)
-    {
-        case wxTOPLEVEL_BUTTON_CLOSE:    idx = FrameButton_Close; break;
-        case wxTOPLEVEL_BUTTON_MAXIMIZE: idx = FrameButton_Maximize; break;
-        case wxTOPLEVEL_BUTTON_ICONIZE: idx = FrameButton_Minimize; break;
-        case wxTOPLEVEL_BUTTON_RESTORE:  idx = FrameButton_Restore; break;
-        case wxTOPLEVEL_BUTTON_HELP:     idx = FrameButton_Help; break;
-        default:
-            wxFAIL_MSG(wxT("incorrect button specification"));
-    }
-
-    if ( flags & wxCONTROL_PRESSED )
-    {
-        DrawShadedRect(dc, &r, m_penBlack, m_penHighlight);
-        DrawShadedRect(dc, &r, m_penDarkGrey, m_penLightGrey);
-        DrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), r);
-        dc.DrawBitmap(m_bmpFrameButtons[idx], r.x+1, r.y+1, true);
-    }
-    else
-    {
-        DrawShadedRect(dc, &r, m_penHighlight, m_penBlack);
-        DrawShadedRect(dc, &r, m_penLightGrey, m_penDarkGrey);
-        DrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), r);
-        dc.DrawBitmap(m_bmpFrameButtons[idx], r.x, r.y, true);
-    }
-}
-
-
-wxRect wxWin32Renderer::GetFrameClientArea(const wxRect& rect,
-                                           int flags) const
-{
-    wxRect r(rect);
-
-    if ( (flags & wxTOPLEVEL_BORDER) && !(flags & wxTOPLEVEL_MAXIMIZED) )
-    {
-        int border = (flags & wxTOPLEVEL_RESIZEABLE) ?
-                        RESIZEABLE_FRAME_BORDER_THICKNESS :
-                        FRAME_BORDER_THICKNESS;
-        r.Inflate(-border);
-    }
-    if ( flags & wxTOPLEVEL_TITLEBAR )
-    {
-        r.y += FRAME_TITLEBAR_HEIGHT;
-        r.height -= FRAME_TITLEBAR_HEIGHT;
-    }
-
-    return r;
-}
-
-wxSize wxWin32Renderer::GetFrameTotalSize(const wxSize& clientSize,
-                                     int flags) const
-{
-    wxSize s(clientSize);
-
-    if ( (flags & wxTOPLEVEL_BORDER) && !(flags & wxTOPLEVEL_MAXIMIZED) )
-    {
-        int border = (flags & wxTOPLEVEL_RESIZEABLE) ?
-                        RESIZEABLE_FRAME_BORDER_THICKNESS :
-                        FRAME_BORDER_THICKNESS;
-        s.x += 2*border;
-        s.y += 2*border;
-    }
-    if ( flags & wxTOPLEVEL_TITLEBAR )
-        s.y += FRAME_TITLEBAR_HEIGHT;
-
-    return s;
-}
-
-wxSize wxWin32Renderer::GetFrameMinSize(int flags) const
-{
-    wxSize s;
-
-    if ( (flags & wxTOPLEVEL_BORDER) && !(flags & wxTOPLEVEL_MAXIMIZED) )
-    {
-        int border = (flags & wxTOPLEVEL_RESIZEABLE) ?
-                        RESIZEABLE_FRAME_BORDER_THICKNESS :
-                        FRAME_BORDER_THICKNESS;
-        s.x += 2*border;
-        s.y += 2*border;
-    }
-
-    if ( flags & wxTOPLEVEL_TITLEBAR )
-    {
-        s.y += FRAME_TITLEBAR_HEIGHT;
-
-        if ( flags & wxTOPLEVEL_ICON )
-            s.x += FRAME_TITLEBAR_HEIGHT + 2;
-        if ( flags & wxTOPLEVEL_BUTTON_CLOSE )
-            s.x += FRAME_BUTTON_WIDTH + 2;
-        if ( flags & wxTOPLEVEL_BUTTON_MAXIMIZE )
-            s.x += FRAME_BUTTON_WIDTH;
-        if ( flags & wxTOPLEVEL_BUTTON_RESTORE )
-            s.x += FRAME_BUTTON_WIDTH;
-        if ( flags & wxTOPLEVEL_BUTTON_ICONIZE )
-            s.x += FRAME_BUTTON_WIDTH;
-        if ( flags & wxTOPLEVEL_BUTTON_HELP )
-            s.x += FRAME_BUTTON_WIDTH;
-    }
-
-    return s;
-}
-
-wxSize wxWin32Renderer::GetFrameIconSize() const
-{
-    return wxSize(16, 16);
-}
-
-
 // ----------------------------------------------------------------------------
 // standard icons
 // ----------------------------------------------------------------------------
 
 /* Copyright (c) Julian Smart */
 // ----------------------------------------------------------------------------
 // standard icons
 // ----------------------------------------------------------------------------
 
 /* Copyright (c) Julian Smart */
-static char *error_xpm[]={
+static const char *error_xpm[]={
 /* columns rows colors chars-per-pixel */
 "32 32 70 1",
 "- c #BF0101",
 /* columns rows colors chars-per-pixel */
 "32 32 70 1",
 "- c #BF0101",
@@ -3375,7 +2886,7 @@ static char *error_xpm[]={
 };
 
 /* Copyright (c) Julian Smart */
 };
 
 /* Copyright (c) Julian Smart */
-static char *info_xpm[]={
+static const char *info_xpm[]={
 /* columns rows colors chars-per-pixel */
 "32 32 17 1",
 "* c #A1A3FB",
 /* columns rows colors chars-per-pixel */
 "32 32 17 1",
 "* c #A1A3FB",
@@ -3431,7 +2942,7 @@ static char *info_xpm[]={
 };
 
 /* Copyright (c) Julian Smart */
 };
 
 /* Copyright (c) Julian Smart */
-static char *question_xpm[]={
+static const char *question_xpm[]={
 /* columns rows colors chars-per-pixel */
 "32 32 16 1",
 "O c #A3A3FF",
 /* columns rows colors chars-per-pixel */
 "32 32 16 1",
 "O c #A3A3FF",
@@ -3486,7 +2997,7 @@ static char *question_xpm[]={
 };
 
 /* Copyright (c) Julian Smart */
 };
 
 /* Copyright (c) Julian Smart */
-static char *warning_xpm[]={
+static const char *warning_xpm[]={
 /* columns rows colors chars-per-pixel */
 "32 32 9 1",
 "@ c Black",
 /* columns rows colors chars-per-pixel */
 "32 32 9 1",
 "@ c Black",
@@ -3556,28 +3067,20 @@ wxBitmap wxWin32ArtProvider::CreateBitmap(const wxArtID& id,
 // text control geometry
 // ----------------------------------------------------------------------------
 
 // text control geometry
 // ----------------------------------------------------------------------------
 
-static inline int GetTextBorderWidth()
-{
-    return 1;
-}
-
 wxRect
 wxRect
-wxWin32Renderer::GetTextTotalArea(const wxTextCtrl * WXUNUSED(text),
+wxWin32Renderer::GetTextTotalArea(const wxTextCtrl *text,
                                   const wxRect& rect) const
 {
                                   const wxRect& rect) const
 {
-    wxRect rectTotal = rect;
-
-    wxCoord widthBorder = GetTextBorderWidth();
-    rectTotal.Inflate(widthBorder);
+    wxRect rectTotal = wxStdRenderer::GetTextTotalArea(text, rect);
 
 
-    // this is what Windows does
+    // this is strange but it's what Windows does
     rectTotal.height++;
 
     return rectTotal;
 }
 
 wxRect
     rectTotal.height++;
 
     return rectTotal;
 }
 
 wxRect
-wxWin32Renderer::GetTextClientArea(const wxTextCtrl * WXUNUSED(text),
+wxWin32Renderer::GetTextClientArea(const wxTextCtrl *text,
                                    const wxRect& rect,
                                    wxCoord *extraSpaceBeyond) const
 {
                                    const wxRect& rect,
                                    wxCoord *extraSpaceBeyond) const
 {
@@ -3587,13 +3090,7 @@ wxWin32Renderer::GetTextClientArea(const wxTextCtrl * WXUNUSED(text),
     if ( rectText.height > 0 )
         rectText.height--;
 
     if ( rectText.height > 0 )
         rectText.height--;
 
-    wxCoord widthBorder = GetTextBorderWidth();
-    rectText.Inflate(-widthBorder);
-
-    if ( extraSpaceBeyond )
-        *extraSpaceBeyond = 0;
-
-    return rectText;
+    return wxStdRenderer::GetTextClientArea(text, rect, extraSpaceBeyond);
 }
 
 #endif // wxUSE_TEXTCTRL
 }
 
 #endif // wxUSE_TEXTCTRL
@@ -3664,10 +3161,18 @@ void wxWin32Renderer::AdjustSize(wxSize *size, const wxWindow *window)
     }
 #endif // wxUSE_BUTTON || wxUSE_TOGGLEBTN
 
     }
 #endif // wxUSE_BUTTON || wxUSE_TOGGLEBTN
 
-    // take into account the border width
-    wxRect rectBorder = GetBorderDimensions(window->GetBorder());
-    size->x += rectBorder.x + rectBorder.width;
-    size->y += rectBorder.y + rectBorder.height;
+    wxStdRenderer::AdjustSize(size, window);
+}
+
+wxBitmap wxWin32Renderer::GetFrameButtonBitmap(FrameButtonType type)
+{
+    wxBitmap& bmp = m_bmpFrameButtons[type];
+    if ( !bmp.Ok() )
+    {
+        bmp = wxBitmap(ms_xpmFrameButtons[type]);
+    }
+
+    return bmp;
 }
 
 // ============================================================================
 }
 
 // ============================================================================
@@ -3691,10 +3196,9 @@ bool wxWin32InputHandler::HandleMouse(wxInputConsumer *control,
     // clicking on the control gives it focus
     if ( event.ButtonDown() )
     {
     // clicking on the control gives it focus
     if ( event.ButtonDown() )
     {
-        wxWindow *win = control->GetInputWindow();
+        wxWindow * const win = control->GetInputWindow();
 
 
-        if ( (wxWindow::FindFocus() != control->GetInputWindow()) &&
-             win->AcceptsFocus() )
+        if ( win->CanAcceptFocus() && wxWindow::FindFocus() != win )
         {
             win->SetFocus();
 
         {
             win->SetFocus();
 
@@ -3727,13 +3231,11 @@ bool wxWin32ScrollBarInputHandler::OnScrollTimer(wxScrollBar *scrollbar,
     bool stop = false;
     if ( action == wxACTION_SCROLL_PAGE_DOWN )
     {
     bool stop = false;
     if ( action == wxACTION_SCROLL_PAGE_DOWN )
     {
-        stop = m_renderer->HitTestScrollbar(scrollbar, m_ptStartScrolling)
-                != wxHT_SCROLLBAR_BAR_2;
+        stop = scrollbar->HitTestBar(m_ptStartScrolling) != wxHT_SCROLLBAR_BAR_2;
     }
     else if ( action == wxACTION_SCROLL_PAGE_UP )
     {
     }
     else if ( action == wxACTION_SCROLL_PAGE_UP )
     {
-        stop = m_renderer->HitTestScrollbar(scrollbar, m_ptStartScrolling)
-                != wxHT_SCROLLBAR_BAR_1;
+        stop = scrollbar->HitTestBar(m_ptStartScrolling) != wxHT_SCROLLBAR_BAR_1;
     }
 
     if ( stop )
     }
 
     if ( stop )
@@ -3795,7 +3297,7 @@ bool wxWin32ScrollBarInputHandler::HandleMouseMove(wxInputConsumer *control,
             return false;
         }
 
             return false;
         }
 
-        ht = m_renderer->HitTestScrollbar(scrollbar, event.GetPosition());
+        ht = scrollbar->HitTestBar(event.GetPosition());
         if ( ht == m_htLast )
         {
             // yes it did, resume scrolling
         if ( ht == m_htLast )
         {
             // yes it did, resume scrolling
@@ -3825,7 +3327,7 @@ bool wxWin32ScrollBarInputHandler::HandleMouseMove(wxInputConsumer *control,
         // Always let thumb jump back if we leave the scrollbar
         if ( event.Moving() )
         {
         // Always let thumb jump back if we leave the scrollbar
         if ( event.Moving() )
         {
-            ht = m_renderer->HitTestScrollbar(scrollbar, event.GetPosition());
+            ht = scrollbar->HitTestBar(event.GetPosition());
         }
         else // event.Leaving()
         {
         }
         else // event.Leaving()
         {
@@ -3844,7 +3346,7 @@ bool wxWin32ScrollBarInputHandler::HandleMouseMove(wxInputConsumer *control,
             if (pos.y > -40 && pos.y < scrollbar->GetSize().y+40)
                pos.y = 5;
         }
             if (pos.y > -40 && pos.y < scrollbar->GetSize().y+40)
                pos.y = 5;
         }
-        ht = m_renderer->HitTestScrollbar(scrollbar, pos );
+        ht = scrollbar->HitTestBar(pos);
 #endif
 
         // if we're dragging the thumb and the mouse stays in the scrollbar, it
 #endif
 
         // if we're dragging the thumb and the mouse stays in the scrollbar, it
@@ -4144,21 +3646,13 @@ END_EVENT_TABLE()
 
 void wxWin32SystemMenuEvtHandler::OnSystemMenu(wxCommandEvent &WXUNUSED(event))
 {
 
 void wxWin32SystemMenuEvtHandler::OnSystemMenu(wxCommandEvent &WXUNUSED(event))
 {
-    int border = ((m_wnd->GetWindowStyle() & wxRESIZE_BORDER) &&
-                  !m_wnd->IsMaximized()) ?
-                      RESIZEABLE_FRAME_BORDER_THICKNESS :
-                      FRAME_BORDER_THICKNESS;
-    wxPoint pt = m_wnd->GetClientAreaOrigin();
-    pt.x = -pt.x + border;
-    pt.y = -pt.y + border + FRAME_TITLEBAR_HEIGHT;
-
 #if wxUSE_ACCEL
     wxAcceleratorTable table = *m_wnd->GetAcceleratorTable();
     m_wnd->SetAcceleratorTable(wxNullAcceleratorTable);
 #endif
 
 #if wxUSE_MENUS
 #if wxUSE_ACCEL
     wxAcceleratorTable table = *m_wnd->GetAcceleratorTable();
     m_wnd->SetAcceleratorTable(wxNullAcceleratorTable);
 #endif
 
 #if wxUSE_MENUS
-    m_inputHnd->PopupSystemMenu(m_wnd, pt);
+    m_inputHnd->PopupSystemMenu(m_wnd);
 #endif // wxUSE_MENUS
 
 #if wxUSE_ACCEL
 #endif // wxUSE_MENUS
 
 #if wxUSE_ACCEL
@@ -4219,7 +3713,7 @@ bool wxWin32FrameInputHandler::HandleMouse(wxInputConsumer *consumer,
                        hit == wxHT_TOPLEVEL_ICON)) )
             {
 #if wxUSE_MENUS
                        hit == wxHT_TOPLEVEL_ICON)) )
             {
 #if wxUSE_MENUS
-                PopupSystemMenu(tlw, event.GetPosition());
+                PopupSystemMenu(tlw);
 #endif // wxUSE_MENUS
                 return true;
             }
 #endif // wxUSE_MENUS
                 return true;
             }
@@ -4231,38 +3725,36 @@ bool wxWin32FrameInputHandler::HandleMouse(wxInputConsumer *consumer,
 
 #if wxUSE_MENUS
 
 
 #if wxUSE_MENUS
 
-void wxWin32FrameInputHandler::PopupSystemMenu(wxTopLevelWindow *window,
-                                               const wxPoint& pos) const
+void wxWin32FrameInputHandler::PopupSystemMenu(wxTopLevelWindow *window) const
 {
 {
-    wxMenu *menu = new wxMenu;
+    wxMenu menu;
 
     if ( window->GetWindowStyle() & wxMAXIMIZE_BOX )
 
     if ( window->GetWindowStyle() & wxMAXIMIZE_BOX )
-        menu->Append(wxID_RESTORE_FRAME , _("&Restore"));
-    menu->Append(wxID_MOVE_FRAME , _("&Move"));
+        menu.Append(wxID_RESTORE_FRAME , _("&Restore"));
+    menu.Append(wxID_MOVE_FRAME , _("&Move"));
     if ( window->GetWindowStyle() & wxRESIZE_BORDER )
     if ( window->GetWindowStyle() & wxRESIZE_BORDER )
-        menu->Append(wxID_RESIZE_FRAME , _("&Size"));
+        menu.Append(wxID_RESIZE_FRAME , _("&Size"));
     if ( wxSystemSettings::HasFeature(wxSYS_CAN_ICONIZE_FRAME) )
     if ( wxSystemSettings::HasFeature(wxSYS_CAN_ICONIZE_FRAME) )
-        menu->Append(wxID_ICONIZE_FRAME , _("Mi&nimize"));
+        menu.Append(wxID_ICONIZE_FRAME , _("Mi&nimize"));
     if ( window->GetWindowStyle() & wxMAXIMIZE_BOX )
     if ( window->GetWindowStyle() & wxMAXIMIZE_BOX )
-        menu->Append(wxID_MAXIMIZE_FRAME , _("Ma&ximize"));
-    menu->AppendSeparator();
-    menu->Append(wxID_CLOSE_FRAME, _("Close\tAlt-F4"));
+        menu.Append(wxID_MAXIMIZE_FRAME , _("Ma&ximize"));
+    menu.AppendSeparator();
+    menu.Append(wxID_CLOSE_FRAME, _("Close\tAlt-F4"));
 
     if ( window->GetWindowStyle() & wxMAXIMIZE_BOX )
     {
         if ( window->IsMaximized() )
         {
 
     if ( window->GetWindowStyle() & wxMAXIMIZE_BOX )
     {
         if ( window->IsMaximized() )
         {
-            menu->Enable(wxID_MAXIMIZE_FRAME, false);
-            menu->Enable(wxID_MOVE_FRAME, false);
+            menu.Enable(wxID_MAXIMIZE_FRAME, false);
+            menu.Enable(wxID_MOVE_FRAME, false);
             if ( window->GetWindowStyle() & wxRESIZE_BORDER )
             if ( window->GetWindowStyle() & wxRESIZE_BORDER )
-                menu->Enable(wxID_RESIZE_FRAME, false);
+                menu.Enable(wxID_RESIZE_FRAME, false);
         }
         else
         }
         else
-            menu->Enable(wxID_RESTORE_FRAME, false);
+            menu.Enable(wxID_RESTORE_FRAME, false);
     }
 
     }
 
-    window->PopupMenu(menu, pos);
-    delete menu;
+    window->PopupMenu(&menu, wxPoint(0, 0));
 }
 
 #endif // wxUSE_MENUS
 }
 
 #endif // wxUSE_MENUS
@@ -4283,3 +3775,5 @@ bool wxWin32FrameInputHandler::HandleActivation(wxInputConsumer *consumer,
 
     return wxStdInputHandler::HandleActivation(consumer, activated);
 }
 
     return wxStdInputHandler::HandleActivation(consumer, activated);
 }
+
+#endif // wxUSE_THEME_WIN32