2001-09-16 23:15:56 +00:00
|
|
|
// GTK.Application.cs - GTK Main Event Loop class implementation
|
|
|
|
//
|
|
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
|
|
//
|
|
|
|
// (c) 2001 Mike Kestner
|
|
|
|
|
2001-09-19 02:04:57 +00:00
|
|
|
namespace Gtk {
|
2001-09-16 23:15:56 +00:00
|
|
|
|
|
|
|
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 {
|
|
|
|
|
2002-03-28 21:16:43 +00:00
|
|
|
[DllImport("gtk-x11-2.0")]
|
2002-03-26 01:29:43 +00:00
|
|
|
static extern void gtk_init (int argc, IntPtr argv);
|
|
|
|
|
|
|
|
public static void Init ()
|
|
|
|
{
|
|
|
|
gtk_init (0, new IntPtr(0));
|
|
|
|
}
|
|
|
|
|
2002-03-28 21:16:43 +00:00
|
|
|
[DllImport("gtk-x11-2.0")]
|
2001-09-16 23:15:56 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2002-06-23 18:49:33 +00:00
|
|
|
[DllImport("gtk-x11-2.0")]
|
|
|
|
static extern void gtk_main ();
|
|
|
|
|
2001-09-16 23:15:56 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Run Method
|
|
|
|
/// </summary>
|
|
|
|
///
|
|
|
|
/// <remarks>
|
|
|
|
/// Begins the event loop iteration.
|
|
|
|
/// </remarks>
|
|
|
|
|
|
|
|
public static void Run ()
|
|
|
|
{
|
|
|
|
gtk_main ();
|
|
|
|
}
|
|
|
|
|
2002-06-23 18:49:33 +00:00
|
|
|
[DllImport("gtk-x11-2.0")]
|
|
|
|
static extern void gtk_main_quit ();
|
2001-09-16 23:15:56 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Quit Method
|
|
|
|
/// </summary>
|
|
|
|
///
|
|
|
|
/// <remarks>
|
|
|
|
/// Terminates the event loop iteration.
|
|
|
|
/// </remarks>
|
|
|
|
|
|
|
|
public static void Quit ()
|
|
|
|
{
|
|
|
|
gtk_main_quit ();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|