Chromium Code Reviews| 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 (gtk_get_major_version() > 3 || |
| 105 (gtk_get_major_version() == 3 && gtk_get_minor_version() >= 20)) { | |
| 106 return GetBgColor("GtkMenu#menu GtkSeparator#separator"); | |
| 107 } else { | |
| 108 return GetFgColor("GtkMenu#menu GtkMenuItem#menuitem.separator"); | |
| 109 } | |
| 105 | 110 |
| 106 // Label | 111 // Label |
| 107 case ui::NativeTheme::kColorId_LabelEnabledColor: | 112 case ui::NativeTheme::kColorId_LabelEnabledColor: |
| 108 return GetFgColor("GtkLabel#label"); | 113 return GetFgColor("GtkLabel#label"); |
| 109 case ui::NativeTheme::kColorId_LabelDisabledColor: | 114 case ui::NativeTheme::kColorId_LabelDisabledColor: |
| 110 return GetFgColor("GtkLabel#label:disabled"); | 115 return GetFgColor("GtkLabel#label:disabled"); |
| 111 case ui::NativeTheme::kColorId_LabelTextSelectionColor: | 116 case ui::NativeTheme::kColorId_LabelTextSelectionColor: |
| 112 return GetFgColor("GtkLabel#label #selection:selected"); | 117 return GetFgColor("GtkLabel#label #selection:selected"); |
| 113 case ui::NativeTheme::kColorId_LabelTextSelectionBackgroundFocused: | 118 case ui::NativeTheme::kColorId_LabelTextSelectionBackgroundFocused: |
| 114 return GetBgColor("GtkLabel#label #selection:selected"); | 119 return GetBgColor("GtkLabel#label #selection:selected"); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 130 gdk_color_free(color); | 135 gdk_color_free(color); |
| 131 return ret_color; | 136 return ret_color; |
| 132 } else { | 137 } else { |
| 133 // Default color comes from gtklinkbutton.c. | 138 // Default color comes from gtklinkbutton.c. |
| 134 return SkColorSetRGB(0x00, 0x00, 0xEE); | 139 return SkColorSetRGB(0x00, 0x00, 0xEE); |
| 135 } | 140 } |
| 136 } | 141 } |
| 137 | 142 |
| 138 // Separator | 143 // Separator |
| 139 case ui::NativeTheme::kColorId_SeparatorColor: | 144 case ui::NativeTheme::kColorId_SeparatorColor: |
| 140 return GetFgColor("GtkSeparator#separator.horizontal"); | 145 if (gtk_get_major_version() > 3 || |
| 146 (gtk_get_major_version() == 3 && gtk_get_minor_version() >= 20)) { | |
|
Elliot Glaysher
2017/01/12 18:15:43
Separate this blob of version checks into its own
Tom (Use chromium acct)
2017/01/12 22:12:04
Done. Added GtkVersionCheck. I made it generic b
| |
| 147 return GetBgColor("GtkSeparator#separator.horizontal"); | |
| 148 } else { | |
| 149 return GetFgColor("GtkSeparator#separator.horizontal"); | |
| 150 } | |
| 141 | 151 |
| 142 // Button | 152 // Button |
| 143 case ui::NativeTheme::kColorId_ButtonEnabledColor: | 153 case ui::NativeTheme::kColorId_ButtonEnabledColor: |
| 144 return GetFgColor("GtkButton#button.text-button GtkLabel#label"); | 154 return GetFgColor("GtkButton#button.text-button GtkLabel#label"); |
| 145 case ui::NativeTheme::kColorId_ButtonDisabledColor: | 155 case ui::NativeTheme::kColorId_ButtonDisabledColor: |
| 146 return GetFgColor("GtkButton#button.text-button:disabled GtkLabel#label"); | 156 return GetFgColor("GtkButton#button.text-button:disabled GtkLabel#label"); |
| 147 case ui::NativeTheme::kColorId_ButtonHoverColor: | 157 case ui::NativeTheme::kColorId_ButtonHoverColor: |
| 148 return GetFgColor("GtkButton#button.text-button:hover GtkLabel#label"); | 158 return GetFgColor("GtkButton#button.text-button:hover GtkLabel#label"); |
| 149 case ui::NativeTheme::kColorId_ButtonPressedShade: | 159 case ui::NativeTheme::kColorId_ButtonPressedShade: |
| 150 return SK_ColorTRANSPARENT; | 160 return SK_ColorTRANSPARENT; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 349 void NativeThemeGtk3::PaintMenuItemBackground( | 359 void NativeThemeGtk3::PaintMenuItemBackground( |
| 350 SkCanvas* canvas, | 360 SkCanvas* canvas, |
| 351 State state, | 361 State state, |
| 352 const gfx::Rect& rect, | 362 const gfx::Rect& rect, |
| 353 const MenuItemExtraParams& menu_item) const { | 363 const MenuItemExtraParams& menu_item) const { |
| 354 PaintWidget(canvas, rect, "GtkMenu#menu GtkMenuItem#menuitem", | 364 PaintWidget(canvas, rect, "GtkMenu#menu GtkMenuItem#menuitem", |
| 355 StateToStateFlags(state)); | 365 StateToStateFlags(state)); |
| 356 } | 366 } |
| 357 | 367 |
| 358 } // namespace libgtkui | 368 } // namespace libgtkui |
| OLD | NEW |