summaryrefslogtreecommitdiffstats
path: root/views/controls/button/native_button_gtk.cc
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-20 20:56:11 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-20 20:56:11 +0000
commit893160d54cb5b2c1c68d3b69ec8ebc9b25b68b82 (patch)
tree0f29c1776a2f34f06ba60ba53a20691d261b6366 /views/controls/button/native_button_gtk.cc
parent22332192088e1e897d02a4bc7a2983e3864ab3b6 (diff)
downloadchromium_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/controls/button/native_button_gtk.cc')
-rw-r--r--views/controls/button/native_button_gtk.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/views/controls/button/native_button_gtk.cc b/views/controls/button/native_button_gtk.cc
index 858fdcd..3f10897 100644
--- a/views/controls/button/native_button_gtk.cc
+++ b/views/controls/button/native_button_gtk.cc
@@ -75,6 +75,8 @@ gfx::Size NativeButtonGtk::GetPreferredSize() {
void NativeButtonGtk::CreateNativeControl() {
GtkWidget* widget = gtk_button_new();
+ g_signal_connect(G_OBJECT(widget), "clicked",
+ G_CALLBACK(CallClicked), NULL);
NativeControlCreated(widget);
}
@@ -86,6 +88,17 @@ void NativeButtonGtk::NativeControlCreated(GtkWidget* widget) {
UpdateDefault();
}
+// static
+void NativeButtonGtk::CallClicked(GtkButton* widget) {
+ View* view = GetViewForNative(GTK_WIDGET(widget));
+ if (view)
+ static_cast<NativeButtonGtk*>(view)->OnClicked();
+}
+
+void NativeButtonGtk::OnClicked() {
+ native_button_->ButtonPressed();
+}
+
NativeCheckboxGtk::NativeCheckboxGtk(Checkbox* checkbox)
: NativeButtonGtk(checkbox) {
}