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"
29 #include "wx/window.h"
33 #include "wx/renderer.h"
35 #include "wx/msw/uxtheme.h"
37 // ----------------------------------------------------------------------------
38 // wxRendererMSW: wxRendererNative implementation for "old" Win32 systems
39 // ----------------------------------------------------------------------------
41 class WXDLLEXPORT wxRendererMSW
: public wxDelegateRendererNative
46 static wxRendererNative
& Get();
49 DECLARE_NO_COPY_CLASS(wxRendererMSW
)
52 // ----------------------------------------------------------------------------
53 // wxRendererXP: wxRendererNative implementation for Windows XP and later
54 // ----------------------------------------------------------------------------
56 class WXDLLEXPORT wxRendererXP
: public wxDelegateRendererNative
59 wxRendererXP() : wxDelegateRendererNative(wxRendererMSW::Get()) { }
61 static wxRendererNative
& Get();
63 virtual void DrawSplitterBorder(wxWindow
*win
,
67 virtual void DrawSplitterSash(wxWindow
*win
,
73 virtual wxSplitterRenderParams
GetSplitterParams(const wxWindow
*win
);
76 DECLARE_NO_COPY_CLASS(wxRendererXP
)
79 // ============================================================================
80 // wxRendererNative and wxRendererMSW implementation
81 // ============================================================================
84 wxRendererNative
& wxRendererNative::GetDefault()
86 wxUxThemeEngine
*themeEngine
= wxUxThemeEngine::Get();
87 return themeEngine
&& themeEngine
->IsAppThemed() ? wxRendererXP::Get()
88 : wxRendererMSW::Get();
92 wxRendererNative
& wxRendererMSW::Get()
94 static wxRendererMSW s_rendererMSW
;
99 // ============================================================================
100 // wxRendererXP implementation
101 // ============================================================================
104 wxRendererNative
& wxRendererXP::Get()
106 static wxRendererXP s_rendererXP
;
111 // ----------------------------------------------------------------------------
113 // ----------------------------------------------------------------------------
115 // the width of the sash: this is the same as used by Explorer...
116 static const wxCoord SASH_WIDTH
= 4;
118 wxSplitterRenderParams
119 wxRendererXP::GetSplitterParams(const wxWindow
* WXUNUSED(win
))
121 return wxSplitterRenderParams(SASH_WIDTH
, 0, false);
125 wxRendererXP::DrawSplitterBorder(wxWindow
* WXUNUSED(win
),
127 const wxRect
& WXUNUSED(rect
),
133 wxRendererXP::DrawSplitterSash(wxWindow
*win
,
137 wxOrientation orient
,
140 // I don't know if it is correct to use the rebar background for the
141 // splitter but it least this works ok in the default theme
142 wxUxThemeHandle
hTheme(win
, L
"REBAR");
146 if ( orient
== wxVERTICAL
)
148 rect
.left
= position
;
149 rect
.right
= position
+ SASH_WIDTH
;
151 rect
.bottom
= size
.y
;
158 rect
.bottom
= position
+ SASH_WIDTH
;
161 wxUxThemeEngine::Get()->DrawThemeBackground