home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2004 July / APC0407D2.iso / workshop / apache / files / ActivePerl-5.6.1.638-MSWin32-x86.msi / _c0ef3243a3cadba590727ec92fcd365e < prev    next >
Encoding:
Text File  |  2004-04-13  |  9.1 KB  |  252 lines

  1. /*
  2.  * tkButton.h --
  3.  *
  4.  *    Declarations of types and functions used to implement
  5.  *    button-like widgets.
  6.  *
  7.  * Copyright (c) 1996 by Sun Microsystems, Inc.
  8.  *
  9.  * See the file "license.terms" for information on usage and redistribution
  10.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  11.  *
  12.  * RCS: @(#) $Id: tkButton.h,v 1.4 1998/09/14 18:23:04 stanton Exp $
  13.  */
  14.  
  15. #ifndef _TKBUTTON
  16. #define _TKBUTTON
  17.  
  18. #ifndef _TKINT
  19. #include "tkInt.h"
  20. #endif
  21.  
  22. #ifdef BUILD_tk
  23. # undef TCL_STORAGE_CLASS
  24. # define TCL_STORAGE_CLASS DLLEXPORT
  25. #endif
  26.  
  27. /*
  28.  * A data structure of the following type is kept for each
  29.  * widget managed by this file:
  30.  */
  31.  
  32. typedef struct {
  33.     Tk_Window tkwin;        /* Window that embodies the button.  NULL
  34.                  * means that the window has been destroyed. */
  35.     Display *display;        /* Display containing widget.  Needed to
  36.                  * free up resources after tkwin is gone. */
  37.     Tcl_Interp *interp;        /* Interpreter associated with button. */
  38.     Tcl_Command widgetCmd;    /* Token for button's widget command. */
  39.     int type;            /* Type of widget:  restricts operations
  40.                  * that may be performed on widget.  See
  41.                  * below for possible values. */
  42.  
  43.     /*
  44.      * Information about what's in the button.
  45.      */
  46.  
  47.     char *text;            /* Text to display in button (malloc'ed)
  48.                  * or NULL. */
  49.     int underline;        /* Index of character to underline.  < 0 means
  50.                  * don't underline anything. */
  51.     Var textVarName;        /* Name of variable (malloc'ed) or NULL.
  52.                  * If non-NULL, button displays the contents
  53.                  * of this variable. */
  54.     Pixmap bitmap;        /* Bitmap to display or None.  If not None
  55.                  * then text and textVar are ignored. */
  56.     char *imageString;        /* Name of image to display (malloc'ed), or
  57.                  * NULL.  If non-NULL, bitmap, text, and
  58.                  * textVarName are ignored. */
  59.     Tk_Image image;        /* Image to display in window, or NULL if
  60.                  * none. */
  61.     char *selectImageString;    /* Name of image to display when selected
  62.                  * (malloc'ed), or NULL. */
  63.     Tk_Image selectImage;    /* Image to display in window when selected,
  64.                  * or NULL if none.  Ignored if image is
  65.                  * NULL. */
  66.  
  67.     /*
  68.      * Information used when displaying widget:
  69.      */
  70.  
  71.     Tk_State state;        /* State of button for display purposes:
  72.                  * normal, active, or disabled. */
  73.     Tk_3DBorder normalBorder;    /* Structure used to draw 3-D
  74.                  * border and background when window
  75.                  * isn't active.  NULL means no such
  76.                  * border exists. */
  77.     Tk_3DBorder activeBorder;    /* Structure used to draw 3-D
  78.                  * border and background when window
  79.                  * is active.  NULL means no such
  80.                  * border exists. */
  81.     int borderWidth;        /* Width of border. */
  82.     int relief;            /* 3-d effect: TK_RELIEF_RAISED, etc. */
  83.     int highlightWidth;        /* Width in pixels of highlight to draw
  84.                  * around widget when it has the focus.
  85.                  * <= 0 means don't draw a highlight. */
  86.     Tk_3DBorder highlightBorder;
  87.                 /* Structure used to draw 3-D default ring
  88.                  * and focus highlight area when highlight
  89.                  * is off. */
  90.     XColor *highlightColorPtr;    /* Color for drawing traversal highlight. */
  91.  
  92.     int inset;            /* Total width of all borders, including
  93.                  * traversal highlight and 3-D border.
  94.                  * Indicates how much interior stuff must
  95.                  * be offset from outside edges to leave
  96.                  * room for borders. */
  97.     Tk_Font tkfont;        /* Information about text font, or NULL. */
  98.     XColor *normalFg;        /* Foreground color in normal mode. */
  99.     XColor *activeFg;        /* Foreground color in active mode.  NULL
  100.                  * means use normalFg instead. */
  101.     XColor *disabledFg;        /* Foreground color when disabled.  NULL
  102.                  * means use normalFg with a 50% stipple
  103.                  * instead. */
  104.     GC normalTextGC;        /* GC for drawing text in normal mode.  Also
  105.                  * used to copy from off-screen pixmap onto
  106.                  * screen. */
  107.     GC activeTextGC;        /* GC for drawing text in active mode (NULL
  108.                  * means use normalTextGC). */
  109.     Pixmap gray;        /* Pixmap for displaying disabled text if
  110.                  * disabledFg is NULL. */
  111.     GC disabledGC;        /* Used to produce disabled effect.  If
  112.                  * disabledFg isn't NULL, this GC is used to
  113.                  * draw button text or icon.  Otherwise
  114.                  * text or icon is drawn with normalGC and
  115.                  * this GC is used to stipple background
  116.                  * across it.  For labels this is None. */
  117.     GC copyGC;            /* Used for copying information from an
  118.                  * off-screen pixmap to the screen. */
  119.     Arg widthString;        /* Value of -width option.  Malloc'ed. */
  120.     Arg heightString;        /* Value of -height option.  Malloc'ed. */
  121.     int width, height;        /* If > 0, these specify dimensions to request
  122.                  * for window, in characters for text and in
  123.                  * pixels for bitmaps.  In this case the actual
  124.                  * size of the text string or bitmap is
  125.                  * ignored in computing desired window size. */
  126.     int wrapLength;        /* Line length (in pixels) at which to wrap
  127.                  * onto next line.  <= 0 means don't wrap
  128.                  * except at newlines. */
  129.     int padX, padY;        /* Extra space around text (pixels to leave
  130.                  * on each side).  Ignored for bitmaps and
  131.                  * images. */
  132.     Tk_Anchor anchor;        /* Where text/bitmap should be displayed
  133.                  * inside button region. */
  134.     Tk_Justify justify;        /* Justification to use for multi-line text. */
  135.     int indicatorOn;        /* True means draw indicator, false means
  136.                  * don't draw it. */
  137.     Tk_3DBorder selectBorder;    /* For drawing indicator background, or perhaps
  138.                  * widget background, when selected. */
  139.     int textWidth;        /* Width needed to display text as requested,
  140.                  * in pixels. */
  141.     int textHeight;        /* Height needed to display text as requested,
  142.                  * in pixels. */
  143.     Tk_TextLayout textLayout;    /* Saved text layout information. */
  144.     int indicatorSpace;        /* Horizontal space (in pixels) allocated for
  145.                  * display of indicator. */
  146.     int indicatorDiameter;    /* Diameter of indicator, in pixels. */
  147.     Tk_State defaultState;    /* State of default ring: TK_STATE_NORMAL,
  148.                  * TK_STATE_ACTIVE, or TK_STATE_DISABLED. */
  149.  
  150.     /*
  151.      * For check and radio buttons, the fields below are used
  152.      * to manage the variable indicating the button's state.
  153.      */
  154.  
  155.     Var selVarName;        /* Name of variable used to control selected
  156.                  * state of button.  Malloc'ed (if
  157.                  * not NULL). */
  158.     Arg onValue;        /* Value to store in variable when
  159.                  * this button is selected.  Malloc'ed (if
  160.                  * not NULL). */
  161.     Arg offValue;        /* Value to store in variable when this
  162.                  * button isn't selected.  Malloc'ed
  163.                  * (if not NULL).  Valid only for check
  164.                  * buttons. */
  165.  
  166.     /*
  167.      * Miscellaneous information:
  168.      */
  169.  
  170.     Tk_Cursor cursor;        /* Current cursor for window, or None. */
  171.     char *takeFocus;        /* Value of -takefocus option;  not used in
  172.                  * the C code, but used by keyboard traversal
  173.                  * scripts.  Malloc'ed, but may be NULL. */
  174.     LangCallback *command;    /* Command to execute when button is
  175.                  * invoked; valid for buttons only.
  176.                  * If not NULL, it's malloc-ed. */
  177.     int flags;            /* Various flags;  see below for
  178.                  * definitions. */
  179.     Tk_Tile tile, activeTile, disabledTile;
  180.     Tk_TSOffset tsoffset;    /* offset for tiling */
  181. } TkButton;
  182.  
  183. /*
  184.  * Possible "type" values for buttons.  These are the kinds of
  185.  * widgets supported by this file.  The ordering of the type
  186.  * numbers is significant:  greater means more features and is
  187.  * used in the code.
  188.  */
  189.  
  190. #define TYPE_LABEL        0
  191. #define TYPE_BUTTON        1
  192. #define TYPE_CHECK_BUTTON    2
  193. #define TYPE_RADIO_BUTTON    3
  194.  
  195. /*
  196.  * Flag bits for buttons:
  197.  *
  198.  * REDRAW_PENDING:        Non-zero means a DoWhenIdle handler
  199.  *                has already been queued to redraw
  200.  *                this window.
  201.  * SELECTED:            Non-zero means this button is selected,
  202.  *                so special highlight should be drawn.
  203.  * GOT_FOCUS:            Non-zero means this button currently
  204.  *                has the input focus.
  205.  */
  206.  
  207. #define REDRAW_PENDING        1
  208. #define SELECTED        2
  209. #define GOT_FOCUS        4
  210.  
  211. /*
  212.  * Mask values used to selectively enable entries in the
  213.  * configuration specs:
  214.  */
  215.  
  216. #define LABEL_MASK        TK_CONFIG_USER_BIT
  217. #define BUTTON_MASK        TK_CONFIG_USER_BIT << 1
  218. #define CHECK_BUTTON_MASK    TK_CONFIG_USER_BIT << 2
  219. #define RADIO_BUTTON_MASK    TK_CONFIG_USER_BIT << 3
  220. #define ALL_MASK        (LABEL_MASK | BUTTON_MASK \
  221.     | CHECK_BUTTON_MASK | RADIO_BUTTON_MASK)
  222.  
  223. /*
  224.  * Declaration of variables shared between the files in the button module.
  225.  */
  226.  
  227. extern TkClassProcs tkpButtonProcs;
  228. extern Tk_ConfigSpec tkpButtonConfigSpecs[];
  229.  
  230. /*
  231.  * Declaration of procedures used in the implementation of the button
  232.  * widget.
  233.  */
  234.  
  235. EXTERN void        TkButtonWorldChanged _ANSI_ARGS_((
  236.                 ClientData instanceData));
  237. EXTERN void        TkpComputeButtonGeometry _ANSI_ARGS_((
  238.                 TkButton *butPtr));
  239. EXTERN TkButton *    TkpCreateButton _ANSI_ARGS_((Tk_Window tkwin));
  240. #ifndef TkpDestroyButton
  241. EXTERN void         TkpDestroyButton _ANSI_ARGS_((TkButton *butPtr));
  242. #endif
  243. #ifndef TkpDisplayButton
  244. EXTERN void        TkpDisplayButton _ANSI_ARGS_((ClientData clientData));
  245. #endif
  246. EXTERN int        TkInvokeButton  _ANSI_ARGS_((TkButton *butPtr));
  247.  
  248. # undef TCL_STORAGE_CLASS
  249. # define TCL_STORAGE_CLASS DLLIMPORT
  250.  
  251. #endif /* _TKBUTTON */
  252.