OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_GTK_CUSTOM_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_CUSTOM_BUTTON_H_ |
6 #define CHROME_BROWSER_UI_GTK_CUSTOM_BUTTON_H_ | 6 #define CHROME_BROWSER_UI_GTK_CUSTOM_BUTTON_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 gboolean OnExpose(GtkWidget* widget, GdkEventExpose* e, gdouble hover_state); | 51 gboolean OnExpose(GtkWidget* widget, GdkEventExpose* e, gdouble hover_state); |
52 | 52 |
53 void set_paint_override(int state) { paint_override_ = state; } | 53 void set_paint_override(int state) { paint_override_ = state; } |
54 int paint_override() const { return paint_override_; } | 54 int paint_override() const { return paint_override_; } |
55 | 55 |
56 // Set the background details. | 56 // Set the background details. |
57 void SetBackground(SkColor color, SkBitmap* image, SkBitmap* mask); | 57 void SetBackground(SkColor color, SkBitmap* image, SkBitmap* mask); |
58 | 58 |
59 // Provide NotificationObserver implementation. | 59 // Provide NotificationObserver implementation. |
60 virtual void Observe(NotificationType type, | 60 virtual void Observe(int type, |
61 const NotificationSource& source, | 61 const NotificationSource& source, |
62 const NotificationDetails& details); | 62 const NotificationDetails& details); |
63 | 63 |
64 private: | 64 private: |
65 // Get the CairoCachedSurface from |surfaces_| for |state|. | 65 // Get the CairoCachedSurface from |surfaces_| for |state|. |
66 CairoCachedSurface* PixbufForState(int state); | 66 CairoCachedSurface* PixbufForState(int state); |
67 | 67 |
68 // We store one surface for each possible state of the button; | 68 // We store one surface for each possible state of the button; |
69 // INSENSITIVE is the last available state; | 69 // INSENSITIVE is the last available state; |
70 scoped_ptr<CairoCachedSurface> surfaces_[GTK_STATE_INSENSITIVE + 1]; | 70 scoped_ptr<CairoCachedSurface> surfaces_[GTK_STATE_INSENSITIVE + 1]; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // state. | 178 // state. |
179 void SetPaintOverride(GtkStateType state); | 179 void SetPaintOverride(GtkStateType state); |
180 | 180 |
181 // Resume normal drawing of the widget's state. | 181 // Resume normal drawing of the widget's state. |
182 void UnsetPaintOverride(); | 182 void UnsetPaintOverride(); |
183 | 183 |
184 // Set the background details. | 184 // Set the background details. |
185 void SetBackground(SkColor color, SkBitmap* image, SkBitmap* mask); | 185 void SetBackground(SkColor color, SkBitmap* image, SkBitmap* mask); |
186 | 186 |
187 // NotificationObserver implementation. | 187 // NotificationObserver implementation. |
188 virtual void Observe(NotificationType type, | 188 virtual void Observe(int type, |
189 const NotificationSource& source, | 189 const NotificationSource& source, |
190 const NotificationDetails& details); | 190 const NotificationDetails& details); |
191 | 191 |
192 // Returns a standard close button. Pass a |theme_provider| to use Gtk icons | 192 // Returns a standard close button. Pass a |theme_provider| to use Gtk icons |
193 // in Gtk rendering mode. | 193 // in Gtk rendering mode. |
194 static CustomDrawButton* CloseButton(GtkThemeService* theme_provider); | 194 static CustomDrawButton* CloseButton(GtkThemeService* theme_provider); |
195 | 195 |
196 private: | 196 private: |
197 // Sets the button to themed or not. | 197 // Sets the button to themed or not. |
198 void SetBrowserTheme(); | 198 void SetBrowserTheme(); |
(...skipping 19 matching lines...) Expand all Loading... |
218 // Our theme provider. | 218 // Our theme provider. |
219 GtkThemeService* theme_service_; | 219 GtkThemeService* theme_service_; |
220 | 220 |
221 // Used to listen for theme change notifications. | 221 // Used to listen for theme change notifications. |
222 NotificationRegistrar registrar_; | 222 NotificationRegistrar registrar_; |
223 | 223 |
224 DISALLOW_COPY_AND_ASSIGN(CustomDrawButton); | 224 DISALLOW_COPY_AND_ASSIGN(CustomDrawButton); |
225 }; | 225 }; |
226 | 226 |
227 #endif // CHROME_BROWSER_UI_GTK_CUSTOM_BUTTON_H_ | 227 #endif // CHROME_BROWSER_UI_GTK_CUSTOM_BUTTON_H_ |
OLD | NEW |