1 (* Copyright (C) 2004-2005, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://helm.cs.unibo.it/
26 (** {2 Gtk helpers} *)
28 (** given a window and a check menu item it links the two so that the former
29 * is only hidden on delete and the latter toggle show/hide of the former *)
30 val toggle_window_visibility:
31 window:GWindow.window -> check:GMenu.check_menu_item -> unit
33 (** given a window and a check menu item it links the two so that the former
34 * is only hidden on delete and the latter toggle show/hide of the former *)
35 val toggle_widget_visibility:
36 widget:GObj.widget -> check:GMenu.check_menu_item -> unit
39 callback:(bool -> unit) -> check:GMenu.check_menu_item -> unit
42 ?check:GMenu.check_menu_item -> GWindow.window -> unit -> unit
44 val add_key_binding: Gdk.keysym -> (unit -> 'a) -> GBin.event_box -> unit
46 (** Connect a callback to the clicked signal of a button, ignoring its return
48 val connect_button: #GButton.button -> (unit -> unit) -> unit
51 (** Connect a callback to the toggled signal of a button, ignoring its return
53 val connect_toggle_button: #GButton.toggle_button -> (unit -> unit) -> unit
55 (** Like connect_button above, but connects a callback to the activate signal of
57 val connect_menu_item: #GMenu.menu_item -> (unit -> unit) -> unit
59 (** connect a unit -> unit callback to a particular key press event. Event can
60 * be specified using its keysym and a list of modifiers which must be in
61 * effect for the callback to be executed. Further signal processing of other
62 * key press events remains unchanged; further signal processing of the
63 * specified key press depends on the stop parameter *)
66 ?modifiers:Gdk.Tags.modifier list ->
67 ?stop:bool -> (* stop signal handling when the given key has been pressed?
68 * Defaults to false *)
69 Gdk.keysym -> (* (= int) the key, see GdkKeysyms.ml *)
70 (unit -> unit) -> (* callback *)
73 (** n-ary string column list *)
74 class multiStringListModel:
78 method list_store: GTree.list_store (** list_store forwarding *)
80 method easy_mappend: string list -> unit (** append + set *)
81 method easy_minsert: int -> string list -> unit (** insert + set *)
82 method easy_mselection: unit -> string list list
85 (** single string column list *)
86 class stringListModel:
89 inherit multiStringListModel
91 method easy_append: string -> unit (** append + set *)
92 method easy_insert: int -> string -> unit (** insert + set *)
93 method easy_selection: unit -> string list
97 (** as above with Pixbuf associated to each row. Each time an insert is
98 * performed a string tag should be specified, the corresponding pixbuf in the
99 * tags associative list will be shown on the left of the inserted row *)
100 class taggedStringListModel:
101 tags:((string * GdkPixbuf.pixbuf) list) ->
104 method list_store: GTree.list_store (** list_store forwarding *)
106 method easy_append: tag:string -> string -> unit
107 method easy_insert: int -> tag:string -> string -> unit
108 method easy_selection: unit -> string list
111 (** {2 Matita GUI components} *)
114 object (* minimal gui object requirements *)
115 method newUriDialog: unit -> MatitaGeneratedGui.uriChoiceDialog
116 method newRecordDialog: unit -> MatitaGeneratedGui.recordChoiceDialog
117 method newConfirmationDialog: unit -> MatitaGeneratedGui.confirmationDialog
118 method newEmptyDialog: unit -> MatitaGeneratedGui.emptyDialog
122 * In functions below:
123 * @param title window title
124 * @param message content of the text label shown to the user *)
126 (** @param parent to center the window on it *)
127 val ask_confirmation:
128 title:string -> message:string ->
129 ?parent:#GWindow.window_skel ->
131 [`YES | `NO | `CANCEL]
133 (** @param multiline (default: false) if true a TextView widget will be used
134 * for prompting the user otherwise a TextEntry widget will be
135 * @return the string given by the user *)
138 ?title:string -> ?message:string ->
139 ?multiline:bool -> ?default:string -> unit ->
142 (** @param fields field names
143 * @param records list of records, each record is a list of [fields] strings
144 * @return number of the chosen record, 0 for the first one *)
145 val ask_record_choice:
147 ?title:string -> ?message:string ->
148 fields:string list -> records:string list list ->
153 title:string -> message:string ->
154 ?parent:#GWindow.window_skel ->
158 (* given an utf8 string a floc returns the parsed substring and its length
160 val utf8_parsed_text: string -> Token.flocation -> string * int
162 (* the length in characters, not bytes *)
163 val utf8_string_length: string -> int