summaryrefslogtreecommitdiff
path: root/src/gtkext/graph/nodes/virtual.h
blob: 7f32591cb99e3f3b799239c667c8d0ffa82cbf4f (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
77

/* Chrysalide - Outil d'analyse de fichiers binaires
 * virtual.h - prototypes pour l'encapsulation graphique des blocs virtuels
 *
 * Copyright (C) 2013 Cyrille Bagard
 *
 *  This file is part of Chrysalide.
 *
 *  OpenIDA 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
 *  (at your option) any later version.
 *
 *  OpenIDA 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 Foobar.  If not, see <http://www.gnu.org/licenses/>.
 */


#ifndef _GTKEXT_GRAPH_NODES_VIRTUAL_H
#define _GTKEXT_GRAPH_NODES_VIRTUAL_H


#include "../node.h"
#include "../../../analysis/blocks/virtual.h"


/* Indice d'une hauteur au sein des rangs */
typedef size_t vspan_slot_t;

/* Indice non initilisé */
#define UNINITIALIZED_VSPAN_SLOT (~((vspan_slot_t)0))


#define G_TYPE_VIRTUAL_NODE                  (g_virtual_node_get_type())
#define G_VIRTUAL_NODE(obj)                  (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_VIRTUAL_NODE, GVirtualNode))
#define G_VIRTUAL_NODE_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_VIRTUAL_NODE, GVirtualNodeClass))
#define G_IS_VIRTUAL_NODE(obj)               (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_VIRTUAL_NODE))
#define G_IS_VIRTUAL_NODE_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_VIRTUAL_NODE))
#define G_VIRTUAL_NODE_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_VIRTUAL_NODE, GVirtualNodeClass))


/* Encapsulation graphique d'un bloc virtuel (instance) */
typedef struct _GVirtualNode GVirtualNode;

/* Encapsulation graphique d'un bloc virtuel (classe) */
typedef struct _GVirtualNodeClass GVirtualNodeClass;


/* Indique le type définit par la GLib pour l'encapsulation d'un bloc virtuel. */
GType g_virtual_node_get_type(void);

/* Encapsule graphiquement un bloc virtuel. */
GGraphNode *g_virtual_node_new(GVirtualBlock *);

/* Ajoute un noeud au groupe courant. */
void g_virtual_node_add_child(GVirtualNode *, GGraphNode *);

/* Compte le nombre de noeuds contenus dans le groupe courant. */
size_t g_virtual_node_count_children(const GVirtualNode *);

/* Renvoie un des noeuds contenus dans le groupe courant. */
GGraphNode *g_virtual_node_get_child(const GVirtualNode *, size_t);

/* Réserve une portion de largeur pour un lien. */
vspan_slot_t g_virtual_node_reserve_span(GVirtualNode *, unsigned int, unsigned int, bool);

/* Fournit la position horizontale obtenue par réservation. */
gint g_virtual_node_get_x_for_vspan_slot(const GVirtualNode *, vspan_slot_t, bool);



#endif  /* _GTKEXT_GRAPH_NODES_VIRTUAL_H */