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
,
66 virtual void DrawSplitterSash(wxWindow
*win
,
70 wxOrientation orient
);
71 virtual wxPoint
GetSplitterSashAndBorder(const wxWindow
*win
);
74 DECLARE_NO_COPY_CLASS(wxRendererXP
)
77 // ============================================================================
78 // wxRendererNative and wxRendererMSW implementation
79 // ============================================================================
82 wxRendererNative
& wxRendererNative::GetDefault()
84 wxUxThemeEngine
*themeEngine
= wxUxThemeEngine::Get();
85 return themeEngine
&& themeEngine
->IsThemeActive() ? wxRendererXP::Get()
86 : wxRendererMSW::Get();
90 wxRendererNative
& wxRendererMSW::Get()
92 static wxRendererMSW s_rendererMSW
;
97 // ============================================================================
98 // wxRendererXP implementation
99 // ============================================================================
102 wxRendererNative
& wxRendererXP::Get()
104 static wxRendererXP s_rendererXP
;
109 // ----------------------------------------------------------------------------
111 // ----------------------------------------------------------------------------
113 // the width of the sash: this is the same as used by Explorer...
114 static const wxCoord SASH_WIDTH
= 4;
116 wxPoint
wxRendererXP::GetSplitterSashAndBorder(const wxWindow
* WXUNUSED(win
))
118 return wxPoint(SASH_WIDTH
, 0);
122 wxRendererXP::DrawSplitterBorder(wxWindow
* WXUNUSED(win
),
124 const wxRect
& WXUNUSED(rect
))
129 wxRendererXP::DrawSplitterSash(wxWindow
*win
,
133 wxOrientation orient
)
135 // I don't know if it is correct to use the rebar background for the
136 // splitter but it least this works ok in the default theme
137 wxUxThemeHandle
hTheme(win
, L
"REBAR");
141 if ( orient
== wxVERTICAL
)
143 rect
.left
= position
;
144 rect
.right
= position
+ SASH_WIDTH
;
146 rect
.bottom
= size
.y
;
153 rect
.bottom
= position
+ SASH_WIDTH
;
156 wxUxThemeEngine::Get()->DrawThemeBackground