| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/ui/libgtkui/native_theme_gtk3.h" | 5 #include "chrome/browser/ui/libgtkui/native_theme_gtk3.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "chrome/browser/ui/libgtkui/chrome_gtk_frame.h" | 9 #include "chrome/browser/ui/libgtkui/chrome_gtk_frame.h" |
| 10 #include "chrome/browser/ui/libgtkui/chrome_gtk_menu_subclasses.h" | 10 #include "chrome/browser/ui/libgtkui/chrome_gtk_menu_subclasses.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 return GetFgColor( | 94 return GetFgColor( |
| 95 "GtkMenu#menu GtkMenuItem#menuitem:disabled GtkLabel#label"); | 95 "GtkMenu#menu GtkMenuItem#menuitem:disabled GtkLabel#label"); |
| 96 case ui::NativeTheme::kColorId_MenuItemSubtitleColor: | 96 case ui::NativeTheme::kColorId_MenuItemSubtitleColor: |
| 97 return GetFgColor( | 97 return GetFgColor( |
| 98 "GtkMenu#menu GtkMenuItem#menuitem GtkLabel#label.accelerator"); | 98 "GtkMenu#menu GtkMenuItem#menuitem GtkLabel#label.accelerator"); |
| 99 case ui::NativeTheme::kColorId_MenuSeparatorColor: | 99 case ui::NativeTheme::kColorId_MenuSeparatorColor: |
| 100 // MenuButton borders are used the same way as menu separators in Chrome. | 100 // MenuButton borders are used the same way as menu separators in Chrome. |
| 101 case ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor: | 101 case ui::NativeTheme::kColorId_EnabledMenuButtonBorderColor: |
| 102 case ui::NativeTheme::kColorId_FocusedMenuButtonBorderColor: | 102 case ui::NativeTheme::kColorId_FocusedMenuButtonBorderColor: |
| 103 case ui::NativeTheme::kColorId_HoverMenuButtonBorderColor: | 103 case ui::NativeTheme::kColorId_HoverMenuButtonBorderColor: |
| 104 return GetFgColor("GtkMenu#menu GtkMenuItem#menuitem.separator:disabled"); | 104 if (GtkVersionCheck(3, 20)) |
| 105 return GetBgColor("GtkMenu#menu GtkSeparator#separator"); |
| 106 else |
| 107 return GetFgColor("GtkMenu#menu GtkMenuItem#menuitem.separator"); |
| 105 | 108 |
| 106 // Label | 109 // Label |
| 107 case ui::NativeTheme::kColorId_LabelEnabledColor: | 110 case ui::NativeTheme::kColorId_LabelEnabledColor: |
| 108 return GetFgColor("GtkLabel#label"); | 111 return GetFgColor("GtkLabel#label"); |
| 109 case ui::NativeTheme::kColorId_LabelDisabledColor: | 112 case ui::NativeTheme::kColorId_LabelDisabledColor: |
| 110 return GetFgColor("GtkLabel#label:disabled"); | 113 return GetFgColor("GtkLabel#label:disabled"); |
| 111 case ui::NativeTheme::kColorId_LabelTextSelectionColor: | 114 case ui::NativeTheme::kColorId_LabelTextSelectionColor: |
| 112 return GetFgColor("GtkLabel#label #selection:selected"); | 115 return GetFgColor("GtkLabel#label #selection:selected"); |
| 113 case ui::NativeTheme::kColorId_LabelTextSelectionBackgroundFocused: | 116 case ui::NativeTheme::kColorId_LabelTextSelectionBackgroundFocused: |
| 114 return GetBgColor("GtkLabel#label #selection:selected"); | 117 return GetBgColor("GtkLabel#label #selection:selected"); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 130 gdk_color_free(color); | 133 gdk_color_free(color); |
| 131 return ret_color; | 134 return ret_color; |
| 132 } else { | 135 } else { |
| 133 // Default color comes from gtklinkbutton.c. | 136 // Default color comes from gtklinkbutton.c. |
| 134 return SkColorSetRGB(0x00, 0x00, 0xEE); | 137 return SkColorSetRGB(0x00, 0x00, 0xEE); |
| 135 } | 138 } |
| 136 } | 139 } |
| 137 | 140 |
| 138 // Separator | 141 // Separator |
| 139 case ui::NativeTheme::kColorId_SeparatorColor: | 142 case ui::NativeTheme::kColorId_SeparatorColor: |
| 140 return GetFgColor("GtkSeparator#separator.horizontal"); | 143 if (GtkVersionCheck(3, 20)) |
| 144 return GetBgColor("GtkSeparator#separator.horizontal"); |
| 145 else |
| 146 return GetFgColor("GtkSeparator#separator.horizontal"); |
| 141 | 147 |
| 142 // Button | 148 // Button |
| 143 case ui::NativeTheme::kColorId_ButtonEnabledColor: | 149 case ui::NativeTheme::kColorId_ButtonEnabledColor: |
| 144 return GetFgColor("GtkButton#button.text-button GtkLabel#label"); | 150 return GetFgColor("GtkButton#button.text-button GtkLabel#label"); |
| 145 case ui::NativeTheme::kColorId_ButtonDisabledColor: | 151 case ui::NativeTheme::kColorId_ButtonDisabledColor: |
| 146 return GetFgColor("GtkButton#button.text-button:disabled GtkLabel#label"); | 152 return GetFgColor("GtkButton#button.text-button:disabled GtkLabel#label"); |
| 147 case ui::NativeTheme::kColorId_ButtonHoverColor: | 153 case ui::NativeTheme::kColorId_ButtonHoverColor: |
| 148 return GetFgColor("GtkButton#button.text-button:hover GtkLabel#label"); | 154 return GetFgColor("GtkButton#button.text-button:hover GtkLabel#label"); |
| 149 case ui::NativeTheme::kColorId_ButtonPressedShade: | 155 case ui::NativeTheme::kColorId_ButtonPressedShade: |
| 150 return SK_ColorTRANSPARENT; | 156 return SK_ColorTRANSPARENT; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 void NativeThemeGtk3::PaintMenuItemBackground( | 355 void NativeThemeGtk3::PaintMenuItemBackground( |
| 350 SkCanvas* canvas, | 356 SkCanvas* canvas, |
| 351 State state, | 357 State state, |
| 352 const gfx::Rect& rect, | 358 const gfx::Rect& rect, |
| 353 const MenuItemExtraParams& menu_item) const { | 359 const MenuItemExtraParams& menu_item) const { |
| 354 PaintWidget(canvas, rect, "GtkMenu#menu GtkMenuItem#menuitem", | 360 PaintWidget(canvas, rect, "GtkMenu#menu GtkMenuItem#menuitem", |
| 355 StateToStateFlags(state)); | 361 StateToStateFlags(state)); |
| 356 } | 362 } |
| 357 | 363 |
| 358 } // namespace libgtkui | 364 } // namespace libgtkui |
| OLD | NEW |