GtkSharp/glib/Idle.cs
John Luke 7e9700901f add Idle.Remove method
svn path=/trunk/gtk-sharp/; revision=21483
2003-12-24 19:37:41 +00:00

59 lines
1.2 KiB
C#
Executable file

// GLib.Idle.cs - Idle class implementation
//
// Author: Mike Kestner <mkestner@speakeasy.net>
// Rachel Hestilow <hestilow@ximian.com>
//
// (c) 2002 Mike Kestner, Rachel Hestilow
namespace GLib {
using System;
using System.Runtime.InteropServices;
/// <summary>
/// IdleHandler Delegate
/// </summary>
///
/// <remarks>
/// Delegate used for idle handlerss in the GLib main loop. Return
/// true to restart the idle. Returning false clears the
/// idle.
/// </remarks>
public delegate bool IdleHandler ();
/// <summary>
/// Idle Class
/// </summary>
///
/// <remarks>
/// Allows the installation of Idle Handlers on the GLib main
/// loop.
/// </remarks>
public class Idle {
private Idle ()
{
}
[DllImport("libglib-2.0-0.dll")]
static extern uint g_idle_add (IdleHandler d, IntPtr data);
public static uint Add (IdleHandler hndlr)
{
return g_idle_add (hndlr, IntPtr.Zero);
}
[DllImport("libglib-2.0-0.dll")]
static extern bool g_source_remove_by_funcs_user_data (IdleHandler d, IntPtr data);
public static bool Remove (IdleHandler hndlr)
{
return g_source_remove_by_funcs_user_data (hndlr, IntPtr.Zero);
}
}
}