summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/custom_button.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-24 21:03:05 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-24 21:03:05 +0000
commitbcb71cf13f3997254c8c054590f2c43819f5c0cc (patch)
tree3954a4ba6035456139a422e6075833b8eabe2e00 /chrome/browser/gtk/custom_button.cc
parent062f0518d01e2adcd33130826a827db7dfd0f485 (diff)
downloadchromium_src-bcb71cf13f3997254c8c054590f2c43819f5c0cc.zip
chromium_src-bcb71cf13f3997254c8c054590f2c43819f5c0cc.tar.gz
chromium_src-bcb71cf13f3997254c8c054590f2c43819f5c0cc.tar.bz2
GTK: Let custom draw buttons specify their stock size as well as their stock image.
I tried to also make the tab strip use stock gtk close button but that is gonna require a lot more work to get layout right so leave it alone for now. BUG=none TEST=close button on download shelf is sanely sized Review URL: http://codereview.chromium.org/159325 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21575 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/custom_button.cc')
-rw-r--r--chrome/browser/gtk/custom_button.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/chrome/browser/gtk/custom_button.cc b/chrome/browser/gtk/custom_button.cc
index b9e836e..f27e01b 100644
--- a/chrome/browser/gtk/custom_button.cc
+++ b/chrome/browser/gtk/custom_button.cc
@@ -117,10 +117,11 @@ void CustomDrawButtonBase::Observe(NotificationType type,
}
CustomDrawButton::CustomDrawButton(int normal_id, int active_id,
- int highlight_id, int depressed_id, const char* stock_id)
+ int highlight_id, int depressed_id)
: button_base_(NULL, normal_id, active_id, highlight_id, depressed_id),
theme_provider_(NULL),
- gtk_stock_name_(stock_id) {
+ gtk_stock_name_(NULL),
+ icon_size_(GTK_ICON_SIZE_INVALID) {
Init();
// Initialize the theme stuff with no theme_provider.
@@ -129,11 +130,12 @@ CustomDrawButton::CustomDrawButton(int normal_id, int active_id,
CustomDrawButton::CustomDrawButton(GtkThemeProvider* theme_provider,
int normal_id, int active_id, int highlight_id, int depressed_id,
- const char* stock_id)
+ const char* stock_id, GtkIconSize stock_size)
: button_base_(theme_provider, normal_id, active_id, highlight_id,
depressed_id),
theme_provider_(theme_provider),
- gtk_stock_name_(stock_id) {
+ gtk_stock_name_(stock_id),
+ icon_size_(stock_size) {
Init();
theme_provider_->InitThemesFor(this);
@@ -193,7 +195,7 @@ CustomDrawButton* CustomDrawButton::CloseButton(
GtkThemeProvider* theme_provider) {
CustomDrawButton* button = new CustomDrawButton(
theme_provider, IDR_CLOSE_BAR, IDR_CLOSE_BAR_P,
- IDR_CLOSE_BAR_H, 0, GTK_STOCK_CLOSE);
+ IDR_CLOSE_BAR_H, 0, GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
return button;
}
@@ -203,7 +205,7 @@ void CustomDrawButton::SetBrowserTheme() {
if (use_gtk && gtk_stock_name_) {
gtk_button_set_image(
GTK_BUTTON(widget_.get()),
- gtk_image_new_from_stock(gtk_stock_name_, GTK_ICON_SIZE_SMALL_TOOLBAR));
+ gtk_image_new_from_stock(gtk_stock_name_, icon_size_));
gtk_widget_set_size_request(widget_.get(), -1, -1);
gtk_widget_set_app_paintable(widget_.get(), FALSE);
gtk_widget_set_double_buffered(widget_.get(), TRUE);