summaryrefslogtreecommitdiff
path: root/src/sheet/node-item.c
blob: cd200206f75c51bc9cff3b15d6a2b601f4ff8c5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
 * node-item.c
 * Authors:
 *  Richard Hult <rhult@hem.passagen.se>
 *  Ricardo Markiewicz <rmarkie@fi.uba.ar>
 *  Andres de Barbara <adebarbara@fi.uba.ar>
 *  Marc Lorber <lorber.marc@wanadoo.fr>
 *
 * Web page: https://github.com/marc-lorber/oregano
 *
 * Copyright (C) 1999-2001  Richard Hult
 * Copyright (C) 2003,2006  Ricardo Markiewicz
 * Copyright (C) 2009-2012  Marc Lorber
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#include <gtk/gtk.h>

#include "node-item.h"

static void node_item_init		(NodeItem		 *item);
static void node_item_class_init	(NodeItemClass	 *klass);

struct _NodeItemPriv {
	GooCanvasItem *dot_item;
};

G_DEFINE_TYPE (NodeItem, node_item, GOO_TYPE_CANVAS_GROUP)

static void
node_item_class_init (NodeItemClass *klass)
{
	node_item_parent_class = g_type_class_peek_parent (klass);
}

static void
node_item_init (NodeItem *item)
{
	item->priv = g_new0 (NodeItemPriv, 1);
}

void
node_item_show_dot (NodeItem *item, gboolean show)
{
	g_return_if_fail (item != NULL);
	g_return_if_fail (IS_NODE_ITEM (item));

	if (show) {
		if (item->priv->dot_item == NULL) {
			item->priv->dot_item = goo_canvas_ellipse_new (
			     	GOO_CANVAS_ITEM (item),
			   		0.0, 0.0, 2.0, 2.0, 
			   		"fill_color", "black", 
			        NULL);
		}
		g_object_set (item->priv->dot_item, 
				      "visibility", GOO_CANVAS_ITEM_VISIBLE, NULL);
	} 
	else if (item->priv->dot_item != NULL)
		g_object_set (item->priv->dot_item, 
				      "visibility", GOO_CANVAS_ITEM_INVISIBLE, NULL);
}