mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-16 11:34:47 +02:00
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
@ -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>
|
2003-02-05 Rodrigo Moya <rodrigo@ximian.com>
|
||||||
|
|
||||||
* gda/Application.cs:
|
* gda/Application.cs:
|
||||||
|
@ -163,13 +163,16 @@ namespace GtkSharp.Generation {
|
|||||||
sw.Write("(this, Handle, " + cname + ", value, System.Type.GetType(\"" + argsname);
|
sw.Write("(this, Handle, " + cname + ", value, System.Type.GetType(\"" + argsname);
|
||||||
if (argsname != "System.EventArgs")
|
if (argsname != "System.EventArgs")
|
||||||
sw.Write("," + container_type.NS.ToLower() + "-sharp");
|
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\tEventList.AddHandler(" + cname + ", value);");
|
||||||
sw.WriteLine("\t\t\t}");
|
sw.WriteLine("\t\t\t}");
|
||||||
sw.WriteLine("\t\t\tremove {");
|
sw.WriteLine("\t\t\tremove {");
|
||||||
sw.WriteLine("\t\t\t\tEventList.RemoveHandler(" + cname + ", value);");
|
sw.WriteLine("\t\t\t\tEventList.RemoveHandler(" + cname + ", value);");
|
||||||
sw.WriteLine("\t\t\t\tif (EventList[" + cname + "] == null)");
|
sw.WriteLine("\t\t\t\tif (EventList[" + cname + "] == null)");
|
||||||
sw.WriteLine("\t\t\t\t\tSignals.Remove(" + cname + ");");
|
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\t}");
|
||||||
sw.WriteLine("\t\t}");
|
sw.WriteLine("\t\t}");
|
||||||
sw.WriteLine();
|
sw.WriteLine();
|
||||||
|
@ -168,7 +168,7 @@ namespace GtkSharp.Generation {
|
|||||||
sw.WriteLine(" int flags);");
|
sw.WriteLine(" int flags);");
|
||||||
sw.WriteLine();
|
sw.WriteLine();
|
||||||
sw.Write("\t\tpublic " + sname + "(GLib.Object obj, IntPtr raw, ");
|
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{");
|
||||||
sw.WriteLine("\t\t\tif (_Delegate == null) {");
|
sw.WriteLine("\t\t\tif (_Delegate == null) {");
|
||||||
sw.WriteLine("\t\t\t\t_Delegate = new " + dname + "(" + cbname + ");");
|
sw.WriteLine("\t\t\t\t_Delegate = new " + dname + "(" + cbname + ");");
|
||||||
|
@ -28,7 +28,7 @@ namespace GtkSharp {
|
|||||||
|
|
||||||
// protected instance members
|
// protected instance members
|
||||||
protected GLib.Object _obj;
|
protected GLib.Object _obj;
|
||||||
protected MulticastDelegate _handler;
|
protected Delegate _handler;
|
||||||
protected int _key;
|
protected int _key;
|
||||||
protected Type _argstype;
|
protected Type _argstype;
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ namespace GtkSharp {
|
|||||||
/// Initializes instance data.
|
/// Initializes instance data.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
||||||
public SignalCallback (GLib.Object obj, MulticastDelegate eh, Type argstype)
|
public SignalCallback (GLib.Object obj, Delegate eh, Type argstype)
|
||||||
{
|
{
|
||||||
_key = _NextKey++;
|
_key = _NextKey++;
|
||||||
_obj = obj;
|
_obj = obj;
|
||||||
@ -49,5 +49,14 @@ namespace GtkSharp {
|
|||||||
_Instances [_key] = this;
|
_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 New Issue
Block a user