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 20 matching lines...) Expand all Loading... |
31 class CustomDrawButtonBase : public NotificationObserver { | 31 class CustomDrawButtonBase : public NotificationObserver { |
32 public: | 32 public: |
33 // If the images come from ResourceBundle rather than the theme provider, | 33 // If the images come from ResourceBundle rather than the theme provider, |
34 // pass in NULL for |theme_provider|. | 34 // pass in NULL for |theme_provider|. |
35 CustomDrawButtonBase(GtkThemeService* theme_provider, | 35 CustomDrawButtonBase(GtkThemeService* theme_provider, |
36 int normal_id, | 36 int normal_id, |
37 int pressed_id, | 37 int pressed_id, |
38 int hover_id, | 38 int hover_id, |
39 int disabled_id); | 39 int disabled_id); |
40 | 40 |
41 ~CustomDrawButtonBase(); | 41 virtual ~CustomDrawButtonBase(); |
42 | 42 |
43 // Flip the image horizontally. Not to be used for RTL/LTR reasons. (In RTL | 43 // Flip the image horizontally. Not to be used for RTL/LTR reasons. (In RTL |
44 // mode, this will unflip the image.) | 44 // mode, this will unflip the image.) |
45 void set_flipped(bool flipped) { flipped_ = flipped; } | 45 void set_flipped(bool flipped) { flipped_ = flipped; } |
46 | 46 |
47 // Returns the dimensions of the first surface. | 47 // Returns the dimensions of the first surface. |
48 int Width() const; | 48 int Width() const; |
49 int Height() const; | 49 int Height() const; |
50 | 50 |
51 gboolean OnExpose(GtkWidget* widget, GdkEventExpose* e, gdouble hover_state); | 51 gboolean OnExpose(GtkWidget* widget, GdkEventExpose* e, gdouble hover_state); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 // As above, but uses an arbitrary GtkImage rather than a stock icon. This | 148 // As above, but uses an arbitrary GtkImage rather than a stock icon. This |
149 // constructor takes ownership of |native_widget|. | 149 // constructor takes ownership of |native_widget|. |
150 CustomDrawButton(GtkThemeService* theme_provider, | 150 CustomDrawButton(GtkThemeService* theme_provider, |
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 ~CustomDrawButton(); | 157 virtual ~CustomDrawButton(); |
158 | 158 |
159 void Init(); | 159 void Init(); |
160 | 160 |
161 // Flip the image horizontally. Not to be used for RTL/LTR reasons. (In RTL | 161 // Flip the image horizontally. Not to be used for RTL/LTR reasons. (In RTL |
162 // mode, this will unflip the image.) | 162 // mode, this will unflip the image.) |
163 void set_flipped(bool flipped) { button_base_.set_flipped(flipped); } | 163 void set_flipped(bool flipped) { button_base_.set_flipped(flipped); } |
164 | 164 |
165 GtkWidget* widget() const { return widget_.get(); } | 165 GtkWidget* widget() const { return widget_.get(); } |
166 | 166 |
167 gfx::Rect bounds() const { | 167 gfx::Rect bounds() const { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |