Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 404d46ca9bb341d7a0e7e04bc69da9df > files > 782

ghc-gtk-devel-0.12.0-4.fc15.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Graphics.UI.Gtk.General.General</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Graphics-UI-Gtk-General-General.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Graphics-UI-Gtk-General-General.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">gtk-0.12.0: Binding to the Gtk+ graphical user interface library.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>portable (depends on GHC)</td></tr><tr><th>Stability</th><td>provisional</td></tr><tr><th>Maintainer</th><td>gtk2hs-users@lists.sourceforge.net</td></tr></table><p class="caption">Graphics.UI.Gtk.General.General</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Initialisation
</a><ul><li><a href="#g:2">Support for OS threads
</a></li></ul></li><li><a href="#g:3">Main event loop
</a><ul><li><a href="#g:4">Less commonly used event loop functions
</a></li><li><a href="#g:5">Call when mainloop is left
</a></li></ul></li><li><a href="#g:6">Grab widgets
</a></li><li><a href="#g:7">Timeout and idle callbacks
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>library initialization, main event loop, and events
</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:initGUI">initGUI</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> [<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a>]</li><li class="src short"><a href="#v:unsafeInitGUIForThreadedRTS">unsafeInitGUIForThreadedRTS</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> [<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a>]</li><li class="src short"><a href="#v:postGUISync">postGUISync</a> ::  <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> a -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> a</li><li class="src short"><a href="#v:postGUIAsync">postGUIAsync</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:threadsEnter">threadsEnter</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:threadsLeave">threadsLeave</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:mainGUI">mainGUI</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:mainQuit">mainQuit</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:eventsPending">eventsPending</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:mainLevel">mainLevel</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:mainIteration">mainIteration</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:mainIterationDo">mainIterationDo</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:mainDoEvent">mainDoEvent</a> ::  <a href="Graphics-UI-Gtk-Gdk-EventM.html#t:EventM">EventM</a> t <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:quitAddDestroy">quitAddDestroy</a> :: <a href="Graphics-UI-Gtk-Abstract-Object.html#t:ObjectClass">ObjectClass</a> obj =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; obj -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:quitAdd">quitAdd</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:quitRemove">quitRemove</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:grabAdd">grabAdd</a> :: <a href="Graphics-UI-Gtk-Abstract-Widget.html#t:WidgetClass">WidgetClass</a> wd =&gt; wd -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:grabGetCurrent">grabGetCurrent</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Graphics-UI-Gtk-Abstract-Widget.html#t:Widget">Widget</a>)</li><li class="src short"><a href="#v:grabRemove">grabRemove</a> :: <a href="Graphics-UI-Gtk-Abstract-Widget.html#t:WidgetClass">WidgetClass</a> w =&gt; w -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><span class="keyword">type</span> <a href="#t:Priority">Priority</a> = <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:priorityLow">priorityLow</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:priorityDefaultIdle">priorityDefaultIdle</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:priorityHighIdle">priorityHighIdle</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:priorityDefault">priorityDefault</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:priorityHigh">priorityHigh</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:timeoutAdd">timeoutAdd</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Graphics-UI-Gtk-General-General.html#t:HandlerId">HandlerId</a></li><li class="src short"><a href="#v:timeoutAddFull">timeoutAddFull</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="Graphics-UI-Gtk-General-General.html#t:Priority">Priority</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Graphics-UI-Gtk-General-General.html#t:HandlerId">HandlerId</a></li><li class="src short"><a href="#v:timeoutRemove">timeoutRemove</a> :: <a href="Graphics-UI-Gtk-General-General.html#t:HandlerId">HandlerId</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:idleAdd">idleAdd</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="Graphics-UI-Gtk-General-General.html#t:Priority">Priority</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Graphics-UI-Gtk-General-General.html#t:HandlerId">HandlerId</a></li><li class="src short"><a href="#v:idleRemove">idleRemove</a> :: <a href="Graphics-UI-Gtk-General-General.html#t:HandlerId">HandlerId</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:inputAdd">inputAdd</a> :: <a href="Graphics-UI-Gtk-General-General.html#t:FD">FD</a> -&gt; [<a href="Graphics-UI-Gtk-General-General.html#t:IOCondition">IOCondition</a>] -&gt; <a href="Graphics-UI-Gtk-General-General.html#t:Priority">Priority</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Graphics-UI-Gtk-General-General.html#t:HandlerId">HandlerId</a></li><li class="src short"><a href="#v:inputRemove">inputRemove</a> :: <a href="Graphics-UI-Gtk-General-General.html#t:HandlerId">HandlerId</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><span class="keyword">data</span>  <a href="#t:IOCondition">IOCondition</a> <ul class="subs"><li>= <a href="#v:IOIn">IOIn</a>  </li><li>| <a href="#v:IOOut">IOOut</a>  </li><li>| <a href="#v:IOPri">IOPri</a>  </li><li>| <a href="#v:IOErr">IOErr</a>  </li><li>| <a href="#v:IOHup">IOHup</a>  </li><li>| <a href="#v:IOInvalid">IOInvalid</a>  </li></ul></li><li class="src short"><span class="keyword">type</span> <a href="#t:HandlerId">HandlerId</a> = <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Foreign-C-Types.html#t:CUInt">CUInt</a></li><li class="src short"><span class="keyword">type</span> <a href="#t:FD">FD</a> = <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></li></ul></div><div id="interface"><h1 id="g:1">Initialisation
</h1><div class="top"><p class="src"><a name="v:initGUI" class="def">initGUI</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> [<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a>]<a href="src/Graphics-UI-Gtk-General-General.html#initGUI" class="link">Source</a></p><div class="doc"><p>Initialize the GUI.
</p><p>This must be called before any other function in the Gtk2Hs library.
</p><p>This function initializes the GUI toolkit and parses all Gtk
 specific arguments. The remaining arguments are returned. If the
 initialization of the toolkit fails for whatever reason, an exception
 is thrown.
</p><ul><li> Throws: <code>error &quot;Cannot initialize GUI.&quot;</code>
</li><li> If you want to use Gtk2Hs and in a multi-threaded application then it is your obligation
 to ensure that all calls to Gtk+ happen in a single OS thread.
 If you want to make calls to Gtk2Hs functions from a Haskell thread other
 than the one that calls this functions and <code><a href="Graphics-UI-Gtk-General-General.html#v:mainGUI">mainGUI</a></code> then you will have to
 'post' your GUI actions to the main GUI thread. You can do this using
 <code><a href="Graphics-UI-Gtk-General-General.html#v:postGUISync">postGUISync</a></code> or <code><a href="Graphics-UI-Gtk-General-General.html#v:postGUIAsync">postGUIAsync</a></code>. See also <code><a href="Graphics-UI-Gtk-General-General.html#v:threadsEnter">threadsEnter</a></code>.
</li></ul></div></div><h2 id="g:2">Support for OS threads
</h2><div class="top"><p class="src"><a name="v:unsafeInitGUIForThreadedRTS" class="def">unsafeInitGUIForThreadedRTS</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> [<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Char.html#t:String">String</a>]<a href="src/Graphics-UI-Gtk-General-General.html#unsafeInitGUIForThreadedRTS" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:postGUISync" class="def">postGUISync</a> ::  <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> a -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> a<a href="src/Graphics-UI-Gtk-General-General.html#postGUISync" class="link">Source</a></p><div class="doc"><p>Post an action to be run in the main GUI thread.
</p><p>The current thread blocks until the action completes and the result is
 returned.
</p></div></div><div class="top"><p class="src"><a name="v:postGUIAsync" class="def">postGUIAsync</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/Graphics-UI-Gtk-General-General.html#postGUIAsync" class="link">Source</a></p><div class="doc"><p>Post an action to be run in the main GUI thread.
</p><p>The current thread continues and does not wait for the result of the
 action.
</p></div></div><div class="top"><p class="src"><a name="v:threadsEnter" class="def">threadsEnter</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/Graphics-UI-Gtk-General-General.html#threadsEnter" class="link">Source</a></p><div class="doc"><p>Acquire the global Gtk lock.
</p><ul><li> During normal operation, this lock is held by the thread from which all
 interaction with Gtk is performed. When calling <code><a href="Graphics-UI-Gtk-General-General.html#v:mainGUI">mainGUI</a></code>, the thread will
 release this global lock before it waits for user interaction. During this
 time it is, in principle, possible to use a different OS thread (any other
 Haskell thread that is bound to the Gtk OS thread will be blocked anyway)
 to interact with Gtk by explicitly acquiring the lock, calling Gtk functions
 and releasing the lock. However, the Gtk functions that are called from this
 different thread may not trigger any calls to the OS since this will
 lead to a crash on Windows (the Win32 API can only be used from a single
 thread). Since it is very hard to tell which function only interacts on
 Gtk data structures and which function call actual OS functions, it
 is best not to use this feature at all. A better way to perform updates
 in the background is to spawn a Haskell thread and to perform the update
 to Gtk widgets using <code><a href="Graphics-UI-Gtk-General-General.html#v:postGUIAsync">postGUIAsync</a></code> or <code><a href="Graphics-UI-Gtk-General-General.html#v:postGUISync">postGUISync</a></code>. These will execute
 their arguments from the main loop, that is, from the OS thread of Gtk,
 thereby ensuring that any Gtk and OS function can be called.
</li></ul></div></div><div class="top"><p class="src"><a name="v:threadsLeave" class="def">threadsLeave</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/Graphics-UI-Gtk-General-General.html#threadsLeave" class="link">Source</a></p><div class="doc"><p>Release the global Gtk lock.
</p><ul><li> The use of this function is not recommended. See <code><a href="Graphics-UI-Gtk-General-General.html#v:threadsEnter">threadsEnter</a></code>.
</li></ul></div></div><h1 id="g:3">Main event loop
</h1><div class="top"><p class="src"><a name="v:mainGUI" class="def">mainGUI</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/Graphics-UI-Gtk-General-General.html#mainGUI" class="link">Source</a></p><div class="doc"><p>Run the Gtk+ main event loop.
</p></div></div><div class="top"><p class="src"><a name="v:mainQuit" class="def">mainQuit</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/Graphics-UI-Gtk-General-General.html#mainQuit" class="link">Source</a></p><div class="doc"><p>Exit the main event loop.
</p></div></div><h2 id="g:4">Less commonly used event loop functions
</h2><div class="top"><p class="src"><a name="v:eventsPending" class="def">eventsPending</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a><a href="src/Graphics-UI-Gtk-General-General.html#eventsPending" class="link">Source</a></p><div class="doc"><p>Inquire the number of events pending on the event queue
</p></div></div><div class="top"><p class="src"><a name="v:mainLevel" class="def">mainLevel</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a><a href="src/Graphics-UI-Gtk-General-General.html#mainLevel" class="link">Source</a></p><div class="doc"><p>Inquire the main loop level.
</p><ul><li> Callbacks that take more time to process can call <code><a href="Graphics-UI-Gtk-General-General.html#v:mainIteration">mainIteration</a></code> to keep
 the GUI responsive. Each time the main loop is restarted this way, the main
 loop counter is increased. This function returns this counter.
</li></ul></div></div><div class="top"><p class="src"><a name="v:mainIteration" class="def">mainIteration</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a><a href="src/Graphics-UI-Gtk-General-General.html#mainIteration" class="link">Source</a></p><div class="doc"><p>Process an event, block if necessary.
</p><ul><li> Returns <code>True</code> if <code><a href="Graphics-UI-Gtk-General-General.html#v:mainQuit">mainQuit</a></code> was called while processing the event.
</li></ul></div></div><div class="top"><p class="src"><a name="v:mainIterationDo" class="def">mainIterationDo</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a><a href="src/Graphics-UI-Gtk-General-General.html#mainIterationDo" class="link">Source</a></p><div class="doc"><p>Process a single event.
</p><ul><li> Called with <code>True</code>, this function behaves as <code><a href="Graphics-UI-Gtk-General-General.html#v:mainIteration">mainIteration</a></code> in that it
 waits until an event is available for processing. It will return
 immediately, if passed <code>False</code>.
</li><li> Returns <code>True</code> if the <code><a href="Graphics-UI-Gtk-General-General.html#v:mainQuit">mainQuit</a></code> was called while processing the event.
</li></ul></div></div><div class="top"><p class="src"><a name="v:mainDoEvent" class="def">mainDoEvent</a> ::  <a href="Graphics-UI-Gtk-Gdk-EventM.html#t:EventM">EventM</a> t <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/Graphics-UI-Gtk-General-General.html#mainDoEvent" class="link">Source</a></p><div class="doc"><p>Processes a single GDK event. This is public only to allow filtering of events between GDK and
 GTK+. You will not usually need to call this function directly.
</p><p>While you should not call this function directly, you might want to know how exactly events are
 handled. So here is what this function does with the event:
</p><ol><li> Compress enter/leave notify events. If the event passed build an enter/leave pair together with
 the next event (peeked from GDK) both events are thrown away. This is to avoid a backlog of
 (de-)highlighting widgets crossed by the pointer.
</li><li> Find the widget which got the event. If the widget can't be determined the event is thrown away
 unless it belongs to a INCR transaction. In that case it is passed to
 <code>selectionIncrEvent</code>.
</li><li> Then the event is passed on a stack so you can query the currently handled event with
 <code>getCurrentEvent</code>.
</li><li> The event is sent to a widget. If a grab is active all events for widgets that are not in the
 contained in the grab widget are sent to the latter with a few exceptions:
</li></ol><ul><li> Deletion and destruction events are still sent to the event widget for obvious reasons.
</li><li> Events which directly relate to the visual representation of the event widget.
</li><li> Leave events are delivered to the event widget if there was an enter event delivered to it
 before without the paired leave event.
</li><li> Drag events are not redirected because it is unclear what the semantics of that would be.
</li></ul><p>Another point of interest might be that all key events are first passed through the key snooper
 functions if there are any. Read the description of <code>keySnooperInstall</code> if you need this
 feature.
</p><ol><li> After finishing the delivery the event is popped from the event stack.
</li></ol></div></div><h2 id="g:5">Call when mainloop is left
</h2><div class="top"><p class="src"><a name="v:quitAddDestroy" class="def">quitAddDestroy</a><a href="src/Graphics-UI-Gtk-General-General.html#quitAddDestroy" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Graphics-UI-Gtk-Abstract-Object.html#t:ObjectClass">ObjectClass</a> obj</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">=&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></td><td class="doc"><p><code>mainLevel</code> Level of the mainloop which shall trigger the destruction.
</p></td></tr><tr><td class="src">-&gt; obj</td><td class="doc"><p><code>object</code> Object to be destroyed.
</p></td></tr><tr><td class="src">-&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p>Trigger destruction of object in case the mainloop at level <code>mainLevel</code> is quit.
</p></div></div><div class="top"><p class="src"><a name="v:quitAdd" class="def">quitAdd</a><a href="src/Graphics-UI-Gtk-General-General.html#quitAdd" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></td><td class="doc"><p><code>mainLevel</code> Level at which termination the function shall be called. You can pass 0 here to have the function run at the current mainloop.
</p></td></tr><tr><td class="src">-&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a></td><td class="doc"><p><code>function</code> The function to call. This should return <code><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#v:False">False</a></code> to be removed from the list of quit handlers. Otherwise the function might be called again.
</p></td></tr><tr><td class="src">-&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></td><td class="doc"><p>returns A handle for this quit handler (you need this for <code><a href="Graphics-UI-Gtk-General-General.html#v:quitRemove">quitRemove</a></code>)
</p></td></tr></table></div><div class="doc"><p>Registers a function to be called when an instance of the mainloop is left.
</p></div></div><div class="top"><p class="src"><a name="v:quitRemove" class="def">quitRemove</a><a href="src/Graphics-UI-Gtk-General-General.html#quitRemove" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></td><td class="doc"><p><code>quitHandlerId</code> Identifier for the handler returned when installing it.
</p></td></tr><tr><td class="src">-&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p>Removes a quit handler by its identifier.
</p></div></div><h1 id="g:6">Grab widgets
</h1><div class="top"><p class="src"><a name="v:grabAdd" class="def">grabAdd</a> :: <a href="Graphics-UI-Gtk-Abstract-Widget.html#t:WidgetClass">WidgetClass</a> wd =&gt; wd -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/Graphics-UI-Gtk-General-General.html#grabAdd" class="link">Source</a></p><div class="doc"><p>add a grab widget
</p></div></div><div class="top"><p class="src"><a name="v:grabGetCurrent" class="def">grabGetCurrent</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Graphics-UI-Gtk-Abstract-Widget.html#t:Widget">Widget</a>)<a href="src/Graphics-UI-Gtk-General-General.html#grabGetCurrent" class="link">Source</a></p><div class="doc"><p>inquire current grab widget
</p></div></div><div class="top"><p class="src"><a name="v:grabRemove" class="def">grabRemove</a> :: <a href="Graphics-UI-Gtk-Abstract-Widget.html#t:WidgetClass">WidgetClass</a> w =&gt; w -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/Graphics-UI-Gtk-General-General.html#grabRemove" class="link">Source</a></p><div class="doc"><p>remove a grab widget
</p></div></div><h1 id="g:7">Timeout and idle callbacks
</h1><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:Priority" class="def">Priority</a> = <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></p><div class="doc"><p>Priorities for installing callbacks.
</p></div></div><div class="top"><p class="src"><a name="v:priorityLow" class="def">priorityLow</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></p></div><div class="top"><p class="src"><a name="v:priorityDefaultIdle" class="def">priorityDefaultIdle</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></p></div><div class="top"><p class="src"><a name="v:priorityHighIdle" class="def">priorityHighIdle</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></p></div><div class="top"><p class="src"><a name="v:priorityDefault" class="def">priorityDefault</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></p></div><div class="top"><p class="src"><a name="v:priorityHigh" class="def">priorityHigh</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a></p></div><div class="top"><p class="src"><a name="v:timeoutAdd" class="def">timeoutAdd</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Graphics-UI-Gtk-General-General.html#t:HandlerId">HandlerId</a><a href="src/Graphics-UI-Gtk-General-General.html#timeoutAdd" class="link">Source</a></p><div class="doc"><p>Sets a function to be called at regular intervals, with the default
 priority <code><a href="Graphics-UI-Gtk-General-General.html#v:priorityDefault">priorityDefault</a></code>. The function is called repeatedly until it
 returns <code>False</code>, after which point the timeout function will not be called
 again. The first call to the function will be at the end of the first interval.
</p><p>Note that timeout functions may be delayed, due to the processing of other
 event sources. Thus they should not be relied on for precise timing. After
 each call to the timeout function, the time of the next timeout is
 recalculated based on the current time and the given interval (it does not
 try to 'catch up' time lost in delays).
</p><p>This function differs from <code><a href="/usr/share/doc/ghc/html/libraries/glib-0.12.0/System-Glib-MainLoop.html#v:timeoutAdd">timeoutAdd</a></code> in that the action will
 be executed within the global Gtk+ lock. It is therefore possible to
 call Gtk+ functions from the action.
</p></div></div><div class="top"><p class="src"><a name="v:timeoutAddFull" class="def">timeoutAddFull</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="Graphics-UI-Gtk-General-General.html#t:Priority">Priority</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Graphics-UI-Gtk-General-General.html#t:HandlerId">HandlerId</a><a href="src/Graphics-UI-Gtk-General-General.html#timeoutAddFull" class="link">Source</a></p><div class="doc"><p>Sets a function to be called at regular intervals, with the given
 priority. The function is called repeatedly until it returns <code>False</code>, after
 which point the timeout function will not be called again. The first call
 to the function will be at the end of the first interval.
</p><p>Note that timeout functions may be delayed, due to the processing of other
 event sources. Thus they should not be relied on for precise timing. After
 each call to the timeout function, the time of the next timeout is
 recalculated based on the current time and the given interval (it does not
 try to 'catch up' time lost in delays).
</p><p>This function differs from <code><a href="/usr/share/doc/ghc/html/libraries/glib-0.12.0/System-Glib-MainLoop.html#v:timeoutAddFull">timeoutAddFull</a></code> in that the action will
 be executed within the global Gtk+ lock. It is therefore possible to
 call Gtk+ functions from the action.
</p></div></div><div class="top"><p class="src"><a name="v:timeoutRemove" class="def">timeoutRemove</a> :: <a href="Graphics-UI-Gtk-General-General.html#t:HandlerId">HandlerId</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> ()</p><div class="doc"><p>Remove a previously added timeout handler by its <code><a href="Graphics-UI-Gtk-General-General.html#t:HandlerId">HandlerId</a></code>.
</p></div></div><div class="top"><p class="src"><a name="v:idleAdd" class="def">idleAdd</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="Graphics-UI-Gtk-General-General.html#t:Priority">Priority</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Graphics-UI-Gtk-General-General.html#t:HandlerId">HandlerId</a><a href="src/Graphics-UI-Gtk-General-General.html#idleAdd" class="link">Source</a></p><div class="doc"><p>Add a callback that is called whenever the system is idle.
</p><ul><li> A priority can be specified via an integer. This should usually be
 <code><a href="Graphics-UI-Gtk-General-General.html#v:priorityDefaultIdle">priorityDefaultIdle</a></code>.
</li><li> If the function returns <code>False</code> it will be removed.
</li></ul><p>This function differs from <code><a href="/usr/share/doc/ghc/html/libraries/glib-0.12.0/System-Glib-MainLoop.html#v:idleAdd">idleAdd</a></code> in that the action will
 be executed within the global Gtk+ lock. It is therefore possible to
 call Gtk+ functions from the action.
</p></div></div><div class="top"><p class="src"><a name="v:idleRemove" class="def">idleRemove</a> :: <a href="Graphics-UI-Gtk-General-General.html#t:HandlerId">HandlerId</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> ()</p><div class="doc"><p>Remove a previously added idle handler by its <code><a href="Graphics-UI-Gtk-General-General.html#t:HandlerId">HandlerId</a></code>.
</p></div></div><div class="top"><p class="src"><a name="v:inputAdd" class="def">inputAdd</a><a href="src/Graphics-UI-Gtk-General-General.html#inputAdd" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Graphics-UI-Gtk-General-General.html#t:FD">FD</a></td><td class="doc"><p>a file descriptor
</p></td></tr><tr><td class="src">-&gt; [<a href="Graphics-UI-Gtk-General-General.html#t:IOCondition">IOCondition</a>]</td><td class="doc"><p>the condition to watch for
</p></td></tr><tr><td class="src">-&gt; <a href="Graphics-UI-Gtk-General-General.html#t:Priority">Priority</a></td><td class="doc"><p>the priority of the event source
</p></td></tr><tr><td class="src">-&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a></td><td class="doc"><p>the function to call when the condition is satisfied.
 The function should return False if the event source
 should be removed.
</p></td></tr><tr><td class="src">-&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> <a href="Graphics-UI-Gtk-General-General.html#t:HandlerId">HandlerId</a></td><td class="doc"><p>the event source id
</p></td></tr></table></div><div class="doc"><p>Adds the file descriptor into the main event loop with the given priority.
</p><p>This function differs from <code><a href="/usr/share/doc/ghc/html/libraries/glib-0.12.0/System-Glib-MainLoop.html#v:inputAdd">inputAdd</a></code> in that the action will
 be executed within the global Gtk+ lock. It is therefore possible to
 call Gtk+ functions from the action.
</p></div></div><div class="top"><p class="src"><a name="v:inputRemove" class="def">inputRemove</a> :: <a href="Graphics-UI-Gtk-General-General.html#t:HandlerId">HandlerId</a> -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/System-IO.html#t:IO">IO</a> ()</p></div><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:IOCondition" class="def">IOCondition</a>  </p><div class="doc"><p>Flags representing a condition to watch for on a file descriptor.
</p><dl><dt><code>IOIn</code></dt><dd> There is data to read.
 [<code>IOOut</code>] Data can be written (without blocking).
 [<code>IOPri</code>] There is urgent data to read.
 [<code>IOErr</code>] Error condition.
 [<code>IOHup</code>] Hung up (the connection has been broken, usually for
 pipes and sockets).
 [<code>IOInvalid</code>] Invalid request. The file descriptor is not open.
</dd></dl></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:IOIn" class="def">IOIn</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:IOOut" class="def">IOOut</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:IOPri" class="def">IOPri</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:IOErr" class="def">IOErr</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:IOHup" class="def">IOHup</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a name="v:IOInvalid" class="def">IOInvalid</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="subs instances"><p id="control.i:IOCondition" class="caption collapser" onclick="toggleSection('i:IOCondition')">Instances</p><div id="section.i:IOCondition" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Prelude.html#t:Bounded">Bounded</a> <a href="Graphics-UI-Gtk-General-General.html#t:IOCondition">IOCondition</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Prelude.html#t:Enum">Enum</a> <a href="Graphics-UI-Gtk-General-General.html#t:IOCondition">IOCondition</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Eq.html#t:Eq">Eq</a> <a href="Graphics-UI-Gtk-General-General.html#t:IOCondition">IOCondition</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/glib-0.12.0/System-Glib-Flags.html#t:Flags">Flags</a> <a href="Graphics-UI-Gtk-General-General.html#t:IOCondition">IOCondition</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:HandlerId" class="def">HandlerId</a> = <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Foreign-C-Types.html#t:CUInt">CUInt</a></p></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:FD" class="def">FD</a> = <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a><a href="src/Graphics-UI-Gtk-General-General.html#FD" class="link">Source</a></p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.2</p></div></body></html>