Chromium Code Reviews| 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 18 matching lines...) Expand all Loading... | |
| 29 #include "ui/native_theme/common_theme.h" | 29 #include "ui/native_theme/common_theme.h" |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 // TODO: Obtain the correct colors using GetSysColor. | 33 // TODO: Obtain the correct colors using GetSysColor. |
| 34 // Theme colors returned by GetSystemColor(). | 34 // Theme colors returned by GetSystemColor(). |
| 35 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128); | 35 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128); |
| 36 // Dialogs: | 36 // Dialogs: |
| 37 const SkColor kDialogBackgroundColor = SkColorSetRGB(200, 200, 200); | 37 const SkColor kDialogBackgroundColor = SkColorSetRGB(200, 200, 200); |
| 38 // FocusableBorder: | 38 // FocusableBorder: |
| 39 const SkColor kFocusedBorderColor = SkColorSetRGB(0x4D, 0x90, 0xFE); | 39 const SkColor kFocusedBorderColor = SkColorSetRGB(0x4d, 0x90, 0xfe); |
| 40 const SkColor kUnfocusedBorderColor = SkColorSetRGB(0xD9, 0xD9, 0xD9); | 40 const SkColor kUnfocusedBorderColor = SkColorSetRGB(0xd9, 0xd9, 0xd9); |
| 41 // TextButton: | 41 // TextButton: |
| 42 const SkColor kTextButtonBackgroundColor = SkColorSetRGB(0xde, 0xde, 0xde); | 42 const SkColor kTextButtonBackgroundColor = SkColorSetRGB(0xde, 0xde, 0xde); |
| 43 const SkColor kTextButtonEnabledColor = SkColorSetRGB(6, 45, 117); | |
| 44 const SkColor kTextButtonDisabledColor = SkColorSetRGB(161, 161, 146); | |
| 45 const SkColor kTextButtonHighlightColor = SkColorSetARGB(200, 255, 255, 255); | 43 const SkColor kTextButtonHighlightColor = SkColorSetARGB(200, 255, 255, 255); |
| 46 const SkColor kTextButtonHoverColor = kTextButtonEnabledColor; | 44 const SkColor kTextButtonHoverColor = SkColorSetRGB(6, 45, 117); |
| 47 // MenuItem: | 45 // MenuItem: |
| 48 const SkColor kEnabledMenuItemForegroundColor = kTextButtonEnabledColor; | 46 const SkColor kEnabledMenuItemForegroundColor = SkColorSetRGB(6, 45, 117); |
| 49 const SkColor kDisabledMenuItemForegroundColor = kTextButtonDisabledColor; | 47 const SkColor kDisabledMenuItemForegroundColor = SkColorSetRGB(161, 161, 146); |
| 50 const SkColor kFocusedMenuItemBackgroundColor = SkColorSetRGB(246, 249, 253); | 48 const SkColor kFocusedMenuItemBackgroundColor = SkColorSetRGB(246, 249, 253); |
| 51 const SkColor kMenuSeparatorColor = SkColorSetARGB(50, 0, 0, 0); | 49 const SkColor kMenuSeparatorColor = SkColorSetARGB(50, 0, 0, 0); |
| 52 // Textfield: | 50 // Textfield: |
| 53 const SkColor kTextfieldSelectionBackgroundUnfocused = SK_ColorLTGRAY; | 51 const SkColor kTextfieldSelectionBackgroundUnfocused = SK_ColorLTGRAY; |
| 54 | 52 |
| 55 // Windows system color IDs cached and updated by the native theme. | 53 // Windows system color IDs cached and updated by the native theme. |
| 56 const int kSystemColors[] = { | 54 const int kSystemColors[] = { |
| 57 COLOR_3DFACE, | 55 COLOR_3DFACE, |
| 58 COLOR_GRAYTEXT, | 56 COLOR_GRAYTEXT, |
| 59 COLOR_HIGHLIGHT, | 57 COLOR_HIGHLIGHT, |
| 60 COLOR_HIGHLIGHTTEXT, | 58 COLOR_HIGHLIGHTTEXT, |
| 61 COLOR_SCROLLBAR, | 59 COLOR_SCROLLBAR, |
| 62 COLOR_WINDOW, | 60 COLOR_WINDOW, |
| 63 COLOR_WINDOWTEXT, | 61 COLOR_WINDOWTEXT, |
| 62 COLOR_BTNTEXT, | |
|
msw
2012/12/12 23:45:46
nit: alphabetize.
| |
| 64 }; | 63 }; |
| 65 | 64 |
| 66 void SetCheckerboardShader(SkPaint* paint, const RECT& align_rect) { | 65 void SetCheckerboardShader(SkPaint* paint, const RECT& align_rect) { |
| 67 // Create a 2x2 checkerboard pattern using the 3D face and highlight colors. | 66 // Create a 2x2 checkerboard pattern using the 3D face and highlight colors. |
| 68 const SkColor face = color_utils::GetSysSkColor(COLOR_3DFACE); | 67 const SkColor face = color_utils::GetSysSkColor(COLOR_3DFACE); |
| 69 const SkColor highlight = color_utils::GetSysSkColor(COLOR_3DHILIGHT); | 68 const SkColor highlight = color_utils::GetSysSkColor(COLOR_3DHILIGHT); |
| 70 SkColor buffer[] = { face, highlight, highlight, face }; | 69 SkColor buffer[] = { face, highlight, highlight, face }; |
| 71 // Confusing bit: we first create a temporary bitmap with our desired pattern, | 70 // Confusing bit: we first create a temporary bitmap with our desired pattern, |
| 72 // then copy it to another bitmap. The temporary bitmap doesn't take | 71 // then copy it to another bitmap. The temporary bitmap doesn't take |
| 73 // ownership of the pixel data, and so will point to garbage when this | 72 // ownership of the pixel data, and so will point to garbage when this |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 459 // FocusableBorder | 458 // FocusableBorder |
| 460 case kColorId_FocusedBorderColor: | 459 case kColorId_FocusedBorderColor: |
| 461 return kFocusedBorderColor; | 460 return kFocusedBorderColor; |
| 462 case kColorId_UnfocusedBorderColor: | 461 case kColorId_UnfocusedBorderColor: |
| 463 return kUnfocusedBorderColor; | 462 return kUnfocusedBorderColor; |
| 464 | 463 |
| 465 // TextButton | 464 // TextButton |
| 466 case kColorId_TextButtonBackgroundColor: | 465 case kColorId_TextButtonBackgroundColor: |
| 467 return kTextButtonBackgroundColor; | 466 return kTextButtonBackgroundColor; |
| 468 case kColorId_TextButtonEnabledColor: | 467 case kColorId_TextButtonEnabledColor: |
| 469 return kTextButtonEnabledColor; | 468 return system_colors_[COLOR_BTNTEXT]; |
| 470 case kColorId_TextButtonDisabledColor: | 469 case kColorId_TextButtonDisabledColor: |
| 471 return kTextButtonDisabledColor; | 470 return system_colors_[COLOR_GRAYTEXT]; |
| 472 case kColorId_TextButtonHighlightColor: | 471 case kColorId_TextButtonHighlightColor: |
| 473 return kTextButtonHighlightColor; | 472 return kTextButtonHighlightColor; |
| 474 case kColorId_TextButtonHoverColor: | 473 case kColorId_TextButtonHoverColor: |
| 475 return kTextButtonHoverColor; | 474 return kTextButtonHoverColor; |
| 476 | 475 |
| 477 // MenuItem | 476 // MenuItem |
| 478 case kColorId_EnabledMenuItemForegroundColor: | 477 case kColorId_EnabledMenuItemForegroundColor: |
| 479 return kEnabledMenuItemForegroundColor; | 478 return kEnabledMenuItemForegroundColor; |
| 480 case kColorId_DisabledMenuItemForegroundColor: | 479 case kColorId_DisabledMenuItemForegroundColor: |
| 481 return kDisabledMenuItemForegroundColor; | 480 return kDisabledMenuItemForegroundColor; |
| 482 case kColorId_FocusedMenuItemBackgroundColor: | 481 case kColorId_FocusedMenuItemBackgroundColor: |
| 483 return kFocusedMenuItemBackgroundColor; | 482 return kFocusedMenuItemBackgroundColor; |
| 484 case kColorId_MenuSeparatorColor: | 483 case kColorId_MenuSeparatorColor: |
| 485 return kMenuSeparatorColor; | 484 return kMenuSeparatorColor; |
| 486 | 485 |
| 487 // Label | 486 // Label |
| 488 case kColorId_LabelEnabledColor: | 487 case kColorId_LabelEnabledColor: |
| 489 return system_colors_[COLOR_WINDOWTEXT]; | 488 return system_colors_[COLOR_BTNTEXT]; |
| 490 case kColorId_LabelDisabledColor: | 489 case kColorId_LabelDisabledColor: |
| 491 return system_colors_[COLOR_GRAYTEXT]; | 490 return system_colors_[COLOR_GRAYTEXT]; |
| 492 case kColorId_LabelBackgroundColor: | 491 case kColorId_LabelBackgroundColor: |
| 493 return system_colors_[COLOR_WINDOW]; | 492 return system_colors_[COLOR_WINDOW]; |
| 494 | 493 |
| 495 // Textfield | 494 // Textfield |
| 496 case kColorId_TextfieldDefaultColor: | 495 case kColorId_TextfieldDefaultColor: |
| 497 return system_colors_[COLOR_WINDOWTEXT]; | 496 return system_colors_[COLOR_WINDOWTEXT]; |
| 498 case kColorId_TextfieldDefaultBackground: | 497 case kColorId_TextfieldDefaultBackground: |
| 499 return system_colors_[COLOR_WINDOW]; | 498 return system_colors_[COLOR_WINDOW]; |
| (...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1973 handle = open_theme_(NULL, L"Spin"); | 1972 handle = open_theme_(NULL, L"Spin"); |
| 1974 break; | 1973 break; |
| 1975 default: | 1974 default: |
| 1976 NOTREACHED(); | 1975 NOTREACHED(); |
| 1977 } | 1976 } |
| 1978 theme_handles_[theme_name] = handle; | 1977 theme_handles_[theme_name] = handle; |
| 1979 return handle; | 1978 return handle; |
| 1980 } | 1979 } |
| 1981 | 1980 |
| 1982 } // namespace ui | 1981 } // namespace ui |
| OLD | NEW |