diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-17 19:47:15 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-17 19:47:15 +0000 |
commit | ea9a760bf723eda730f6de3662e71d3af3b9cdd1 (patch) | |
tree | bf26aa989ade18c4eb6a158595566041f3f9ddaa /chrome/browser/gtk/nine_box.h | |
parent | d55ad15d8c3e118d6f03dbf236d6b98c62d66fe9 (diff) | |
download | chromium_src-ea9a760bf723eda730f6de3662e71d3af3b9cdd1.zip chromium_src-ea9a760bf723eda730f6de3662e71d3af3b9cdd1.tar.gz chromium_src-ea9a760bf723eda730f6de3662e71d3af3b9cdd1.tar.bz2 |
Make the toolbar background themed on Linux.
Add a class for managing images for scalable themed widgets, and then
implement the toolbar on top of this.
Review URL: http://codereview.chromium.org/21390
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9898 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/nine_box.h')
-rw-r--r-- | chrome/browser/gtk/nine_box.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/chrome/browser/gtk/nine_box.h b/chrome/browser/gtk/nine_box.h new file mode 100644 index 0000000..3521a82 --- /dev/null +++ b/chrome/browser/gtk/nine_box.h @@ -0,0 +1,39 @@ +// 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_NINE_BOX_H_ +#define CHROME_BROWSER_GTK_NINE_BOX_H_ + +#include <gdk-pixbuf/gdk-pixbuf.h> + +// A NineBox manages a set of source images representing a 3x3 grid, where +// non-corner images can be tiled to make a larger image. It's used to +// use bitmaps for constructing image-based resizable widgets like buttons. +// +// TODO(port): add support for caching server-side pixmaps of prerendered +// nineboxes. +class NineBox { + public: + // Construct a NineBox with nine images. NULL images are allowed. + // Takes ownership of each image, but not the |images| array. + NineBox(GdkPixbuf* images[9]); + ~NineBox(); + + // Render the NineBox to dst. + // Expects dst to already be the proper size. + void RenderToPixbuf(GdkPixbuf* dst); + + // Render the top row of images to dst between x1 and x2. + // This is split from RenderToPixbuf so the toolbar can use it. + void RenderTopCenterStrip(GdkPixbuf* dst, int x1, int x2); + + private: + // Repeatedly stamp src across dst. + void TileImage(GdkPixbuf* src, GdkPixbuf* dst, + int x1, int y1, int x2, int y2); + + GdkPixbuf* images_[9]; +}; + +#endif // CHROME_BROWSER_GTK_NINE_BOX_H_ |