1 /* simplechartfactory.vala
3 * Copyright (C) 2008 Florian Brosch
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 * Florian Brosch <flo.brosch@gmail.com>
23 [CCode (cname
= "valadoc_compat_gvc_graph_new")]
24 extern Gvc
.Graph
valadoc_gvc_graph_new (string name
);
26 public class Valadoc
.Charts
.SimpleFactory
: Charts
.Factory
{
27 protected virtual Gvc
.Node
configure_type (Gvc
.Node node
, Api
.Node item
) {
28 node
.safe_set ("shape", "box", "");
29 node
.safe_set ("fontname", "Times", "");
30 node
.safe_set ("label", item
.get_full_name (), "");
34 public override Gvc
.Graph
create_graph (Api
.Node item
) {
35 return valadoc_gvc_graph_new (item
.get_full_name ());
38 public override Gvc
.Context
create_context (Gvc
.Graph graph
) {
39 var context
= new Gvc
.Context ();
40 context
.layout_jobs (graph
);
41 context
.layout (graph
, "dot");
45 public override Gvc
.Node
create_class (Gvc
.Graph graph
, Api
.Class item
) {
46 var node
= configure_type (create_type (graph
, item
), item
);
47 node
.safe_set ("style", "bold", "");
51 public override Gvc
.Node
create_struct (Gvc
.Graph graph
, Api
.Struct item
) {
52 var node
= configure_type (create_type (graph
, item
), item
);
53 node
.safe_set ("style", "bold", "");
57 public override Gvc
.Node
create_interface (Gvc
.Graph graph
, Api
.Interface item
) {
58 return configure_type (create_type (graph
, item
), item
);
61 public override Gvc
.Node
create_enum (Gvc
.Graph graph
, Api
.Enum item
) {
62 return configure_type (create_type (graph
, item
), item
);
65 public override Gvc
.Node
create_delegate (Gvc
.Graph graph
, Api
.Delegate item
) {
66 return configure_type (create_type (graph
, item
), item
);
69 public override Gvc
.Node
create_errordomain (Gvc
.Graph graph
, Api
.ErrorDomain item
) {
70 return configure_type (create_type (graph
, item
), item
);
73 public override Gvc
.Node
create_namespace (Gvc
.Graph graph
, Api
.Namespace item
) {
74 return configure_type (create_type (graph
, item
), item
);
77 public override Gvc
.Edge
add_children (Gvc
.Graph graph
, Gvc
.Node parent
, Gvc
.Node child
) {
78 var edge
= graph
.create_edge (parent
, child
);
79 edge
.safe_set ("dir", "back", "");