Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Side by Side Diff: chrome/browser/gtk/custom_button.h

Issue 3029032: Cleanup: Rename gtk button state names to (a) match other platforms and (b) n... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/gtk/browser_toolbar_gtk.cc ('k') | chrome/browser/gtk/custom_button.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 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>
11 11
(...skipping 14 matching lines...) Expand all
26 26
27 // CustomDrawButtonBase provides the base for building a custom drawn button. 27 // CustomDrawButtonBase provides the base for building a custom drawn button.
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 active_id, 36 int pressed_id,
37 int highlight_id, 37 int hover_id,
38 int depressed_id, 38 int disabled_id,
39 int background_id); 39 int background_id);
40 40
41 ~CustomDrawButtonBase(); 41 ~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;
(...skipping 22 matching lines...) Expand all
71 71
72 // The background image. 72 // The background image.
73 scoped_ptr<CairoCachedSurface> background_image_; 73 scoped_ptr<CairoCachedSurface> background_image_;
74 74
75 // If non-negative, the state to paint the button. 75 // If non-negative, the state to paint the button.
76 int paint_override_; 76 int paint_override_;
77 77
78 // 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
79 // provider so we can reload images if the user changes theme. 79 // provider so we can reload images if the user changes theme.
80 int normal_id_; 80 int normal_id_;
81 int active_id_; 81 int pressed_id_;
82 int highlight_id_; 82 int hover_id_;
83 int depressed_id_; 83 int disabled_id_;
84 int button_background_id_; 84 int button_background_id_;
85 GtkThemeProvider* theme_provider_; 85 GtkThemeProvider* theme_provider_;
86 86
87 // Whether the button is flipped horizontally. Not used for RTL (we get 87 // Whether the button is flipped horizontally. Not used for RTL (we get
88 // flipped versions from the theme provider). Used for the flipped window 88 // flipped versions from the theme provider). Used for the flipped window
89 // buttons. 89 // buttons.
90 bool flipped_; 90 bool flipped_;
91 91
92 // Used to listen for theme change notifications. 92 // Used to listen for theme change notifications.
93 NotificationRegistrar registrar_; 93 NotificationRegistrar registrar_;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 }; 125 };
126 126
127 // CustomDrawButton is a plain button where all its various states are drawn 127 // CustomDrawButton is a plain button where all its various states are drawn
128 // with static images. In GTK rendering mode, it will show the standard button 128 // with static images. In GTK rendering mode, it will show the standard button
129 // with GTK |stock_id|. 129 // with GTK |stock_id|.
130 class CustomDrawButton : public NotificationObserver { 130 class CustomDrawButton : public NotificationObserver {
131 public: 131 public:
132 // The constructor takes 4 resource ids. If a resource doesn't exist for a 132 // The constructor takes 4 resource ids. If a resource doesn't exist for a
133 // button, pass in 0. 133 // button, pass in 0.
134 CustomDrawButton(int normal_id, 134 CustomDrawButton(int normal_id,
135 int active_id, 135 int pressed_id,
136 int highlight_id, 136 int hover_id,
137 int depressed_id); 137 int disabled_id);
138 138
139 // Same as above, but uses themed (and possibly tinted) images. 139 // Same as above, but uses themed (and possibly tinted) images.
140 CustomDrawButton(GtkThemeProvider* theme_provider, 140 CustomDrawButton(GtkThemeProvider* theme_provider,
141 int normal_id, 141 int normal_id,
142 int active_id, 142 int pressed_id,
143 int highlight_id, 143 int hover_id,
144 int depressed_id, 144 int disabled_id,
145 int background_id, 145 int background_id,
146 const char* stock_id, 146 const char* stock_id,
147 GtkIconSize stock_size); 147 GtkIconSize stock_size);
148 148
149 ~CustomDrawButton(); 149 ~CustomDrawButton();
150 150
151 void Init(); 151 void Init();
152 152
153 // Flip the image horizontally. Not to be used for RTL/LTR reasons. (In RTL 153 // Flip the image horizontally. Not to be used for RTL/LTR reasons. (In RTL
154 // mode, this will unflip the image.) 154 // mode, this will unflip the image.)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 const char* gtk_stock_name_; 208 const char* gtk_stock_name_;
209 GtkIconSize icon_size_; 209 GtkIconSize icon_size_;
210 210
211 // Used to listen for theme change notifications. 211 // Used to listen for theme change notifications.
212 NotificationRegistrar registrar_; 212 NotificationRegistrar registrar_;
213 213
214 DISALLOW_COPY_AND_ASSIGN(CustomDrawButton); 214 DISALLOW_COPY_AND_ASSIGN(CustomDrawButton);
215 }; 215 };
216 216
217 #endif // CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_ 217 #endif // CHROME_BROWSER_GTK_CUSTOM_BUTTON_H_
OLDNEW
« no previous file with comments | « chrome/browser/gtk/browser_toolbar_gtk.cc ('k') | chrome/browser/gtk/custom_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698