aboutsummaryrefslogtreecommitdiff
path: root/generic/WidgetInfo.h
diff options
context:
space:
mode:
authorlecoanet2003-04-16 09:49:22 +0000
committerlecoanet2003-04-16 09:49:22 +0000
commit3261805fee19e346b4d1f84b23816daa1628764a (patch)
tree63ca1d7e4b0a3d9ae49cc0888e58033c3ef3fe22 /generic/WidgetInfo.h
parenteed2656db0adae2c234c3d74af0913746ed5c444 (diff)
downloadtkzinc-3261805fee19e346b4d1f84b23816daa1628764a.zip
tkzinc-3261805fee19e346b4d1f84b23816daa1628764a.tar.gz
tkzinc-3261805fee19e346b4d1f84b23816daa1628764a.tar.bz2
tkzinc-3261805fee19e346b4d1f84b23816daa1628764a.tar.xz
Update from the Windows port and general cleanup/restructure
Diffstat (limited to 'generic/WidgetInfo.h')
-rw-r--r--generic/WidgetInfo.h140
1 files changed, 87 insertions, 53 deletions
diff --git a/generic/WidgetInfo.h b/generic/WidgetInfo.h
index b9f5ac8..dbccff0 100644
--- a/generic/WidgetInfo.h
+++ b/generic/WidgetInfo.h
@@ -31,28 +31,46 @@
#define _WidgetInfo_h
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#ifdef GLX
-#include <GL/glx.h>
-#endif
-
#include "libtess/glu.h"
#include "Item.h"
#include "Transfo.h"
#include "Types.h"
+#ifndef _WIN32
#include "perfos.h"
+#endif
#include "Color.h"
-#ifndef NUM_ALPHA_STEPS
-#define NUM_ALPHA_STEPS 16
+
+#define ZN_NUM_ALPHA_STEPS 16
+
+/*
+ * Constants for flags
+ */
+#define ZN_REPICK_IN_PROGRESS (1<<0)
+#define ZN_LEFT_GRABBED_ITEM (1<<1)
+#define ZN_REALIZED (1<<2)
+#define ZN_INTERNAL_NEED_REPICK (1<<3)
+#define ZN_UPDATE_SCROLLBARS (1<<4) /* If set, the scrollbars must be updated. */
+#define ZN_GOT_FOCUS (1<<5) /* Set means that the widget has the input focus. */
+#define ZN_UPDATE_PENDING (1<<6) /* Set means there is a pending graphic update. */
+#define ZN_HAS_GL (1<<7) /* Tell if openGL can be used. */
+#define ZN_HAS_X_SHAPE (1<<8) /* Tell if the X shape extension is available. */
+#define ZN_MONITORING (1<<9) /* Set if performance monitoring is on. */
+#define ZN_PRINT_CONFIG (1<<10) /* If set the openGL hardware configuration is printed
+ * on startup. */
+
+#ifdef __CPLUSPLUS__
+extern "C" {
#endif
-/* Constants for flags */
-#define REPICK_IN_PROGRESS 1
-#define LEFT_GRABBED_ITEM 2
-#define INTERNAL_NEED_REPICK 8
+/*
+ * Structure used by the tesselator.
+ */
+typedef struct _ZnCombineData {
+ ZnReal v[2];
+ struct _ZnCombineData *next;
+} ZnCombineData;
/*
@@ -62,10 +80,10 @@
* and the item-specific code, but most of the fields should be written
* only by the canvas generic code.
*/
-typedef struct _TextInfo {
+typedef struct _ZnTextInfo {
ZnGradient *sel_color; /* Background color for selected text.
* Read-only to items.*/
- Item sel_item; /* Pointer to selected item. ZN_NO_ITEM
+ ZnItem sel_item; /* Pointer to selected item. ZN_NO_ITEM
* means that the widget doesn't own the
* selection. Writable by items. */
int sel_field;
@@ -73,7 +91,7 @@ typedef struct _TextInfo {
* Writable by items. */
int sel_last; /* Index of last selected character.
* Writable by items. */
- Item anchor_item; /* Item corresponding to sel_anchor: not
+ ZnItem 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"
@@ -81,19 +99,20 @@ typedef struct _TextInfo {
* 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
+ unsigned 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;
+} ZnTextInfo;
-typedef struct _WidgetInfo {
+typedef struct _ZnWInfo {
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. */
+ int flags;
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
@@ -103,26 +122,22 @@ typedef struct _WidgetInfo {
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 */
+ ZnItem current_item; /* Item picked from previous pick sequence */
+ ZnItem 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,
+ ZnItem hot_item;
+ ZnItem hot_prev;
+ ZnItem 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];
+ Pixmap alpha_stipples[ZN_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
@@ -131,21 +146,21 @@ typedef struct _WidgetInfo {
* manager. */
ZnGradient *relief_grad; /* The gradient describing the border relief
* colors. */
- ReliefStyle relief; /* The border relief. */
+ ZnReliefStyle relief; /* The border relief. */
/* Tracks global resources */
- int track_managed_history_size; /* Size of history for tracks */
+ unsigned 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. */
+ ZnItem om_group; /* processed for anti label overlap. */
#endif
/* Maps global resources */
- ZnFont map_text_font; /* Font for texts in Map items */
-#ifdef GLX
+ Tk_Font map_text_font; /* Font for texts in Map items */
+#ifdef GL
ZnTexFontInfo map_font_tfi; /* Used to preserve the default font from
* being freed again and again */
#endif
@@ -167,13 +182,11 @@ typedef struct _WidgetInfo {
int light_angle;
int pick_aperture; /* size of pick aperture in pixels */
- ZnFont font; /* Default font used in new items */
-#ifdef GLX
+ Tk_Font font; /* Default font used in new items */
+#ifdef GL
ZnTexFontInfo font_tfi; /* Used to preserve the default font from
* being freed again and again */
#endif
- ZnBool reshape; /* Use the Shape Extension on the window.*/
- ZnBool full_reshape; /* Use it on the top level window. */
ZnImage tile;
/* Zinc private resources */
@@ -184,28 +197,30 @@ typedef struct _WidgetInfo {
/* 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;
+ Tk_Window win; /* The window of the widget. */
+#ifdef GL
+ ZnGLContext gl_context;
+# ifdef _WIN32
+ HDC hdc;
+ HWND hwnd;
+# else
XVisualInfo *gl_visual;
+# endif
ZnReal max_line_width;
ZnReal max_point_width;
-#endif
+#endif /* GL */
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. */
+ ZnBool reshape; /* Use the Shape Extension on the window.*/
+ ZnBool full_reshape; /* Use it on the top level window. */
+ Window real_top;
int render;
unsigned char alpha; /* Current composite group alpha. */
- int events_flags; /* NEED_REPICK et al */
- Window real_top;
- Item top_group;
+ ZnItem top_group;
ZnList work_item_list; /* Temporary item list used in internal
* works. */
ZnList work_pts; /* Temporary point lists. */
@@ -214,7 +229,7 @@ typedef struct _WidgetInfo {
ZnList work_strs; /* Temporary string list */
/* Text management */
- TextInfo text_info;
+ ZnTextInfo text_info;
int insert_on_time;
int insert_off_time;
Tcl_TimerToken blink_handler;
@@ -226,14 +241,33 @@ typedef struct _WidgetInfo {
* area when highlight is off. */
ZnGradient *highlight_color; /* Color for drawing traversal highlight.*/
+ /* Scrollbar management */
+ ZnPoint origin; /* Coordinate mapped to the upper left corner
+ * of the zinc window. */
+ char *x_scroll_cmd; /* Command prefixes for communicating with */
+ char *y_scroll_cmd; /* scrollbars. NULL means no scrollbar.
+ * Malloc'ed */
+ int x_scroll_incr; /* If >0, defines a grid for horiz/vert */
+ int y_scroll_incr; /* scrolling. This is the size of the "unit",
+ * and the left edge of the screen will always
+ * lie on an even unit boundary. */
+ int scroll_xo; /* This bbox define the region that is the */
+ int scroll_yo; /* 100% area for scrolling (i.e. it determines */
+ int scroll_xc; /* the size and location of the sliders on */
+int scroll_yc; /* scrollbars). */
+ ZnBool confine; /* When true, it is not possible to scroll the
+ * viewing area past the scroll region. */
+ char *region; /* Scroll region option string source of the
+ * scroll_region above. */
/* Perf measurement variables. */
- ZnBool monitoring;
- Chrono this_draw_chrono;
- Chrono total_draw_chrono;
+#ifndef _WIN32
+ ZnChrono this_draw_chrono;
+ ZnChrono total_draw_chrono;
+#endif
int num_items;
int damaged_area_w;
int damaged_area_h;
-} WidgetInfo;
+} ZnWInfo;
#ifdef __CPLUSPLUS__