diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-03 00:42:29 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-03 00:42:29 +0000 |
commit | a5166af69628552e4bcf746a38f3710cc895eac3 (patch) | |
tree | 0d6e0ab20143724111855ac501aad3fd469e6b8d /chrome/browser/gtk/custom_button.h | |
parent | 08f91cc8431cc6dea19e3c3ff3a229c71a7fc71f (diff) | |
download | chromium_src-a5166af69628552e4bcf746a38f3710cc895eac3.zip chromium_src-a5166af69628552e4bcf746a38f3710cc895eac3.tar.gz chromium_src-a5166af69628552e4bcf746a38f3710cc895eac3.tar.bz2 |
GTK: Initial implementation of using GTK themes, partially based on evan's CL 118358.
A lot of stuff works:
- Colors are picked out of the GTK theme.
- Buttons use the current GTK button theme.
- We use the user's icon theme.
A lot of stuff doesn't:
- We could do a better job of picking colors for the skylines.
- The omnibox hasn't been touched.
- UI that's not part of the toolbar hasn't been touched.
- We currently fail on themes like HighContrastInverse.
TEST=Under Options>Personal Stuff, click GTK Theme. Colors and widgets should be rendered with the current GTK theme stuff.
TEST=With chrome open and in GTK Theme mode, change your GTK theme or icon theme. chrome should pick up on the change immediately and reimport the colors and images.
http://crbug.com/13967
Review URL: http://codereview.chromium.org/150176
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19868 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/custom_button.h')
-rw-r--r-- | chrome/browser/gtk/custom_button.h | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/chrome/browser/gtk/custom_button.h b/chrome/browser/gtk/custom_button.h index 0e54732..143a090 100644 --- a/chrome/browser/gtk/custom_button.h +++ b/chrome/browser/gtk/custom_button.h @@ -45,7 +45,8 @@ class CustomDrawButtonBase { }; // CustomDrawButton is a plain button where all its various states are drawn -// with static images. +// with static images. In GTK rendering mode, it will show the standard button +// with GTK |stock_id|. class CustomDrawButton { public: // The constructor takes 4 resource ids. If a resource doesn't exist for a @@ -53,7 +54,8 @@ class CustomDrawButton { CustomDrawButton(int normal_id, int active_id, int highlight_id, - int depressed_id); + int depressed_id, + const char* stock_id); explicit CustomDrawButton(const std::string& filename); ~CustomDrawButton(); @@ -69,6 +71,12 @@ class CustomDrawButton { int width() const { return widget_->allocation.width; } int height() const { return widget_->allocation.height; } + // Sets properties on the GtkButton returned by widget(). By default, the + // button is very boring. This will either give it an image from the + // |gtk_stock_name_| if |use_gtk| is true or will use the chrome frame + // images. + void SetUseSystemTheme(bool use_gtk); + // Set the state to draw. We will paint the widget as if it were in this // state. void SetPaintOverride(GtkStateType state); @@ -80,16 +88,22 @@ class CustomDrawButton { static CustomDrawButton* CloseButton(); private: - // Callback for expose, used to draw the custom graphics. - static gboolean OnExpose(GtkWidget* widget, - GdkEventExpose* e, - CustomDrawButton* obj); + // Callback for custom button expose, used to draw the custom graphics. + static gboolean OnCustomExpose(GtkWidget* widget, + GdkEventExpose* e, + CustomDrawButton* obj); // The actual button widget. OwnedWidgetGtk widget_; CustomDrawButtonBase button_base_; + // The stock icon name. + const char* gtk_stock_name_; + + // Whether we have an expose signal handler we may need to remove. + bool has_expose_signal_handler_; + DISALLOW_COPY_AND_ASSIGN(CustomDrawButton); }; |