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/gtk_theme_provider.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/gtk_theme_provider.h')
-rw-r--r-- | chrome/browser/gtk/gtk_theme_provider.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/chrome/browser/gtk/gtk_theme_provider.h b/chrome/browser/gtk/gtk_theme_provider.h new file mode 100644 index 0000000..88f0fed --- /dev/null +++ b/chrome/browser/gtk/gtk_theme_provider.h @@ -0,0 +1,61 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_GTK_GTK_THEME_PROVIDER_H_ +#define CHROME_BROWSER_GTK_GTK_THEME_PROVIDER_H_ + +#include "chrome/browser/browser_theme_provider.h" + +#include "skia/ext/skia_utils.h" + +class Profile; + +typedef struct _GtkStyle GtkStyle; +typedef struct _GtkWidget GtkWidget; + +// Specialization of BrowserThemeProvider which supplies system colors. +class GtkThemeProvider : public BrowserThemeProvider { + public: + GtkThemeProvider(); + virtual ~GtkThemeProvider(); + + // Overridden from BrowserThemeProvider: + // + // Sets that we aren't using the system theme, then calls + // BrowserThemeProvider's implementation. + virtual void SetTheme(Extension* extension); + virtual void UseDefaultTheme(); + virtual void SetNativeTheme(); + + // Whether we should use the GTK system theme. + static bool UseSystemThemeGraphics(Profile* profile); + + private: + // Load theme data from preferences, possibly picking colors from GTK. + virtual void LoadThemePrefs(); + + // Possibly creates a theme specific version of theme_toolbar_default. + // (minimally acceptable version right now, which is just a fill of the bg + // color; this should instead invoke gtk_draw_box(...) for complex theme + // engines.) + virtual SkBitmap* LoadThemeBitmap(int id); + + // Handles signal from GTK that our theme has been changed. + static void OnStyleSet(GtkWidget* widget, + GtkStyle* previous_style, + GtkThemeProvider* provider); + + void LoadGtkValues(); + + // Sets the underlying theme colors/tints from a GTK color. + void SetThemeColorFromGtk(const char* id, GdkColor* color); + void SetThemeTintFromGtk(const char* id, GdkColor* color, + const skia::HSL& default_tint); + + // A GtkWidget that exists only so we can look at its properties (and take + // its colors). + GtkWidget* fake_window_; +}; + +#endif // CHROME_BROWSER_GTK_GTK_THEME_PROVIDER_H_ |