/* * 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 #include #ifdef GLX #include #include #endif #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; GLUtesselator *tess; ZnCombineData *tess_combine_list; int tess_type; XVisualInfo *gl_visual; ZnReal max_line_width; ZnReal max_point_width; #endif 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 */