summaryrefslogtreecommitdiff
path: root/navit/layout.h
blob: ece5d0cc82e5508791616d1e1b441c3aaa5c4a71 (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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/**
 * Navit, a modular navigation system.
 * Copyright (C) 2005-2009 Navit Team
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public License
 * version 2 as published by the Free Software Foundation.
 *
 * 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 Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 */

#ifndef NAVIT_LAYOUT_H
#define NAVIT_LAYOUT_H

#include "item.h"
#include "color.h"

#ifdef __cplusplus
extern "C" {
#endif


struct element {
	enum { element_point, element_polyline, element_polygon, element_circle, element_text, element_icon, element_image, element_arrows } type;
	struct color color;
	int text_size;
	union {
		struct element_point {
			char stub;
		} point;
		struct element_polyline {
			int width;
			int directed;
			int dash_num;
			int offset;
			unsigned char dash_table[4];
		} polyline;
		struct element_polygon {
			char stub;
		} polygon;
		struct element_circle {
			int width;
			int radius;
			struct color background_color;
		} circle;
		struct element_icon {
			char *src;
			int width;
			int height;
			int rotation;
			int x;
			int y;
		} icon;
		struct element_text {
			struct color background_color;
		} text;
	} u;
	int coord_count;
	struct coord *coord;
};


struct itemgra {
	struct range order,sequence_range,speed_range,angle_range;
	GList *type;
	GList *elements;
};

struct layer {
	NAVIT_OBJECT
	struct navit *navit;
	char *name;
	int details;
	GList *itemgras;
	int active;
	struct layer *ref;
};

struct cursor {
	struct attr **attrs;
	struct range *sequence_range;
	char *name;
	int w,h;
	int interval;
};

struct layout {
	NAVIT_OBJECT
	struct navit *navit;
	char *name;
	char* dayname;
	char* nightname;
	char *font;
	struct color color;
	GList *layers;
	GList *cursors;
	int order_delta;
	int active;
};

/* prototypes */
enum attr_type;
struct arrows;
struct attr;
struct attr_iter;
struct circle;
struct cursor;
struct element;
struct icon;
struct image;
struct itemgra;
struct layer;
struct layout;
struct polygon;
struct polyline;
struct text;
struct layout *layout_new(struct attr *parent, struct attr **attrs);
struct attr_iter *layout_attr_iter_new(void);
void layout_attr_iter_destroy(struct attr_iter *iter);
int layout_get_attr(struct layout *layout, enum attr_type type, struct attr *attr, struct attr_iter *iter);
int layout_add_attr(struct layout *layout, struct attr *attr);
struct cursor *layout_get_cursor(struct layout *this_, char *name);
struct cursor *cursor_new(struct attr *parent, struct attr **attrs);
void cursor_destroy(struct cursor *this_);
int cursor_add_attr(struct cursor *this_, struct attr *attr);
struct layer *layer_new(struct attr *parent, struct attr **attrs);
int layer_get_attr(struct layer *layer, enum attr_type type, struct attr *attr, struct attr_iter *iter);
int layer_add_attr(struct layer *layer, struct attr *attr);
int layer_set_attr(struct layer *layer, struct attr *attr);
struct itemgra *itemgra_new(struct attr *parent, struct attr **attrs);
int itemgra_add_attr(struct itemgra *itemgra, struct attr *attr);
struct polygon *polygon_new(struct attr *parent, struct attr **attrs);
struct polyline *polyline_new(struct attr *parent, struct attr **attrs);
struct circle *circle_new(struct attr *parent, struct attr **attrs);
struct text *text_new(struct attr *parent, struct attr **attrs);
struct icon *icon_new(struct attr *parent, struct attr **attrs);
struct image *image_new(struct attr *parent, struct attr **attrs);
struct arrows *arrows_new(struct attr *parent, struct attr **attrs);
int element_add_attr(struct element *e, struct attr *attr);
/* end of prototypes */

#ifdef __cplusplus
}
#endif

#endif