2003-02-12 02:00:12 +00:00
<Type Name= "Application" FullName= "Gtk.Application" >
2011-11-09 16:01:51 +00:00
<TypeSignature Language= "C#" Value= "public class Application : GLib.Application" Maintainer= "John Luke" />
<TypeSignature Language= "ILAsm" Value= ".class public auto ansi Application extends GLib.Application" />
2003-02-12 02:00:12 +00:00
<AssemblyInfo >
<AssemblyName > gtk-sharp</AssemblyName>
2003-12-24 01:35:30 +00:00
<AssemblyPublicKey >
</AssemblyPublicKey>
2003-02-12 02:00:12 +00:00
</AssemblyInfo>
2003-02-23 07:26:30 +00:00
<ThreadSafetyStatement > Gtk# is thread aware, but not thread safe; See the <link location= "node:gtk-sharp/programming/threads" > Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
2011-11-09 16:01:51 +00:00
<Base >
<BaseTypeName > GLib.Application</BaseTypeName>
</Base>
<Interfaces />
2003-02-12 02:00:12 +00:00
<Docs >
2003-03-11 02:07:29 +00:00
<summary > Application class</summary>
<remarks >
<para >
Provides the initialization and event loop iteration related
2003-07-04 21:36:15 +00:00
methods for the Gtk# widget library. Since Gtk# is an event
2003-03-11 02:07:29 +00:00
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.
</para>
2003-07-04 21:36:15 +00:00
<example >
<code lang= "C#" >
using Gtk;
using System;
2005-01-29 23:51:56 +00:00
using GLib;
2003-07-04 21:36:15 +00:00
public class HelloWorld {
public static int Main (string[] args)
{
Application.Init ();
Gtk.Window win = new Gtk.Window ("Gtk# Hello World");
win.DeleteEvent += new DeleteEventHandler (Window_Delete);
win.ShowAll ();
Application.Run ();
return 0;
}
static void Window_Delete (object obj, DeleteEventArgs args)
{
SignalArgs sa = (SignalArgs) args;
Application.Quit ();
sa.RetVal = true;
}
}
</code>
</example>
2003-03-11 02:07:29 +00:00
</remarks>
2003-02-12 02:00:12 +00:00
</Docs>
<Members >
2011-11-09 16:01:51 +00:00
<Member MemberName= ".ctor" >
<MemberSignature Language= "C#" Value= "public Application (IntPtr raw);" />
<MemberSignature Language= "ILAsm" Value= ".method public hidebysig specialname rtspecialname instance void .ctor(native int raw) cil managed" />
<MemberType > Constructor</MemberType>
<Parameters >
<Parameter Name= "raw" Type= "System.IntPtr" />
</Parameters>
<Docs >
2013-12-04 20:23:25 +00:00
<param name= "raw" > Native object pointer.</param>
<summary > Internal constructor</summary>
<remarks > This is not typically used by C# code. Exposed primarily for use by language bindings to wrap native object instances.</remarks>
2011-11-09 16:01:51 +00:00
<since version= "Gtk# 3.0" />
</Docs>
</Member>
<Member MemberName= ".ctor" >
<MemberSignature Language= "C#" Value= "public Application (string application_id, GLib.ApplicationFlags flags);" />
<MemberSignature Language= "ILAsm" Value= ".method public hidebysig specialname rtspecialname instance void .ctor(string application_id, valuetype GLib.ApplicationFlags flags) cil managed" />
<MemberType > Constructor</MemberType>
<Parameters >
<Parameter Name= "application_id" Type= "System.String" />
<Parameter Name= "flags" Type= "GLib.ApplicationFlags" />
</Parameters>
<Docs >
<param name= "application_id" > To be added.</param>
<param name= "flags" > To be added.</param>
<summary > To be added.</summary>
<remarks > To be added.</remarks>
<since version= "Gtk# 3.0" />
</Docs>
</Member>
<Member MemberName= "AddWindow" >
<MemberSignature Language= "C#" Value= "public void AddWindow (Gtk.Window window);" />
<MemberSignature Language= "ILAsm" Value= ".method public hidebysig instance void AddWindow(class Gtk.Window window) cil managed" />
2003-02-12 02:00:12 +00:00
<MemberType > Method</MemberType>
<ReturnValue >
<ReturnType > System.Void</ReturnType>
</ReturnValue>
2011-11-09 16:01:51 +00:00
<Parameters >
<Parameter Name= "window" Type= "Gtk.Window" />
</Parameters>
2003-02-12 02:00:12 +00:00
<Docs >
2011-11-09 16:01:51 +00:00
<param name= "window" > To be added.</param>
<summary > To be added.</summary>
<remarks > To be added.</remarks>
<since version= "Gtk# 3.0" />
2003-02-12 02:00:12 +00:00
</Docs>
</Member>
2011-11-09 16:01:51 +00:00
<Member MemberName= "CurrentEvent" >
<MemberSignature Language= "C#" Value= "public static Gdk.Event CurrentEvent { get; }" />
<MemberSignature Language= "ILAsm" Value= ".property class Gdk.Event CurrentEvent" />
<MemberType > Property</MemberType>
2003-02-12 02:00:12 +00:00
<ReturnValue >
2011-11-09 16:01:51 +00:00
<ReturnType > Gdk.Event</ReturnType>
2003-02-12 02:00:12 +00:00
</ReturnValue>
<Parameters />
<Docs >
2011-11-09 16:01:51 +00:00
<summary > Returns the event currently taking place.</summary>
<value > a <see cref= "T:Gdk.Event" /> </value>
<remarks />
2003-03-11 02:07:29 +00:00
</Docs>
</Member>
2003-02-12 02:00:12 +00:00
<Member MemberName= "EventsPending" >
<MemberSignature Language= "C#" Value= "public static bool EventsPending ();" />
2011-11-09 16:01:51 +00:00
<MemberSignature Language= "ILAsm" Value= ".method public static hidebysig bool EventsPending() cil managed" />
2003-02-12 02:00:12 +00:00
<MemberType > Method</MemberType>
<ReturnValue >
<ReturnType > System.Boolean</ReturnType>
</ReturnValue>
<Parameters />
<Docs >
2003-03-11 02:07:29 +00:00
<summary > Whether there are events on the queue</summary>
2003-07-17 06:38:40 +00:00
<returns >
<see langword= "true" /> if events are available to be processed, <see langword= "false" /> otherwise</returns>
2003-03-11 02:07:29 +00:00
<remarks >
2003-03-15 22:58:57 +00:00
<para >
2003-03-11 02:07:29 +00:00
Checks if any events are pending. This can be used to
update the GUI and invoke timeouts etc. while doing some
time intensive computation.
</para>
2003-03-15 22:58:57 +00:00
<example >
<code lang= "C#" >
2003-07-04 21:36:15 +00:00
void LongComputation ()
{
while (!done){
ComputationChunk ();
2003-03-11 02:07:29 +00:00
2003-07-04 21:36:15 +00:00
// Flush pending events to keep the GUI reponsive
while (Application.EventsPending ())
Application.RunIteration ();
}
}
2003-03-11 02:07:29 +00:00
</code>
2003-03-15 22:58:57 +00:00
</example>
</remarks>
2003-02-12 02:00:12 +00:00
</Docs>
</Member>
2011-11-09 16:01:51 +00:00
<Member MemberName= "GType" >
<MemberSignature Language= "C#" Value= "public static GLib.GType GType { get; }" />
<MemberSignature Language= "ILAsm" Value= ".property valuetype GLib.GType GType" />
<MemberType > Property</MemberType>
2003-02-12 02:00:12 +00:00
<ReturnValue >
2011-11-09 16:01:51 +00:00
<ReturnType > GLib.GType</ReturnType>
2003-02-12 02:00:12 +00:00
</ReturnValue>
<Docs >
2013-12-04 20:19:59 +00:00
<summary > GType Property.</summary>
<value > The native <see cref= "T:GLib.GType" /> value.</value>
<remarks > Returns the native <see cref= "T:GLib.GType" /> value for <see cref= "T:Gtk.Application" /> .</remarks>
2011-11-09 16:01:51 +00:00
<since version= "Gtk# 3.0" />
2003-02-12 02:00:12 +00:00
</Docs>
</Member>
2003-03-07 01:30:00 +00:00
<Member MemberName= "Init" >
2003-03-11 02:07:29 +00:00
<MemberSignature Language= "C#" Value= "public static void Init ();" />
2011-11-09 16:01:51 +00:00
<MemberSignature Language= "ILAsm" Value= ".method public static hidebysig void Init() cil managed" />
2003-03-07 01:30:00 +00:00
<MemberType > Method</MemberType>
<ReturnValue >
<ReturnType > System.Void</ReturnType>
</ReturnValue>
2003-03-15 22:58:57 +00:00
<Parameters />
2003-03-07 01:30:00 +00:00
<Docs >
2003-03-11 02:07:29 +00:00
<summary > Initializes GTK+ for operation.</summary>
<remarks >
2003-03-15 22:58:57 +00:00
<para >
2003-07-04 21:36:15 +00:00
Call this function before using any other Gtk# functions
2003-03-11 02:07:29 +00:00
in your GUI applications. It will initialize everything
needed to operate the toolkit.
</para>
2003-03-15 22:58:57 +00:00
<para >
2003-03-11 02:07:29 +00:00
This function will terminate your program if it was unable
to initialize the GUI for some reason. If you want your
program to fall back to a textual interface you want to
2004-01-19 03:24:25 +00:00
call <see cref= "M:Gtk.Application.InitCheck(System.String, System.String []&)" /> instead.
2003-03-11 02:07:29 +00:00
</para>
2003-03-15 22:58:57 +00:00
<para >
2003-03-11 02:07:29 +00:00
If you want to pass arguments from the command line use
2004-01-19 03:24:25 +00:00
the <see cref= "T:Gtk.Application.Init(System.String, System.String []&)" />
2003-03-11 02:07:29 +00:00
method instead.
</para>
2003-03-15 22:58:57 +00:00
</remarks>
</Docs>
</Member>
2005-08-23 17:02:47 +00:00
<Member MemberName= "Init" >
2005-05-23 20:41:51 +00:00
<MemberSignature Language= "C#" Value= "public static void Init (string progname, ref string[] args);" />
2011-11-09 16:01:51 +00:00
<MemberSignature Language= "ILAsm" Value= ".method public static hidebysig void Init(string progname, string[] args) cil managed" />
2005-05-23 20:41:51 +00:00
<MemberType > Method</MemberType>
<ReturnValue >
<ReturnType > System.Void</ReturnType>
</ReturnValue>
<Parameters >
<Parameter Name= "progname" Type= "System.String" />
<Parameter Name= "args" Type= "System.String[]&" RefType= "ref" />
</Parameters>
<Docs >
2006-03-22 06:39:01 +00:00
<param name= "progname" > The name of the program.</param>
<param name= "args" > An string array with the parameters given to the program.</param>
<summary > Call this method before using any other GTK# method in your GUI applications.</summary>
<remarks >
2007-01-16 16:18:05 +00:00
<para >
2006-03-22 06:39:01 +00:00
It will initialize everything needed to operate the toolkit and parses some standard command line options, <paramref name= "args" /> is adjusted accordingly so your code will never see those standard arugments.
</para>
2007-01-16 16:18:05 +00:00
<para >
2006-03-22 06:39:01 +00:00
Note that there are some alternative ways to initialize GTK#, if you are calling <see cref= "M:Gtk.Global.ParseArgs" /> or <see cref= "M:Gtk.Application.InitCheck" /> you don't have to call <see cref= "M:Gtk.Application.Init" /> .
</para>
2007-01-16 16:18:05 +00:00
</remarks>
2005-05-23 20:41:51 +00:00
</Docs>
</Member>
2005-08-23 17:02:47 +00:00
<Member MemberName= "InitCheck" >
2005-05-23 20:41:51 +00:00
<MemberSignature Language= "C#" Value= "public static bool InitCheck (string progname, ref string[] args);" />
2011-11-09 16:01:51 +00:00
<MemberSignature Language= "ILAsm" Value= ".method public static hidebysig bool InitCheck(string progname, string[] args) cil managed" />
2005-05-23 20:41:51 +00:00
<MemberType > Method</MemberType>
<ReturnValue >
<ReturnType > System.Boolean</ReturnType>
</ReturnValue>
<Parameters >
<Parameter Name= "progname" Type= "System.String" />
<Parameter Name= "args" Type= "System.String[]&" RefType= "ref" />
</Parameters>
<Docs >
2006-03-22 06:39:01 +00:00
<param name= "progname" > The name of the program.</param>
<param name= "args" > An string array with the parameters given to the program.</param>
<summary > This method does the same work as <see cref= "M:Gtk.Application.Init" /> with only a single change, it does not terminate the program if the GUI can't be initialized. Instead it returns <see langword= "false" /> on failure.</summary>
2006-08-04 23:48:02 +00:00
<returns >
<see langword= "" /> if the GUI has been succesfully initialized, otherwise <see langword= "false" /> .</returns>
2006-03-22 06:39:01 +00:00
<remarks > This way the application can fall back to some toher means of communication with the user, for example a curses or command line interface.</remarks>
2005-05-23 20:41:51 +00:00
</Docs>
</Member>
2005-09-07 17:56:34 +00:00
<Member MemberName= "Invoke" >
2005-09-02 22:55:48 +00:00
<MemberSignature Language= "C#" Value= "public static void Invoke (EventHandler d);" />
2011-11-09 16:01:51 +00:00
<MemberSignature Language= "ILAsm" Value= ".method public static hidebysig void Invoke(class System.EventHandler d) cil managed" />
2005-09-02 22:55:48 +00:00
<MemberType > Method</MemberType>
<ReturnValue >
<ReturnType > System.Void</ReturnType>
</ReturnValue>
<Parameters >
<Parameter Name= "d" Type= "System.EventHandler" />
</Parameters>
<Docs >
<param name= "d" > An event handler to invoke on the main thread.</param>
<summary > Invoke the given EventHandler in the GUI thread.</summary>
<remarks >
Use this method to invoke the given delegate code in the
main thread. This is necessary since Gtk# does not allow
multiple threads to perform operations on Gtk objects as it
the toolkit is not thread-safe.
<para >
2005-09-07 17:56:34 +00:00
This mechanism is simpler to use than <see cref= "T:Gtk.ThreadNotify" /> since it does not require the
2005-09-02 22:55:48 +00:00
creation of a notifier per event.
2005-09-07 17:56:34 +00:00
</para> <para >
2005-09-02 22:55:48 +00:00
This is particularly useful with C# 2.0 as it is possible
to use anonymous methods with it, for example:
2007-01-16 16:18:05 +00:00
</para> <example > <code lang= "C#" >
2005-09-02 22:55:48 +00:00
using Gtk;
using Gdk;
using System;
using System.Threading;
public class HelloThreads {
static Label msg;
static Button but;
static int count;
static Thread thr;
public static int Main (string[] args)
{
Application.Init ();
Gtk.Window win = new Gtk.Window ("Gtk# Threaded Counter");
win.DeleteEvent += new DeleteEventHandler (Window_Delete);
msg = new Label ("Click to quit");
but = new Button (msg);
but.Clicked += delegate { thr.Abort (); Application.Quit (); };
win.Add (but);
win.ShowAll ();
thr = new Thread (ThreadMethod);
thr.Start ();
Application.Run ();
return 0;
}
static void ThreadMethod ()
{
Console.WriteLine ("Starting thread");
while (true){
count++;
Thread.Sleep (500);
Application.Invoke (delegate {
msg.Text = String.Format ("Click to Quit ({0})", count);
});
}
}
static void Window_Delete (object obj, DeleteEventArgs args)
{
Application.Quit ();
args.RetVal = true;
}
2007-01-16 16:18:05 +00:00
</code> </example> </remarks>
2005-09-02 22:55:48 +00:00
</Docs>
</Member>
2005-09-07 17:56:34 +00:00
<Member MemberName= "Invoke" >
2005-09-02 22:55:48 +00:00
<MemberSignature Language= "C#" Value= "public static void Invoke (object sender, EventArgs args, EventHandler d);" />
2011-11-09 16:01:51 +00:00
<MemberSignature Language= "ILAsm" Value= ".method public static hidebysig void Invoke(object sender, class System.EventArgs args, class System.EventHandler d) cil managed" />
2005-09-02 22:55:48 +00:00
<MemberType > Method</MemberType>
<ReturnValue >
<ReturnType > System.Void</ReturnType>
</ReturnValue>
<Parameters >
<Parameter Name= "sender" Type= "System.Object" />
<Parameter Name= "args" Type= "System.EventArgs" />
<Parameter Name= "d" Type= "System.EventHandler" />
</Parameters>
<Docs >
<param name= "sender" > The sender to pass to the event handler..</param>
<param name= "args" > The argument to pass to the event handler.</param>
<param name= "d" > An event handler to invoke on the main thread.</param>
<summary > Invoke the given EventHandler in the GUI thread.</summary>
<remarks >
Use this method to invoke the given delegate code in the
main thread. This is necessary since Gtk# does not allow
multiple threads to perform operations on Gtk objects as it
the toolkit is not thread-safe.
<para >
2005-09-07 17:56:34 +00:00
This mechanism is simpler to use than <see cref= "T:Gtk.ThreadNotify" /> since it does not require the
2005-09-02 22:55:48 +00:00
creation of a notifier per event.
2005-09-07 17:56:34 +00:00
</para> <para >
2005-09-02 22:55:48 +00:00
This is particularly useful with C# 2.0 as it is possible
to use anonymous methods with it, for example:
2007-01-16 16:18:05 +00:00
</para> <example > <code lang= "C#" >
2005-09-02 22:55:48 +00:00
using Gtk;
using Gdk;
using System;
using System.Threading;
public class HelloThreads {
static Label msg;
static Button but;
static int count;
static Thread thr;
public static int Main (string[] args)
{
Application.Init ();
Gtk.Window win = new Gtk.Window ("Gtk# Threaded Counter");
win.DeleteEvent += new DeleteEventHandler (Window_Delete);
msg = new Label ("Click to quit");
but = new Button (msg);
but.Clicked += delegate { thr.Abort (); Application.Quit (); };
win.Add (but);
win.ShowAll ();
thr = new Thread (ThreadMethod);
thr.Start ();
Application.Run ();
return 0;
}
static void ThreadMethod ()
{
Console.WriteLine ("Starting thread");
while (true){
count++;
Thread.Sleep (500);
Application.Invoke (delegate {
msg.Text = String.Format ("Click to Quit ({0})", count);
});
}
}
static void Window_Delete (object obj, DeleteEventArgs args)
{
Application.Quit ();
args.RetVal = true;
}
2007-01-16 16:18:05 +00:00
</code> </example> </remarks>
2005-09-02 22:55:48 +00:00
</Docs>
</Member>
2011-11-09 16:01:51 +00:00
<Member MemberName= "Quit" >
<MemberSignature Language= "C#" Value= "public static void Quit ();" />
<MemberSignature Language= "ILAsm" Value= ".method public static hidebysig void Quit() cil managed" />
<MemberType > Method</MemberType>
<ReturnValue >
<ReturnType > System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs >
<summary > Quits the current main loop</summary>
<remarks >
<para >
Makes the innermost invocation of the main loop return when it regains control.
</para>
</remarks>
</Docs>
</Member>
<Member MemberName= "RemoveWindow" >
<MemberSignature Language= "C#" Value= "public void RemoveWindow (Gtk.Window window);" />
<MemberSignature Language= "ILAsm" Value= ".method public hidebysig instance void RemoveWindow(class Gtk.Window window) cil managed" />
<MemberType > Method</MemberType>
<ReturnValue >
<ReturnType > System.Void</ReturnType>
</ReturnValue>
<Parameters >
<Parameter Name= "window" Type= "Gtk.Window" />
</Parameters>
<Docs >
<param name= "window" > To be added.</param>
<summary > To be added.</summary>
<remarks > To be added.</remarks>
<since version= "Gtk# 3.0" />
</Docs>
</Member>
<Member MemberName= "Run" >
<MemberSignature Language= "C#" Value= "public static void Run ();" />
<MemberSignature Language= "ILAsm" Value= ".method public static hidebysig void Run() cil managed" />
<MemberType > Method</MemberType>
<ReturnValue >
<ReturnType > System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs >
<summary > Runs the main loop</summary>
<remarks >
<para >
Runs the main loop until <see cref= "M:Gtk.Application.Quit()" /> is called. You can nest
calls to <see cref= "M:Gtk.Application.Run()" /> . In that
case <see cref= "M:Gtk.Application.Quit()" /> will make the
innermost invocation of the main loop return.
</para>
</remarks>
</Docs>
</Member>
<Member MemberName= "RunIteration" >
<MemberSignature Language= "C#" Value= "public static void RunIteration ();" />
<MemberSignature Language= "ILAsm" Value= ".method public static hidebysig void RunIteration() cil managed" />
<MemberType > Method</MemberType>
<ReturnValue >
<ReturnType > System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs >
<summary > Runs a single iteration of the main loop.</summary>
<remarks >
<para >
Runs a single iteration of the main loop. If no events are
waiting to be processed Gtk# will block until the next
event is noticed. If you do not want to block look at <see cref= "M:Gtk.Application.RunIteration(System.Boolean)" /> or check if
any events are pending with <see cref= "M:Gtk.Application.EventsPending()" /> first.
</para>
</remarks>
</Docs>
</Member>
<Member MemberName= "RunIteration" >
<MemberSignature Language= "C#" Value= "public static bool RunIteration (bool blocking);" />
<MemberSignature Language= "ILAsm" Value= ".method public static hidebysig bool RunIteration(bool blocking) cil managed" />
<MemberType > Method</MemberType>
<ReturnValue >
<ReturnType > System.Boolean</ReturnType>
</ReturnValue>
<Parameters >
<Parameter Name= "blocking" Type= "System.Boolean" />
</Parameters>
<Docs >
<param name= "blocking" > A boolean value, whether the iteration should block or not</param>
<summary > Runs a single iteration of the main loop.</summary>
<returns >
<see langword= "true" /> if <see cref= "M:Gtk.Application.Quit()" /> has been called in the innermost main loop.</returns>
<remarks >
<para >
Runs a single iteration of the main loop. If <paramref name= "blocking" /> is <see langword= "true" /> , then if no events are
waiting to be processed Gtk# will block until the next event is noticed; If <paramref name= "blocking" /> is <see langword= "false" /> ,
then it if no events are waiting to be processed Gtk#, routine will return immediately.
</para>
</remarks>
</Docs>
</Member>
<Member MemberName= "Windows" >
<MemberSignature Language= "C#" Value= "public Gtk.Window[] Windows { get; }" />
<MemberSignature Language= "ILAsm" Value= ".property instance class Gtk.Window[] Windows" />
<MemberType > Property</MemberType>
<ReturnValue >
<ReturnType > Gtk.Window[]</ReturnType>
</ReturnValue>
<Docs >
<summary > To be added.</summary>
<value > To be added.</value>
<remarks > To be added.</remarks>
<since version= "Gtk# 3.0" />
</Docs>
</Member>
2003-02-12 02:00:12 +00:00
</Members>
2005-05-23 20:41:51 +00:00
</Type>