diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-08 23:23:05 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-08 23:23:05 +0000 |
commit | 37cd3a96b55aac1dad9016c05e78b5983972f985 (patch) | |
tree | 1159bb8897fa21faeadde942163412736889ead9 /views | |
parent | 4d4c0b94960366979943dbe4e3c8880ce80dbdef (diff) | |
download | chromium_src-37cd3a96b55aac1dad9016c05e78b5983972f985.zip chromium_src-37cd3a96b55aac1dad9016c05e78b5983972f985.tar.gz chromium_src-37cd3a96b55aac1dad9016c05e78b5983972f985.tar.bz2 |
First part of tab overview. It isn't wired up, nor is it complete, but
it's a good enough stage that I want to check it in.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/119329
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17906 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/widget/widget.h | 4 | ||||
-rw-r--r-- | views/widget/widget_gtk.cc | 11 | ||||
-rw-r--r-- | views/widget/widget_gtk.h | 1 | ||||
-rw-r--r-- | views/widget/widget_win.cc | 5 | ||||
-rw-r--r-- | views/widget/widget_win.h | 1 |
5 files changed, 22 insertions, 0 deletions
diff --git a/views/widget/widget.h b/views/widget/widget.h index 14a61a0..1dabf08 100644 --- a/views/widget/widget.h +++ b/views/widget/widget.h @@ -10,6 +10,7 @@ class ThemeProvider; namespace gfx { +class Path; class Rect; } @@ -49,6 +50,9 @@ class Widget { // Sizes and/or places the widget to the specified bounds, size or position. virtual void SetBounds(const gfx::Rect& bounds) = 0; + // Sets a shape on the widget. + virtual void SetShape(const gfx::Path& shape) = 0; + // Hides the widget then closes it after a return to the message loop. virtual void Close() = 0; diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc index 4928d27..776af0d 100644 --- a/views/widget/widget_gtk.cc +++ b/views/widget/widget_gtk.cc @@ -4,6 +4,7 @@ #include "views/widget/widget_gtk.h" +#include "app/gfx/path.h" #include "base/compiler_specific.h" #include "views/fill_layout.h" #include "views/widget/default_theme_provider.h" @@ -270,6 +271,16 @@ void WidgetGtk::SetBounds(const gfx::Rect& bounds) { } } +void WidgetGtk::SetShape(const gfx::Path& shape) { + DCHECK(widget_); + DCHECK(widget_->window); + + gdk_window_shape_combine_region(widget_->window, NULL, 0, 0); + GdkRegion* region = shape.CreateGdkRegion(); + gdk_window_shape_combine_region(widget_->window, region, 0, 0); + gdk_region_destroy(region); +} + void WidgetGtk::Close() { if (!widget_) return; // No need to do anything. diff --git a/views/widget/widget_gtk.h b/views/widget/widget_gtk.h index 8ac47fc..2442f74 100644 --- a/views/widget/widget_gtk.h +++ b/views/widget/widget_gtk.h @@ -71,6 +71,7 @@ class WidgetGtk : public Widget, public MessageLoopForUI::Observer { // Overridden from Widget: virtual void GetBounds(gfx::Rect* out, bool including_frame) const; virtual void SetBounds(const gfx::Rect& bounds); + virtual void SetShape(const gfx::Path& shape); virtual void Close(); virtual void CloseNow(); virtual void Show(); diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index adce4d9..353fcbc 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -5,6 +5,7 @@ #include "views/widget/widget_win.h" #include "app/gfx/canvas.h" +#include "app/gfx/path.h" #include "app/win_util.h" #include "base/gfx/native_theme.h" #include "base/string_util.h" @@ -258,6 +259,10 @@ void WidgetWin::SetBounds(const gfx::Rect& bounds) { SWP_NOACTIVATE | SWP_NOZORDER); } +void WidgetWin::SetShape(const gfx::Path& shape) { + SetWindowRgn(shape.CreateHRGN(), TRUE); +} + void WidgetWin::Close() { if (!IsWindow()) return; // No need to do anything. diff --git a/views/widget/widget_win.h b/views/widget/widget_win.h index fa6bab6..c57de93 100644 --- a/views/widget/widget_win.h +++ b/views/widget/widget_win.h @@ -214,6 +214,7 @@ class WidgetWin : public Widget, // Overridden from Widget: virtual void GetBounds(gfx::Rect* out, bool including_frame) const; virtual void SetBounds(const gfx::Rect& bounds); + virtual void SetShape(const gfx::Path& shape); virtual void Close(); virtual void CloseNow(); virtual void Show(); |