From 7142444f6cfb934afaf453d2878ef588ca0622b7 Mon Sep 17 00:00:00 2001 From: Brad Taylor Date: Thu, 12 Apr 2007 17:17:09 +0000 Subject: [PATCH] 2007-04-09 Brad Taylor * gtk/glue/widget.c: * gtk/Widget.custom: Bind activate_signal in GtkWidgetClass. svn path=/trunk/gtk-sharp/; revision=75653 --- ChangeLog | 5 +++++ gtk/Widget.custom | 30 +++++++++++++++++++++++++++++- gtk/glue/widget.c | 17 ++++++++++++++++- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 569691bbb..e7c18d4b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-04-09 Brad Taylor + + * gtk/glue/widget.c: + * gtk/Widget.custom: Bind activate_signal in GtkWidgetClass. + 2007-04-05 Mike Kestner * glib/ToggleRef.cs : flush a few leftover changes from a diff --git a/gtk/Widget.custom b/gtk/Widget.custom index 2bf53e884..656339616 100644 --- a/gtk/Widget.custom +++ b/gtk/Widget.custom @@ -1,8 +1,10 @@ // // Gtk.Widget.custom - Gtk Widget class customizations // -// Author: Rachel Hestilow +// Authors: Rachel Hestilow , +// Brad Taylor // +// Copyright (C) 2007 Brad Taylor // Copyright (C) 2002 Rachel Hestilow // // This code is inserted after the automatically generated code. @@ -220,6 +222,32 @@ protected virtual void OnSetScrollAdjustments (Gtk.Adjustment hadj, Gtk.Adjustme { } +[DllImport("gtksharpglue-2")] +static extern int gtksharp_widget_connect_activate_signal (IntPtr gtype, ActivateDelegate cb); + +[GLib.CDeclCallback] +delegate void ActivateDelegate (IntPtr widget); + +static ActivateDelegate ActivateCallback; + +static void Activate_cb (IntPtr widget) +{ + Widget obj = GLib.Object.GetObject (widget, false) as Widget; + obj.OnActivate (); +} + +static void ConnectActivate (GLib.GType gtype) +{ + if (ActivateCallback == null) + ActivateCallback = new ActivateDelegate (Activate_cb); + gtksharp_widget_connect_activate_signal (gtype.Val, ActivateCallback); +} + +[GLib.DefaultSignalHandler (Type=typeof (Gtk.Widget), ConnectionMethod="ConnectActivate")] +protected virtual void OnActivate () +{ +} + private class BindingInvoker { System.Reflection.MethodInfo mi; object[] parms; diff --git a/gtk/glue/widget.c b/gtk/glue/widget.c index adcd3e719..a686f7350 100644 --- a/gtk/glue/widget.c +++ b/gtk/glue/widget.c @@ -1,7 +1,9 @@ /* widget.c : Glue to access fields in GtkWidget. * - * Author: Rachel Hestilow + * Authors: Rachel Hestilow , + * Brad Taylor * + * Copyright (c) 2007 Brad Taylor * Copyright (c) 2002 Rachel Hestilow, Mike Kestner * * This program is free software; you can redistribute it and/or @@ -31,6 +33,7 @@ int gtksharp_gtk_widget_get_flags (GtkWidget *widget); void gtksharp_gtk_widget_set_flags (GtkWidget *widget, int flags); int gtksharp_gtk_widget_style_get_int (GtkWidget *widget, const char *name); void gtksharp_widget_connect_set_scroll_adjustments_signal (GType gtype, gpointer callback); +void gtksharp_widget_connect_activate_signal (GType gtype, gpointer callback); void _gtksharp_marshal_VOID__OBJECT_OBJECT (GClosure *closure, GValue *return_value, guint n_param_values, const GValue *param_values, gpointer invocation_hint, gpointer marshal_data); int gtksharp_gtk_widget_get_flags (GtkWidget *widget); void gtksharp_gtk_widget_set_flags (GtkWidget *widget, int flags); @@ -139,6 +142,18 @@ gtksharp_widget_connect_set_scroll_adjustments_signal (GType gtype, gpointer cb) G_TYPE_NONE, 2, parm_types); } +void +gtksharp_widget_connect_activate_signal (GType gtype, gpointer cb) +{ + GtkWidgetClass *klass = g_type_class_peek (gtype); + if (!klass) + klass = g_type_class_ref (gtype); + klass->activate_signal = g_signal_newv ( + "activate_signal", gtype, G_SIGNAL_RUN_LAST, + g_cclosure_new (cb, NULL, NULL), NULL, NULL, g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0, NULL); +} + void gtksharp_widget_add_binding_signal (GType gtype, const gchar *sig_name, GCallback cb) {