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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 int normal_id, | 151 int normal_id, |
152 int pressed_id, | 152 int pressed_id, |
153 int hover_id, | 153 int hover_id, |
154 int disabled_id, | 154 int disabled_id, |
155 GtkWidget* native_widget); | 155 GtkWidget* native_widget); |
156 | 156 |
157 virtual ~CustomDrawButton(); | 157 virtual ~CustomDrawButton(); |
158 | 158 |
159 void Init(); | 159 void Init(); |
160 | 160 |
161 // Make this CustomDrawButton always use the chrome style rendering; it will | |
162 // never render gtk-like. | |
163 void ForceChromeTheme(); | |
164 | |
161 // Flip the image horizontally. Not to be used for RTL/LTR reasons. (In RTL | 165 // Flip the image horizontally. Not to be used for RTL/LTR reasons. (In RTL |
162 // mode, this will unflip the image.) | 166 // mode, this will unflip the image.) |
163 void set_flipped(bool flipped) { button_base_.set_flipped(flipped); } | 167 void set_flipped(bool flipped) { button_base_.set_flipped(flipped); } |
164 | 168 |
165 GtkWidget* widget() const { return widget_.get(); } | 169 GtkWidget* widget() const { return widget_.get(); } |
166 | 170 |
167 gfx::Rect bounds() const { | 171 gfx::Rect bounds() const { |
168 return gfx::Rect(widget_->allocation.x, | 172 return gfx::Rect(widget_->allocation.x, |
169 widget_->allocation.y, | 173 widget_->allocation.y, |
170 widget_->allocation.width, | 174 widget_->allocation.width, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 CustomDrawButtonBase button_base_; | 219 CustomDrawButtonBase button_base_; |
216 | 220 |
217 CustomDrawHoverController hover_controller_; | 221 CustomDrawHoverController hover_controller_; |
218 | 222 |
219 // The widget to use when we are displaying in GTK+ theme mode. | 223 // The widget to use when we are displaying in GTK+ theme mode. |
220 ui::OwnedWidgetGtk native_widget_; | 224 ui::OwnedWidgetGtk native_widget_; |
221 | 225 |
222 // Our theme provider. | 226 // Our theme provider. |
223 GtkThemeService* theme_service_; | 227 GtkThemeService* theme_service_; |
224 | 228 |
229 // Some buttons are always drawn in chrome style because they are part of | |
230 // HTML extensions. | |
Evan Stade
2011/08/31 20:00:12
explaining the current use of this var is a little
| |
231 bool forcing_chrome_theme_; | |
232 | |
225 // Used to listen for theme change notifications. | 233 // Used to listen for theme change notifications. |
226 NotificationRegistrar registrar_; | 234 NotificationRegistrar registrar_; |
227 | 235 |
228 DISALLOW_COPY_AND_ASSIGN(CustomDrawButton); | 236 DISALLOW_COPY_AND_ASSIGN(CustomDrawButton); |
229 }; | 237 }; |
230 | 238 |
231 #endif // CHROME_BROWSER_UI_GTK_CUSTOM_BUTTON_H_ | 239 #endif // CHROME_BROWSER_UI_GTK_CUSTOM_BUTTON_H_ |
OLD | NEW |