1 (* Copyright (C) 2006, 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/
28 (** {1 LablGtk "widget" for rendering Graphviz graphs and connecting to clicks
29 * on nodes, edges, ...} *)
31 type attribute = string * string (* <key, value> pair *)
33 class type graphviz_widget =
36 (** Load graphviz markup from file and then:
37 * 1) render it to PNG, loading the risulting image in the embedded
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:
47 method load_graph_from_file: ?gviz_cmd:string -> string -> unit
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" ] *)
55 (GdkEvent.Button.t -> attribute list -> unit) -> unit
57 (** Center the viewport on the node having the given href value, if any *)
58 method center_on_href: string -> unit
60 (** {3 low level access to embedded widgets}
61 * Containment hierarchy:
65 method as_image: GMisc.image
66 method as_viewport: GBin.viewport
69 (** {2 Constructors} *)
71 val graphviz: ?packing:(GObj.widget -> unit) -> unit -> graphviz_widget