diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-16 23:59:55 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-16 23:59:55 +0000 |
commit | b253e636b63e9383271fdeb2858f416d59922b57 (patch) | |
tree | bdb8de9fcf6ffa25e2b4070e2e2d065be3cf4af4 /views/widget | |
parent | 45a613edf3b4cd4566cf631424217b59c75c146d (diff) | |
download | chromium_src-b253e636b63e9383271fdeb2858f416d59922b57.zip chromium_src-b253e636b63e9383271fdeb2858f416d59922b57.tar.gz chromium_src-b253e636b63e9383271fdeb2858f416d59922b57.tar.bz2 |
Hover buttons for notification.
* Chagned WidgetGtk so that any GtkFixed can be parent of WidgetGtk.
* Close button and Options menu is moved to separate TYPE_CHILD WidgetGtk
which is shown/hidden as mouse moves.
TODO: host Widget is not transparent right now. I'll address this in separate CL.
BUG=41011
TEST=none
Review URL: http://codereview.chromium.org/1654006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44861 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget')
-rw-r--r-- | views/widget/widget_gtk.cc | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc index 006a089..d65ee99 100644 --- a/views/widget/widget_gtk.cc +++ b/views/widget/widget_gtk.cc @@ -454,9 +454,7 @@ void WidgetGtk::Init(GtkWidget* parent, if (type_ == TYPE_CHILD) { if (parent) { - WidgetGtk* parent_widget = GetViewForNative(parent); - parent_widget->PositionChild(widget_, bounds.x(), bounds.y(), - bounds.width(), bounds.height()); + SetBounds(bounds); } } else { if (bounds.width() > 0 && bounds.height() > 0) @@ -501,9 +499,21 @@ void WidgetGtk::GetBounds(gfx::Rect* out, bool including_frame) const { void WidgetGtk::SetBounds(const gfx::Rect& bounds) { if (type_ == TYPE_CHILD) { - WidgetGtk* parent_widget = GetViewForNative(gtk_widget_get_parent(widget_)); - parent_widget->PositionChild(widget_, bounds.x(), bounds.y(), - bounds.width(), bounds.height()); + GtkWidget* parent = gtk_widget_get_parent(widget_); + if (GTK_IS_VIEWS_FIXED(parent)) { + WidgetGtk* parent_widget = GetViewForNative(parent); + parent_widget->PositionChild(widget_, bounds.x(), bounds.y(), + bounds.width(), bounds.height()); + } else { + DCHECK(GTK_IS_FIXED(parent)) + << "Parent of WidgetGtk has to be Fixed or ViewsFixed"; + // Just request the size if the parent is not WidgetGtk but plain + // GtkFixed. WidgetGtk does not know the minimum size so we assume + // the caller of the SetBounds knows exactly how big it wants to be. + gtk_widget_set_size_request(widget_, bounds.width(), bounds.height()); + if (parent != null_parent_) + gtk_fixed_move(GTK_FIXED(parent), widget_, bounds.x(), bounds.y()); + } } else if (GTK_WIDGET_MAPPED(widget_)) { // If the widget is mapped (on screen), we can move and resize with one // call, which avoids two separate window manager steps. |