]> matita.cs.unibo.it Git - helm.git/blob - matita/lablGraphviz.mli
tagged 0.5.0-rc1
[helm.git] / matita / lablGraphviz.mli
1 (* Copyright (C) 2006, 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 (* $Id$ *)
27
28 (** {1 LablGtk "widget" for rendering Graphviz graphs and connecting to clicks
29  * on nodes, edges, ...} *)
30
31 type attribute = string * string  (* <key, value> pair *)
32
33 class type graphviz_widget =
34   object
35
36     (** Load graphviz markup from file and then:
37       * 1) render it to PNG, loading the risulting image in the embedded
38       *    GtkImage widget
39       * 2) render it to a (HTML) map, internalizing its data.
40       * Remember that map entries are generated only for nodes, (edges, ...)
41       * that have an "href" (or "URL", a synonym) attribute 
42       * Interesting values for gviz_cmd are:
43       *   'neato'
44       *   'dot'
45       *   'tred | dot'
46       *)
47     method load_graph_from_file: ?gviz_cmd:string -> string -> unit
48
49     (** Callback invoked when a click on a node listed in the map is received.
50      * @param gdk's button event
51      * @param attrs attributes of the node clicked on, as they appear on the map
52      * (e.g.: [ "shape","rect"; "href","http://foo.bar.com/";
53      *          "title","foo"; "alt","description"; "coords","41,6,113,54" ] *)
54     method connect_href:
55       (GdkEvent.Button.t -> attribute list -> unit) -> unit
56
57     (** Center the viewport on the node having the given href value, if any *)
58     method center_on_href: string -> unit
59
60       (** {3 low level access to embedded widgets}
61        * Containment hierarchy:
62        *  viewport
63        *    \- image *)
64
65     method as_image: GMisc.image
66     method as_viewport: GBin.viewport
67   end
68
69 (** {2 Constructors} *)
70
71 val graphviz: ?packing:(GObj.widget -> unit) -> unit -> graphviz_widget
72