| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 } | 226 } |
| 227 | 227 |
| 228 gfx::Size NativeThemeWin::GetPartSize(Part part, | 228 gfx::Size NativeThemeWin::GetPartSize(Part part, |
| 229 State state, | 229 State state, |
| 230 const ExtraParams& extra) const { | 230 const ExtraParams& extra) const { |
| 231 if (IsNewMenuStyleEnabled()) { | 231 if (IsNewMenuStyleEnabled()) { |
| 232 gfx::Size size = CommonThemeGetPartSize(part, state, extra); | 232 gfx::Size size = CommonThemeGetPartSize(part, state, extra); |
| 233 if (!size.IsEmpty()) | 233 if (!size.IsEmpty()) |
| 234 return size; | 234 return size; |
| 235 } | 235 } |
| 236 |
| 237 // The GetThemePartSize call below returns the default size without |
| 238 // accounting for user customization (crbug/218291). |
| 236 SIZE size; | 239 SIZE size; |
| 240 switch (part) { |
| 241 case kScrollbarDownArrow: |
| 242 case kScrollbarLeftArrow: |
| 243 case kScrollbarRightArrow: |
| 244 case kScrollbarUpArrow: |
| 245 case kScrollbarHorizontalThumb: |
| 246 case kScrollbarVerticalThumb: |
| 247 case kScrollbarHorizontalTrack: |
| 248 case kScrollbarVerticalTrack: |
| 249 size.cx = size.cy = ui::win::GetSystemMetricsInDIP(SM_CXVSCROLL); |
| 250 return gfx::Size(size.cx, size.cy); |
| 251 } |
| 252 |
| 237 int part_id = GetWindowsPart(part, state, extra); | 253 int part_id = GetWindowsPart(part, state, extra); |
| 238 int state_id = GetWindowsState(part, state, extra); | 254 int state_id = GetWindowsState(part, state, extra); |
| 239 | 255 |
| 240 HDC hdc = GetDC(NULL); | 256 HDC hdc = GetDC(NULL); |
| 241 HRESULT hr = GetThemePartSize(GetThemeName(part), hdc, part_id, state_id, | 257 HRESULT hr = GetThemePartSize(GetThemeName(part), hdc, part_id, state_id, |
| 242 NULL, TS_TRUE, &size); | 258 NULL, TS_TRUE, &size); |
| 243 ReleaseDC(NULL, hdc); | 259 ReleaseDC(NULL, hdc); |
| 244 | 260 |
| 245 if (FAILED(hr)) { | 261 if (FAILED(hr)) { |
| 246 // TODO(rogerta): For now, we need to support radio buttons and checkboxes | 262 // TODO(rogerta): For now, we need to support radio buttons and checkboxes |
| 247 // when theming is not enabled. Support for other parts can be added | 263 // when theming is not enabled. Support for other parts can be added |
| 248 // if/when needed. | 264 // if/when needed. |
| 249 switch (part) { | 265 switch (part) { |
| 250 case kCheckbox: | 266 case kCheckbox: |
| 251 case kRadio: | 267 case kRadio: |
| 252 // TODO(rogerta): I was not able to find any API to get the default | 268 // TODO(rogerta): I was not able to find any API to get the default |
| 253 // size of these controls, so determined these values empirically. | 269 // size of these controls, so determined these values empirically. |
| 254 size.cx = 13; | 270 size.cx = 13; |
| 255 size.cy = 13; | 271 size.cy = 13; |
| 256 break; | 272 break; |
| 257 case kScrollbarDownArrow: | |
| 258 case kScrollbarLeftArrow: | |
| 259 case kScrollbarRightArrow: | |
| 260 case kScrollbarUpArrow: | |
| 261 case kScrollbarHorizontalThumb: | |
| 262 case kScrollbarVerticalThumb: | |
| 263 case kScrollbarHorizontalTrack: | |
| 264 case kScrollbarVerticalTrack: | |
| 265 size.cx = size.cy = GetSystemMetrics(SM_CXVSCROLL) / | |
| 266 ui::win::GetDeviceScaleFactor(); | |
| 267 break; | |
| 268 default: | 273 default: |
| 269 size.cx = 0; | 274 size.cx = 0; |
| 270 size.cy = 0; | 275 size.cy = 0; |
| 271 break; | 276 break; |
| 272 } | 277 } |
| 273 } | 278 } |
| 274 | 279 |
| 275 return gfx::Size(size.cx, size.cy); | 280 return gfx::Size(size.cx, size.cy); |
| 276 } | 281 } |
| 277 | 282 |
| (...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2068 handle = open_theme_(NULL, L"Spin"); | 2073 handle = open_theme_(NULL, L"Spin"); |
| 2069 break; | 2074 break; |
| 2070 default: | 2075 default: |
| 2071 NOTREACHED(); | 2076 NOTREACHED(); |
| 2072 } | 2077 } |
| 2073 theme_handles_[theme_name] = handle; | 2078 theme_handles_[theme_name] = handle; |
| 2074 return handle; | 2079 return handle; |
| 2075 } | 2080 } |
| 2076 | 2081 |
| 2077 } // namespace ui | 2082 } // namespace ui |
| OLD | NEW |