aboutsummaryrefslogtreecommitdiff
path: root/generic/WidgetInfo.h
blob: 63d0b62f14e8fa56237f14b99bc2303bc3fe85ba (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
/*
 * 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 "Item.h"
#include "Transfo.h"
#include "Types.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


typedef struct _WidgetInfo {
  Tcl_Interp		*interp;	/* Interpreter associated with widget.	*/
  Tcl_Command		cmd;		/* Token for zinc widget command.	*/
  Tcl_HashTable		*tag_table;	/* Hash table for object tags.		*/
  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;
  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. */
  Tk_3DBorder		bg_border;	/* The data describing the background
					 * and border 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.				*/
  int			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		*/
  Pixmap		map_distance_symbol;
						/* display distance marks along Map	*/
						/* lines.				*/
  /* Transformer */
  ZnTransfo		*current_transfo;
  ZnList		transfo_stack;
  struct _ClipState	*current_clip;
  ZnList		clip_stack;
  
  /* Others */
  ZnColor		fore_color;		/* Default foreground used in new items */
  ZnColor		back_color;		/* Color of the widget background.	*/
  ZnColor		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.	*/
  char			*tile_name;
  ZnImage		tile;
  
  /* Zinc private resources */
  int			width;			/* Actual window dimension. */
  int			height;

  /* Graphic variables */
  Display		*dpy;			/* The display of the widget window.	*/
  Screen		*screen;
  ZnWindow		win;			/* The window of the widget. */
  ZnBool		realized;
  Pixmap		draw_buffer;		/* Pixmap for double buffering		*/
  ZnBBox		damaged_area;		/* The current damaged rectangle	*/
  GC			gc;
  ZnBool		has_x_shm;		/* Tell if the SHM X11 ext is avail.	*/
  ZnBool		has_x_shape;		/* Tell if she Shape X ext. is avail.	*/
  ZnBool		has_x_input;		/* Tell if she X input ext. is avail.	*/
  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;

  /* Perf measurement variables. */
  ZnBool		monitoring;
  int			num_updates;
  int			last_time;
  int			total_time;
  int			num_items;
} WidgetInfo;

  
#ifdef __CPLUSPLUS__
}
#endif

#endif /* _WidgetInfo_h */