tkScrollbar.h
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:7k
源码类别:

通讯编程

开发平台:

Visual C++

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