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
|
/*
* WidgetInfo.h -- Zinc Widget record.
*
* Authors : Patrick Lecoanet.
* Creation date : Mon Feb 1 12:13:24 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 _WidgetInfo_h
#define _WidgetInfo_h
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <GL/glx.h>
#include <GL/glu.h>
#include "Item.h"
#include "Transfo.h"
#include "Types.h"
#include "perfos.h"
#include "Color.h"
#ifndef NUM_ALPHA_STEPS
#define NUM_ALPHA_STEPS 16
#endif
/* Constants for flags */
#define REPICK_IN_PROGRESS 1
#define LEFT_GRABBED_ITEM 2
#define INTERNAL_NEED_REPICK 8
/*
* The following structure provides information about the selection and
* the insertion cursor. It is needed by only a few items, such as
* those that display text. It is shared by the generic canvas code
* and the item-specific code, but most of the fields should be written
* only by the canvas generic code.
*/
typedef struct _TextInfo {
ZnGradient *sel_color; /* Background color for selected text.
* Read-only to items.*/
Item sel_item; /* Pointer to selected item. ZN_NO_ITEM
* means that the widget doesn't own the
* selection. Writable by items. */
int sel_field;
int sel_first; /* Index of first selected character.
* Writable by items. */
int sel_last; /* Index of last selected character.
* Writable by items. */
Item anchor_item; /* Item corresponding to sel_anchor: not
* necessarily sel_item. Read-only to items. */
int anchor_field;
int sel_anchor; /* Fixed end of selection (i.e. "select to"
* operation will use this as one end of the
* selection). Writable by items. */
ZnGradient *insert_color; /* Used to draw vertical bar for insertion
* cursor. Read-only to items. */
int insert_width; /* Total width of insertion cursor. Read-only
* to items. */
ZnBool cursor_on; /* True means that an insertion cursor should
* be displayed in focus_item. Read-only to
* items.*/
} TextInfo;
typedef struct _WidgetInfo {
Tcl_Interp *interp; /* Interpreter associated with widget. */
Tcl_Command cmd; /* Token for zinc widget command. */
Tcl_HashTable *id_table; /* Hash table for object ids. */
Tcl_HashTable *t_table; /* Hash table for transformations. */
unsigned long obj_id; /* Id for the next new object. */
Tk_BindingTable binding_table; /* Table of all bindings currently defined
* for this widget. NULL means that no
* bindings exist, so the table hasn't been
* created. Each "object" used for this
* table is either a Tk_Uid for a tag or
* the address of an item named by id. */
int state; /* Last known modifier state. Used to
* defer picking a new current object
* while buttons are down. */
Item current_item; /* Item picked from previous pick sequence */
Item new_item; /* Item picked from current pick sequence */
int current_part;
int new_part;
Item hot_item;
Item hot_prev;
Item focus_item; /* Item that currently has the input focus,
* or ZN_NO_ITEM if no such item. Read-only to
* items. */
int focus_field;
ZnBool got_focus; /* True means that the widget has the input
* focus. Read-only to items.*/
XEvent pick_event; /* Event used to forge fake events and to do
* repicks. */
ZnBool update_pending; /* True means there is a pending graphic
* update. */
ZnBBox exposed_area; /* Window area that need to be rexposed.
* It is distinct from redraw_area which
* is updated when items are changed. */
Pixmap alpha_stipples[NUM_ALPHA_STEPS];
int border_width;
int opt_width; /* Window size as stated/reported by the option. */
int opt_height; /* They are equal to the width/height fields after
* the actual resize. They may to be equal if
* the resize is not acknowledged by the geo
* manager. */
ZnGradient *relief_grad; /* The gradient describing the border relief
* colors. */
ReliefStyle relief; /* The border relief. */
/* Tracks global resources */
int track_managed_history_size; /* Size of history for tracks */
ZnBool track_manage_history; /* Tell if the tracks manage their */
/* histories. */
ZnReal speed_vector_length; /* How long (in time) are speedvectors*/
#ifdef OM
int om_group_id; /* Tell which group contains tracks to be */
Item om_group; /* processed for anti label overlap. */
#endif
/* Maps global resources */
ZnFont map_text_font; /* Font for texts in Map items */
ZnImage map_distance_symbol;
/* display distance marks along Map */
/* lines. */
/* Transformer */
ZnTransfo *current_transfo;
ZnList transfo_stack;
struct _ClipState *current_clip;
ZnList clip_stack;
/* Others */
ZnGradient *fore_color; /* Default gradient used in new items */
ZnGradient *back_color; /* Color of the widget background. */
ZnGradient *bbox_color; /* Color used to draw bboxes (debug). */
Cursor cursor; /* Cursor displayed in zinc window. */
ZnBool draw_bboxes; /* Draw item's bboxes (debug). */
int light_angle;
int pick_aperture; /* size of pick aperture in pixels */
ZnFont font; /* Default font used in new items */
ZnBool reshape; /* Use the Shape Extension on the window.*/
ZnBool full_reshape; /* Use it on the top level window. */
ZnImage tile;
/* Zinc private resources */
int width; /* Actual window dimension. */
int height;
int inset; /* Border and highlight width */
/* Graphic variables */
Display *dpy; /* The display of the widget window. */
Screen *screen;
ZnWindow win; /* The window of the widget. */
ZnBool realized;
#ifdef GLX
GLXContext gl_context;
XVisualInfo *gl_visual;
ZnReal max_line_width;
ZnReal max_point_width;
#endif
GLUtesselator *tess;
ZnCombineData *tess_combine_list;
int tess_type;
Pixmap draw_buffer; /* Pixmap for double buffering */
ZnBBox damaged_area; /* The current damaged rectangle */
GC gc;
ZnBool has_glx; /* Tell if openGL can be used. */
ZnBool has_x_shape; /* Tell if the X shape ext. is avail. */
ZnBool has_x_input; /* Tell if the X input ext. is avail. */
int render;
unsigned char alpha; /* Current composite group alpha. */
int events_flags; /* NEED_REPICK et al */
Window real_top;
Item top_group;
ZnList work_item_list; /* Temporary item list used in internal
* works. */
ZnList work_pts; /* Temporary point lists. */
ZnList work_xpts;
ZnList work_doubles; /* Temporary number list. */
ZnList work_strs; /* Temporary string list */
/* Text management */
TextInfo text_info;
int insert_on_time;
int insert_off_time;
Tcl_TimerToken blink_handler;
char *take_focus;
int highlight_width; /* Width in pixels of highlight to draw
* around widget when it has the focus.
* = 0 means don't draw a highlight. */
ZnGradient *highlight_bg_color; /* Color for drawing traversal highlight
* area when highlight is off. */
ZnGradient *highlight_color; /* Color for drawing traversal highlight.*/
/* Perf measurement variables. */
ZnBool monitoring;
Chrono this_draw_chrono;
Chrono total_draw_chrono;
int num_items;
int damaged_area_w;
int damaged_area_h;
} WidgetInfo;
#ifdef __CPLUSPLUS__
}
#endif
#endif /* _WidgetInfo_h */
|