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