i2005-09-02 Miguel de Icaza <miguel@novell.com>
* gtk/Application.cs (Invoke): Add new overloads to easily invoke methods on the executing thread. svn path=/trunk/gtk-sharp/; revision=49379
This commit is contained in:
parent
e4682de9cf
commit
95a22dd13b
2 changed files with 50 additions and 0 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2005-09-02 Miguel de Icaza <miguel@novell.com>
|
||||||
|
|
||||||
|
* gtk/Application.cs (Invoke): Add new overloads to easily invoke
|
||||||
|
methods on the executing thread.
|
||||||
|
|
||||||
|
2005-09-01 Miguel de Icaza <miguel@novell.com>
|
||||||
|
|
||||||
|
* gtk/Application.cs (Invoke): Add sugar to invoke a method on the
|
||||||
|
main thread.
|
||||||
|
|
||||||
2005-09-02 Ben Maurer <bmaurer@ximian.com>
|
2005-09-02 Ben Maurer <bmaurer@ximian.com>
|
||||||
|
|
||||||
* sample/NodeViewDemo.cs: take advantage of the stuff below
|
* sample/NodeViewDemo.cs: take advantage of the stuff below
|
||||||
|
|
|
@ -141,5 +141,45 @@ namespace Gtk {
|
||||||
return new Gdk.Event (gtk_get_current_event ());
|
return new Gdk.Event (gtk_get_current_event ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal class InvokeCB {
|
||||||
|
EventHandler d;
|
||||||
|
object sender;
|
||||||
|
EventArgs args;
|
||||||
|
|
||||||
|
internal InvokeCB (EventHandler d)
|
||||||
|
{
|
||||||
|
this.d = d;
|
||||||
|
args = EventArgs.Empty;
|
||||||
|
sender = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal InvokeCB (EventHandler d, object sender, EventArgs args)
|
||||||
|
{
|
||||||
|
this.d = d;
|
||||||
|
this.args = args;
|
||||||
|
this.sender = sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal bool Invoke ()
|
||||||
|
{
|
||||||
|
d (sender, args);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Invoke (EventHandler d)
|
||||||
|
{
|
||||||
|
InvokeCB icb = new InvokeCB (d);
|
||||||
|
|
||||||
|
GLib.Idle.Add (new GLib.IdleHandler (icb.Invoke));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Invoke (object sender, EventArgs args, EventHandler d)
|
||||||
|
{
|
||||||
|
InvokeCB icb = new InvokeCB (d);
|
||||||
|
|
||||||
|
GLib.Idle.Add (new GLib.IdleHandler (icb.Invoke));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue