]>
Commit | Line | Data |
---|---|---|
9c7f49f5 | 1 | /////////////////////////////////////////////////////////////////////////////// |
90b903c2 | 2 | // Name: src/msw/renderer.cpp |
38c4cb6a | 3 | // Purpose: implementation of wxRendererNative for Windows |
9c7f49f5 VZ |
4 | // Author: Vadim Zeitlin |
5 | // Modified by: | |
6 | // Created: 20.07.2003 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org> | |
65571936 | 9 | // License: wxWindows licence |
9c7f49f5 VZ |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
20 | // for compilers that support precompilation, includes "wx.h". | |
21 | #include "wx/wxprec.h" | |
22 | ||
23 | #ifdef __BORLANDC__ | |
24 | #pragma hdrstop | |
25 | #endif | |
26 | ||
27 | #ifndef WX_PRECOMP | |
28 | #include "wx/string.h" | |
85b657c7 VS |
29 | #include "wx/window.h" |
30 | #include "wx/dc.h" | |
9eddec69 | 31 | #include "wx/settings.h" |
9c7f49f5 VZ |
32 | #endif //WX_PRECOMP |
33 | ||
3c2544bb | 34 | #include "wx/splitter.h" |
9c7f49f5 | 35 | #include "wx/renderer.h" |
03f01e63 | 36 | #include "wx/msw/private.h" |
4614c8e5 | 37 | #include "wx/msw/uxtheme.h" |
8b97949e | 38 | |
7cf3223a VZ |
39 | // tmschema.h is in Win32 Platform SDK and might not be available with earlier |
40 | // compilers | |
41 | #ifndef CP_DROPDOWNBUTTON | |
2209baae | 42 | #define BP_PUSHBUTTON 1 |
9f93b45e VZ |
43 | #define BP_CHECKBOX 3 |
44 | #define CBS_UNCHECKEDNORMAL 1 | |
45 | #define CBS_CHECKEDNORMAL (CBS_UNCHECKEDNORMAL + 4) | |
46 | #define CBS_MIXEDNORMAL (CBS_CHECKEDNORMAL + 4) | |
47 | ||
2209baae RR |
48 | #define PBS_NORMAL 1 |
49 | #define PBS_HOT 2 | |
50 | #define PBS_PRESSED 3 | |
51 | #define PBS_DISABLED 4 | |
52 | #define PBS_DEFAULTED 5 | |
53 | ||
7cf3223a VZ |
54 | #define CP_DROPDOWNBUTTON 1 |
55 | ||
56 | #define CBXS_NORMAL 1 | |
57 | #define CBXS_HOT 2 | |
58 | #define CBXS_PRESSED 3 | |
59 | #define CBXS_DISABLED 4 | |
a9d9e2f2 | 60 | |
9f93b45e VZ |
61 | #define TVP_GLYPH 2 |
62 | ||
63 | #define GLPS_CLOSED 1 | |
a9d9e2f2 JS |
64 | #define GLPS_OPENED 2 |
65 | ||
66 | #define HP_HEADERITEM 1 | |
67 | ||
68 | #define HIS_NORMAL 1 | |
69 | #define HIS_HOT 2 | |
70 | #define HIS_PRESSED 3 | |
4b94ddc4 RD |
71 | |
72 | #define TMT_HEIGHT 2417 | |
73 | ||
74 | #define HP_HEADERSORTARROW 4 | |
75 | #define HSAS_SORTEDUP 1 | |
76 | #define HSAS_SORTEDDOWN 2 | |
7cf3223a VZ |
77 | #endif |
78 | ||
9f93b45e VZ |
79 | #if defined(__WXWINCE__) && !defined(DFCS_FLAT) |
80 | #define DFCS_FLAT 0 | |
81 | #endif | |
82 | ||
59ee63e9 VZ |
83 | #ifndef DFCS_HOT |
84 | #define DFCS_HOT 0x1000 | |
85 | #endif | |
86 | ||
9c7f49f5 | 87 | // ---------------------------------------------------------------------------- |
8b97949e | 88 | // wxRendererMSW: wxRendererNative implementation for "old" Win32 systems |
9c7f49f5 VZ |
89 | // ---------------------------------------------------------------------------- |
90 | ||
38c4cb6a | 91 | class WXDLLEXPORT wxRendererMSW : public wxDelegateRendererNative |
9c7f49f5 | 92 | { |
2eb10e2a VZ |
93 | public: |
94 | wxRendererMSW() { } | |
95 | ||
8b97949e VZ |
96 | static wxRendererNative& Get(); |
97 | ||
7402677a VZ |
98 | virtual void DrawComboBoxDropButton(wxWindow *win, |
99 | wxDC& dc, | |
100 | const wxRect& rect, | |
101 | int flags = 0); | |
102 | ||
59ee63e9 VZ |
103 | virtual void DrawCheckBox(wxWindow *win, |
104 | wxDC& dc, | |
105 | const wxRect& rect, | |
106 | int flags = 0); | |
107 | ||
2209baae RR |
108 | virtual void DrawPushButton(wxWindow *win, |
109 | wxDC& dc, | |
110 | const wxRect& rect, | |
111 | int flags = 0); | |
112 | ||
2eb10e2a VZ |
113 | private: |
114 | DECLARE_NO_COPY_CLASS(wxRendererMSW) | |
9c7f49f5 VZ |
115 | }; |
116 | ||
8b97949e VZ |
117 | // ---------------------------------------------------------------------------- |
118 | // wxRendererXP: wxRendererNative implementation for Windows XP and later | |
119 | // ---------------------------------------------------------------------------- | |
120 | ||
7cf3223a VZ |
121 | #if wxUSE_UXTHEME |
122 | ||
8b97949e VZ |
123 | class WXDLLEXPORT wxRendererXP : public wxDelegateRendererNative |
124 | { | |
125 | public: | |
126 | wxRendererXP() : wxDelegateRendererNative(wxRendererMSW::Get()) { } | |
127 | ||
128 | static wxRendererNative& Get(); | |
129 | ||
c97c9952 | 130 | virtual int DrawHeaderButton(wxWindow *win, |
4b94ddc4 RD |
131 | wxDC& dc, |
132 | const wxRect& rect, | |
133 | int flags = 0, | |
80752b57 | 134 | wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, |
4b94ddc4 RD |
135 | wxHeaderButtonParams* params = NULL); |
136 | virtual int GetHeaderButtonHeight(wxWindow *win); | |
f4322df6 | 137 | |
9f93b45e VZ |
138 | virtual void DrawTreeItemButton(wxWindow *win, |
139 | wxDC& dc, | |
140 | const wxRect& rect, | |
141 | int flags = 0); | |
8b97949e VZ |
142 | virtual void DrawSplitterBorder(wxWindow *win, |
143 | wxDC& dc, | |
c4e6c15e VZ |
144 | const wxRect& rect, |
145 | int flags = 0); | |
8b97949e VZ |
146 | virtual void DrawSplitterSash(wxWindow *win, |
147 | wxDC& dc, | |
148 | const wxSize& size, | |
149 | wxCoord position, | |
c4e6c15e VZ |
150 | wxOrientation orient, |
151 | int flags = 0); | |
7cf3223a VZ |
152 | virtual void DrawComboBoxDropButton(wxWindow *win, |
153 | wxDC& dc, | |
154 | const wxRect& rect, | |
155 | int flags = 0); | |
90b903c2 WS |
156 | virtual void DrawCheckBox(wxWindow *win, |
157 | wxDC& dc, | |
158 | const wxRect& rect, | |
159 | int flags = 0); | |
9f93b45e | 160 | |
2209baae RR |
161 | virtual void DrawPushButton(wxWindow *win, |
162 | wxDC& dc, | |
163 | const wxRect& rect, | |
164 | int flags = 0); | |
165 | ||
a9fdf824 RR |
166 | virtual void DrawItemSelectionRect(wxWindow *win, |
167 | wxDC& dc, | |
168 | const wxRect& rect, | |
169 | int flags = 0 ); | |
170 | ||
171 | ||
9f93b45e | 172 | virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win); |
8b97949e VZ |
173 | private: |
174 | DECLARE_NO_COPY_CLASS(wxRendererXP) | |
175 | }; | |
176 | ||
7cf3223a VZ |
177 | #endif // wxUSE_UXTHEME |
178 | ||
9c7f49f5 | 179 | // ============================================================================ |
8b97949e | 180 | // wxRendererNative and wxRendererMSW implementation |
9c7f49f5 VZ |
181 | // ============================================================================ |
182 | ||
183 | /* static */ | |
f0244295 | 184 | wxRendererNative& wxRendererNative::GetDefault() |
8b97949e | 185 | { |
7cf3223a | 186 | #if wxUSE_UXTHEME |
8b97949e | 187 | wxUxThemeEngine *themeEngine = wxUxThemeEngine::Get(); |
7cf3223a VZ |
188 | if ( themeEngine && themeEngine->IsAppThemed() ) |
189 | return wxRendererXP::Get(); | |
190 | #endif // wxUSE_UXTHEME | |
191 | ||
192 | return wxRendererMSW::Get(); | |
8b97949e VZ |
193 | } |
194 | ||
195 | /* static */ | |
196 | wxRendererNative& wxRendererMSW::Get() | |
9c7f49f5 VZ |
197 | { |
198 | static wxRendererMSW s_rendererMSW; | |
199 | ||
200 | return s_rendererMSW; | |
201 | } | |
202 | ||
7402677a VZ |
203 | void |
204 | wxRendererMSW::DrawComboBoxDropButton(wxWindow * WXUNUSED(win), | |
205 | wxDC& dc, | |
206 | const wxRect& rect, | |
207 | int flags) | |
208 | { | |
209 | RECT r; | |
46bd1978 | 210 | wxCopyRectToRECT(rect, r); |
7402677a VZ |
211 | |
212 | int style = DFCS_SCROLLCOMBOBOX; | |
213 | if ( flags & wxCONTROL_DISABLED ) | |
214 | style |= DFCS_INACTIVE; | |
215 | if ( flags & wxCONTROL_PRESSED ) | |
7cf3223a | 216 | style |= DFCS_PUSHED | DFCS_FLAT; |
7402677a VZ |
217 | |
218 | ::DrawFrameControl(GetHdcOf(dc), &r, DFC_SCROLL, style); | |
219 | } | |
220 | ||
59ee63e9 VZ |
221 | void |
222 | wxRendererMSW::DrawCheckBox(wxWindow * WXUNUSED(win), | |
223 | wxDC& dc, | |
224 | const wxRect& rect, | |
225 | int flags) | |
226 | { | |
227 | RECT r; | |
228 | wxCopyRectToRECT(rect, r); | |
229 | ||
230 | int style = DFCS_BUTTONCHECK; | |
231 | if ( flags & wxCONTROL_CHECKED ) | |
232 | style |= DFCS_CHECKED; | |
233 | if ( flags & wxCONTROL_DISABLED ) | |
234 | style |= DFCS_INACTIVE; | |
8a461249 VZ |
235 | if ( flags & wxCONTROL_FLAT ) |
236 | style |= DFCS_MONO; | |
59ee63e9 VZ |
237 | if ( flags & wxCONTROL_PRESSED ) |
238 | style |= DFCS_PUSHED; | |
239 | if ( flags & wxCONTROL_CURRENT ) | |
240 | style |= DFCS_HOT; | |
241 | ||
242 | ::DrawFrameControl(GetHdcOf(dc), &r, DFC_BUTTON, style); | |
243 | } | |
244 | ||
2209baae RR |
245 | void |
246 | wxRendererMSW::DrawPushButton(wxWindow * WXUNUSED(win), | |
247 | wxDC& dc, | |
f2ea4255 | 248 | const wxRect& rectOrig, |
2209baae RR |
249 | int flags) |
250 | { | |
f2ea4255 | 251 | wxRect rect(rectOrig); |
2209baae RR |
252 | |
253 | int style = DFCS_BUTTONPUSH; | |
254 | if ( flags & wxCONTROL_DISABLED ) | |
255 | style |= DFCS_INACTIVE; | |
256 | if ( flags & wxCONTROL_PRESSED ) | |
257 | style |= DFCS_PUSHED | DFCS_FLAT; | |
f2ea4255 VZ |
258 | if ( flags & wxCONTROL_ISDEFAULT ) |
259 | { | |
260 | // DrawFrameControl() doesn't seem to support default buttons so we | |
261 | // have to draw the border ourselves | |
262 | wxDCPenChanger pen(dc, *wxBLACK_PEN); | |
263 | wxDCBrushChanger brush(dc, *wxTRANSPARENT_BRUSH); | |
264 | dc.DrawRectangle(rect); | |
844b9f5f | 265 | rect.Deflate(1); |
f2ea4255 VZ |
266 | } |
267 | ||
268 | RECT rc; | |
269 | wxCopyRectToRECT(rect, rc); | |
270 | ||
271 | ::DrawFrameControl(GetHdcOf(dc), &rc, DFC_BUTTON, style); | |
2209baae RR |
272 | } |
273 | ||
8b97949e VZ |
274 | // ============================================================================ |
275 | // wxRendererXP implementation | |
276 | // ============================================================================ | |
277 | ||
7cf3223a VZ |
278 | #if wxUSE_UXTHEME |
279 | ||
8b97949e VZ |
280 | /* static */ |
281 | wxRendererNative& wxRendererXP::Get() | |
282 | { | |
283 | static wxRendererXP s_rendererXP; | |
284 | ||
285 | return s_rendererXP; | |
286 | } | |
287 | ||
7cf3223a VZ |
288 | // NOTE: There is no guarantee that the button drawn fills the entire rect (XP |
289 | // default theme, for example), so the caller should have cleared button's | |
290 | // background before this call. This is quite likely a wxMSW-specific thing. | |
291 | void | |
292 | wxRendererXP::DrawComboBoxDropButton(wxWindow * win, | |
293 | wxDC& dc, | |
294 | const wxRect& rect, | |
295 | int flags) | |
296 | { | |
297 | wxUxThemeHandle hTheme(win, L"COMBOBOX"); | |
9f93b45e | 298 | if ( !hTheme ) |
7cf3223a | 299 | { |
9f93b45e VZ |
300 | m_rendererNative.DrawComboBoxDropButton(win, dc, rect, flags); |
301 | return; | |
302 | } | |
303 | ||
304 | RECT r; | |
305 | wxCopyRectToRECT(rect, r); | |
7cf3223a | 306 | |
9f93b45e VZ |
307 | int state; |
308 | if ( flags & wxCONTROL_PRESSED ) | |
309 | state = CBXS_PRESSED; | |
310 | else if ( flags & wxCONTROL_CURRENT ) | |
311 | state = CBXS_HOT; | |
312 | else if ( flags & wxCONTROL_DISABLED ) | |
313 | state = CBXS_DISABLED; | |
314 | else | |
315 | state = CBXS_NORMAL; | |
316 | ||
317 | wxUxThemeEngine::Get()->DrawThemeBackground | |
318 | ( | |
319 | hTheme, | |
320 | GetHdcOf(dc), | |
321 | CP_DROPDOWNBUTTON, | |
322 | state, | |
323 | &r, | |
324 | NULL | |
325 | ); | |
326 | ||
327 | } | |
328 | ||
c97c9952 | 329 | int |
9f93b45e VZ |
330 | wxRendererXP::DrawHeaderButton(wxWindow *win, |
331 | wxDC& dc, | |
332 | const wxRect& rect, | |
4b94ddc4 | 333 | int flags, |
80752b57 | 334 | wxHeaderSortIconType sortArrow, |
4b94ddc4 | 335 | wxHeaderButtonParams* params) |
9f93b45e VZ |
336 | { |
337 | wxUxThemeHandle hTheme(win, L"HEADER"); | |
338 | if ( !hTheme ) | |
339 | { | |
c97c9952 | 340 | return m_rendererNative.DrawHeaderButton(win, dc, rect, flags, sortArrow, params); |
7cf3223a | 341 | } |
9f93b45e VZ |
342 | |
343 | RECT r; | |
344 | wxCopyRectToRECT(rect, r); | |
345 | ||
346 | int state; | |
347 | if ( flags & wxCONTROL_PRESSED ) | |
348 | state = HIS_PRESSED; | |
349 | else if ( flags & wxCONTROL_CURRENT ) | |
350 | state = HIS_HOT; | |
351 | else | |
352 | state = HIS_NORMAL; | |
353 | wxUxThemeEngine::Get()->DrawThemeBackground | |
354 | ( | |
355 | hTheme, | |
356 | GetHdcOf(dc), | |
357 | HP_HEADERITEM, | |
358 | state, | |
359 | &r, | |
360 | NULL | |
361 | ); | |
4b94ddc4 RD |
362 | |
363 | // NOTE: Using the theme to draw HP_HEADERSORTARROW doesn't do anything. | |
364 | // Why? If this can be fixed then draw the sort arrows using the theme | |
365 | // and then clear those flags before calling DrawHeaderButtonContents. | |
f4322df6 | 366 | |
4b94ddc4 | 367 | // Add any extras that are specified in flags and params |
c97c9952 | 368 | return DrawHeaderButtonContents(win, dc, rect, flags, sortArrow, params); |
9f93b45e VZ |
369 | } |
370 | ||
4b94ddc4 RD |
371 | |
372 | int | |
373 | wxRendererXP::GetHeaderButtonHeight(wxWindow *win) | |
374 | { | |
375 | wxUxThemeHandle hTheme(win, L"HEADER"); | |
376 | if ( !hTheme ) | |
377 | { | |
378 | return m_rendererNative.GetHeaderButtonHeight(win); | |
379 | } | |
f4322df6 | 380 | |
4b94ddc4 RD |
381 | HRESULT hr; |
382 | int value = -1; | |
f4322df6 | 383 | |
4b94ddc4 RD |
384 | hr = wxUxThemeEngine::Get()->GetThemeMetric( hTheme, |
385 | NULL, | |
386 | HP_HEADERITEM, | |
387 | HIS_NORMAL, | |
388 | TMT_HEIGHT, | |
389 | &value ); | |
390 | if ( hr == S_OK ) | |
391 | return value; | |
392 | else | |
393 | return 20; | |
394 | } | |
395 | ||
396 | ||
9f93b45e VZ |
397 | void |
398 | wxRendererXP::DrawTreeItemButton(wxWindow *win, | |
399 | wxDC& dc, | |
400 | const wxRect& rect, | |
401 | int flags) | |
402 | { | |
403 | wxUxThemeHandle hTheme(win, L"TREEVIEW"); | |
404 | if ( !hTheme ) | |
405 | { | |
406 | m_rendererNative.DrawTreeItemButton(win, dc, rect, flags); | |
407 | return; | |
408 | } | |
409 | ||
410 | RECT r; | |
411 | wxCopyRectToRECT(rect, r); | |
412 | ||
413 | int state = flags & wxCONTROL_EXPANDED ? GLPS_OPENED : GLPS_CLOSED; | |
414 | wxUxThemeEngine::Get()->DrawThemeBackground | |
415 | ( | |
416 | hTheme, | |
417 | GetHdcOf(dc), | |
418 | TVP_GLYPH, | |
419 | state, | |
420 | &r, | |
421 | NULL | |
422 | ); | |
423 | } | |
424 | ||
425 | void | |
90b903c2 WS |
426 | wxRendererXP::DrawCheckBox(wxWindow *win, |
427 | wxDC& dc, | |
428 | const wxRect& rect, | |
429 | int flags) | |
9f93b45e VZ |
430 | { |
431 | wxUxThemeHandle hTheme(win, L"BUTTON"); | |
432 | if ( !hTheme ) | |
433 | { | |
90b903c2 | 434 | m_rendererNative.DrawCheckBox(win, dc, rect, flags); |
9f93b45e VZ |
435 | return; |
436 | } | |
437 | ||
438 | RECT r; | |
439 | wxCopyRectToRECT(rect, r); | |
440 | ||
441 | int state; | |
442 | if ( flags & wxCONTROL_CHECKED ) | |
443 | state = CBS_CHECKEDNORMAL; | |
444 | else if ( flags & wxCONTROL_UNDETERMINED ) | |
445 | state = CBS_MIXEDNORMAL; | |
446 | else | |
447 | state = CBS_UNCHECKEDNORMAL; | |
448 | ||
59ee63e9 VZ |
449 | // CBS_XXX is followed by CBX_XXXHOT, then CBS_XXXPRESSED and DISABLED |
450 | enum | |
451 | { | |
452 | CBS_HOT_OFFSET = 1, | |
453 | CBS_PRESSED_OFFSET = 2, | |
454 | CBS_DISABLED_OFFSET = 3 | |
455 | }; | |
456 | ||
457 | if ( flags & wxCONTROL_DISABLED ) | |
458 | state += CBS_DISABLED_OFFSET; | |
9f93b45e | 459 | else if ( flags & wxCONTROL_PRESSED ) |
59ee63e9 VZ |
460 | state += CBS_PRESSED_OFFSET; |
461 | else if ( flags & wxCONTROL_CURRENT ) | |
462 | state += CBS_HOT_OFFSET; | |
9f93b45e VZ |
463 | |
464 | wxUxThemeEngine::Get()->DrawThemeBackground | |
465 | ( | |
466 | hTheme, | |
467 | GetHdcOf(dc), | |
468 | BP_CHECKBOX, | |
469 | state, | |
470 | &r, | |
471 | NULL | |
472 | ); | |
7cf3223a VZ |
473 | } |
474 | ||
2209baae RR |
475 | void |
476 | wxRendererXP::DrawPushButton(wxWindow * win, | |
477 | wxDC& dc, | |
478 | const wxRect& rect, | |
479 | int flags) | |
480 | { | |
481 | wxUxThemeHandle hTheme(win, L"BUTTON"); | |
482 | if ( !hTheme ) | |
483 | { | |
484 | m_rendererNative.DrawPushButton(win, dc, rect, flags); | |
485 | return; | |
486 | } | |
487 | ||
488 | RECT r; | |
489 | wxCopyRectToRECT(rect, r); | |
490 | ||
491 | int state; | |
492 | if ( flags & wxCONTROL_PRESSED ) | |
493 | state = PBS_PRESSED; | |
494 | else if ( flags & wxCONTROL_CURRENT ) | |
495 | state = PBS_HOT; | |
496 | else if ( flags & wxCONTROL_DISABLED ) | |
497 | state = PBS_DISABLED; | |
498 | else if ( flags & wxCONTROL_ISDEFAULT ) | |
499 | state = PBS_DEFAULTED; | |
500 | else | |
501 | state = PBS_NORMAL; | |
502 | ||
503 | wxUxThemeEngine::Get()->DrawThemeBackground | |
504 | ( | |
505 | hTheme, | |
506 | GetHdcOf(dc), | |
507 | BP_PUSHBUTTON, | |
508 | state, | |
509 | &r, | |
510 | NULL | |
511 | ); | |
512 | ||
513 | } | |
514 | ||
a9fdf824 RR |
515 | void |
516 | wxRendererXP::DrawItemSelectionRect(wxWindow * WXUNUSED(win), | |
517 | wxDC& dc, | |
518 | const wxRect& rect, | |
519 | int flags) | |
520 | { | |
521 | wxBrush brush; | |
522 | if ( flags & wxCONTROL_SELECTED ) | |
523 | { | |
524 | if ( flags & wxCONTROL_FOCUSED ) | |
525 | { | |
526 | brush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)); | |
527 | } | |
528 | else // !focused | |
529 | { | |
530 | brush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW)); | |
531 | } | |
532 | } | |
533 | else // !selected | |
534 | { | |
535 | brush = *wxTRANSPARENT_BRUSH; | |
536 | } | |
537 | ||
538 | dc.SetBrush(brush); | |
539 | ||
540 | // unlike for wxRendererGeneric, on windows we _never_ want to draw | |
541 | // the outline of the rectangle: | |
542 | dc.SetPen(*wxTRANSPARENT_PEN); | |
543 | ||
544 | dc.DrawRectangle( rect ); | |
545 | } | |
546 | ||
547 | ||
548 | ||
8b97949e VZ |
549 | // ---------------------------------------------------------------------------- |
550 | // splitter drawing | |
551 | // ---------------------------------------------------------------------------- | |
552 | ||
553 | // the width of the sash: this is the same as used by Explorer... | |
554 | static const wxCoord SASH_WIDTH = 4; | |
555 | ||
c4e6c15e | 556 | wxSplitterRenderParams |
3c2544bb | 557 | wxRendererXP::GetSplitterParams(const wxWindow * win) |
8b97949e | 558 | { |
9f93b45e | 559 | if ( win->HasFlag(wxSP_NO_XP_THEME) ) |
3c2544bb JS |
560 | return m_rendererNative.GetSplitterParams(win); |
561 | else | |
562 | return wxSplitterRenderParams(SASH_WIDTH, 0, false); | |
8b97949e VZ |
563 | } |
564 | ||
565 | void | |
3c2544bb JS |
566 | wxRendererXP::DrawSplitterBorder(wxWindow * win, |
567 | wxDC& dc, | |
568 | const wxRect& rect, | |
569 | int flags) | |
8b97949e | 570 | { |
9f93b45e | 571 | if ( win->HasFlag(wxSP_NO_XP_THEME) ) |
3c2544bb JS |
572 | { |
573 | m_rendererNative.DrawSplitterBorder(win, dc, rect, flags); | |
574 | } | |
8b97949e VZ |
575 | } |
576 | ||
577 | void | |
578 | wxRendererXP::DrawSplitterSash(wxWindow *win, | |
579 | wxDC& dc, | |
580 | const wxSize& size, | |
581 | wxCoord position, | |
c4e6c15e | 582 | wxOrientation orient, |
3c2544bb | 583 | int flags) |
8b97949e | 584 | { |
6421119d | 585 | if ( !win->HasFlag(wxSP_NO_XP_THEME) ) |
8b97949e | 586 | { |
fe404d1a JS |
587 | dc.SetPen(*wxTRANSPARENT_PEN); |
588 | dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE))); | |
589 | if ( orient == wxVERTICAL ) | |
8b97949e | 590 | { |
fe404d1a | 591 | dc.DrawRectangle(position, 0, SASH_WIDTH, size.y); |
8b97949e | 592 | } |
fe404d1a JS |
593 | else // wxHORIZONTAL |
594 | { | |
595 | dc.DrawRectangle(0, position, size.x, SASH_WIDTH); | |
596 | } | |
597 | ||
598 | return; | |
8b97949e | 599 | } |
6421119d VZ |
600 | |
601 | m_rendererNative.DrawSplitterSash(win, dc, size, position, orient, flags); | |
8b97949e VZ |
602 | } |
603 | ||
7cf3223a | 604 | #endif // wxUSE_UXTHEME |