/[dtapublic]/projs/ets/trunk/src/c_tk_base_7_5_w_mods/tkscale.h
ViewVC logotype

Diff of /projs/ets/trunk/src/c_tk_base_7_5_w_mods/tkscale.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 69 by dashley, Sat Nov 5 10:54:17 2016 UTC revision 71 by dashley, Sat Nov 5 11:07:06 2016 UTC
# Line 1  Line 1 
1  /* $Header$ */  /* $Header$ */
2    
3  /*  /*
4   * tkScale.h --   * tkScale.h --
5   *   *
6   *      Declarations of types and functions used to implement   *      Declarations of types and functions used to implement
7   *      the scale widget.   *      the scale widget.
8   *   *
9   * Copyright (c) 1996 by Sun Microsystems, Inc.   * Copyright (c) 1996 by Sun Microsystems, Inc.
10   * Copyright (c) 1999-2000 by Scriptics Corporation.   * Copyright (c) 1999-2000 by Scriptics Corporation.
11   *   *
12   * See the file "license.terms" for information on usage and redistribution   * See the file "license.terms" for information on usage and redistribution
13   * of this file, and for a DISCLAIMER OF ALL WARRANTIES.   * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14   *   *
15   * RCS: @(#) $Id: tkscale.h,v 1.1.1.1 2001/06/13 05:07:47 dtashley Exp $   * RCS: @(#) $Id: tkscale.h,v 1.1.1.1 2001/06/13 05:07:47 dtashley Exp $
16   */   */
17    
18  #ifndef _TKSCALE  #ifndef _TKSCALE
19  #define _TKSCALE  #define _TKSCALE
20    
21  #ifndef _TK  #ifndef _TK
22  #include "tk.h"  #include "tk.h"
23  #endif  #endif
24    
25  #ifdef BUILD_tk  #ifdef BUILD_tk
26  # undef TCL_STORAGE_CLASS  # undef TCL_STORAGE_CLASS
27  # define TCL_STORAGE_CLASS DLLEXPORT  # define TCL_STORAGE_CLASS DLLEXPORT
28  #endif  #endif
29    
30  /*  /*
31   * Legal values for the "orient" field of TkScale records.   * Legal values for the "orient" field of TkScale records.
32   */   */
33    
34  enum orient {  enum orient {
35      ORIENT_HORIZONTAL, ORIENT_VERTICAL      ORIENT_HORIZONTAL, ORIENT_VERTICAL
36  };  };
37    
38  /*  /*
39   * Legal values for the "state" field of TkScale records.   * Legal values for the "state" field of TkScale records.
40   */   */
41    
42  enum state {  enum state {
43      STATE_ACTIVE, STATE_DISABLED, STATE_NORMAL      STATE_ACTIVE, STATE_DISABLED, STATE_NORMAL
44  };  };
45    
46  /*  /*
47   * A data structure of the following type is kept for each scale   * A data structure of the following type is kept for each scale
48   * widget managed by this file:   * widget managed by this file:
49   */   */
50    
51  typedef struct TkScale {  typedef struct TkScale {
52      Tk_Window tkwin;            /* Window that embodies the scale.  NULL      Tk_Window tkwin;            /* Window that embodies the scale.  NULL
53                                   * means that the window has been destroyed                                   * means that the window has been destroyed
54                                   * but the data structures haven't yet been                                   * but the data structures haven't yet been
55                                   * cleaned up.*/                                   * cleaned up.*/
56      Display *display;           /* Display containing widget.  Used, among      Display *display;           /* Display containing widget.  Used, among
57                                   * other things, so that resources can be                                   * other things, so that resources can be
58                                   * freed even after tkwin has gone away. */                                   * freed even after tkwin has gone away. */
59      Tcl_Interp *interp;         /* Interpreter associated with scale. */      Tcl_Interp *interp;         /* Interpreter associated with scale. */
60      Tcl_Command widgetCmd;      /* Token for scale's widget command. */      Tcl_Command widgetCmd;      /* Token for scale's widget command. */
61      Tk_OptionTable optionTable; /* Table that defines configuration options      Tk_OptionTable optionTable; /* Table that defines configuration options
62                                   * available for this widget. */                                   * available for this widget. */
63      enum orient orient;         /* Orientation for window (vertical or      enum orient orient;         /* Orientation for window (vertical or
64                                   * horizontal). */                                   * horizontal). */
65      int width;                  /* Desired narrow dimension of scale,      int width;                  /* Desired narrow dimension of scale,
66                                   * in pixels. */                                   * in pixels. */
67      int length;                 /* Desired long dimension of scale,      int length;                 /* Desired long dimension of scale,
68                                   * in pixels. */                                   * in pixels. */
69      double value;               /* Current value of scale. */      double value;               /* Current value of scale. */
70      Tcl_Obj *varNamePtr;        /* Name of variable or NULL.      Tcl_Obj *varNamePtr;        /* Name of variable or NULL.
71                                   * If non-NULL, scale's value tracks                                   * If non-NULL, scale's value tracks
72                                   * the contents of this variable and                                   * the contents of this variable and
73                                   * vice versa. */                                   * vice versa. */
74      double fromValue;           /* Value corresponding to left or top of      double fromValue;           /* Value corresponding to left or top of
75                                   * scale. */                                   * scale. */
76      double toValue;             /* Value corresponding to right or bottom      double toValue;             /* Value corresponding to right or bottom
77                                   * of scale. */                                   * of scale. */
78      double tickInterval;        /* Distance between tick marks;      double tickInterval;        /* Distance between tick marks;
79                                   * 0 means don't display any tick marks. */                                   * 0 means don't display any tick marks. */
80      double resolution;          /* If > 0, all values are rounded to an      double resolution;          /* If > 0, all values are rounded to an
81                                   * even multiple of this value. */                                   * even multiple of this value. */
82      int digits;                 /* Number of significant digits to print      int digits;                 /* Number of significant digits to print
83                                   * in values.  0 means we get to choose the                                   * in values.  0 means we get to choose the
84                                   * number based on resolution and/or the                                   * number based on resolution and/or the
85                                   * range of the scale. */                                   * range of the scale. */
86      char format[10];            /* Sprintf conversion specifier computed from      char format[10];            /* Sprintf conversion specifier computed from
87                                   * digits and other information. */                                   * digits and other information. */
88      double bigIncrement;        /* Amount to use for large increments to      double bigIncrement;        /* Amount to use for large increments to
89                                   * scale value.  (0 means we pick a value). */                                   * scale value.  (0 means we pick a value). */
90      char *command;              /* Command prefix to use when invoking Tcl      char *command;              /* Command prefix to use when invoking Tcl
91                                   * commands because the scale value changed.                                   * commands because the scale value changed.
92                                   * NULL means don't invoke commands. */                                   * NULL means don't invoke commands. */
93      int repeatDelay;            /* How long to wait before auto-repeating      int repeatDelay;            /* How long to wait before auto-repeating
94                                   * on scrolling actions (in ms). */                                   * on scrolling actions (in ms). */
95      int repeatInterval;         /* Interval between autorepeats (in ms). */      int repeatInterval;         /* Interval between autorepeats (in ms). */
96      char *label;                /* Label to display above or to right of      char *label;                /* Label to display above or to right of
97                                   * scale;  NULL means don't display a label. */                                   * scale;  NULL means don't display a label. */
98      int labelLength;            /* Number of non-NULL chars. in label. */      int labelLength;            /* Number of non-NULL chars. in label. */
99      enum state state;           /* Values are active, normal, or disabled.      enum state state;           /* Values are active, normal, or disabled.
100                                   * Value of scale cannot be changed when                                   * Value of scale cannot be changed when
101                                   * disabled. */                                   * disabled. */
102    
103      /*      /*
104       * Information used when displaying widget:       * Information used when displaying widget:
105       */       */
106    
107      int borderWidth;            /* Width of 3-D border around window. */      int borderWidth;            /* Width of 3-D border around window. */
108      Tk_3DBorder bgBorder;       /* Used for drawing slider and other      Tk_3DBorder bgBorder;       /* Used for drawing slider and other
109                                   * background areas. */                                   * background areas. */
110      Tk_3DBorder activeBorder;   /* For drawing the slider when active. */      Tk_3DBorder activeBorder;   /* For drawing the slider when active. */
111      int sliderRelief;           /* Is slider to be drawn raised, sunken,      int sliderRelief;           /* Is slider to be drawn raised, sunken,
112                                   * etc. */                                   * etc. */
113      XColor *troughColorPtr;     /* Color for drawing trough. */      XColor *troughColorPtr;     /* Color for drawing trough. */
114      GC troughGC;                /* For drawing trough. */      GC troughGC;                /* For drawing trough. */
115      GC copyGC;                  /* Used for copying from pixmap onto screen. */      GC copyGC;                  /* Used for copying from pixmap onto screen. */
116      Tk_Font tkfont;             /* Information about text font, or NULL. */      Tk_Font tkfont;             /* Information about text font, or NULL. */
117      XColor *textColorPtr;       /* Color for drawing text. */      XColor *textColorPtr;       /* Color for drawing text. */
118      GC textGC;                  /* GC for drawing text in normal mode. */      GC textGC;                  /* GC for drawing text in normal mode. */
119      int relief;                 /* Indicates whether window as a whole is      int relief;                 /* Indicates whether window as a whole is
120                                   * raised, sunken, or flat. */                                   * raised, sunken, or flat. */
121      int highlightWidth;         /* Width in pixels of highlight to draw      int highlightWidth;         /* Width in pixels of highlight to draw
122                                   * around widget when it has the focus.                                   * around widget when it has the focus.
123                                   * <= 0 means don't draw a highlight. */                                   * <= 0 means don't draw a highlight. */
124      Tk_3DBorder highlightBorder;/* Value of -highlightbackground option:      Tk_3DBorder highlightBorder;/* Value of -highlightbackground option:
125                                   * specifies background with which to draw 3-D                                   * specifies background with which to draw 3-D
126                                   * default ring and focus highlight area when                                   * default ring and focus highlight area when
127                                   * highlight is off. */                                   * highlight is off. */
128      XColor *highlightColorPtr;  /* Color for drawing traversal highlight. */      XColor *highlightColorPtr;  /* Color for drawing traversal highlight. */
129      int inset;                  /* Total width of all borders, including      int inset;                  /* Total width of all borders, including
130                                   * traversal highlight and 3-D border.                                   * traversal highlight and 3-D border.
131                                   * Indicates how much interior stuff must                                   * Indicates how much interior stuff must
132                                   * be offset from outside edges to leave                                   * be offset from outside edges to leave
133                                   * room for borders. */                                   * room for borders. */
134      int sliderLength;           /* Length of slider, measured in pixels along      int sliderLength;           /* Length of slider, measured in pixels along
135                                   * long dimension of scale. */                                   * long dimension of scale. */
136      int showValue;              /* Non-zero means to display the scale value      int showValue;              /* Non-zero means to display the scale value
137                                   * below or to the left of the slider;  zero                                   * below or to the left of the slider;  zero
138                                   * means don't display the value. */                                   * means don't display the value. */
139    
140      /*      /*
141       * Layout information for horizontal scales, assuming that window       * Layout information for horizontal scales, assuming that window
142       * gets the size it requested:       * gets the size it requested:
143       */       */
144    
145      int horizLabelY;            /* Y-coord at which to draw label. */      int horizLabelY;            /* Y-coord at which to draw label. */
146      int horizValueY;            /* Y-coord at which to draw value text. */      int horizValueY;            /* Y-coord at which to draw value text. */
147      int horizTroughY;           /* Y-coord of top of slider trough. */      int horizTroughY;           /* Y-coord of top of slider trough. */
148      int horizTickY;             /* Y-coord at which to draw tick text. */      int horizTickY;             /* Y-coord at which to draw tick text. */
149      /*      /*
150       * Layout information for vertical scales, assuming that window       * Layout information for vertical scales, assuming that window
151       * gets the size it requested:       * gets the size it requested:
152       */       */
153    
154      int vertTickRightX;         /* X-location of right side of tick-marks. */      int vertTickRightX;         /* X-location of right side of tick-marks. */
155      int vertValueRightX;        /* X-location of right side of value string. */      int vertValueRightX;        /* X-location of right side of value string. */
156      int vertTroughX;            /* X-location of scale's slider trough. */      int vertTroughX;            /* X-location of scale's slider trough. */
157      int vertLabelX;             /* X-location of origin of label. */      int vertLabelX;             /* X-location of origin of label. */
158    
159      /*      /*
160       * Miscellaneous information:       * Miscellaneous information:
161       */       */
162    
163      int fontHeight;             /* Height of scale font. */      int fontHeight;             /* Height of scale font. */
164      Tk_Cursor cursor;           /* Current cursor for window, or None. */      Tk_Cursor cursor;           /* Current cursor for window, or None. */
165      Tcl_Obj *takeFocusPtr;      /* Value of -takefocus option;  not used in      Tcl_Obj *takeFocusPtr;      /* Value of -takefocus option;  not used in
166                                   * the C code, but used by keyboard traversal                                   * the C code, but used by keyboard traversal
167                                   * scripts.  May be NULL. */                                   * scripts.  May be NULL. */
168      int flags;                  /* Various flags;  see below for      int flags;                  /* Various flags;  see below for
169                                   * definitions. */                                   * definitions. */
170  } TkScale;  } TkScale;
171    
172  /*  /*
173   * Flag bits for scales:   * Flag bits for scales:
174   *   *
175   * REDRAW_SLIDER -              1 means slider (and numerical readout) need   * REDRAW_SLIDER -              1 means slider (and numerical readout) need
176   *                              to be redrawn.   *                              to be redrawn.
177   * REDRAW_OTHER -               1 means other stuff besides slider and value   * REDRAW_OTHER -               1 means other stuff besides slider and value
178   *                              need to be redrawn.   *                              need to be redrawn.
179   * REDRAW_ALL -                 1 means the entire widget needs to be redrawn.   * REDRAW_ALL -                 1 means the entire widget needs to be redrawn.
180   * REDRAW_PENDING -             1 means any sort of redraw is pending   * REDRAW_PENDING -             1 means any sort of redraw is pending
181   * ACTIVE -                     1 means the widget is active (the mouse is   * ACTIVE -                     1 means the widget is active (the mouse is
182   *                              in its window).   *                              in its window).
183   * INVOKE_COMMAND -             1 means the scale's command needs to be   * INVOKE_COMMAND -             1 means the scale's command needs to be
184   *                              invoked during the next redisplay (the   *                              invoked during the next redisplay (the
185   *                              value of the scale has changed since the   *                              value of the scale has changed since the
186   *                              last time the command was invoked).   *                              last time the command was invoked).
187   * SETTING_VAR -                1 means that the associated variable is   * SETTING_VAR -                1 means that the associated variable is
188   *                              being set by us, so there's no need for   *                              being set by us, so there's no need for
189   *                              ScaleVarProc to do anything.   *                              ScaleVarProc to do anything.
190   * NEVER_SET -                  1 means that the scale's value has never   * NEVER_SET -                  1 means that the scale's value has never
191   *                              been set before (so must invoke -command and   *                              been set before (so must invoke -command and
192   *                              set associated variable even if the value   *                              set associated variable even if the value
193   *                              doesn't appear to have changed).   *                              doesn't appear to have changed).
194   * GOT_FOCUS -                  1 means that the focus is currently in   * GOT_FOCUS -                  1 means that the focus is currently in
195   *                              this widget.   *                              this widget.
196   * SCALE_DELETED -              1 means the scale widget is being deleted   * SCALE_DELETED -              1 means the scale widget is being deleted
197   */   */
198    
199  #define REDRAW_SLIDER           (1<<0)  #define REDRAW_SLIDER           (1<<0)
200  #define REDRAW_OTHER            (1<<1)  #define REDRAW_OTHER            (1<<1)
201  #define REDRAW_ALL              (REDRAW_OTHER|REDRAW_SLIDER)  #define REDRAW_ALL              (REDRAW_OTHER|REDRAW_SLIDER)
202  #define REDRAW_PENDING          (1<<2)  #define REDRAW_PENDING          (1<<2)
203  #define ACTIVE                  (1<<3)  #define ACTIVE                  (1<<3)
204  #define INVOKE_COMMAND          (1<<4)  #define INVOKE_COMMAND          (1<<4)
205  #define SETTING_VAR             (1<<5)  #define SETTING_VAR             (1<<5)
206  #define NEVER_SET               (1<<6)  #define NEVER_SET               (1<<6)
207  #define GOT_FOCUS               (1<<7)  #define GOT_FOCUS               (1<<7)
208  #define SCALE_DELETED           (1<<8)  #define SCALE_DELETED           (1<<8)
209    
210  /*  /*
211   * Symbolic values for the active parts of a slider.  These are   * Symbolic values for the active parts of a slider.  These are
212   * the values that may be returned by the ScaleElement procedure.   * the values that may be returned by the ScaleElement procedure.
213   */   */
214    
215  #define OTHER           0  #define OTHER           0
216  #define TROUGH1         1  #define TROUGH1         1
217  #define SLIDER          2  #define SLIDER          2
218  #define TROUGH2         3  #define TROUGH2         3
219    
220  /*  /*
221   * Space to leave between scale area and text, and between text and   * Space to leave between scale area and text, and between text and
222   * edge of window.   * edge of window.
223   */   */
224    
225  #define SPACING 2  #define SPACING 2
226    
227  /*  /*
228   * How many characters of space to provide when formatting the   * How many characters of space to provide when formatting the
229   * scale's value:   * scale's value:
230   */   */
231    
232  #define PRINT_CHARS 150  #define PRINT_CHARS 150
233    
234  /*  /*
235   * Declaration of procedures used in the implementation of the scale   * Declaration of procedures used in the implementation of the scale
236   * widget.   * widget.
237   */   */
238    
239  extern void             TkEventuallyRedrawScale _ANSI_ARGS_((TkScale *scalePtr,  extern void             TkEventuallyRedrawScale _ANSI_ARGS_((TkScale *scalePtr,
240                              int what));                              int what));
241  extern double           TkRoundToResolution _ANSI_ARGS_((TkScale *scalePtr,  extern double           TkRoundToResolution _ANSI_ARGS_((TkScale *scalePtr,
242                              double value));                              double value));
243  extern TkScale *        TkpCreateScale _ANSI_ARGS_((Tk_Window tkwin));  extern TkScale *        TkpCreateScale _ANSI_ARGS_((Tk_Window tkwin));
244  extern void             TkpDestroyScale _ANSI_ARGS_((TkScale *scalePtr));  extern void             TkpDestroyScale _ANSI_ARGS_((TkScale *scalePtr));
245  extern void             TkpDisplayScale _ANSI_ARGS_((ClientData clientData));  extern void             TkpDisplayScale _ANSI_ARGS_((ClientData clientData));
246  extern int              TkpScaleElement _ANSI_ARGS_((TkScale *scalePtr,  extern int              TkpScaleElement _ANSI_ARGS_((TkScale *scalePtr,
247                               int x, int y));                               int x, int y));
248  extern void             TkScaleSetValue _ANSI_ARGS_((TkScale *scalePtr,  extern void             TkScaleSetValue _ANSI_ARGS_((TkScale *scalePtr,
249                              double value, int setVar, int invokeCommand));                              double value, int setVar, int invokeCommand));
250  extern double           TkScalePixelToValue _ANSI_ARGS_((TkScale *scalePtr,  extern double           TkScalePixelToValue _ANSI_ARGS_((TkScale *scalePtr,
251                              int x, int y));                              int x, int y));
252  extern int              TkScaleValueToPixel _ANSI_ARGS_((TkScale *scalePtr,  extern int              TkScaleValueToPixel _ANSI_ARGS_((TkScale *scalePtr,
253                              double value));                              double value));
254    
255  # undef TCL_STORAGE_CLASS  # undef TCL_STORAGE_CLASS
256  # define TCL_STORAGE_CLASS DLLIMPORT  # define TCL_STORAGE_CLASS DLLIMPORT
257    
258  #endif /* _TKSCALE */  #endif /* _TKSCALE */
259    
260  /* End of tkscale.h */  /* End of tkscale.h */

Legend:
Removed from v.69  
changed lines
  Added in v.71

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25