OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/native_theme/native_theme_win.h" | 5 #include "ui/native_theme/native_theme_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <uxtheme.h> | 8 #include <uxtheme.h> |
9 #include <vsstyle.h> | 9 #include <vsstyle.h> |
10 #include <vssym32.h> | 10 #include <vssym32.h> |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 COLOR_GRAYTEXT, | 66 COLOR_GRAYTEXT, |
67 COLOR_HIGHLIGHT, | 67 COLOR_HIGHLIGHT, |
68 COLOR_HIGHLIGHTTEXT, | 68 COLOR_HIGHLIGHTTEXT, |
69 COLOR_SCROLLBAR, | 69 COLOR_SCROLLBAR, |
70 COLOR_WINDOW, | 70 COLOR_WINDOW, |
71 COLOR_WINDOWTEXT, | 71 COLOR_WINDOWTEXT, |
72 COLOR_BTNFACE, | 72 COLOR_BTNFACE, |
73 COLOR_MENUHIGHLIGHT, | 73 COLOR_MENUHIGHLIGHT, |
74 }; | 74 }; |
75 | 75 |
76 const int kUnthemedScrollbarThickness = | |
77 static_cast<int>(GetSystemMetrics(SM_CXVSCROLL) / | |
sky
2013/02/20 22:22:47
Can't GetSystemMetrics change?
kevers
2013/02/20 22:37:22
The system metric could change if you update your
sky
2013/02/20 22:59:00
When that happens don't we get a WM_SYSCOLORCHANGE
| |
78 ui::win::GetDeviceScaleFactor()); | |
79 | |
76 void SetCheckerboardShader(SkPaint* paint, const RECT& align_rect) { | 80 void SetCheckerboardShader(SkPaint* paint, const RECT& align_rect) { |
77 // Create a 2x2 checkerboard pattern using the 3D face and highlight colors. | 81 // Create a 2x2 checkerboard pattern using the 3D face and highlight colors. |
78 const SkColor face = color_utils::GetSysSkColor(COLOR_3DFACE); | 82 const SkColor face = color_utils::GetSysSkColor(COLOR_3DFACE); |
79 const SkColor highlight = color_utils::GetSysSkColor(COLOR_3DHILIGHT); | 83 const SkColor highlight = color_utils::GetSysSkColor(COLOR_3DHILIGHT); |
80 SkColor buffer[] = { face, highlight, highlight, face }; | 84 SkColor buffer[] = { face, highlight, highlight, face }; |
81 // Confusing bit: we first create a temporary bitmap with our desired pattern, | 85 // Confusing bit: we first create a temporary bitmap with our desired pattern, |
82 // then copy it to another bitmap. The temporary bitmap doesn't take | 86 // then copy it to another bitmap. The temporary bitmap doesn't take |
83 // ownership of the pixel data, and so will point to garbage when this | 87 // ownership of the pixel data, and so will point to garbage when this |
84 // function returns. The copy will copy the pixel data into a place owned by | 88 // function returns. The copy will copy the pixel data into a place owned by |
85 // the bitmap, which is in turn owned by the shader, etc., so it will live | 89 // the bitmap, which is in turn owned by the shader, etc., so it will live |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 // when theming is not enabled. Support for other parts can be added | 251 // when theming is not enabled. Support for other parts can be added |
248 // if/when needed. | 252 // if/when needed. |
249 switch (part) { | 253 switch (part) { |
250 case kCheckbox: | 254 case kCheckbox: |
251 case kRadio: | 255 case kRadio: |
252 // TODO(rogerta): I was not able to find any API to get the default | 256 // TODO(rogerta): I was not able to find any API to get the default |
253 // size of these controls, so determined these values empirically. | 257 // size of these controls, so determined these values empirically. |
254 size.cx = 13; | 258 size.cx = 13; |
255 size.cy = 13; | 259 size.cy = 13; |
256 break; | 260 break; |
261 case kScrollbarDownArrow: | |
262 case kScrollbarLeftArrow: | |
263 case kScrollbarRightArrow: | |
264 case kScrollbarUpArrow: | |
265 case kScrollbarHorizontalThumb: | |
266 case kScrollbarVerticalThumb: | |
267 size.cx = size.cy = kUnthemedScrollbarThickness; | |
268 break; | |
257 default: | 269 default: |
258 size.cx = 0; | 270 size.cx = 0; |
259 size.cy = 0; | 271 size.cy = 0; |
260 break; | 272 break; |
261 } | 273 } |
262 } | 274 } |
263 | 275 |
264 return gfx::Size(size.cx, size.cy); | 276 return gfx::Size(size.cx, size.cy); |
265 } | 277 } |
266 | 278 |
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2057 handle = open_theme_(NULL, L"Spin"); | 2069 handle = open_theme_(NULL, L"Spin"); |
2058 break; | 2070 break; |
2059 default: | 2071 default: |
2060 NOTREACHED(); | 2072 NOTREACHED(); |
2061 } | 2073 } |
2062 theme_handles_[theme_name] = handle; | 2074 theme_handles_[theme_name] = handle; |
2063 return handle; | 2075 return handle; |
2064 } | 2076 } |
2065 | 2077 |
2066 } // namespace ui | 2078 } // namespace ui |
OLD | NEW |