aboutsummaryrefslogtreecommitdiff
path: root/generic/Attrs.h
blob: 2c12835fcff88e755a19a3dda1b82c94f84eadcc (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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
/*
 * Attrs.h -- Header for the attribute manipulation routines.
 *
 * Authors		: Patrick Lecoanet.
 * Creation date	: Fri Dec 31 10:06:37 1999
 *
 * $Id$
 */

/*
 *  Copyright (c) 1993 - 1999 CENA, Patrick Lecoanet --
 *
 * This code is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This code 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 code; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */


#ifndef _Attrs_h
#define _Attrs_h

#ifdef __CPLUSPLUS__
extern "C" {
#endif


#include <Types.h>
  

struct _ZnWInfo;

/*
 * Type and constant values for line styles.
 */
typedef unsigned char	ZnLineStyle;

#define ZN_LINE_SIMPLE	0
#define ZN_LINE_DASHED	1
#define ZN_LINE_MIXED	2
#define ZN_LINE_DOTTED	3

int ZnGetLineStyle(struct _ZnWInfo *wi, char *name, ZnLineStyle *line_style);
char *ZnNameOfLineStyle(ZnLineStyle line_style);


/*
 * Type and constant values for line shapes.
 */
typedef unsigned char	ZnLineShape;

#define ZN_LINE_STRAIGHT		0
#define ZN_LINE_LEFT_LIGHTNING      	1
#define ZN_LINE_LEFT_CORNER		2
#define ZN_LINE_DOUBLE_LEFT_CORNER	3
#define ZN_LINE_RIGHT_LIGHTNING		4
#define ZN_LINE_RIGHT_CORNER		5
#define ZN_LINE_DOUBLE_RIGHT_CORNER	6

int ZnGetLineShape(struct _ZnWInfo *wi, char *name, ZnLineShape *line_shape);
char *ZnNameOfLineShape(ZnLineShape line_shape);


/*
 * Type and constant values for relief styles.
 */
typedef unsigned char	ZnReliefStyle;
#define ZN_RELIEF_FLAT		0
#define ZN_RELIEF_RAISED	1
#define ZN_RELIEF_SUNKEN	2
#define ZN_RELIEF_GROOVE	(ZN_RELIEF_TWO_FACES|ZN_RELIEF_SUNKEN)
#define ZN_RELIEF_RIDGE		(ZN_RELIEF_TWO_FACES|ZN_RELIEF_RAISED)
#define ZN_RELIEF_ROUND_SUNKEN	(ZN_RELIEF_ROUND|ZN_RELIEF_SUNKEN)
#define ZN_RELIEF_ROUND_RAISED	(ZN_RELIEF_ROUND|ZN_RELIEF_RAISED)
#define ZN_RELIEF_ROUND_GROOVE	(ZN_RELIEF_ROUND|ZN_RELIEF_TWO_FACES|ZN_RELIEF_SUNKEN)
#define ZN_RELIEF_ROUND_RIDGE	(ZN_RELIEF_ROUND|ZN_RELIEF_TWO_FACES|ZN_RELIEF_RAISED)
#define ZN_RELIEF_SUNKEN_RULE	(ZN_RELIEF_ROUND|ZN_RELIEF_TWO_FACES|ZN_RELIEF_SUNKEN|ZN_RELIEF_RULE)
#define ZN_RELIEF_RAISED_RULE	(ZN_RELIEF_ROUND|ZN_RELIEF_TWO_FACES|ZN_RELIEF_RAISED|ZN_RELIEF_RULE)
#define ZN_RELIEF_ROUND		0x80
#define	ZN_RELIEF_TWO_FACES	0x40
#define	ZN_RELIEF_RULE		0x20
#define	ZN_RELIEF_MASK		0x3

/*
 * Number of steps for relief drawing. This translate in
 * RELIEF_STEPS*2+1 color shades in the color gradient.
 */
#define ZN_RELIEF_STEPS		6
  
int ZnGetRelief(struct _ZnWInfo *wi, char *name, ZnReliefStyle *relief);
char *ZnNameOfRelief(ZnReliefStyle relief);


/*
 * Type and constant values for borders.
 */
typedef unsigned char	ZnBorder;
#define ZN_NO_BORDER		0
#define ZN_LEFT_BORDER		1
#define ZN_RIGHT_BORDER		2
#define ZN_TOP_BORDER		4
#define ZN_BOTTOM_BORDER	8
#define ZN_CONTOUR_BORDER	(ZN_LEFT_BORDER|ZN_RIGHT_BORDER|ZN_TOP_BORDER|ZN_BOTTOM_BORDER)
#define ZN_COUNTER_OBLIQUE	16
#define ZN_OBLIQUE		32

void ZnNameOfBorder(ZnBorder border, char *str);
int ZnGetBorder(struct _ZnWInfo *wi, Tcl_Obj *name, ZnBorder *border);


/*
 * Type for leader anchors.
 */
typedef struct {
  int		left_x;		/* left leader anchor field or percent of bbox */
  int		right_x;	/* right leader anchor field or percent of bbox */
  short		left_y;		/* left leader percent of bbox or < 0 if field */
  short		right_y;	/* right leader percent of bbox or < 0 if field */
} ZnLeaderAnchorsStruct, *ZnLeaderAnchors;

int ZnGetLeaderAnchors(struct _ZnWInfo *wi, char *name, ZnLeaderAnchors *leader_anchors);
void ZnNameOfLeaderAnchors(ZnLeaderAnchors leader_anchors, char *name);


/*
 * Type and constant values for automatic alignments.
 */
typedef struct {
  ZnBool	automatic;
  Tk_Justify	align[3];
} ZnAutoAlign;
#define ZN_AA_LEFT		0
#define ZN_AA_CENTER		1
#define ZN_AA_RIGHT		2

int ZnGetAutoAlign(struct _ZnWInfo *wi, char *name, ZnAutoAlign *aa);
void ZnNameOfAutoAlign(ZnAutoAlign *aa, char *name);


/*
 * Label Formats.
 */
  
/*
 * field flags.
 */
#define	ZN_LF_ATTACH_PIXEL	0
#define	ZN_LF_ATTACH_FWD	1
#define	ZN_LF_ATTACH_BWD	2
#define	ZN_LF_ATTACH_LEFT	3	/* Align left on left or top on top */
#define	ZN_LF_ATTACH_RIGHT	4	/* Align right on right or bottom on bottom */

#define ZN_LF_DIM_PIXEL	0
#define	ZN_LF_DIM_FONT	1
#define	ZN_LF_DIM_ICON	2
#define ZN_LF_DIM_AUTO	3
#define ZN_LF_DIM_LABEL	4
  
typedef struct {
  int	x_spec;
  int	y_spec;
  short	width_spec;
  short	height_spec;
  char	x_attach;
  char	y_attach;
  char	x_dim;
  char	y_dim;
} ZnFieldFormatStruct, *ZnFieldFormat;

typedef struct {
  short		clip_width;
  short		clip_height;
  unsigned int	num_fields;
  Tcl_HashEntry	*entry;
  unsigned int	ref_count;
  ZnFieldFormatStruct fields[1];
} ZnLabelFormatStruct, *ZnLabelFormat;
  

ZnLabelFormat
ZnLFCreate(Tcl_Interp	* /* interp */,
	   char		* /* format_str */,
	   unsigned int	/* num_fields */);
ZnLabelFormat
ZnLFDuplicate(ZnLabelFormat	/* label_format */);
void
ZnLFDelete(ZnLabelFormat	/* label_format */);
char *
ZnLFGetString(ZnLabelFormat	/* label_format */);
ZnBool
ZnLFGetClipBox(ZnLabelFormat	/* label_format */,
	       ZnDim		* /* width */,
	       ZnDim		* /* height */);
#define ZnLFNumFields(lf)	((lf)->num_fields)
void
ZnLFGetField(ZnLabelFormat	/* label_format */,
	     unsigned int	/* field */,
	     char		* /* x_attach */,
	     char		* /* y_attach */,
	     char		* /* x_dim */,
	     char		* /* y_dim */,
	     int		* /* x_spec */,
	     int		* /* y_spec */,
	     short		* /* width_spec */,
	     short		* /* height_spec */);

/*
 * Line Ends.
 */
typedef struct {
  ZnReal	shape_a;
  ZnReal	shape_b;
  ZnReal	shape_c;
  Tcl_HashEntry	*entry;
  unsigned int	ref_count;
} ZnLineEndStruct, *ZnLineEnd;

ZnLineEnd
ZnLineEndCreate(Tcl_Interp	*interp,
		char		*line_end_str);
ZnLineEnd
ZnLineEndDuplicate(ZnLineEnd	le);
void
ZnLineEndDelete(ZnLineEnd	le);
char *
ZnLineEndGetString(ZnLineEnd	le);


/*
 * Type and protypes for fill rules.
 */
typedef unsigned int	ZnFillRule;

char *ZnNameOfFillRule(ZnFillRule fill_rule);
int ZnGetFillRule(struct _ZnWInfo *wi, char *name, ZnFillRule *fill_rule);


#ifdef __CPLUSPLUS__
}
#endif

#endif	/* _Attrs_h */