File: edge.h

package info (click to toggle)
ganv 0~svn4468~dfsg0-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,232 kB
  • sloc: python: 12,014; ansic: 6,656; cpp: 2,437; sh: 40; makefile: 23
file content (111 lines) | stat: -rw-r--r-- 3,065 bytes parent folder | download
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/* This file is part of Ganv.
 * Copyright 2007-2012 David Robillard <http://drobilla.net>
 *
 * Ganv 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 3 of the License, or any later version.
 *
 * Ganv 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 details.
 *
 * You should have received a copy of the GNU General Public License along
 * with Ganv.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef GANV_EDGE_H
#define GANV_EDGE_H

#include "ganv/canvas-base.h"
#include "ganv/node.h"
#include "ganv/types.h"

G_BEGIN_DECLS

#define GANV_TYPE_EDGE            (ganv_edge_get_type())
#define GANV_EDGE(obj)            (GTK_CHECK_CAST((obj), GANV_TYPE_EDGE, GanvEdge))
#define GANV_EDGE_CLASS(klass)    (GTK_CHECK_CLASS_CAST((klass), GANV_TYPE_EDGE, GanvEdgeClass))
#define GANV_IS_EDGE(obj)         (GTK_CHECK_TYPE((obj), GANV_TYPE_EDGE))
#define GANV_IS_EDGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), GANV_TYPE_EDGE))
#define GANV_EDGE_GET_CLASS(obj)  (GTK_CHECK_GET_CLASS((obj), GANV_TYPE_EDGE, GanvEdgeClass))

typedef struct _GanvEdgeClass GanvEdgeClass;
typedef struct _GanvEdgeImpl GanvEdgeImpl;

struct _GanvEdge {
	GanvItem      item;
	GanvEdgeImpl* impl;
};

struct _GanvEdgeClass {
	GanvItemClass parent_class;
};

GType ganv_edge_get_type(void);

GanvEdge*
ganv_edge_new(GanvCanvas* canvas,
              GanvNode*   tail,
              GanvNode*   head,
              const char* first_prop_name, ...);

gboolean
ganv_edge_is_within(const GanvEdge* edge,
                    double          x1,
                    double          y1,
                    double          x2,
                    double          y2);

void
ganv_edge_update_location(GanvEdge* edge);

void
ganv_edge_select(GanvEdge* edge);

void
ganv_edge_unselect(GanvEdge* edge);

void
ganv_edge_highlight(GanvEdge* edge);

void
ganv_edge_unhighlight(GanvEdge* edge);

/**
 * ganv_edge_disconnect:
 * Disconnect the edge.  This will disconnect the edge just as if it had been
 * disconnected by the user via the canvas.  The canvas disconnect signal will
 * be emitted, allowing the application to control disconnect logic.
 */
void
ganv_edge_disconnect(GanvEdge* edge);

/**
 * ganv_edge_remove:
 * Remove the edge from the canvas.  This will only remove the edge visually,
 * it will not emit the canvas disconnect signal to notify the application.
 */
void
ganv_edge_remove(GanvEdge* edge);

void
ganv_edge_tick(GanvEdge* edge,
               double    seconds);

/**
 * ganv_edge_get_tail:
 * Return value: (transfer none): The tail of @a edge.
 */
GanvNode*
ganv_edge_get_tail(const GanvEdge* edge);

/**
 * ganv_edge_get_head:
 * Return value: (transfer none): The head of @a edge.
 */
GanvNode*
ganv_edge_get_head(const GanvEdge* edge);

G_END_DECLS

#endif  /* GANV_EDGE_H */