/* * 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 SHM #include #endif #include "Item.h" #include "Transfo.h" #include "Types.h" #include "perfos.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 #ifdef SHM /* * Data for local rendering mode. */ typedef struct { unsigned char *buf; /* 24-bit RGB buffer for rendering */ int rowstride; /* Rowstride for the buffer */ int ox, oy, cx, cy; /* Rectangle describing the rendering area */ } RenderBuf; #endif /* * 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 { ZnColor 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_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 sel_anchor; /* Fixed end of selection (i.e. "select to" * operation will use this as one end of the * selection). Writable by items. */ ZnColor 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. */ Item focus_item; /* Item that currently has the input focus, * or ZN_NO_ITEM if no such item. Read-only to * items. */ ZnBool got_focus; /* True means that the widget has the input * focus. Read-only to items.*/ ZnBool cursor_on; /* True means that an insertion cursor should * be displayed in focus_item. Read-only to * items.*/ struct _ColorGradient *sel_relief; struct _ColorGradient *insert_relief; } 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; 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; 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 SHM XImage *draw_buffer_im; /* Image for double buffering */ RenderBuf buf; #endif 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 the X shape ext. is avail. */ ZnBool has_x_input; /* Tell if the X input ext. is avail. */ ZnBool local_render; /* Instruct to render to a local image, * using libart. */ #ifdef SHM XShmSegmentInfo x_shm_info; #endif 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; /* 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. */ ZnColor highlight_bg_color; /* Color for drawing traversal highlight * area when highlight is off. */ ZnColor 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 */