1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: palmos/renderer.cpp
3 // Purpose: implementation of wxRendererNative for Palm OS
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
9 // License: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // Palm OS doesn't really have a theme engine, so this is not needed.
23 // for compilers that support precompilation, includes "wx.h".
24 #include "wx/wxprec.h"
31 #include "wx/string.h"
32 #include "wx/window.h"
36 #include "wx/splitter.h"
37 #include "wx/renderer.h"
39 #include "wx/palmos/uxtheme.h"
41 // ----------------------------------------------------------------------------
42 // wxRendererMSW: wxRendererNative implementation for "old" Win32 systems
43 // ----------------------------------------------------------------------------
45 class WXDLLEXPORT wxRendererMSW
: public wxDelegateRendererNative
50 static wxRendererNative
& Get();
53 DECLARE_NO_COPY_CLASS(wxRendererMSW
)
56 // ----------------------------------------------------------------------------
57 // wxRendererXP: wxRendererNative implementation for Windows XP and later
58 // ----------------------------------------------------------------------------
60 class WXDLLEXPORT wxRendererXP
: public wxDelegateRendererNative
63 wxRendererXP() : wxDelegateRendererNative(wxRendererMSW::Get()) { }
65 static wxRendererNative
& Get();
67 virtual void DrawSplitterBorder(wxWindow
*win
,
71 virtual void DrawSplitterSash(wxWindow
*win
,
77 virtual wxSplitterRenderParams
GetSplitterParams(const wxWindow
*win
);
80 DECLARE_NO_COPY_CLASS(wxRendererXP
)
83 // ============================================================================
84 // wxRendererNative and wxRendererMSW implementation
85 // ============================================================================
88 wxRendererNative
& wxRendererNative::GetDefault()
90 wxUxThemeEngine
*themeEngine
= wxUxThemeEngine::Get();
91 return themeEngine
&& themeEngine
->IsAppThemed() ? wxRendererXP::Get()
92 : wxRendererMSW::Get();
96 wxRendererNative
& wxRendererMSW::Get()
98 static wxRendererMSW s_rendererMSW
;
100 return s_rendererMSW
;
103 // ============================================================================
104 // wxRendererXP implementation
105 // ============================================================================
108 wxRendererNative
& wxRendererXP::Get()
110 static wxRendererXP s_rendererXP
;
115 // ----------------------------------------------------------------------------
117 // ----------------------------------------------------------------------------
119 // the width of the sash: this is the same as used by Explorer...
120 static const wxCoord SASH_WIDTH
= 4;
122 wxSplitterRenderParams
123 wxRendererXP::GetSplitterParams(const wxWindow
* win
)
125 if (win
->GetWindowStyle() & wxSP_NO_XP_THEME
)
126 return m_rendererNative
.GetSplitterParams(win
);
128 return wxSplitterRenderParams(SASH_WIDTH
, 0, false);
132 wxRendererXP::DrawSplitterBorder(wxWindow
* win
,
137 if (win
->GetWindowStyle() & wxSP_NO_XP_THEME
)
139 m_rendererNative
.DrawSplitterBorder(win
, dc
, rect
, flags
);
144 wxRendererXP::DrawSplitterSash(wxWindow
*win
,
148 wxOrientation orient
,
151 if (win
->GetWindowStyle() & wxSP_NO_XP_THEME
)
153 m_rendererNative
.DrawSplitterSash(
154 win
, dc
, size
, position
, orient
, flags
);
158 // I don't know if it is correct to use the rebar background for the
159 // splitter but it least this works ok in the default theme
160 wxUxThemeHandle
hTheme(win
, L
"REBAR");
164 if ( orient
== wxVERTICAL
)
166 rect
.left
= position
;
167 rect
.right
= position
+ SASH_WIDTH
;
169 rect
.bottom
= size
.y
;
176 rect
.bottom
= position
+ SASH_WIDTH
;
179 wxUxThemeEngine::Get()->DrawThemeBackground