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/gfx/native_theme_win.h" | 5 #include "ui/gfx/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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/scoped_handle.h" | 14 #include "base/memory/scoped_handle.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/win/scoped_gdi_object.h" | 16 #include "base/win/scoped_gdi_object.h" |
17 #include "base/win/scoped_hdc.h" | 17 #include "base/win/scoped_hdc.h" |
18 #include "base/win/scoped_select_object.h" | 18 #include "base/win/scoped_select_object.h" |
19 #include "base/win/windows_version.h" | 19 #include "base/win/windows_version.h" |
20 #include "skia/ext/platform_canvas.h" | 20 #include "skia/ext/platform_canvas.h" |
21 #include "skia/ext/skia_utils_win.h" | 21 #include "skia/ext/skia_utils_win.h" |
22 #include "third_party/skia/include/core/SkCanvas.h" | 22 #include "third_party/skia/include/core/SkCanvas.h" |
23 #include "third_party/skia/include/core/SkColorPriv.h" | 23 #include "third_party/skia/include/core/SkColorPriv.h" |
24 #include "third_party/skia/include/core/SkShader.h" | 24 #include "third_party/skia/include/core/SkShader.h" |
| 25 #include "ui/gfx/color_utils.h" |
25 #include "ui/gfx/gdi_util.h" | 26 #include "ui/gfx/gdi_util.h" |
26 #include "ui/gfx/rect.h" | 27 #include "ui/gfx/rect.h" |
27 | 28 |
28 namespace { | 29 namespace { |
29 | 30 |
30 // TODO: Obtain the correct colors using GetSysColor. | 31 // TODO: Obtain the correct colors using GetSysColor. |
31 // Theme colors returned by GetSystemColor(). | 32 // Theme colors returned by GetSystemColor(). |
32 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128); | 33 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128); |
33 // Dialogs: | 34 // Dialogs: |
34 const SkColor kDialogBackgroundColor = SkColorSetRGB(200, 200, 200); | 35 const SkColor kDialogBackgroundColor = SkColorSetRGB(200, 200, 200); |
35 // FocusableBorder (should be unused on Win): | 36 // FocusableBorder (should be unused on Win): |
36 const SkColor kFocusedBorderColor= SkColorSetRGB(0x4D, 0x90, 0xFE); | 37 const SkColor kFocusedBorderColor= SkColorSetRGB(0x4D, 0x90, 0xFE); |
37 const SkColor kUnfocusedBorderColor = SkColorSetRGB(0xD9, 0xD9, 0xD9); | 38 const SkColor kUnfocusedBorderColor = SkColorSetRGB(0xD9, 0xD9, 0xD9); |
38 // TextButton: | 39 // TextButton: |
39 const SkColor kTextButtonBackgroundColor = SkColorSetRGB(0xde, 0xde, 0xde); | 40 const SkColor kTextButtonBackgroundColor = SkColorSetRGB(0xde, 0xde, 0xde); |
40 const SkColor kTextButtonEnabledColor = SkColorSetRGB(6, 45, 117); | 41 const SkColor kTextButtonEnabledColor = SkColorSetRGB(6, 45, 117); |
41 const SkColor kTextButtonDisabledColor = SkColorSetRGB(161, 161, 146); | 42 const SkColor kTextButtonDisabledColor = SkColorSetRGB(161, 161, 146); |
42 const SkColor kTextButtonHighlightColor = SkColorSetARGB(200, 255, 255, 255); | 43 const SkColor kTextButtonHighlightColor = SkColorSetARGB(200, 255, 255, 255); |
43 const SkColor kTextButtonHoverColor = kTextButtonEnabledColor; | 44 const SkColor kTextButtonHoverColor = kTextButtonEnabledColor; |
44 // MenuItem: | 45 // MenuItem: |
45 const SkColor kEnabledMenuItemForegroundColor = kTextButtonEnabledColor; | 46 const SkColor kEnabledMenuItemForegroundColor = kTextButtonEnabledColor; |
46 const SkColor kDisabledMenuItemForegroundColor = kTextButtonDisabledColor; | 47 const SkColor kDisabledMenuItemForegroundColor = kTextButtonDisabledColor; |
47 const SkColor kFocusedMenuItemBackgroundColor = SkColorSetRGB(246, 249, 253); | 48 const SkColor kFocusedMenuItemBackgroundColor = SkColorSetRGB(246, 249, 253); |
| 49 // Label: |
| 50 const SkColor kLabelEnabledColor = color_utils::GetSysSkColor(COLOR_WINDOWTEXT); |
| 51 const SkColor kLabelDisabledColor = color_utils::GetSysSkColor(COLOR_GRAYTEXT); |
| 52 const SkColor kLabelBackgroundColor = color_utils::GetSysSkColor(COLOR_WINDOW); |
48 // Textfield: | 53 // Textfield: |
49 const SkColor kTextfieldDefaultColor = SK_ColorBLACK; | 54 const SkColor kTextfieldDefaultColor = SK_ColorBLACK; |
50 const SkColor kTextfieldDefaultBackground = SK_ColorWHITE; | 55 const SkColor kTextfieldDefaultBackground = SK_ColorWHITE; |
51 const SkColor kTextfieldSelectionColor = SK_ColorWHITE; | 56 const SkColor kTextfieldSelectionColor = SK_ColorWHITE; |
52 const SkColor kTextfieldSelectionBackgroundFocused = | 57 const SkColor kTextfieldSelectionBackgroundFocused = |
53 SkColorSetRGB(0x1D, 0x90, 0xFF); | 58 SkColorSetRGB(0x1D, 0x90, 0xFF); |
54 const SkColor kTextfieldSelectionBackgroundUnfocused = SK_ColorLTGRAY; | 59 const SkColor kTextfieldSelectionBackgroundUnfocused = SK_ColorLTGRAY; |
55 | 60 |
56 SkColor WinColorToSkColor(COLORREF color) { | 61 SkColor WinColorToSkColor(COLORREF color) { |
57 return SkColorSetRGB(GetRValue(color), GetGValue(color), GetBValue(color)); | 62 return SkColorSetRGB(GetRValue(color), GetGValue(color), GetBValue(color)); |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 return kTextButtonHoverColor; | 397 return kTextButtonHoverColor; |
393 | 398 |
394 // MenuItem | 399 // MenuItem |
395 case kColorId_EnabledMenuItemForegroundColor: | 400 case kColorId_EnabledMenuItemForegroundColor: |
396 return kEnabledMenuItemForegroundColor; | 401 return kEnabledMenuItemForegroundColor; |
397 case kColorId_DisabledMenuItemForegroundColor: | 402 case kColorId_DisabledMenuItemForegroundColor: |
398 return kDisabledMenuItemForegroundColor; | 403 return kDisabledMenuItemForegroundColor; |
399 case kColorId_FocusedMenuItemBackgroundColor: | 404 case kColorId_FocusedMenuItemBackgroundColor: |
400 return kFocusedMenuItemBackgroundColor; | 405 return kFocusedMenuItemBackgroundColor; |
401 | 406 |
| 407 // Label |
| 408 case kColorId_LabelEnabledColor: |
| 409 return kLabelEnabledColor; |
| 410 case kColorId_LabelDisabledColor: |
| 411 return kLabelDisabledColor; |
| 412 case kColorId_LabelBackgroundColor: |
| 413 return kLabelBackgroundColor; |
| 414 |
402 // Textfield | 415 // Textfield |
403 case kColorId_TextfieldDefaultColor: | 416 case kColorId_TextfieldDefaultColor: |
404 return kTextfieldDefaultColor; | 417 return kTextfieldDefaultColor; |
405 case kColorId_TextfieldDefaultBackground: | 418 case kColorId_TextfieldDefaultBackground: |
406 return kTextfieldDefaultBackground; | 419 return kTextfieldDefaultBackground; |
407 case kColorId_TextfieldSelectionColor: | 420 case kColorId_TextfieldSelectionColor: |
408 return kTextfieldSelectionColor; | 421 return kTextfieldSelectionColor; |
409 case kColorId_TextfieldSelectionBackgroundFocused: | 422 case kColorId_TextfieldSelectionBackgroundFocused: |
410 return kTextfieldSelectionBackgroundFocused; | 423 return kTextfieldSelectionBackgroundFocused; |
411 case kColorId_TextfieldSelectionBackgroundUnfocused: | 424 case kColorId_TextfieldSelectionBackgroundUnfocused: |
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1754 handle = open_theme_(NULL, L"Spin"); | 1767 handle = open_theme_(NULL, L"Spin"); |
1755 break; | 1768 break; |
1756 default: | 1769 default: |
1757 NOTREACHED(); | 1770 NOTREACHED(); |
1758 } | 1771 } |
1759 theme_handles_[theme_name] = handle; | 1772 theme_handles_[theme_name] = handle; |
1760 return handle; | 1773 return handle; |
1761 } | 1774 } |
1762 | 1775 |
1763 } // namespace gfx | 1776 } // namespace gfx |
OLD | NEW |