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

Unified Diff: chrome/browser/gtk/custom_button.h

Issue 62154: Implement stop/go button for Linux (Closed)
Patch Set: Add a small DCHECK => DCHECK_NE change. Created 11 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/gtk/browser_window_gtk.cc ('k') | chrome/browser/gtk/custom_button.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/custom_button.h
diff --git a/chrome/browser/gtk/custom_button.h b/chrome/browser/gtk/custom_button.h
index 518f069569af6ae7e067cec2f4b8c989485ce217..96b4ad6b0de50c75fe292ddfb4c2ef8e55101c77 100644
--- a/chrome/browser/gtk/custom_button.h
+++ b/chrome/browser/gtk/custom_button.h
@@ -17,6 +17,29 @@ class NineBox;
// These classes implement two kinds of custom-drawn buttons. They're
// used on the toolbar and the bookmarks bar.
+// CustomDrawButtonBase provides the base for building a custom drawn button.
+// It handles managing the pixbufs containing all the static images used to draw
+// the button. It also manages painting these pixbufs.
+class CustomDrawButtonBase {
+ public:
+ CustomDrawButtonBase(int normal_id,
+ int active_id,
+ int highlight_id,
+ int depressed_id);
+ ~CustomDrawButtonBase();
+
+ GdkPixbuf* pixbufs(int i) const { return pixbufs_[i]; }
+
+ gboolean OnExpose(GtkWidget* widget, GdkEventExpose* e);
+
+ private:
+ // We store one GdkPixbuf* for each possible state of the button;
+ // INSENSITIVE is the last available state;
+ GdkPixbuf* pixbufs_[GTK_STATE_INSENSITIVE + 1];
+
+ DISALLOW_COPY_AND_ASSIGN(CustomDrawButtonBase);
+};
+
// CustomDrawButton is a plain button where all its various states are drawn
// with static images.
class CustomDrawButton {
@@ -40,15 +63,16 @@ class CustomDrawButton {
private:
// Callback for expose, used to draw the custom graphics.
- static gboolean OnExpose(GtkWidget* widget, GdkEventExpose* e,
+ static gboolean OnExpose(GtkWidget* widget,
+ GdkEventExpose* e,
CustomDrawButton* obj);
// The actual button widget.
OwnedWidgetGtk widget_;
- // We store one GdkPixbuf* for each possible state of the button;
- // INSENSITIVE is the last available state;
- GdkPixbuf* pixbufs_[GTK_STATE_INSENSITIVE + 1];
+ CustomDrawButtonBase button_base_;
+
+ DISALLOW_COPY_AND_ASSIGN(CustomDrawButton);
};
// CustomContainerButton wraps another widget and uses a NineBox of
« no previous file with comments | « chrome/browser/gtk/browser_window_gtk.cc ('k') | chrome/browser/gtk/custom_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698