OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_GTK_CUSTOM_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_ |
6 #define CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_ | 6 #define CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 22 matching lines...) Expand all Loading... |
33 int highlight_id, | 33 int highlight_id, |
34 int depressed_id); | 34 int depressed_id); |
35 | 35 |
36 ~CustomDrawButtonBase(); | 36 ~CustomDrawButtonBase(); |
37 | 37 |
38 GdkPixbuf* pixbufs(int i) const { return pixbufs_[i]; } | 38 GdkPixbuf* pixbufs(int i) const { return pixbufs_[i]; } |
39 | 39 |
40 gboolean OnExpose(GtkWidget* widget, GdkEventExpose* e); | 40 gboolean OnExpose(GtkWidget* widget, GdkEventExpose* e); |
41 | 41 |
42 void set_paint_override(int state) { paint_override_ = state; } | 42 void set_paint_override(int state) { paint_override_ = state; } |
| 43 int paint_override() const { return paint_override_; } |
43 | 44 |
44 // Provide NotificationObserver implementation. | 45 // Provide NotificationObserver implementation. |
45 virtual void Observe(NotificationType type, | 46 virtual void Observe(NotificationType type, |
46 const NotificationSource& source, | 47 const NotificationSource& source, |
47 const NotificationDetails& details); | 48 const NotificationDetails& details); |
48 | 49 |
49 private: | 50 private: |
50 // We store one GdkPixbuf* for each possible state of the button; | 51 // We store one GdkPixbuf* for each possible state of the button; |
51 // INSENSITIVE is the last available state; | 52 // INSENSITIVE is the last available state; |
52 GdkPixbuf* pixbufs_[GTK_STATE_INSENSITIVE + 1]; | 53 GdkPixbuf* pixbufs_[GTK_STATE_INSENSITIVE + 1]; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // Callback for custom button expose, used to draw the custom graphics. | 129 // Callback for custom button expose, used to draw the custom graphics. |
129 static gboolean OnCustomExpose(GtkWidget* widget, | 130 static gboolean OnCustomExpose(GtkWidget* widget, |
130 GdkEventExpose* e, | 131 GdkEventExpose* e, |
131 CustomDrawButton* obj); | 132 CustomDrawButton* obj); |
132 | 133 |
133 // The actual button widget. | 134 // The actual button widget. |
134 OwnedWidgetGtk widget_; | 135 OwnedWidgetGtk widget_; |
135 | 136 |
136 CustomDrawButtonBase button_base_; | 137 CustomDrawButtonBase button_base_; |
137 | 138 |
| 139 GtkThemeProvider* theme_provider_; |
| 140 |
138 // The stock icon name. | 141 // The stock icon name. |
139 const char* gtk_stock_name_; | 142 const char* gtk_stock_name_; |
140 | 143 |
141 // Whether we have an expose signal handler we may need to remove. | |
142 bool has_expose_signal_handler_; | |
143 | |
144 // Used to listen for theme change notifications. | 144 // Used to listen for theme change notifications. |
145 NotificationRegistrar registrar_; | 145 NotificationRegistrar registrar_; |
146 | 146 |
147 DISALLOW_COPY_AND_ASSIGN(CustomDrawButton); | 147 DISALLOW_COPY_AND_ASSIGN(CustomDrawButton); |
148 }; | 148 }; |
149 | 149 |
150 #endif // CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_ | 150 #endif // CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_ |
OLD | NEW |