1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: msw/renderer.cpp
3 // Purpose: implementation of wxRendererNative for Windows
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
9 // License: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // for compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
28 #include "wx/string.h"
31 #include "wx/renderer.h"
33 #include "wx/msw/uxtheme.h"
35 // ----------------------------------------------------------------------------
36 // wxRendererMSW: wxRendererNative implementation for "old" Win32 systems
37 // ----------------------------------------------------------------------------
39 class WXDLLEXPORT wxRendererMSW
: public wxDelegateRendererNative
44 static wxRendererNative
& Get();
47 DECLARE_NO_COPY_CLASS(wxRendererMSW
)
50 // ----------------------------------------------------------------------------
51 // wxRendererXP: wxRendererNative implementation for Windows XP and later
52 // ----------------------------------------------------------------------------
54 class WXDLLEXPORT wxRendererXP
: public wxDelegateRendererNative
57 wxRendererXP() : wxDelegateRendererNative(wxRendererMSW
::Get()) { }
59 static wxRendererNative
& Get();
61 virtual void DrawSplitterBorder(wxWindow
*win
,
64 virtual void DrawSplitterSash(wxWindow
*win
,
68 wxOrientation orient
);
69 virtual wxPoint
GetSplitterSashAndBorder(const wxWindow
*win
);
72 DECLARE_NO_COPY_CLASS(wxRendererXP
)
75 // ============================================================================
76 // wxRendererNative and wxRendererMSW implementation
77 // ============================================================================
80 wxRendererNative
& wxRendererNative
::GetDefault()
82 wxUxThemeEngine
*themeEngine
= wxUxThemeEngine
::Get();
83 return themeEngine
&& themeEngine
->IsThemeActive() ? wxRendererXP
::Get()
84 : wxRendererMSW
::Get();
88 wxRendererNative
& wxRendererMSW
::Get()
90 static wxRendererMSW s_rendererMSW
;
95 // ============================================================================
96 // wxRendererXP implementation
97 // ============================================================================
100 wxRendererNative
& wxRendererXP
::Get()
102 static wxRendererXP s_rendererXP
;
107 // ----------------------------------------------------------------------------
109 // ----------------------------------------------------------------------------
111 // the width of the sash: this is the same as used by Explorer...
112 static const wxCoord SASH_WIDTH
= 4;
114 wxPoint wxRendererXP
::GetSplitterSashAndBorder(const wxWindow
* WXUNUSED(win
))
116 return wxPoint(SASH_WIDTH
, 0);
120 wxRendererXP
::DrawSplitterBorder(wxWindow
* WXUNUSED(win
),
122 const wxRect
& WXUNUSED(rect
))
127 wxRendererXP
::DrawSplitterSash(wxWindow
*win
,
131 wxOrientation orient
)
133 // I don't know if it is correct to use the rebar background for the
134 // splitter but it least this works ok in the default theme
135 wxUxThemeHandle
hTheme(win
, L
"REBAR");
139 if ( orient
== wxVERTICAL
)
141 rect
.left
= position
;
142 rect
.right
= position
+ SASH_WIDTH
;
144 rect
.bottom
= size
.y
;
151 rect
.bottom
= position
+ SASH_WIDTH
;
154 wxUxThemeEngine
::Get()->DrawThemeBackground