]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/matitaGtkMisc.mli
04a531216780997863f7bad05f0d26dc3dab826c
[helm.git] / matita / matita / matitaGtkMisc.mli
1 (* Copyright (C) 2004-2005, HELM Team.
2  * 
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.
6  * 
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.
11  * 
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.
16  *
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,
20  * MA  02111-1307, USA.
21  * 
22  * For details, see the HELM World-Wide-Web page,
23  * http://helm.cs.unibo.it/
24  *)
25
26 (** {2 Gtk helpers} *)
27
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
32   
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
37
38 val toggle_callback:
39   callback:(bool -> unit) -> check:GMenu.check_menu_item -> unit
40   
41 val toggle_win:
42   ?check:GMenu.check_menu_item -> GWindow.window -> unit -> unit
43
44 (** Connect a callback to the clicked signal of a button, ignoring its return
45   * value *)
46 val connect_button: #GButton.button -> (unit -> unit) -> unit
47
48
49 (** Connect a callback to the toggled signal of a button, ignoring its return
50   * value *)
51 val connect_toggle_button: #GButton.toggle_button -> (unit -> unit) -> unit
52
53 (** Like connect_button above, but connects a callback to the activate signal of
54   * a menu item *)
55 val connect_menu_item: #GMenu.menu_item -> (unit -> unit) -> unit
56
57   (** connect a unit -> unit callback to a particular key press event. Event can
58   * be specified using its keysym and a list of modifiers which must be in
59   * effect for the callback to be executed. Further signal processing of other
60   * key press events remains unchanged; further signal processing of the
61   * specified key press depends on the stop parameter *)
62 val connect_key:
63   GObj.event_ops ->
64   ?modifiers:Gdk.Tags.modifier list ->
65   ?stop:bool ->     (* stop signal handling when the given key has been pressed?
66                      * Defaults to false *)
67   Gdk.keysym ->     (* (= int) the key, see GdkKeysyms.ml *)
68   (unit -> unit) -> (* callback *)
69     unit
70
71   (** n-ary string column list *)
72 class multiStringListModel:
73   cols:int ->
74   GTree.view ->
75   object
76     method list_store: GTree.list_store (** list_store forwarding *)
77
78     method easy_mappend:     string list -> unit        (** append + set *)
79     method easy_minsert:     int -> string list -> unit (** insert + set *)
80     method easy_mselection:  unit -> string list list
81   end
82   
83   (** single string column list *)
84 class stringListModel:
85   GTree.view ->
86   object
87     inherit multiStringListModel
88
89     method easy_append:     string -> unit        (** append + set *)
90     method easy_insert:     int -> string -> unit (** insert + set *)
91     method easy_selection:  unit -> string list
92   end
93   
94
95   (** as above with Pixbuf associated to each row. Each time an insert is
96    * performed a string tag should be specified, the corresponding pixbuf in the
97    * tags associative list will be shown on the left of the inserted row *)
98 class taggedStringListModel:
99   tags:((string * GdkPixbuf.pixbuf) list) ->
100   GTree.view ->
101   object
102     method list_store: GTree.list_store (** list_store forwarding *)
103
104     method easy_append:     tag:string -> string -> unit
105     method easy_insert:     int -> tag:string -> string -> unit
106     method easy_selection:  unit -> string list
107   end
108
109 (** {2 Matita GUI components} *)
110
111 class type gui =
112   object  (* minimal gui object requirements *)
113     method newUriDialog:          unit -> MatitaGeneratedGui.uriChoiceDialog
114   end
115
116   (** {3 Dialogs}
117    * In functions below:
118    * @param title window title
119    * @param message content of the text label shown to the user *)
120
121   (** @param parent to center the window on it *)
122 val ask_confirmation:
123   title:string -> message:string -> 
124   ?parent:#GWindow.window_skel ->
125   unit -> [`YES | `NO | `DELETE_EVENT ]
126
127 val report_error:
128   title:string -> message:string -> 
129   ?parent:#GWindow.window_skel ->
130   unit ->
131     unit
132
133     (* given an utf8 string a floc returns the parsed substring and its length
134      * in bytes *)
135 val utf8_parsed_text: string -> Stdpp.location -> string * int
136
137     (* the length in characters, not bytes *)
138 val utf8_string_length: string -> int
139
140 val escape_pango_markup: string -> string
141
142 val matita_lang: GSourceView3.source_language