OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 // It handles managing the pixbufs containing all the static images used to draw | 29 // It handles managing the pixbufs containing all the static images used to draw |
30 // the button. It also manages painting these pixbufs. | 30 // the button. It also manages painting these pixbufs. |
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(GtkThemeProvider* theme_provider, | 35 CustomDrawButtonBase(GtkThemeProvider* 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 int background_id); | |
41 | 40 |
42 ~CustomDrawButtonBase(); | 41 ~CustomDrawButtonBase(); |
43 | 42 |
44 // 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 |
45 // mode, this will unflip the image.) | 44 // mode, this will unflip the image.) |
46 void set_flipped(bool flipped) { flipped_ = flipped; } | 45 void set_flipped(bool flipped) { flipped_ = flipped; } |
47 | 46 |
48 // Returns the dimensions of the first surface. | 47 // Returns the dimensions of the first surface. |
49 int Width() const; | 48 int Width() const; |
50 int Height() const; | 49 int Height() const; |
(...skipping 24 matching lines...) Expand all Loading... |
75 | 74 |
76 // If non-negative, the state to paint the button. | 75 // If non-negative, the state to paint the button. |
77 int paint_override_; | 76 int paint_override_; |
78 | 77 |
79 // We need to remember the image ids that the user passes in and the theme | 78 // We need to remember the image ids that the user passes in and the theme |
80 // provider so we can reload images if the user changes theme. | 79 // provider so we can reload images if the user changes theme. |
81 int normal_id_; | 80 int normal_id_; |
82 int pressed_id_; | 81 int pressed_id_; |
83 int hover_id_; | 82 int hover_id_; |
84 int disabled_id_; | 83 int disabled_id_; |
85 int button_background_id_; | |
86 GtkThemeProvider* theme_provider_; | 84 GtkThemeProvider* theme_provider_; |
87 | 85 |
88 // Whether the button is flipped horizontally. Not used for RTL (we get | 86 // Whether the button is flipped horizontally. Not used for RTL (we get |
89 // flipped versions from the theme provider). Used for the flipped window | 87 // flipped versions from the theme provider). Used for the flipped window |
90 // buttons. | 88 // buttons. |
91 bool flipped_; | 89 bool flipped_; |
92 | 90 |
93 // Used to listen for theme change notifications. | 91 // Used to listen for theme change notifications. |
94 NotificationRegistrar registrar_; | 92 NotificationRegistrar registrar_; |
95 | 93 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 int pressed_id, | 134 int pressed_id, |
137 int hover_id, | 135 int hover_id, |
138 int disabled_id); | 136 int disabled_id); |
139 | 137 |
140 // Same as above, but uses themed (and possibly tinted) images. | 138 // Same as above, but uses themed (and possibly tinted) images. |
141 CustomDrawButton(GtkThemeProvider* theme_provider, | 139 CustomDrawButton(GtkThemeProvider* theme_provider, |
142 int normal_id, | 140 int normal_id, |
143 int pressed_id, | 141 int pressed_id, |
144 int hover_id, | 142 int hover_id, |
145 int disabled_id, | 143 int disabled_id, |
146 int background_id, | |
147 const char* stock_id, | 144 const char* stock_id, |
148 GtkIconSize stock_size); | 145 GtkIconSize stock_size); |
149 | 146 |
150 ~CustomDrawButton(); | 147 ~CustomDrawButton(); |
151 | 148 |
152 void Init(); | 149 void Init(); |
153 | 150 |
154 // Flip the image horizontally. Not to be used for RTL/LTR reasons. (In RTL | 151 // Flip the image horizontally. Not to be used for RTL/LTR reasons. (In RTL |
155 // mode, this will unflip the image.) | 152 // mode, this will unflip the image.) |
156 void set_flipped(bool flipped) { button_base_.set_flipped(flipped); } | 153 void set_flipped(bool flipped) { button_base_.set_flipped(flipped); } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 const char* gtk_stock_name_; | 206 const char* gtk_stock_name_; |
210 GtkIconSize icon_size_; | 207 GtkIconSize icon_size_; |
211 | 208 |
212 // Used to listen for theme change notifications. | 209 // Used to listen for theme change notifications. |
213 NotificationRegistrar registrar_; | 210 NotificationRegistrar registrar_; |
214 | 211 |
215 DISALLOW_COPY_AND_ASSIGN(CustomDrawButton); | 212 DISALLOW_COPY_AND_ASSIGN(CustomDrawButton); |
216 }; | 213 }; |
217 | 214 |
218 #endif // CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_ | 215 #endif // CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_ |
OLD | NEW |