diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-20 20:56:11 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-20 20:56:11 +0000 |
commit | 893160d54cb5b2c1c68d3b69ec8ebc9b25b68b82 (patch) | |
tree | 0f29c1776a2f34f06ba60ba53a20691d261b6366 /views/widget/widget_gtk.h | |
parent | 22332192088e1e897d02a4bc7a2983e3864ab3b6 (diff) | |
download | chromium_src-893160d54cb5b2c1c68d3b69ec8ebc9b25b68b82.zip chromium_src-893160d54cb5b2c1c68d3b69ec8ebc9b25b68b82.tar.gz chromium_src-893160d54cb5b2c1c68d3b69ec8ebc9b25b68b82.tar.bz2 |
Minor gtk-views cleanup:
. Makes closing widget work.
. Makes clicking button send action.
. Fixes ownership of native controls.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/113657
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16532 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget/widget_gtk.h')
-rw-r--r-- | views/widget/widget_gtk.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/views/widget/widget_gtk.h b/views/widget/widget_gtk.h index cebc686..e1a7468 100644 --- a/views/widget/widget_gtk.h +++ b/views/widget/widget_gtk.h @@ -39,6 +39,12 @@ class WidgetGtk : public Widget, public MessageLoopForUI::Observer { // Initializes this widget. void Init(const gfx::Rect& bounds, bool has_own_focus_manager); + // Sets whether or not we are deleted when the widget is destroyed. The + // default is true. + void set_delete_on_destroy(bool delete_on_destroy) { + delete_on_destroy_ = delete_on_destroy; + } + void AddChild(GtkWidget* child); void RemoveChild(GtkWidget* child); @@ -51,6 +57,11 @@ class WidgetGtk : public Widget, public MessageLoopForUI::Observer { virtual void SetContentsView(View* view); + virtual void Close(); + void CloseNow(); + virtual void Show(); + virtual void Hide(); + // Overridden from Widget: virtual void GetBounds(gfx::Rect* out, bool including_frame) const; virtual gfx::NativeView GetNativeView() const; @@ -93,6 +104,7 @@ class WidgetGtk : public Widget, public MessageLoopForUI::Observer { } virtual gboolean OnGrabBrokeEvent(GtkWidget* widget, GdkEvent* event); virtual void OnGrabNotify(GtkWidget* widget, gboolean was_grabbed); + virtual void OnDestroy(GtkWidget* widget); // Returns whether capture should be released on mouse release. The default // is true. @@ -136,6 +148,7 @@ class WidgetGtk : public Widget, public MessageLoopForUI::Observer { GdkEventVisibility* event); static gboolean CallGrabBrokeEvent(GtkWidget* widget, GdkEvent* event); static void CallGrabNotify(GtkWidget* widget, gboolean was_grabbed); + static void CallDestroy(GtkObject* object); // Returns the first ancestor of |widget| that is a window. static Window* GetWindowImpl(GtkWidget* widget); @@ -173,6 +186,12 @@ class WidgetGtk : public Widget, public MessageLoopForUI::Observer { int last_mouse_move_x_; int last_mouse_move_y_; + // The following factory is used to delay destruction. + ScopedRunnableMethodFactory<WidgetGtk> close_widget_factory_; + + // See description above setter. + bool delete_on_destroy_; + DISALLOW_COPY_AND_ASSIGN(WidgetGtk); }; |