// GtkSharp.SignalCallback.cs - Signal callback base class implementation // // Authors: Mike Kestner // // (c) 2001 Mike Kestner namespace GtkSharp { using System; using System.Collections; using System.Runtime.InteropServices; using GLib; /// /// SignalCallback Class /// /// /// /// Base Class for GSignal to C# event marshalling. /// public abstract class SignalCallback { // A counter used to produce unique keys for instances. protected static int _NextKey = 0; // Hashtable containing refs to all current instances. protected static Hashtable _Instances = new Hashtable (); // protected instance members protected GLib.Object _obj; protected Delegate _handler; protected int _key; protected Type _argstype; /// /// SignalCallback Constructor /// /// /// /// Initializes instance data. /// public SignalCallback (GLib.Object obj, Delegate eh, Type argstype) { _key = _NextKey++; _obj = obj; _handler = eh; _argstype = argstype; _Instances [_key] = this; } public void AddDelegate (Delegate d) { _handler = Delegate.Combine (_handler, d); } public void RemoveDelegate (Delegate d) { _handler = Delegate.Remove (_handler, d); } } }