home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _2befca9e767da683455f817e9f42d9ca < prev    next >
Text File  |  2004-06-01  |  7KB  |  210 lines

  1. /*
  2.  * tkScrollbar.h --
  3.  *
  4.  *    Declarations of types and functions used to implement
  5.  *    the scrollbar widget.
  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: tkScrollbar.h,v 1.6 2000/11/22 01:49:38 ericm Exp $
  13.  */
  14.  
  15. #ifndef _TKSCROLLBAR
  16. #define _TKSCROLLBAR
  17.  
  18. #ifndef _TKINT
  19. #include "tkInt.h"
  20. #endif
  21. #include "tkVMacro.h"
  22.  
  23. #ifdef BUILD_tk
  24. # undef TCL_STORAGE_CLASS
  25. # define TCL_STORAGE_CLASS DLLEXPORT
  26. #endif
  27.  
  28. /*
  29.  * A data structure of the following type is kept for each scrollbar
  30.  * widget.
  31.  */
  32.  
  33. typedef struct TkScrollbar {
  34.     Tk_Window tkwin;        /* Window that embodies the scrollbar.  NULL
  35.                  * means that the window has been destroyed
  36.                  * but the data structures haven't yet been
  37.                  * cleaned up.*/
  38.     Display *display;        /* Display containing widget.  Used, among
  39.                  * other things, so that resources can be
  40.                  * freed even after tkwin has gone away. */
  41.     Tcl_Interp *interp;        /* Interpreter associated with scrollbar. */
  42.     Tcl_Command widgetCmd;    /* Token for scrollbar's widget command. */
  43.     int vertical;        /* Non-zero means vertical orientation
  44.                  * requested, zero means horizontal. */
  45.     int width;            /* Desired narrow dimension of scrollbar,
  46.                  * in pixels. */
  47.     LangCallback *command;    /* Command prefix to use when invoking
  48.                  * scrolling commands.  NULL means don't
  49.                  * invoke commands.  Malloc'ed. */
  50. #if 0
  51.     int commandSize;        /* Number of non-NULL bytes in command. */
  52. #endif
  53.     int repeatDelay;        /* How long to wait before auto-repeating
  54.                  * on scrolling actions (in ms). */
  55.     int repeatInterval;        /* Interval between autorepeats (in ms). */
  56.     int jump;            /* Value of -jump option. */
  57.  
  58.     /*
  59.      * Information used when displaying widget:
  60.      */
  61.  
  62.     int borderWidth;        /* Width of 3-D borders. */
  63.     Tk_3DBorder bgBorder;    /* Used for drawing background (all flat
  64.                  * surfaces except for trough). */
  65.     Tk_3DBorder activeBorder;    /* For drawing backgrounds when active (i.e.
  66.                  * when mouse is positioned over element). */
  67.     XColor *troughColorPtr;    /* Color for drawing trough. */
  68.     int relief;            /* Indicates whether window as a whole is
  69.                  * raised, sunken, or flat. */
  70.     int highlightWidth;        /* Width in pixels of highlight to draw
  71.                  * around widget when it has the focus.
  72.                  * <= 0 means don't draw a highlight. */
  73.     XColor *highlightBgColorPtr;
  74.                 /* Color for drawing traversal highlight
  75.                  * area when highlight is off. */
  76.     XColor *highlightColorPtr;    /* Color for drawing traversal highlight. */
  77.     int inset;            /* Total width of all borders, including
  78.                  * traversal highlight and 3-D border.
  79.                  * Indicates how much interior stuff must
  80.                  * be offset from outside edges to leave
  81.                  * room for borders. */
  82.     int elementBorderWidth;    /* Width of border to draw around elements
  83.                  * inside scrollbar (arrows and slider).
  84.                  * -1 means use borderWidth. */
  85.     int arrowLength;        /* Length of arrows along long dimension of
  86.                  * scrollbar, including space for a small gap
  87.                  * between the arrow and the slider.
  88.                  * Recomputed on window size changes. */
  89.     int sliderFirst;        /* Pixel coordinate of top or left edge
  90.                  * of slider area, including border. */
  91.     int sliderLast;        /* Coordinate of pixel just after bottom
  92.                  * or right edge of slider area, including
  93.                  * border. */
  94.     int activeField;        /* Names field to be displayed in active
  95.                  * colors, such as TOP_ARROW, or 0 for
  96.                  * no field. */
  97.     int activeRelief;        /* Value of -activeRelief option: relief
  98.                  * to use for active element. */
  99.  
  100.     /*
  101.      * Information describing the application related to the scrollbar.
  102.      * This information is provided by the application by invoking the
  103.      * "set" widget command.  This information can now be provided in
  104.      * two ways:  the "old" form (totalUnits, windowUnits, firstUnit,
  105.      * and lastUnit), or the "new" form (firstFraction and lastFraction).
  106.      * FirstFraction and lastFraction will always be valid, but
  107.      * the old-style information is only valid if the NEW_STYLE_COMMANDS
  108.      * flag is 0.
  109.      */
  110.  
  111.     int totalUnits;        /* Total dimension of application, in
  112.                  * units.  Valid only if the NEW_STYLE_COMMANDS
  113.                  * flag isn't set. */
  114.     int windowUnits;        /* Maximum number of units that can be
  115.                  * displayed in the window at once.  Valid
  116.                  * only if the NEW_STYLE_COMMANDS flag isn't
  117.                  * set. */
  118.     int firstUnit;        /* Number of last unit visible in
  119.                  * application's window.  Valid only if the
  120.                  * NEW_STYLE_COMMANDS flag isn't set. */
  121.     int lastUnit;        /* Index of last unit visible in window.
  122.                  * Valid only if the NEW_STYLE_COMMANDS
  123.                  * flag isn't set. */
  124.     double firstFraction;    /* Position of first visible thing in window,
  125.                  * specified as a fraction between 0 and
  126.                  * 1.0. */
  127.     double lastFraction;    /* Position of last visible thing in window,
  128.                  * specified as a fraction between 0 and
  129.                  * 1.0. */
  130.  
  131.     /*
  132.      * Miscellaneous information:
  133.      */
  134.  
  135.     Tk_Cursor cursor;        /* Current cursor for window, or None. */
  136.     char *takeFocus;        /* Value of -takefocus option;  not used in
  137.                  * the C code, but used by keyboard traversal
  138.                  * scripts.  Malloc'ed, but may be NULL. */
  139.     int flags;            /* Various flags;  see below for
  140.                  * definitions. */
  141. } TkScrollbar;
  142.  
  143. /*
  144.  * Legal values for "activeField" field of Scrollbar structures.  These
  145.  * are also the return values from the ScrollbarPosition procedure.
  146.  */
  147.  
  148. #define OUTSIDE        0
  149. #define TOP_ARROW    1
  150. #define TOP_GAP        2
  151. #define SLIDER        3
  152. #define BOTTOM_GAP    4
  153. #define BOTTOM_ARROW    5
  154.  
  155. /*
  156.  * Flag bits for scrollbars:
  157.  * 
  158.  * REDRAW_PENDING:        Non-zero means a DoWhenIdle handler
  159.  *                has already been queued to redraw
  160.  *                this window.
  161.  * NEW_STYLE_COMMANDS:        Non-zero means the new style of commands
  162.  *                should be used to communicate with the
  163.  *                widget:  ".t yview scroll 2 lines", instead
  164.  *                of ".t yview 40", for example.
  165.  * GOT_FOCUS:            Non-zero means this window has the input
  166.  *                focus.
  167.  */
  168.  
  169. #define REDRAW_PENDING        1
  170. #define NEW_STYLE_COMMANDS    2
  171. #define GOT_FOCUS        4
  172.  
  173. /*
  174.  * Declaration of scrollbar class procedures structure.
  175.  */
  176.  
  177. extern Tk_ClassProcs tkpScrollbarProcs;
  178.  
  179. /*
  180.  * Declaration of scrollbar configuration options.
  181.  */
  182.  
  183. extern Tk_ConfigSpec tkpScrollbarConfigSpecs[];
  184.  
  185. /*
  186.  * Declaration of procedures used in the implementation of the scrollbar
  187.  * widget. 
  188.  */
  189.  
  190. EXTERN void        TkScrollbarEventProc _ANSI_ARGS_((
  191.                 ClientData clientData, XEvent *eventPtr));
  192. EXTERN void        TkScrollbarEventuallyRedraw _ANSI_ARGS_((
  193.                 TkScrollbar *scrollPtr));
  194. EXTERN void        TkpComputeScrollbarGeometry _ANSI_ARGS_((
  195.                 TkScrollbar *scrollPtr));
  196. EXTERN TkScrollbar *    TkpCreateScrollbar _ANSI_ARGS_((Tk_Window tkwin));
  197. EXTERN void         TkpDestroyScrollbar _ANSI_ARGS_((
  198.                     TkScrollbar *scrollPtr));
  199. EXTERN void        TkpDisplayScrollbar _ANSI_ARGS_((
  200.                 ClientData clientData));
  201. EXTERN void        TkpConfigureScrollbar _ANSI_ARGS_((
  202.                 TkScrollbar *scrollPtr));
  203. EXTERN int        TkpScrollbarPosition _ANSI_ARGS_((
  204.                 TkScrollbar *scrollPtr, int x, int y));
  205.  
  206. # undef TCL_STORAGE_CLASS
  207. # define TCL_STORAGE_CLASS DLLIMPORT
  208.  
  209. #endif /* _TKSCROLLBAR */
  210.