| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/libgtk2ui/native_theme_gtk2.h" | 5 #include "chrome/browser/ui/libgtk2ui/native_theme_gtk2.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "chrome/browser/ui/libgtk2ui/chrome_gtk_frame.h" |
| 9 #include "chrome/browser/ui/libgtk2ui/chrome_gtk_menu_subclasses.h" | 10 #include "chrome/browser/ui/libgtk2ui/chrome_gtk_menu_subclasses.h" |
| 10 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" | 11 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" |
| 11 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h" | 12 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h" |
| 12 #include "chrome/browser/ui/libgtk2ui/skia_utils_gtk2.h" | 13 #include "chrome/browser/ui/libgtk2ui/skia_utils_gtk2.h" |
| 13 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
| 14 #include "ui/gfx/color_utils.h" | 15 #include "ui/gfx/color_utils.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
| 17 #include "ui/gfx/path.h" | 18 #include "ui/gfx/path.h" |
| 18 #include "ui/gfx/skia_util.h" | 19 #include "ui/gfx/skia_util.h" |
| 19 #include "ui/native_theme/common_theme.h" | 20 #include "ui/native_theme/common_theme.h" |
| 20 | 21 |
| 22 |
| 21 namespace { | 23 namespace { |
| 22 | 24 |
| 23 // Theme colors returned by GetSystemColor(). | 25 // Theme colors returned by GetSystemColor(). |
| 24 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128); | 26 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128); |
| 25 | 27 const SkColor kURLTextColor = SkColorSetRGB(0x0b, 0x80, 0x43); |
| 26 const GdkColor kURLTextColor = GDK_COLOR_RGB(0x0b, 0x80, 0x43); | |
| 27 | |
| 28 GdkColor GdkAlphaBlend(GdkColor foreground, | |
| 29 GdkColor background, | |
| 30 SkAlpha alpha) { | |
| 31 return libgtk2ui::SkColorToGdkColor( | |
| 32 color_utils::AlphaBlend(libgtk2ui::GdkColorToSkColor(foreground), | |
| 33 libgtk2ui::GdkColorToSkColor(background), alpha)); | |
| 34 } | |
| 35 | 28 |
| 36 // Generates the normal URL color, a green color used in unhighlighted URL | 29 // Generates the normal URL color, a green color used in unhighlighted URL |
| 37 // text. It is a mix of |kURLTextColor| and the current text color. Unlike the | 30 // text. It is a mix of |kURLTextColor| and the current text color. Unlike the |
| 38 // selected text color, it is more important to match the qualities of the | 31 // selected text color, it is more important to match the qualities of the |
| 39 // foreground typeface color instead of taking the background into account. | 32 // foreground typeface color instead of taking the background into account. |
| 40 GdkColor NormalURLColor(GdkColor foreground) { | 33 SkColor NormalURLColor(SkColor foreground) { |
| 41 color_utils::HSL fg_hsl; | 34 color_utils::HSL fg_hsl, hue_hsl; |
| 42 color_utils::SkColorToHSL(libgtk2ui::GdkColorToSkColor(foreground), &fg_hsl); | 35 color_utils::SkColorToHSL(foreground, &fg_hsl); |
| 43 | 36 color_utils::SkColorToHSL(kURLTextColor, &hue_hsl); |
| 44 color_utils::HSL hue_hsl; | |
| 45 color_utils::SkColorToHSL(libgtk2ui::GdkColorToSkColor(kURLTextColor), | |
| 46 &hue_hsl); | |
| 47 | 37 |
| 48 // Only allow colors that have a fair amount of saturation in them (color vs | 38 // Only allow colors that have a fair amount of saturation in them (color vs |
| 49 // white). This means that our output color will always be fairly green. | 39 // white). This means that our output color will always be fairly green. |
| 50 double s = std::max(0.5, fg_hsl.s); | 40 double s = std::max(0.5, fg_hsl.s); |
| 51 | 41 |
| 52 // Make sure the luminance is at least as bright as the |kURLTextColor| green | 42 // Make sure the luminance is at least as bright as the |kURLTextColor| green |
| 53 // would be if we were to use that. | 43 // would be if we were to use that. |
| 54 double l; | 44 double l; |
| 55 if (fg_hsl.l < hue_hsl.l) | 45 if (fg_hsl.l < hue_hsl.l) |
| 56 l = hue_hsl.l; | 46 l = hue_hsl.l; |
| 57 else | 47 else |
| 58 l = (fg_hsl.l + hue_hsl.l) / 2; | 48 l = (fg_hsl.l + hue_hsl.l) / 2; |
| 59 | 49 |
| 60 color_utils::HSL output = { hue_hsl.h, s, l }; | 50 color_utils::HSL output = { hue_hsl.h, s, l }; |
| 61 return libgtk2ui::SkColorToGdkColor(color_utils::HSLToSkColor(output, 255)); | 51 return color_utils::HSLToSkColor(output, 255); |
| 62 } | 52 } |
| 63 | 53 |
| 64 // Generates the selected URL color, a green color used on URL text in the | 54 // Generates the selected URL color, a green color used on URL text in the |
| 65 // currently highlighted entry in the autocomplete popup. It's a mix of | 55 // currently highlighted entry in the autocomplete popup. It's a mix of |
| 66 // |kURLTextColor|, the current text color, and the background color (the | 56 // |kURLTextColor|, the current text color, and the background color (the |
| 67 // select highlight). It is more important to contrast with the background | 57 // select highlight). It is more important to contrast with the background |
| 68 // saturation than to look exactly like the foreground color. | 58 // saturation than to look exactly like the foreground color. |
| 69 GdkColor SelectedURLColor(GdkColor foreground, GdkColor background) { | 59 SkColor SelectedURLColor(SkColor foreground, SkColor background) { |
| 70 color_utils::HSL fg_hsl; | 60 color_utils::HSL fg_hsl, bg_hsl, hue_hsl; |
| 71 color_utils::SkColorToHSL(libgtk2ui::GdkColorToSkColor(foreground), | 61 color_utils::SkColorToHSL(foreground, &fg_hsl); |
| 72 &fg_hsl); | 62 color_utils::SkColorToHSL(background, &bg_hsl); |
| 73 | 63 color_utils::SkColorToHSL(kURLTextColor, &hue_hsl); |
| 74 color_utils::HSL bg_hsl; | |
| 75 color_utils::SkColorToHSL(libgtk2ui::GdkColorToSkColor(background), | |
| 76 &bg_hsl); | |
| 77 | |
| 78 color_utils::HSL hue_hsl; | |
| 79 color_utils::SkColorToHSL(libgtk2ui::GdkColorToSkColor(kURLTextColor), | |
| 80 &hue_hsl); | |
| 81 | 64 |
| 82 // The saturation of the text should be opposite of the background, clamped | 65 // The saturation of the text should be opposite of the background, clamped |
| 83 // to 0.2-0.8. We make sure it's greater than 0.2 so there's some color, but | 66 // to 0.2-0.8. We make sure it's greater than 0.2 so there's some color, but |
| 84 // less than 0.8 so it's not the oversaturated neon-color. | 67 // less than 0.8 so it's not the oversaturated neon-color. |
| 85 double opposite_s = 1 - bg_hsl.s; | 68 double opposite_s = 1 - bg_hsl.s; |
| 86 double s = std::max(0.2, std::min(0.8, opposite_s)); | 69 double s = std::max(0.2, std::min(0.8, opposite_s)); |
| 87 | 70 |
| 88 // The luminance should match the luminance of the foreground text. Again, | 71 // The luminance should match the luminance of the foreground text. Again, |
| 89 // we clamp so as to have at some amount of color (green) in the text. | 72 // we clamp so as to have at some amount of color (green) in the text. |
| 90 double opposite_l = fg_hsl.l; | 73 double opposite_l = fg_hsl.l; |
| 91 double l = std::max(0.1, std::min(0.9, opposite_l)); | 74 double l = std::max(0.1, std::min(0.9, opposite_l)); |
| 92 | 75 |
| 93 color_utils::HSL output = { hue_hsl.h, s, l }; | 76 color_utils::HSL output = { hue_hsl.h, s, l }; |
| 94 return libgtk2ui::SkColorToGdkColor(color_utils::HSLToSkColor(output, 255)); | 77 return color_utils::HSLToSkColor(output, 255); |
| 95 } | |
| 96 | |
| 97 GdkColor GetReadableColor(SkColor color, const GdkColor& background) { | |
| 98 return libgtk2ui::SkColorToGdkColor(color_utils::GetReadableColor( | |
| 99 color, libgtk2ui::GdkColorToSkColor(background))); | |
| 100 } | 78 } |
| 101 | 79 |
| 102 } // namespace | 80 } // namespace |
| 103 | 81 |
| 104 | 82 |
| 105 namespace libgtk2ui { | 83 namespace libgtk2ui { |
| 106 | 84 |
| 85 enum WidgetState { |
| 86 NORMAL = 0, |
| 87 ACTIVE = 1, |
| 88 PRELIGHT = 2, |
| 89 SELECTED = 3, |
| 90 INSENSITIVE = 4, |
| 91 }; |
| 92 |
| 93 #if GTK_MAJOR_VERSION == 2 |
| 94 // Same order as enum WidgetState above |
| 95 const GtkStateType stateMap[] = { |
| 96 GTK_STATE_NORMAL, |
| 97 GTK_STATE_ACTIVE, |
| 98 GTK_STATE_PRELIGHT, |
| 99 GTK_STATE_SELECTED, |
| 100 GTK_STATE_INSENSITIVE, |
| 101 }; |
| 102 |
| 103 |
| 104 SkColor GetFGColor(GtkWidget* widget, WidgetState state) { |
| 105 return GdkColorToSkColor(gtk_rc_get_style(widget)->fg[stateMap[state]]); |
| 106 } |
| 107 SkColor GetBGColor(GtkWidget* widget, WidgetState state) { |
| 108 return GdkColorToSkColor(gtk_rc_get_style(widget)->bg[stateMap[state]]); |
| 109 } |
| 110 |
| 111 SkColor GetTextColor(GtkWidget* widget, WidgetState state) { |
| 112 return GdkColorToSkColor(gtk_rc_get_style(widget)->text[stateMap[state]]); |
| 113 } |
| 114 SkColor GetTextAAColor(GtkWidget* widget, WidgetState state) { |
| 115 return GdkColorToSkColor(gtk_rc_get_style(widget)->text_aa[stateMap[state]]); |
| 116 } |
| 117 SkColor GetBaseColor(GtkWidget* widget, WidgetState state) { |
| 118 return GdkColorToSkColor(gtk_rc_get_style(widget)->base[stateMap[state]]); |
| 119 } |
| 120 |
| 121 |
| 122 #else |
| 123 // Same order as enum WidgetState above |
| 124 const GtkStateFlags stateMap[] = { |
| 125 GTK_STATE_FLAG_NORMAL, |
| 126 GTK_STATE_FLAG_ACTIVE, |
| 127 GTK_STATE_FLAG_PRELIGHT, |
| 128 GTK_STATE_FLAG_SELECTED, |
| 129 GTK_STATE_FLAG_INSENSITIVE, |
| 130 }; |
| 131 |
| 132 |
| 133 SkColor GetFGColor(GtkWidget* widget, WidgetState state) { |
| 134 GdkRGBA color; |
| 135 gtk_style_context_get_color( |
| 136 gtk_widget_get_style_context(widget), stateMap[state], &color); |
| 137 return SkColorSetRGB(color.red * 255, color.green * 255, color.blue * 255); |
| 138 } |
| 139 SkColor GetBGColor(GtkWidget* widget, WidgetState state) { |
| 140 GdkRGBA color; |
| 141 |
| 142 G_GNUC_BEGIN_IGNORE_DEPRECATIONS |
| 143 gtk_style_context_get_background_color( |
| 144 gtk_widget_get_style_context(widget), stateMap[state], &color); |
| 145 G_GNUC_END_IGNORE_DEPRECATIONS |
| 146 |
| 147 // Hack for default color |
| 148 if (color.alpha == 0.0) |
| 149 color = {1, 1, 1, 1}; |
| 150 |
| 151 return SkColorSetRGB(color.red * 255, color.green * 255, color.blue * 255); |
| 152 } |
| 153 |
| 154 SkColor GetTextColor(GtkWidget* widget, WidgetState state) { |
| 155 return GetFGColor(widget, state); |
| 156 } |
| 157 SkColor GetTextAAColor(GtkWidget* widget, WidgetState state) { |
| 158 return GetFGColor(widget, state); |
| 159 } |
| 160 SkColor GetBaseColor(GtkWidget* widget, WidgetState state) { |
| 161 return GetBGColor(widget, state); |
| 162 } |
| 163 |
| 164 #endif |
| 165 |
| 166 |
| 107 // static | 167 // static |
| 108 NativeThemeGtk2* NativeThemeGtk2::instance() { | 168 NativeThemeGtk2* NativeThemeGtk2::instance() { |
| 109 CR_DEFINE_STATIC_LOCAL(NativeThemeGtk2, s_native_theme, ()); | 169 CR_DEFINE_STATIC_LOCAL(NativeThemeGtk2, s_native_theme, ()); |
| 110 return &s_native_theme; | 170 return &s_native_theme; |
| 111 } | 171 } |
| 112 | 172 |
| 113 NativeThemeGtk2::NativeThemeGtk2() | 173 // Constructors automatically called |
| 114 : fake_window_(NULL), | 174 NativeThemeGtk2::NativeThemeGtk2() {} |
| 115 fake_tooltip_(NULL), | 175 // This doesn't actually get called |
| 116 fake_menu_item_(NULL) { | 176 NativeThemeGtk2::~NativeThemeGtk2() {} |
| 117 } | |
| 118 | 177 |
| 119 NativeThemeGtk2::~NativeThemeGtk2() { | |
| 120 if (fake_window_) | |
| 121 gtk_widget_destroy(fake_window_); | |
| 122 if (fake_tooltip_) | |
| 123 gtk_widget_destroy(fake_tooltip_); | |
| 124 | 178 |
| 125 fake_entry_.Destroy(); | |
| 126 fake_label_.Destroy(); | |
| 127 fake_button_.Destroy(); | |
| 128 fake_tree_.Destroy(); | |
| 129 fake_menu_.Destroy(); | |
| 130 } | |
| 131 | |
| 132 gfx::Size NativeThemeGtk2::GetPartSize(Part part, | |
| 133 State state, | |
| 134 const ExtraParams& extra) const { | |
| 135 if (part == kComboboxArrow) | |
| 136 return gfx::Size(12, 12); | |
| 137 | |
| 138 return ui::NativeThemeBase::GetPartSize(part, state, extra); | |
| 139 } | |
| 140 | |
| 141 void NativeThemeGtk2::Paint(SkCanvas* canvas, | |
| 142 Part part, | |
| 143 State state, | |
| 144 const gfx::Rect& rect, | |
| 145 const ExtraParams& extra) const { | |
| 146 if (rect.IsEmpty()) | |
| 147 return; | |
| 148 | |
| 149 switch (part) { | |
| 150 case kComboboxArrow: | |
| 151 PaintComboboxArrow(canvas, GetGtkState(state), rect); | |
| 152 return; | |
| 153 | |
| 154 default: | |
| 155 NativeThemeBase::Paint(canvas, part, state, rect, extra); | |
| 156 } | |
| 157 } | |
| 158 | |
| 159 SkColor NativeThemeGtk2::GetSystemColor(ColorId color_id) const { | |
| 160 if (color_id == kColorId_BlueButtonShadowColor) | |
| 161 return SK_ColorTRANSPARENT; | |
| 162 | |
| 163 return GdkColorToSkColor(GetSystemGdkColor(color_id)); | |
| 164 } | |
| 165 | 179 |
| 166 void NativeThemeGtk2::PaintMenuPopupBackground( | 180 void NativeThemeGtk2::PaintMenuPopupBackground( |
| 167 SkCanvas* canvas, | 181 SkCanvas* canvas, |
| 168 const gfx::Size& size, | 182 const gfx::Size& size, |
| 169 const MenuBackgroundExtraParams& menu_background) const { | 183 const MenuBackgroundExtraParams& menu_background) const { |
| 170 if (menu_background.corner_radius > 0) { | 184 if (menu_background.corner_radius > 0) { |
| 171 SkPaint paint; | 185 SkPaint paint; |
| 172 paint.setStyle(SkPaint::kFill_Style); | 186 paint.setStyle(SkPaint::kFill_Style); |
| 173 paint.setFlags(SkPaint::kAntiAlias_Flag); | 187 paint.setFlags(SkPaint::kAntiAlias_Flag); |
| 174 paint.setColor(GetSystemColor(kColorId_MenuBackgroundColor)); | 188 paint.setColor(GetSystemColor(kColorId_MenuBackgroundColor)); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 NativeTheme::kColorId_FocusedMenuItemBackgroundColor); | 220 NativeTheme::kColorId_FocusedMenuItemBackgroundColor); |
| 207 paint.setColor(color); | 221 paint.setColor(color); |
| 208 break; | 222 break; |
| 209 default: | 223 default: |
| 210 NOTREACHED() << "Invalid state " << state; | 224 NOTREACHED() << "Invalid state " << state; |
| 211 break; | 225 break; |
| 212 } | 226 } |
| 213 canvas->drawRect(gfx::RectToSkRect(rect), paint); | 227 canvas->drawRect(gfx::RectToSkRect(rect), paint); |
| 214 } | 228 } |
| 215 | 229 |
| 216 GdkColor NativeThemeGtk2::GetSystemGdkColor(ColorId color_id) const { | 230 SkColor NativeThemeGtk2::GetSystemColor(ColorId color_id) const { |
| 231 if (color_id == kColorId_BlueButtonShadowColor) |
| 232 return SK_ColorTRANSPARENT; |
| 233 |
| 217 const SkColor kPositiveTextColor = SkColorSetRGB(0x0b, 0x80, 0x43); | 234 const SkColor kPositiveTextColor = SkColorSetRGB(0x0b, 0x80, 0x43); |
| 218 const SkColor kNegativeTextColor = SkColorSetRGB(0xc5, 0x39, 0x29); | 235 const SkColor kNegativeTextColor = SkColorSetRGB(0xc5, 0x39, 0x29); |
| 236 |
| 219 switch (color_id) { | 237 switch (color_id) { |
| 220 // Windows | 238 // Windows |
| 221 case kColorId_WindowBackground: | 239 case kColorId_WindowBackground: |
| 222 return GetWindowStyle()->bg[GTK_STATE_NORMAL]; | 240 return GetBGColor(GetWindow(), SELECTED); |
| 223 | 241 |
| 224 // Dialogs | 242 // Dialogs |
| 225 case kColorId_DialogBackground: | 243 case kColorId_DialogBackground: |
| 226 return GetWindowStyle()->bg[GTK_STATE_NORMAL]; | 244 return GetBGColor(GetWindow(), NORMAL); |
| 227 | 245 |
| 228 // FocusableBorder | 246 // FocusableBorder |
| 229 case kColorId_FocusedBorderColor: | 247 case kColorId_FocusedBorderColor: |
| 230 return GetEntryStyle()->bg[GTK_STATE_SELECTED]; | 248 return GetBGColor(GetEntry(), SELECTED); |
| 231 case kColorId_UnfocusedBorderColor: | 249 case kColorId_UnfocusedBorderColor: |
| 232 return GetEntryStyle()->text_aa[GTK_STATE_NORMAL]; | 250 return GetTextAAColor(GetEntry(), NORMAL); |
| 233 | 251 |
| 234 // MenuItem | 252 // MenuItem |
| 235 case kColorId_EnabledMenuItemForegroundColor: | 253 case kColorId_EnabledMenuItemForegroundColor: |
| 236 case kColorId_DisabledEmphasizedMenuItemForegroundColor: | 254 case kColorId_DisabledEmphasizedMenuItemForegroundColor: |
| 237 return GetMenuItemStyle()->text[GTK_STATE_NORMAL]; | 255 return GetTextColor(GetMenuItem(), NORMAL); |
| 238 case kColorId_DisabledMenuItemForegroundColor: | 256 case kColorId_DisabledMenuItemForegroundColor: |
| 239 return GetMenuItemStyle()->text[GTK_STATE_INSENSITIVE]; | 257 return GetTextColor(GetMenuItem(), INSENSITIVE); |
| 240 case kColorId_SelectedMenuItemForegroundColor: | 258 case kColorId_SelectedMenuItemForegroundColor: |
| 241 return GetMenuItemStyle()->text[GTK_STATE_SELECTED]; | 259 return GetTextColor(GetMenuItem(), SELECTED); |
| 242 case kColorId_FocusedMenuItemBackgroundColor: | 260 case kColorId_FocusedMenuItemBackgroundColor: |
| 243 return GetMenuItemStyle()->bg[GTK_STATE_SELECTED]; | 261 return GetBGColor(GetMenuItem(), SELECTED); |
| 244 case kColorId_HoverMenuItemBackgroundColor: | 262 case kColorId_HoverMenuItemBackgroundColor: |
| 245 return GetMenuItemStyle()->bg[GTK_STATE_PRELIGHT]; | 263 return GetBGColor(GetMenuItem(), PRELIGHT); |
| 246 case kColorId_FocusedMenuButtonBorderColor: | 264 case kColorId_FocusedMenuButtonBorderColor: |
| 247 return GetEntryStyle()->bg[GTK_STATE_NORMAL]; | 265 return GetBGColor(GetEntry(), NORMAL); |
| 248 case kColorId_HoverMenuButtonBorderColor: | 266 case kColorId_HoverMenuButtonBorderColor: |
| 249 return GetEntryStyle()->text_aa[GTK_STATE_PRELIGHT]; | 267 return GetTextAAColor(GetEntry(), PRELIGHT); |
| 250 case kColorId_MenuBorderColor: | 268 case kColorId_MenuBorderColor: |
| 251 case kColorId_EnabledMenuButtonBorderColor: | 269 case kColorId_EnabledMenuButtonBorderColor: |
| 252 case kColorId_MenuSeparatorColor: { | 270 case kColorId_MenuSeparatorColor: { |
| 253 return GetMenuItemStyle()->text[GTK_STATE_INSENSITIVE]; | 271 return GetTextColor(GetMenuItem(), INSENSITIVE); |
| 254 } | 272 } |
| 255 case kColorId_MenuBackgroundColor: | 273 case kColorId_MenuBackgroundColor: |
| 256 return GetMenuStyle()->bg[GTK_STATE_NORMAL]; | 274 return GetBGColor(GetMenu(), NORMAL); |
| 257 | 275 |
| 258 // Label | 276 // Label |
| 259 case kColorId_LabelEnabledColor: | 277 case kColorId_LabelEnabledColor: |
| 260 return GetLabelStyle()->text[GTK_STATE_NORMAL]; | 278 return GetTextColor(GetEntry(), NORMAL); |
| 261 case kColorId_LabelDisabledColor: | 279 case kColorId_LabelDisabledColor: |
| 262 return GetLabelStyle()->text[GTK_STATE_INSENSITIVE]; | 280 return GetTextColor(GetLabel(), INSENSITIVE); |
| 263 case kColorId_LabelBackgroundColor: | 281 case kColorId_LabelBackgroundColor: |
| 264 return GetWindowStyle()->bg[GTK_STATE_NORMAL]; | 282 return GetBGColor(GetWindow(), NORMAL); |
| 265 | 283 |
| 266 // Button | 284 // Button |
| 267 case kColorId_ButtonBackgroundColor: | 285 case kColorId_ButtonBackgroundColor: |
| 268 return GetButtonStyle()->bg[GTK_STATE_NORMAL]; | 286 return GetBGColor(GetButton(), NORMAL); |
| 269 case kColorId_ButtonEnabledColor: | 287 case kColorId_ButtonEnabledColor: |
| 270 case kColorId_BlueButtonEnabledColor: | 288 case kColorId_BlueButtonEnabledColor: |
| 271 return GetButtonStyle()->text[GTK_STATE_NORMAL]; | 289 return GetTextColor(GetButton(), NORMAL); |
| 272 case kColorId_ButtonDisabledColor: | 290 case kColorId_ButtonDisabledColor: |
| 273 case kColorId_BlueButtonDisabledColor: | 291 case kColorId_BlueButtonDisabledColor: |
| 274 return GetButtonStyle()->text[GTK_STATE_INSENSITIVE]; | 292 return GetTextColor(GetButton(), INSENSITIVE); |
| 275 case kColorId_ButtonHighlightColor: | 293 case kColorId_ButtonHighlightColor: |
| 276 return GetButtonStyle()->base[GTK_STATE_SELECTED]; | 294 return GetBaseColor(GetButton(), SELECTED); |
| 277 case kColorId_ButtonHoverColor: | 295 case kColorId_ButtonHoverColor: |
| 278 case kColorId_BlueButtonHoverColor: | 296 case kColorId_BlueButtonHoverColor: |
| 279 return GetButtonStyle()->text[GTK_STATE_PRELIGHT]; | 297 return GetTextColor(GetButton(), PRELIGHT); |
| 280 case kColorId_ButtonHoverBackgroundColor: | 298 case kColorId_ButtonHoverBackgroundColor: |
| 281 return GetButtonStyle()->bg[GTK_STATE_PRELIGHT]; | 299 return GetBGColor(GetButton(), PRELIGHT); |
| 282 case kColorId_BlueButtonPressedColor: | 300 case kColorId_BlueButtonPressedColor: |
| 283 return GetButtonStyle()->text[GTK_STATE_ACTIVE]; | 301 return GetTextColor(GetButton(), ACTIVE); |
| 284 case kColorId_BlueButtonShadowColor: | 302 case kColorId_BlueButtonShadowColor: |
| 285 // Should be handled in GetSystemColor(). | 303 // Should be handled in GetSystemColor(). |
| 286 NOTREACHED(); | 304 NOTREACHED(); |
| 287 return GetButtonStyle()->text[GTK_STATE_NORMAL]; | 305 return GetTextColor(GetButton(), NORMAL); |
| 288 | 306 |
| 289 // Textfield | 307 // Textfield |
| 290 case kColorId_TextfieldDefaultColor: | 308 case kColorId_TextfieldDefaultColor: |
| 291 return GetEntryStyle()->text[GTK_STATE_NORMAL]; | 309 return GetTextColor(GetEntry(), NORMAL); |
| 292 case kColorId_TextfieldDefaultBackground: | 310 case kColorId_TextfieldDefaultBackground: |
| 293 return GetEntryStyle()->base[GTK_STATE_NORMAL]; | 311 return GetBaseColor(GetEntry(), NORMAL); |
| 294 case kColorId_TextfieldReadOnlyColor: | 312 case kColorId_TextfieldReadOnlyColor: |
| 295 return GetEntryStyle()->text[GTK_STATE_INSENSITIVE]; | 313 return GetTextColor(GetEntry(), INSENSITIVE); |
| 296 case kColorId_TextfieldReadOnlyBackground: | 314 case kColorId_TextfieldReadOnlyBackground: |
| 297 return GetEntryStyle()->base[GTK_STATE_INSENSITIVE]; | 315 return GetBaseColor(GetEntry(), INSENSITIVE); |
| 298 case kColorId_TextfieldSelectionColor: | 316 case kColorId_TextfieldSelectionColor: |
| 299 return GetEntryStyle()->text[GTK_STATE_SELECTED]; | 317 return GetTextColor(GetEntry(), SELECTED); |
| 300 case kColorId_TextfieldSelectionBackgroundFocused: | 318 case kColorId_TextfieldSelectionBackgroundFocused: |
| 301 return GetEntryStyle()->base[GTK_STATE_SELECTED]; | 319 return GetBaseColor(GetEntry(), SELECTED); |
| 302 | 320 |
| 303 // Tooltips | 321 // Tooltips |
| 304 case kColorId_TooltipBackground: | 322 case kColorId_TooltipBackground: |
| 305 return GetTooltipStyle()->bg[GTK_STATE_NORMAL]; | 323 return GetBGColor(GetTooltip(), NORMAL); |
| 306 case kColorId_TooltipText: | 324 case kColorId_TooltipText: |
| 307 return GetTooltipStyle()->fg[GTK_STATE_NORMAL]; | 325 return GetFGColor(GetTooltip(), NORMAL); |
| 308 | 326 |
| 309 // Trees and Tables (implemented on GTK using the same class) | 327 // Trees and Tables (implemented on GTK using the same class) |
| 310 case kColorId_TableBackground: | 328 case kColorId_TableBackground: |
| 311 case kColorId_TreeBackground: | 329 case kColorId_TreeBackground: |
| 312 return GetTreeStyle()->bg[GTK_STATE_NORMAL]; | 330 return GetBGColor(GetTree(), NORMAL); |
| 313 case kColorId_TableText: | 331 case kColorId_TableText: |
| 314 case kColorId_TreeText: | 332 case kColorId_TreeText: |
| 315 return GetTreeStyle()->text[GTK_STATE_NORMAL]; | 333 return GetTextColor(GetTree(), NORMAL); |
| 316 case kColorId_TableSelectedText: | 334 case kColorId_TableSelectedText: |
| 317 case kColorId_TableSelectedTextUnfocused: | 335 case kColorId_TableSelectedTextUnfocused: |
| 318 case kColorId_TreeSelectedText: | 336 case kColorId_TreeSelectedText: |
| 319 case kColorId_TreeSelectedTextUnfocused: | 337 case kColorId_TreeSelectedTextUnfocused: |
| 320 return GetTreeStyle()->text[GTK_STATE_SELECTED]; | 338 return GetTextColor(GetTree(), SELECTED); |
| 321 case kColorId_TableSelectionBackgroundFocused: | 339 case kColorId_TableSelectionBackgroundFocused: |
| 322 case kColorId_TableSelectionBackgroundUnfocused: | 340 case kColorId_TableSelectionBackgroundUnfocused: |
| 323 case kColorId_TreeSelectionBackgroundFocused: | 341 case kColorId_TreeSelectionBackgroundFocused: |
| 324 case kColorId_TreeSelectionBackgroundUnfocused: | 342 case kColorId_TreeSelectionBackgroundUnfocused: |
| 325 return GetTreeStyle()->bg[GTK_STATE_SELECTED]; | 343 return GetBGColor(GetTree(), SELECTED); |
| 326 case kColorId_TreeArrow: | 344 case kColorId_TreeArrow: |
| 327 return GetTreeStyle()->fg[GTK_STATE_NORMAL]; | 345 return GetFGColor(GetTree(), NORMAL); |
| 328 case kColorId_TableGroupingIndicatorColor: | 346 case kColorId_TableGroupingIndicatorColor: |
| 329 return GetTreeStyle()->text_aa[GTK_STATE_NORMAL]; | 347 return GetTextAAColor(GetTree(), NORMAL); |
| 330 | 348 |
| 331 // Results Table | 349 // Results Table |
| 332 case kColorId_ResultsTableNormalBackground: | 350 case kColorId_ResultsTableNormalBackground: |
| 333 return GetEntryStyle()->base[GTK_STATE_NORMAL]; | 351 return GetBaseColor(GetEntry(), NORMAL); |
| 334 case kColorId_ResultsTableHoveredBackground: { | 352 case kColorId_ResultsTableHoveredBackground: |
| 335 GtkStyle* entry_style = GetEntryStyle(); | 353 return color_utils::AlphaBlend(GetBaseColor(GetEntry(), NORMAL), |
| 336 return GdkAlphaBlend( | 354 GetBaseColor(GetEntry(), SELECTED), |
| 337 entry_style->base[GTK_STATE_NORMAL], | 355 0x80); |
| 338 entry_style->base[GTK_STATE_SELECTED], 0x80); | |
| 339 } | |
| 340 case kColorId_ResultsTableSelectedBackground: | 356 case kColorId_ResultsTableSelectedBackground: |
| 341 return GetEntryStyle()->base[GTK_STATE_SELECTED]; | 357 return GetBaseColor(GetEntry(), SELECTED); |
| 342 case kColorId_ResultsTableNormalText: | 358 case kColorId_ResultsTableNormalText: |
| 343 case kColorId_ResultsTableHoveredText: | 359 case kColorId_ResultsTableHoveredText: |
| 344 return GetEntryStyle()->text[GTK_STATE_NORMAL]; | 360 return GetTextColor(GetEntry(), NORMAL); |
| 345 case kColorId_ResultsTableSelectedText: | 361 case kColorId_ResultsTableSelectedText: |
| 346 return GetEntryStyle()->text[GTK_STATE_SELECTED]; | 362 return GetTextColor(GetEntry(), SELECTED); |
| 347 case kColorId_ResultsTableNormalDimmedText: | 363 case kColorId_ResultsTableNormalDimmedText: |
| 348 case kColorId_ResultsTableHoveredDimmedText: { | 364 case kColorId_ResultsTableHoveredDimmedText: |
| 349 GtkStyle* entry_style = GetEntryStyle(); | 365 return color_utils::AlphaBlend(GetTextColor(GetEntry(), NORMAL), |
| 350 return GdkAlphaBlend( | 366 GetBaseColor(GetEntry(), NORMAL), |
| 351 entry_style->text[GTK_STATE_NORMAL], | 367 0x80); |
| 352 entry_style->base[GTK_STATE_NORMAL], 0x80); | 368 case kColorId_ResultsTableSelectedDimmedText: |
| 353 } | 369 return color_utils::AlphaBlend(GetTextColor(GetEntry(), SELECTED), |
| 354 case kColorId_ResultsTableSelectedDimmedText: { | 370 GetBaseColor(GetEntry(), NORMAL), |
| 355 GtkStyle* entry_style = GetEntryStyle(); | 371 0x80); |
| 356 return GdkAlphaBlend( | |
| 357 entry_style->text[GTK_STATE_SELECTED], | |
| 358 entry_style->base[GTK_STATE_NORMAL], 0x80); | |
| 359 } | |
| 360 case kColorId_ResultsTableNormalUrl: | 372 case kColorId_ResultsTableNormalUrl: |
| 361 case kColorId_ResultsTableHoveredUrl: { | 373 case kColorId_ResultsTableHoveredUrl: |
| 362 return NormalURLColor(GetEntryStyle()->text[GTK_STATE_NORMAL]); | 374 return NormalURLColor(GetTextColor(GetEntry(), NORMAL)); |
| 363 } | 375 |
| 364 case kColorId_ResultsTableSelectedUrl: { | 376 case kColorId_ResultsTableSelectedUrl: |
| 365 GtkStyle* entry_style = GetEntryStyle(); | 377 return SelectedURLColor(GetTextColor(GetEntry(), SELECTED), |
| 366 return SelectedURLColor(entry_style->text[GTK_STATE_SELECTED], | 378 GetBaseColor(GetEntry(), SELECTED)); |
| 367 entry_style->base[GTK_STATE_SELECTED]); | 379 case kColorId_ResultsTableNormalDivider: |
| 368 } | 380 return color_utils::AlphaBlend(GetTextColor(GetWindow(), NORMAL), |
| 369 case kColorId_ResultsTableNormalDivider: { | 381 GetBGColor(GetWindow(), NORMAL), |
| 370 GtkStyle* win_style = GetWindowStyle(); | 382 0x34); |
| 371 return GdkAlphaBlend(win_style->text[GTK_STATE_NORMAL], | 383 case kColorId_ResultsTableHoveredDivider: |
| 372 win_style->bg[GTK_STATE_NORMAL], 0x34); | 384 return color_utils::AlphaBlend(GetTextColor(GetWindow(), PRELIGHT), |
| 373 } | 385 GetBGColor(GetWindow(), PRELIGHT), |
| 374 case kColorId_ResultsTableHoveredDivider: { | 386 0x34); |
| 375 GtkStyle* win_style = GetWindowStyle(); | 387 case kColorId_ResultsTableSelectedDivider: |
| 376 return GdkAlphaBlend(win_style->text[GTK_STATE_PRELIGHT], | 388 return color_utils::AlphaBlend(GetTextColor(GetWindow(), SELECTED), |
| 377 win_style->bg[GTK_STATE_PRELIGHT], 0x34); | 389 GetBGColor(GetWindow(), SELECTED), |
| 378 } | 390 0x34); |
| 379 case kColorId_ResultsTableSelectedDivider: { | 391 |
| 380 GtkStyle* win_style = GetWindowStyle(); | |
| 381 return GdkAlphaBlend(win_style->text[GTK_STATE_SELECTED], | |
| 382 win_style->bg[GTK_STATE_SELECTED], 0x34); | |
| 383 } | |
| 384 case kColorId_ResultsTablePositiveText: { | 392 case kColorId_ResultsTablePositiveText: { |
| 385 return GetReadableColor(kPositiveTextColor, | 393 return color_utils::GetReadableColor(kPositiveTextColor, |
| 386 GetEntryStyle()->base[GTK_STATE_NORMAL]); | 394 GetBaseColor(GetEntry(), NORMAL)); |
| 387 } | 395 } |
| 388 case kColorId_ResultsTablePositiveHoveredText: { | 396 case kColorId_ResultsTablePositiveHoveredText: { |
| 389 return GetReadableColor(kPositiveTextColor, | 397 return color_utils::GetReadableColor(kPositiveTextColor, |
| 390 GetEntryStyle()->base[GTK_STATE_PRELIGHT]); | 398 GetBaseColor(GetEntry(), PRELIGHT)); |
| 391 } | 399 } |
| 392 case kColorId_ResultsTablePositiveSelectedText: { | 400 case kColorId_ResultsTablePositiveSelectedText: { |
| 393 return GetReadableColor(kPositiveTextColor, | 401 return color_utils::GetReadableColor(kPositiveTextColor, |
| 394 GetEntryStyle()->base[GTK_STATE_SELECTED]); | 402 GetBaseColor(GetEntry(), SELECTED)); |
| 395 } | 403 } |
| 396 case kColorId_ResultsTableNegativeText: { | 404 case kColorId_ResultsTableNegativeText: { |
| 397 return GetReadableColor(kNegativeTextColor, | 405 return color_utils::GetReadableColor(kNegativeTextColor, |
| 398 GetEntryStyle()->base[GTK_STATE_NORMAL]); | 406 GetBaseColor(GetEntry(), NORMAL)); |
| 399 } | 407 } |
| 400 case kColorId_ResultsTableNegativeHoveredText: { | 408 case kColorId_ResultsTableNegativeHoveredText: { |
| 401 return GetReadableColor(kNegativeTextColor, | 409 return color_utils::GetReadableColor(kNegativeTextColor, |
| 402 GetEntryStyle()->base[GTK_STATE_PRELIGHT]); | 410 GetBaseColor(GetEntry(), PRELIGHT)); |
| 403 } | 411 } |
| 404 case kColorId_ResultsTableNegativeSelectedText: { | 412 case kColorId_ResultsTableNegativeSelectedText: { |
| 405 return GetReadableColor(kNegativeTextColor, | 413 return color_utils::GetReadableColor(kNegativeTextColor, |
| 406 GetEntryStyle()->base[GTK_STATE_SELECTED]); | 414 GetBaseColor(GetEntry(), SELECTED)); |
| 407 } | 415 } |
| 408 | 416 |
| 409 // Throbber | 417 // Throbber |
| 410 case kColorId_ThrobberSpinningColor: | 418 case kColorId_ThrobberSpinningColor: |
| 411 case kColorId_ThrobberLightColor: { | 419 case kColorId_ThrobberLightColor: { |
| 412 return GetEntryStyle()->bg[GTK_STATE_SELECTED]; | 420 return GetBGColor(GetEntry(), SELECTED); |
| 413 } | 421 } |
| 414 | 422 |
| 415 case kColorId_ThrobberWaitingColor: { | 423 case kColorId_ThrobberWaitingColor: { |
| 416 return GdkAlphaBlend(GetEntryStyle()->bg[GTK_STATE_SELECTED], | 424 return color_utils::AlphaBlend(GetBGColor(GetEntry(), SELECTED), |
| 417 GetWindowStyle()->bg[GTK_STATE_NORMAL], 0xff / 2); | 425 GetBGColor(GetWindow(), NORMAL), |
| 426 0x80); |
| 418 } | 427 } |
| 419 | 428 |
| 420 case kColorId_Amber: | 429 case kColorId_Amber: |
| 421 case kColorId_ChromeIconGrey: | 430 case kColorId_ChromeIconGrey: |
| 422 case kColorId_GoogleBlue: | 431 case kColorId_GoogleBlue: |
| 423 case kColorId_NumColors: | 432 case kColorId_NumColors: |
| 424 NOTREACHED(); | 433 NOTREACHED(); |
| 425 break; | 434 break; |
| 426 } | 435 } |
| 427 | 436 |
| 428 return SkColorToGdkColor(kInvalidColorIdColor); | 437 return kInvalidColorIdColor; |
| 429 } | 438 } |
| 430 | 439 |
| 431 GtkWidget* NativeThemeGtk2::GetRealizedWindow() const { | 440 GtkWidget* NativeThemeGtk2::GetWindow() const { |
| 432 if (!fake_window_) { | 441 if (!fake_window_.get()) { |
| 433 fake_window_ = gtk_window_new(GTK_WINDOW_TOPLEVEL); | 442 fake_window_.Own(chrome_gtk_frame_new()); |
| 434 gtk_widget_realize(fake_window_); | 443 gtk_widget_realize(fake_window_.get()); |
| 435 } | 444 } |
| 436 | 445 |
| 437 return fake_window_; | 446 return fake_window_.get(); |
| 438 } | 447 } |
| 439 | 448 |
| 440 GtkStyle* NativeThemeGtk2::GetWindowStyle() const { | 449 GtkWidget* NativeThemeGtk2::GetEntry() const { |
| 441 return gtk_rc_get_style(GetRealizedWindow()); | |
| 442 } | |
| 443 | |
| 444 GtkStyle* NativeThemeGtk2::GetEntryStyle() const { | |
| 445 if (!fake_entry_.get()) { | 450 if (!fake_entry_.get()) { |
| 446 fake_entry_.Own(gtk_entry_new()); | 451 fake_entry_.Own(gtk_entry_new()); |
| 447 | 452 |
| 448 // The fake entry needs to be in the window so it can be realized so we can | 453 // The fake entry needs to be in the window so it can be realized so we can |
| 449 // use the computed parts of the style. | 454 // use the computed parts of the style. |
| 450 gtk_container_add(GTK_CONTAINER(GetRealizedWindow()), fake_entry_.get()); | 455 gtk_container_add(GTK_CONTAINER(GetWindow()), fake_entry_.get()); |
| 451 gtk_widget_realize(fake_entry_.get()); | 456 gtk_widget_realize(fake_entry_.get()); |
| 452 } | 457 } |
| 453 return gtk_rc_get_style(fake_entry_.get()); | 458 |
| 459 return fake_entry_.get(); |
| 454 } | 460 } |
| 455 | 461 |
| 456 GtkStyle* NativeThemeGtk2::GetLabelStyle() const { | 462 GtkWidget* NativeThemeGtk2::GetLabel() const { |
| 457 if (!fake_label_.get()) | 463 if (!fake_label_.get()) |
| 458 fake_label_.Own(gtk_label_new("")); | 464 fake_label_.Own(gtk_label_new("")); |
| 459 | 465 |
| 460 return gtk_rc_get_style(fake_label_.get()); | 466 return fake_label_.get(); |
| 461 } | 467 } |
| 462 | 468 |
| 463 GtkStyle* NativeThemeGtk2::GetButtonStyle() const { | 469 GtkWidget* NativeThemeGtk2::GetButton() const { |
| 464 if (!fake_button_.get()) | 470 if (!fake_button_.get()) |
| 465 fake_button_.Own(gtk_button_new()); | 471 fake_button_.Own(gtk_button_new()); |
| 466 | 472 |
| 467 return gtk_rc_get_style(fake_button_.get()); | 473 return fake_button_.get(); |
| 468 } | 474 } |
| 469 | 475 |
| 470 GtkStyle* NativeThemeGtk2::GetTreeStyle() const { | 476 GtkWidget* NativeThemeGtk2::GetTree() const { |
| 471 if (!fake_tree_.get()) | 477 if (!fake_tree_.get()) |
| 472 fake_tree_.Own(gtk_tree_view_new()); | 478 fake_tree_.Own(gtk_tree_view_new()); |
| 473 | 479 |
| 474 return gtk_rc_get_style(fake_tree_.get()); | 480 return fake_tree_.get(); |
| 475 } | 481 } |
| 476 | 482 |
| 477 GtkStyle* NativeThemeGtk2::GetTooltipStyle() const { | 483 GtkWidget* NativeThemeGtk2::GetTooltip() const { |
| 478 if (!fake_tooltip_) { | 484 if (!fake_tooltip_.get()) { |
| 479 fake_tooltip_ = gtk_window_new(GTK_WINDOW_TOPLEVEL); | 485 fake_tooltip_.Own(gtk_window_new(GTK_WINDOW_TOPLEVEL)); |
| 480 gtk_widget_set_name(fake_tooltip_, "gtk-tooltip"); | 486 gtk_widget_set_name(fake_tooltip_.get(), "gtk-tooltip"); |
| 481 gtk_widget_realize(fake_tooltip_); | 487 gtk_widget_realize(fake_tooltip_.get()); |
| 482 } | 488 } |
| 483 return gtk_rc_get_style(fake_tooltip_); | 489 |
| 490 return fake_tooltip_.get(); |
| 484 } | 491 } |
| 485 | 492 |
| 486 GtkStyle* NativeThemeGtk2::GetMenuStyle() const { | 493 GtkWidget* NativeThemeGtk2::GetMenu() const { |
| 487 if (!fake_menu_.get()) | 494 if (!fake_menu_.get()) |
| 488 fake_menu_.Own(gtk_custom_menu_new()); | 495 fake_menu_.Own(gtk_custom_menu_new()); |
| 489 return gtk_rc_get_style(fake_menu_.get()); | 496 |
| 497 return fake_menu_.get(); |
| 490 } | 498 } |
| 491 | 499 |
| 492 GtkStyle* NativeThemeGtk2::GetMenuItemStyle() const { | 500 GtkWidget* NativeThemeGtk2::GetMenuItem() const { |
| 493 if (!fake_menu_item_) { | 501 if (!fake_menu_item_.get()) { |
| 494 if (!fake_menu_.get()) | 502 fake_menu_item_.Own(gtk_custom_menu_item_new()); |
| 495 fake_menu_.Own(gtk_custom_menu_new()); | 503 gtk_menu_shell_append(GTK_MENU_SHELL(GetMenu()), fake_menu_item_.get()); |
| 496 | |
| 497 fake_menu_item_ = gtk_custom_menu_item_new(); | |
| 498 gtk_menu_shell_append(GTK_MENU_SHELL(fake_menu_.get()), fake_menu_item_); | |
| 499 } | 504 } |
| 500 | 505 |
| 501 return gtk_rc_get_style(fake_menu_item_); | 506 return fake_menu_item_.get(); |
| 502 } | |
| 503 | |
| 504 void NativeThemeGtk2::PaintComboboxArrow(SkCanvas* canvas, | |
| 505 GtkStateType state, | |
| 506 const gfx::Rect& rect) const { | |
| 507 GdkPixmap* pm = gdk_pixmap_new(gtk_widget_get_window(GetRealizedWindow()), | |
| 508 rect.width(), | |
| 509 rect.height(), | |
| 510 -1); | |
| 511 // Paint the background. | |
| 512 gtk_paint_flat_box(GetWindowStyle(), | |
| 513 pm, | |
| 514 state, | |
| 515 GTK_SHADOW_NONE, | |
| 516 NULL, | |
| 517 GetRealizedWindow(), | |
| 518 NULL, 0, 0, rect.width(), rect.height()); | |
| 519 gtk_paint_arrow(GetWindowStyle(), | |
| 520 pm, | |
| 521 state, | |
| 522 GTK_SHADOW_NONE, | |
| 523 NULL, | |
| 524 GetRealizedWindow(), | |
| 525 NULL, | |
| 526 GTK_ARROW_DOWN, | |
| 527 true, | |
| 528 0, 0, rect.width(), rect.height()); | |
| 529 GdkPixbuf* pb = gdk_pixbuf_get_from_drawable(NULL, | |
| 530 pm, | |
| 531 gdk_drawable_get_colormap(pm), | |
| 532 0, 0, | |
| 533 0, 0, | |
| 534 rect.width(), rect.height()); | |
| 535 SkBitmap arrow = GdkPixbufToImageSkia(pb); | |
| 536 canvas->drawBitmap(arrow, rect.x(), rect.y()); | |
| 537 | |
| 538 g_object_unref(pb); | |
| 539 g_object_unref(pm); | |
| 540 } | 507 } |
| 541 | 508 |
| 542 } // namespace libgtk2ui | 509 } // namespace libgtk2ui |
| OLD | NEW |