Ryujinx-GtkSharp/gtk/Application.cs

117 lines
2.3 KiB
C#
Raw Normal View History

// GTK.Application.cs - GTK Main Event Loop class implementation
//
// Author: Mike Kestner <mkestner@speakeasy.net>
//
// (c) 2001 Mike Kestner
namespace Gtk {
using System;
using System.Runtime.InteropServices;
/// <summary>
/// Application Class
/// </summary>
///
/// <remarks>
/// Provides the initialization and event loop iteration related
/// methods for the GTK widget library. Since GTK is an event
/// driven toolkit, Applications register callbacks against various
/// events to handle user input. These callbacks are invoked from
/// the main event loop when events are detected.
/// </remarks>
public class Application {
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_init (int argc, IntPtr argv);
public static void Init ()
{
gtk_init (0, new IntPtr(0));
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_init (ref int argc, ref String[] argv);
/// <summary>
/// Init Method
/// </summary>
///
/// <remarks>
/// Initializes GTK resources.
/// </remarks>
public static void Init (ref string[] args)
{
int argc = args.Length;
gtk_init (ref argc, ref args);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_main ();
/// <summary>
/// Run Method
/// </summary>
///
/// <remarks>
/// Begins the event loop iteration.
/// </remarks>
public static void Run ()
{
gtk_main ();
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern bool gtk_events_pending ();
/// <summary>
/// EventsPending Method
/// </summary>
///
/// <remarks>
/// Returns true if Gtk+ events are pending in the queue.
/// </remarks>
public static bool EventsPending ()
{
return gtk_events_pending ();
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_main_iteration ();
/// <summary>
/// RunIteration Method
/// </summary>
///
/// <remarks>
/// Runs a single iteration of the event loop.
/// </remarks>
public static void RunIteration ()
{
gtk_main_iteration ();
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_main_quit ();
/// <summary>
/// Quit Method
/// </summary>
///
/// <remarks>
/// Terminates the event loop iteration.
/// </remarks>
public static void Quit ()
{
gtk_main_quit ();
}
}
}