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