<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <link rel="Start" href="index.html"> <link rel="previous" href="GUtil.html"> <link rel="next" href="GBroken.html"> <link rel="Up" href="index.html"> <title>LablGTK : GToolbox</title> </head> <body> <div class="navbar"><a href="GUtil.html">Previous</a> <a href="index.html">Up</a> <a href="GBroken.html">Next</a> </div> <center><h1>Module <a href="type_GToolbox.html">GToolbox</a></h1></center> <br> <pre><span class="keyword">module</span> GToolbox: <code class="code">sig</code> <a href="GToolbox.html">..</a> <code class="code">end</code></pre>Useful functions for LablGTK.<br> <hr width="100%"> <br> <a name="2_Menus"></a> <h2>Menus</h2><br> <pre><span class="keyword">type</span> <a name="TYPEmenu_entry"></a><code class="type"></code>menu_entry = <code class="type">[ `C of string * bool * (bool -> unit)<br> | `I of string * (unit -> unit)<br> | `M of string * <a href="GToolbox.html#TYPEmenu_entry">menu_entry</a> list<br> | `R of (string * bool * (bool -> unit)) list<br> | `S ]</code> </pre> <div class="info"> Tree description of a menu<br> </div> <pre><span class="keyword">val</span> <a name="VALbuild_menu"></a>build_menu : <code class="type"><a href="GMenu.menu.html">GMenu.menu</a> -> entries:<a href="GToolbox.html#TYPEmenu_entry">menu_entry</a> list -> unit</code></pre><div class="info"> Build a menu from a tree description<br> </div> <pre><span class="keyword">val</span> <a name="VALpopup_menu"></a>popup_menu : <code class="type">entries:<a href="GToolbox.html#TYPEmenu_entry">menu_entry</a> list -> button:int -> time:int32 -> unit</code></pre><div class="info"> Popup a menu created from the given list of labels and functions.<br> </div> <br> <a name="2_Parametrizeddialogwindows"></a> <h2>Parametrized dialog windows</h2><br> <pre><span class="keyword">val</span> <a name="VALquestion_box"></a>question_box : <code class="type">title:string -><br> buttons:string list -> ?default:int -> ?icon:#<a href="GObj.widget.html">GObj.widget</a> -> string -> int</code></pre><div class="info"> This function is used to display a question in a dialog box, with a parametrized list of buttons. The function returns the number of the clicked button (starting at 1), or 0 if the window is savagedly destroyed.<br> </div> <div class="param_info"><code class="code">title</code> : the title of the dialog</div> <div class="param_info"><code class="code">buttons</code> : the list of button labels.</div> <div class="param_info"><code class="code">default</code> : the index of the default answer</div> <div class="param_info"><code class="code">icon</code> : a widget (usually a pixmap) which can be displayed on the left of the window.</div> <pre><span class="keyword">val</span> <a name="VALmessage_box"></a>message_box : <code class="type">title:string -> ?icon:#<a href="GObj.widget.html">GObj.widget</a> -> ?ok:string -> string -> unit</code></pre><div class="info"> This function is used to display a message in a dialog box with just an Ok button. We use <code class="code">question_box</code> with just an ok button.<br> </div> <div class="param_info"><code class="code">title</code> : the title of the dialog</div> <div class="param_info"><code class="code">icon</code> : a widget (usually a pixmap) which can be displayed on the left of the window.</div> <div class="param_info"><code class="code">ok</code> : the text for the ok button (default is "Ok")</div> <pre><span class="keyword">val</span> <a name="VALinput_string"></a>input_string : <code class="type">title:string -><br> ?ok:string -> ?cancel:string -> ?text:string -> string -> string option</code></pre><div class="info"> Make the user type in a string.<br> <b>Returns</b> <code class="code">None</code> if the user clicked on cancel, or <code class="code">Some s</code> if the user clicked on the ok button.<br> </div> <div class="param_info"><code class="code">title</code> : the title of the dialog</div> <div class="param_info"><code class="code">ok</code> : the text for the confirmation button (default is "Ok")</div> <div class="param_info"><code class="code">cancel</code> : the text for the cancel button (default is "Cancel")</div> <div class="param_info"><code class="code">text</code> : the default text displayed in the entry widget</div> <pre><span class="keyword">val</span> <a name="VALinput_text"></a>input_text : <code class="type">title:string -><br> ?ok:string -> ?cancel:string -> ?text:string -> string -> string option</code></pre><div class="info"> Make the user type in a text.<br> <b>Returns</b> <code class="code">None</code> if the user clicked on cancel, or <code class="code">Some s</code> if the user clicked on the ok button.<br> </div> <div class="param_info"><code class="code">title</code> : the title of the dialog</div> <div class="param_info"><code class="code">ok</code> : the text for the confirmation button (default is "Ok")</div> <div class="param_info"><code class="code">cancel</code> : the text for the cancel button (default is "Cancel")</div> <div class="param_info"><code class="code">text</code> : the default text displayed in the entry widget (utf8)</div> <pre><span class="keyword">val</span> <a name="VALselect_file"></a>select_file : <code class="type">title:string -><br> ?dir:string Pervasives.ref -> ?filename:string -> unit -> string option</code></pre><div class="info"> This function allows the user to select a file and returns the selected file name. A VOIR : multi-selection ?<br> </div> <pre><span class="keyword">type</span> <a name="TYPEtree"></a><code class="type">'a</code> tree = <code class="type">[ `L of 'a | `N of 'a * 'a <a href="GToolbox.html#TYPEtree">tree</a> list ]</code> </pre> <div class="info"> A tree.<br> </div> <pre><span class="keyword">class</span> <a name="TYPEtree_selection"></a><code class="type">['a]</code> <a href="GToolbox.tree_selection.html">tree_selection</a> : <code class="type">tree:'a <a href="GToolbox.html#TYPEtree">tree</a> -> label:('a -> string) -> info:('a -> string) -> ?packing:<a href="GObj.widget.html">GObj.widget</a> -> unit -> ?show:bool -> unit -> </code><code class="code">object</code> <a href="GToolbox.tree_selection.html">..</a> <code class="code">end</code></pre><div class="info"> A class to make the user select a node in a tree. </div> <br><pre><span class="keyword">val</span> <a name="VALtree_selection_dialog"></a>tree_selection_dialog : <code class="type">tree:'a <a href="GToolbox.html#TYPEtree">tree</a> -><br> label:('a -> string) -><br> info:('a -> string) -><br> title:string -><br> ?ok:string -><br> ?cancel:string -><br> ?width:int -> ?height:int -> ?show:bool -> unit -> 'a option</code></pre><div class="info"> A function to make the user select a node in a tree.<br> <b>Returns</b> The data associated to the selected node, or None if the user canceled the selection.<br> </div> <div class="param_info"><code class="code">tree</code> : the to build a tree selection widget</div> <div class="param_info"><code class="code">title</code> : is the title of the window.</div> <div class="param_info"><code class="code">ok</code> : the text for the confirmation button (default is "Ok")</div> <div class="param_info"><code class="code">cancel</code> : the text for the cancel button (default is "Cancel")</div> <br> <a name="2_Miscellaneousfunctions"></a> <h2>Miscellaneous functions</h2><br> <pre><span class="keyword">val</span> <a name="VALautosize_clist"></a>autosize_clist : <code class="type">'a <a href="GList.clist.html">GList.clist</a> -> unit</code></pre><div class="info"> Resize the columns of a clist according to the length of the content and the title of each column.<br> </div> </body></html>