module GToolbox:sig..end
Useful functions for LablGTK.
= [ `C of string * bool * (bool -> unit)
| `I of string * (unit -> unit)
| `M of string * menu_entry list
| `R of (string * bool * (bool -> unit)) list
| `S ]
Tree description of a menu
: GMenu.menu -> entries:menu_entry list -> unitBuild a menu from a tree description
: entries:menu_entry list -> button:int -> time:int32 -> unitPopup a menu created from the given list of labels and functions.
val question_box : ?parent:#GWindow.window_skel ->
title:string ->
buttons:string list -> ?default:int -> ?icon:#GObj.widget -> string -> intThis 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.
parent : the parent window in the front of which it should be displayed.
this also sets the destroy_with_parent property.title : the title of the dialogbuttons : the list of button labels.default : the index of the default answericon : a widget (usually a pixmap) which can be displayed on the left
of the window.val message_box : ?parent:#GWindow.window_skel ->
title:string -> ?icon:#GObj.widget -> ?ok:string -> string -> unitThis function is used to display a message in a dialog box with just an Ok button.
We use question_box with just an ok button.
parent : the parent window in the front of which it should be displayed.
this also sets the destroy_with_parent property.title : the title of the dialogicon : a widget (usually a pixmap) which can be displayed on the left
of the window.ok : the text for the ok button (default is "Ok")val input_string : ?parent:#GWindow.window_skel ->
title:string ->
?ok:string -> ?cancel:string -> ?text:string -> string -> string optionMake the user type in a string.
None if the user clicked on cancel, or Some s if the user
clicked on the ok button.parent : the parent window in the front of which it should be displayed.
this also sets the destroy_with_parent property.title : the title of the dialogok : the text for the confirmation button (default is "Ok")cancel : the text for the cancel button (default is "Cancel")text : the default text displayed in the entry widgetval input_text : ?parent:#GWindow.window_skel ->
title:string ->
?ok:string -> ?cancel:string -> ?text:string -> string -> string optionMake the user type in a text.
None if the user clicked on cancel, or Some s if the user
clicked on the ok button.parent : the parent window in the front of which it should be displayed.
this also sets the destroy_with_parent property.title : the title of the dialogok : the text for the confirmation button (default is "Ok")cancel : the text for the cancel button (default is "Cancel")text : the default text displayed in the entry widget (utf8)val select_file : title:string ->
?dir:string Stdlib.ref -> ?filename:string -> unit -> string optionThis function allows the user to select a file and returns the selected file name. A VOIR : multi-selection ?
type'atree =[ `L of 'a | `N of 'a * 'a tree list ]
A tree.
class['a]tree_selection :tree:'a tree -> label:('a -> string) -> info:('a -> string) -> ?packing:GObj.widget -> unit -> ?show:bool -> unit ->object..end
A class to make the user select a node in a tree.
val tree_selection_dialog : ?parent:#GWindow.window_skel ->
tree:'a tree ->
label:('a -> string) ->
info:('a -> string) ->
title:string ->
?ok:string ->
?cancel:string ->
?width:int -> ?height:int -> ?show:bool -> unit -> 'a optionA function to make the user select a node in a tree.
parent : the parent window in the front of which it should be displayed.
this also sets the destroy_with_parent property.tree : the to build a tree selection widgettitle : is the title of the window.ok : the text for the confirmation button (default is "Ok")cancel : the text for the cancel button (default is "Cancel")Associate messages to key combinations.
typekey_combination =[ `A | `C | `S ] list * char
A keyboard shorcut: a combination of Alt, Control and Shift and a letter.
type 'a shortcut_specification = {
|
name : |
|
keys : |
|
message : |
}
A shortcut specification: name of a GTK+ signal to emit, keyboard shortcuts and the message to send. The name must be unique.
val create_shortcuts : window:#GWindow.window_skel ->
shortcuts:'a shortcut_specification list ->
callback:('a -> unit) -> unitSetup the given shortcut spec list for the given window and callback. This create the GTK+ signal, associate the keyboard shortcuts to it, make the window listen to these shortcuts and eventually call the given callback with the messages from the shortcut specification.
val autosize_clist : 'a GList.clist -> unitResize the columns of a clist according to the length of the content and the title of each column.