GLib.DefaultSignalHandlerAttribute Class
Identifies a virtual class method on a GLib.Object subclass.

See Also: DefaultSignalHandlerAttribute Members

Syntax

public sealed class DefaultSignalHandlerAttribute : Attribute

Remarks

When a virtual method tagged with this attribute is overridden in a subclass, the method is automatically hooked into the native object's vtable. For the most part, this is an internal implementation detail, but it can be used by binding code to manually identify GObject virtual methods that can be overridden by subclasses.

The following code identifies the ForAll method as an overridable native method on the Gtk.Container class. When a managed subclass of Container overrides the ForAll method, at type registration time, the OverrideForall method is invoked to connect up a delegate to the native GtkContainerClass::forall vtable slot.

C# Example

static void Forall_cb (IntPtr container, bool include_internals, IntPtr cb, IntPtr data)
{
        Container obj = GLib.Object.GetObject (container, false) as Container;
        CallbackInvoker invoker = new CallbackInvoker (cb, data);
        obj.ForAll (include_internals, invoker);
}

static void OverrideForall (GLib.GType gtype)
{
        if (ForallCallback == null)
                ForallCallback = new ForallDelegate (Forall_cb);
        gtksharp_container_override_forall (gtype, ForallCallback);
}

[GLib.DefaultSignalHandler (Type=typeof(Gtk.Container), ConnectionMethod="OverrideForall")]
protected virtual void ForAll (bool include_internals, CallbackInvoker invoker)
{
        gtksharp_container_base_forall (Handle, include_internals, invoker.Callback, invoker.Data);
} 

Requirements

Namespace: GLib
Assembly: glib-sharp (in glib-sharp.dll)
Assembly Versions: 2.12.0.0