home *** CD-ROM | disk | FTP | other *** search
/ Practical Programming in Tcl & Tk (4th Edition) / TCLBOOK4.BIN / pc / exsource.old / 47_2.h < prev    next >
C/C++ Source or Header  |  2003-04-15  |  2KB  |  54 lines

  1. /*
  2.  * Example 47-2
  3.  * The Clock widget data structure.
  4.  */
  5.  
  6. #include "tk.h"
  7. #include <sys/time.h>
  8.  
  9. typedef struct {
  10.     Tk_Window tkwin;                            /* The window for the widget */
  11.     Display *display;                            /* Tk's handle on the display */
  12.     Tcl_Interp *interp;                            /* Interpreter of the widget */
  13.     Tcl_Command widgetCmd;                            /* clock instance command. */
  14.     Tk_OptionTable optionTable; /* Used to parse options */
  15.     /*
  16.      * Clock-specific attributes.
  17.      */
  18.     int borderWidth;                            /* Size of 3-D border */
  19.     Tcl_Obj *borderWidthPtr;    /* Original string value */
  20.     int relief;                            /* Style of 3-D border */
  21.     Tk_3DBorder background;                            /* Color for border & background */
  22.     XColor *foreground;                            /* Color for the text */
  23.     XColor *highlight;                            /* Color for active highlight */
  24.     XColor *highlightBg;                            /* Color for neutral highlight */
  25.     int highlightWidth;                            /* Thickness of highlight rim */
  26.     Tcl_Obj *highlightWidthPtr; /* Original string value */
  27.     Tk_Font tkfont;                            /* Font info for the text */
  28.     char *format;                            /* Format for time string */
  29.     /*
  30.      * Graphic contexts and other support.
  31.      */
  32.     GC textGC;                            /* Text graphics context */
  33.     Tk_TimerToken token;                            /* Periodic callback handle*/
  34.     char *clock;                            /* Pointer to the clock string */
  35.     int numChars;                            /* length of the text */
  36.     int textWidth;                            /* in pixels */
  37.     Tcl_Obj *widthPtr;                            /* The original width string value*/
  38.     int textHeight;                            /* in pixels */
  39.     Tcl_Obj *heightPtr;                            /* The original height string value*/
  40.     int padX;                            /* Horizontal padding */
  41.     Tcl_Obj *padXPtr;                            /* The original padX string value*/
  42.     int padY;                            /* Vertical padding */
  43.     Tcl_Obj *padYPtr;                            /* The original padY string value */
  44.     int flags;                            /* Flags defined below */
  45. } Clock;
  46. /*
  47. * Flag bit definitions.
  48. */
  49. #define REDRAW_PENDING                            0x1
  50. #define GOT_FOCUS                            0x2
  51. #define TICKING                            0x4
  52.  
  53.  
  54.