2003-02-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* glib/SignalCallback.cs: new methods AddDelegate and RemoveDelegate. * generator/Signal.cs: add/remove signal handlers from the delegate used to invoke them. * generator/SignalHandler.cs: use Delegate instead of MulticastDelegate. svn path=/trunk/gtk-sharp/; revision=11255
This commit is contained in:
parent
8f6aa9a633
commit
97fec24e46
4 changed files with 25 additions and 4 deletions
|
@ -1,3 +1,12 @@
|
|||
2003-02-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
|
||||
|
||||
* glib/SignalCallback.cs: new methods AddDelegate and RemoveDelegate.
|
||||
|
||||
* generator/Signal.cs: add/remove signal handlers from the delegate used
|
||||
to invoke them.
|
||||
|
||||
* generator/SignalHandler.cs: use Delegate instead of MulticastDelegate.
|
||||
|
||||
2003-02-05 Rodrigo Moya <rodrigo@ximian.com>
|
||||
|
||||
* gda/Application.cs:
|
||||
|
|
|
@ -163,13 +163,16 @@ namespace GtkSharp.Generation {
|
|||
sw.Write("(this, Handle, " + cname + ", value, System.Type.GetType(\"" + argsname);
|
||||
if (argsname != "System.EventArgs")
|
||||
sw.Write("," + container_type.NS.ToLower() + "-sharp");
|
||||
sw.WriteLine("\"));");
|
||||
sw.WriteLine("\"));\n\t\t\t\telse");
|
||||
sw.WriteLine("\t\t\t\t\t((GtkSharp.SignalCallback) Signals [{0}]).AddDelegate (value);", cname);
|
||||
sw.WriteLine("\t\t\t\tEventList.AddHandler(" + cname + ", value);");
|
||||
sw.WriteLine("\t\t\t}");
|
||||
sw.WriteLine("\t\t\tremove {");
|
||||
sw.WriteLine("\t\t\t\tEventList.RemoveHandler(" + cname + ", value);");
|
||||
sw.WriteLine("\t\t\t\tif (EventList[" + cname + "] == null)");
|
||||
sw.WriteLine("\t\t\t\t\tSignals.Remove(" + cname + ");");
|
||||
sw.WriteLine("\t\t\t\telse");
|
||||
sw.WriteLine("\t\t\t\t\t((GtkSharp.SignalCallback) Signals [{0}]).RemoveDelegate (value);", cname);
|
||||
sw.WriteLine("\t\t\t}");
|
||||
sw.WriteLine("\t\t}");
|
||||
sw.WriteLine();
|
||||
|
|
|
@ -168,7 +168,7 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine(" int flags);");
|
||||
sw.WriteLine();
|
||||
sw.Write("\t\tpublic " + sname + "(GLib.Object obj, IntPtr raw, ");
|
||||
sw.WriteLine("String name, MulticastDelegate eh, Type argstype) : base(obj, eh, argstype)");
|
||||
sw.WriteLine("String name, Delegate eh, Type argstype) : base(obj, eh, argstype)");
|
||||
sw.WriteLine("\t\t{");
|
||||
sw.WriteLine("\t\t\tif (_Delegate == null) {");
|
||||
sw.WriteLine("\t\t\t\t_Delegate = new " + dname + "(" + cbname + ");");
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace GtkSharp {
|
|||
|
||||
// protected instance members
|
||||
protected GLib.Object _obj;
|
||||
protected MulticastDelegate _handler;
|
||||
protected Delegate _handler;
|
||||
protected int _key;
|
||||
protected Type _argstype;
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace GtkSharp {
|
|||
/// Initializes instance data.
|
||||
/// </remarks>
|
||||
|
||||
public SignalCallback (GLib.Object obj, MulticastDelegate eh, Type argstype)
|
||||
public SignalCallback (GLib.Object obj, Delegate eh, Type argstype)
|
||||
{
|
||||
_key = _NextKey++;
|
||||
_obj = obj;
|
||||
|
@ -49,5 +49,14 @@ namespace GtkSharp {
|
|||
_Instances [_key] = this;
|
||||
}
|
||||
|
||||
public void AddDelegate (Delegate d)
|
||||
{
|
||||
_handler = Delegate.Combine (_handler, d);
|
||||
}
|
||||
|
||||
public void RemoveDelegate (Delegate d)
|
||||
{
|
||||
_handler = Delegate.Remove (_handler, d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue