/[dtapublic]/projs/trunk/shared_source/c_tk_base_7_5_w_mods/tkbutton.h
ViewVC logotype

Diff of /projs/trunk/shared_source/c_tk_base_7_5_w_mods/tkbutton.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   * tkButton.h --   * tkButton.h --
5   *   *
6   *      Declarations of types and functions used to implement   *      Declarations of types and functions used to implement
7   *      button-like widgets.   *      button-like widgets.
8   *   *
9   * Copyright (c) 1996-1998 by Sun Microsystems, Inc.   * Copyright (c) 1996-1998 by Sun Microsystems, Inc.
10   *   *
11   * See the file "license.terms" for information on usage and redistribution   * See the file "license.terms" for information on usage and redistribution
12   * of this file, and for a DISCLAIMER OF ALL WARRANTIES.   * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13   *   *
14   * RCS: @(#) $Id: tkbutton.h,v 1.1.1.1 2001/06/13 04:54:50 dtashley Exp $   * RCS: @(#) $Id: tkbutton.h,v 1.1.1.1 2001/06/13 04:54:50 dtashley Exp $
15   */   */
16    
17  #ifndef _TKBUTTON  #ifndef _TKBUTTON
18  #define _TKBUTTON  #define _TKBUTTON
19    
20  #ifndef _TKINT  #ifndef _TKINT
21  #include "tkInt.h"  #include "tkInt.h"
22  #endif  #endif
23    
24  #ifdef BUILD_tk  #ifdef BUILD_tk
25  # undef TCL_STORAGE_CLASS  # undef TCL_STORAGE_CLASS
26  # define TCL_STORAGE_CLASS DLLEXPORT  # define TCL_STORAGE_CLASS DLLEXPORT
27  #endif  #endif
28    
29  /*  /*
30   * Legal values for the "state" field of TkButton records.   * Legal values for the "state" field of TkButton records.
31   */   */
32    
33  enum state {  enum state {
34      STATE_ACTIVE, STATE_DISABLED, STATE_NORMAL      STATE_ACTIVE, STATE_DISABLED, STATE_NORMAL
35  };  };
36    
37  /*  /*
38   * Legal values for the "defaultState" field of TkButton records.   * Legal values for the "defaultState" field of TkButton records.
39   */   */
40    
41  enum defaultState {  enum defaultState {
42      DEFAULT_ACTIVE, DEFAULT_DISABLED, DEFAULT_NORMAL      DEFAULT_ACTIVE, DEFAULT_DISABLED, DEFAULT_NORMAL
43  };  };
44    
45  /*  /*
46   * A data structure of the following type is kept for each   * A data structure of the following type is kept for each
47   * widget managed by this file:   * widget managed by this file:
48   */   */
49    
50  typedef struct {  typedef struct {
51      Tk_Window tkwin;            /* Window that embodies the button.  NULL      Tk_Window tkwin;            /* Window that embodies the button.  NULL
52                                   * means that the window has been destroyed. */                                   * means that the window has been destroyed. */
53      Display *display;           /* Display containing widget.  Needed to      Display *display;           /* Display containing widget.  Needed to
54                                   * free up resources after tkwin is gone. */                                   * free up resources after tkwin is gone. */
55      Tcl_Interp *interp;         /* Interpreter associated with button. */      Tcl_Interp *interp;         /* Interpreter associated with button. */
56      Tcl_Command widgetCmd;      /* Token for button's widget command. */      Tcl_Command widgetCmd;      /* Token for button's widget command. */
57      int type;                   /* Type of widget, such as TYPE_LABEL:      int type;                   /* Type of widget, such as TYPE_LABEL:
58                                   * restricts operations that may be performed                                   * restricts operations that may be performed
59                                   * on widget.  See below for legal values. */                                   * on widget.  See below for legal values. */
60      Tk_OptionTable optionTable; /* Table that defines configuration options      Tk_OptionTable optionTable; /* Table that defines configuration options
61                                   * available for this widget. */                                   * available for this widget. */
62    
63      /*      /*
64       * Information about what's in the button.       * Information about what's in the button.
65       */       */
66    
67      Tcl_Obj *textPtr;           /* Value of -text option: specifies text to      Tcl_Obj *textPtr;           /* Value of -text option: specifies text to
68                                   * display in button. */                                   * display in button. */
69      int underline;              /* Value of -underline option: specifies      int underline;              /* Value of -underline option: specifies
70                                   * index of character to underline.  < 0 means                                   * index of character to underline.  < 0 means
71                                   * don't underline anything. */                                   * don't underline anything. */
72      Tcl_Obj *textVarNamePtr;    /* Value of -textvariable option: specifies      Tcl_Obj *textVarNamePtr;    /* Value of -textvariable option: specifies
73                                   * name of variable or NULL.  If non-NULL,                                   * name of variable or NULL.  If non-NULL,
74                                   * button displays the contents of this                                   * button displays the contents of this
75                                   * variable. */                                   * variable. */
76      Pixmap bitmap;              /* Value of -bitmap option.  If not None,      Pixmap bitmap;              /* Value of -bitmap option.  If not None,
77                                   * specifies bitmap to display and text and                                   * specifies bitmap to display and text and
78                                   * textVar are ignored. */                                   * textVar are ignored. */
79      Tcl_Obj *imagePtr;          /* Value of -image option: specifies image      Tcl_Obj *imagePtr;          /* Value of -image option: specifies image
80                                   * to display in window, or NULL if none.                                   * to display in window, or NULL if none.
81                                   * If non-NULL, bitmap, text, and textVarName                                   * If non-NULL, bitmap, text, and textVarName
82                                   * are ignored.*/                                   * are ignored.*/
83      Tk_Image image;             /* Derived from imagePtr by calling      Tk_Image image;             /* Derived from imagePtr by calling
84                                   * Tk_GetImage, or NULL if imagePtr is NULL. */                                   * Tk_GetImage, or NULL if imagePtr is NULL. */
85      Tcl_Obj *selectImagePtr;    /* Value of -selectimage option: specifies      Tcl_Obj *selectImagePtr;    /* Value of -selectimage option: specifies
86                                   * image to display in window when selected,                                   * image to display in window when selected,
87                                   * or NULL if none.  Ignored if imagePtr is                                   * or NULL if none.  Ignored if imagePtr is
88                                   * NULL. */                                   * NULL. */
89      Tk_Image selectImage;       /* Derived from selectImagePtr by calling      Tk_Image selectImage;       /* Derived from selectImagePtr by calling
90                                   * Tk_GetImage, or NULL if selectImagePtr                                   * Tk_GetImage, or NULL if selectImagePtr
91                                   * is NULL. */                                   * is NULL. */
92    
93      /*      /*
94       * Information used when displaying widget:       * Information used when displaying widget:
95       */       */
96    
97      enum state state;           /* Value of -state option: specifies      enum state state;           /* Value of -state option: specifies
98                                   * state of button for display purposes.*/                                   * state of button for display purposes.*/
99      Tk_3DBorder normalBorder;   /* Value of -background option: specifies      Tk_3DBorder normalBorder;   /* Value of -background option: specifies
100                                   * color for background (and border) when                                   * color for background (and border) when
101                                   * window isn't active. */                                   * window isn't active. */
102      Tk_3DBorder activeBorder;   /* Value of -activebackground option:      Tk_3DBorder activeBorder;   /* Value of -activebackground option:
103                                   * this is the color used to draw 3-D border                                   * this is the color used to draw 3-D border
104                                   * and background when widget is active. */                                   * and background when widget is active. */
105      Tcl_Obj *borderWidthPtr;    /* Value of -borderWidth option: specifies      Tcl_Obj *borderWidthPtr;    /* Value of -borderWidth option: specifies
106                                   * width of border in pixels. */                                   * width of border in pixels. */
107      int borderWidth;            /* Integer value corresponding to      int borderWidth;            /* Integer value corresponding to
108                                   * borderWidthPtr.  Always >= 0. */                                   * borderWidthPtr.  Always >= 0. */
109      int relief;                 /* Value of -relief option: specifies 3-d      int relief;                 /* Value of -relief option: specifies 3-d
110                                   * effect for border, such as                                   * effect for border, such as
111                                   * TK_RELIEF_RAISED. */                                   * TK_RELIEF_RAISED. */
112      Tcl_Obj *highlightWidthPtr; /* Value of -highlightthickness option:      Tcl_Obj *highlightWidthPtr; /* Value of -highlightthickness option:
113                                   * specifies width in pixels of highlight to                                   * specifies width in pixels of highlight to
114                                   * draw around widget when it has the focus.                                   * draw around widget when it has the focus.
115                                   * <= 0 means don't draw a highlight. */                                   * <= 0 means don't draw a highlight. */
116      int highlightWidth;         /* Integer value corresponding to      int highlightWidth;         /* Integer value corresponding to
117                                   * highlightWidthPtr.  Always >= 0. */                                   * highlightWidthPtr.  Always >= 0. */
118      Tk_3DBorder highlightBorder;/* Value of -highlightbackground option:      Tk_3DBorder highlightBorder;/* Value of -highlightbackground option:
119                                   * specifies background with which to draw 3-D                                   * specifies background with which to draw 3-D
120                                   * default ring and focus highlight area when                                   * default ring and focus highlight area when
121                                   * highlight is off. */                                   * highlight is off. */
122      XColor *highlightColorPtr;  /* Value of -highlightcolor option:      XColor *highlightColorPtr;  /* Value of -highlightcolor option:
123                                   * specifies color for drawing traversal                                   * specifies color for drawing traversal
124                                   * highlight. */                                   * highlight. */
125      int inset;                  /* Total width of all borders, including      int inset;                  /* Total width of all borders, including
126                                   * traversal highlight and 3-D border.                                   * traversal highlight and 3-D border.
127                                   * Indicates how much interior stuff must                                   * Indicates how much interior stuff must
128                                   * be offset from outside edges to leave                                   * be offset from outside edges to leave
129                                   * room for borders. */                                   * room for borders. */
130      Tk_Font tkfont;             /* Value of -font option: specifies font      Tk_Font tkfont;             /* Value of -font option: specifies font
131                                   * to use for display text. */                                   * to use for display text. */
132      XColor *normalFg;           /* Value of -font option: specifies foreground      XColor *normalFg;           /* Value of -font option: specifies foreground
133                                   * color in normal mode. */                                   * color in normal mode. */
134      XColor *activeFg;           /* Value of -activeforeground option:      XColor *activeFg;           /* Value of -activeforeground option:
135                                   * foreground color in active mode.  NULL                                   * foreground color in active mode.  NULL
136                                   * means use -foreground instead. */                                   * means use -foreground instead. */
137      XColor *disabledFg;         /* Value of -disabledforeground option:      XColor *disabledFg;         /* Value of -disabledforeground option:
138                                   * foreground color when disabled.  NULL                                   * foreground color when disabled.  NULL
139                                   * means use normalFg with a 50% stipple                                   * means use normalFg with a 50% stipple
140                                   * instead. */                                   * instead. */
141      GC normalTextGC;            /* GC for drawing text in normal mode.  Also      GC normalTextGC;            /* GC for drawing text in normal mode.  Also
142                                   * used to copy from off-screen pixmap onto                                   * used to copy from off-screen pixmap onto
143                                   * screen. */                                   * screen. */
144      GC activeTextGC;            /* GC for drawing text in active mode (NULL      GC activeTextGC;            /* GC for drawing text in active mode (NULL
145                                   * means use normalTextGC). */                                   * means use normalTextGC). */
146      GC disabledGC;              /* Used to produce disabled effect.  If      GC disabledGC;              /* Used to produce disabled effect.  If
147                                   * disabledFg isn't NULL, this GC is used to                                   * disabledFg isn't NULL, this GC is used to
148                                   * draw button text or icon.  Otherwise                                   * draw button text or icon.  Otherwise
149                                   * text or icon is drawn with normalGC and                                   * text or icon is drawn with normalGC and
150                                   * this GC is used to stipple background                                   * this GC is used to stipple background
151                                   * across it.  For labels this is None. */                                   * across it.  For labels this is None. */
152      Pixmap gray;                /* Pixmap for displaying disabled text if      Pixmap gray;                /* Pixmap for displaying disabled text if
153                                   * disabledFg is NULL. */                                   * disabledFg is NULL. */
154      GC copyGC;                  /* Used for copying information from an      GC copyGC;                  /* Used for copying information from an
155                                   * off-screen pixmap to the screen. */                                   * off-screen pixmap to the screen. */
156      Tcl_Obj *widthPtr;          /* Value of -width option. */      Tcl_Obj *widthPtr;          /* Value of -width option. */
157      int width;                  /* Integer value corresponding to widthPtr. */      int width;                  /* Integer value corresponding to widthPtr. */
158      Tcl_Obj *heightPtr;         /* Value of -height option. */      Tcl_Obj *heightPtr;         /* Value of -height option. */
159      int height;                 /* Integer value corresponding to heightPtr. */      int height;                 /* Integer value corresponding to heightPtr. */
160      Tcl_Obj *wrapLengthPtr;     /* Value of -wraplength option: specifies      Tcl_Obj *wrapLengthPtr;     /* Value of -wraplength option: specifies
161                                   * line length (in pixels) at which to wrap                                   * line length (in pixels) at which to wrap
162                                   * onto next line.  <= 0 means don't wrap                                   * onto next line.  <= 0 means don't wrap
163                                   * except at newlines. */                                   * except at newlines. */
164      int wrapLength;             /* Integer value corresponding to      int wrapLength;             /* Integer value corresponding to
165                                   * wrapLengthPtr. */                                   * wrapLengthPtr. */
166      Tcl_Obj *padXPtr;           /* Value of -padx option: specifies how many      Tcl_Obj *padXPtr;           /* Value of -padx option: specifies how many
167                                   * pixels of extra space to leave on left and                                   * pixels of extra space to leave on left and
168                                   * right of text.  Ignored for bitmaps and                                   * right of text.  Ignored for bitmaps and
169                                   * images. */                                   * images. */
170      int padX;                   /* Integer value corresponding to padXPtr. */      int padX;                   /* Integer value corresponding to padXPtr. */
171      Tcl_Obj *padYPtr;           /* Value of -padx option: specifies how many      Tcl_Obj *padYPtr;           /* Value of -padx option: specifies how many
172                                   * pixels of extra space to leave above and                                   * pixels of extra space to leave above and
173                                   * below text.  Ignored for bitmaps and                                   * below text.  Ignored for bitmaps and
174                                   * images. */                                   * images. */
175      int padY;                   /* Integer value corresponding to padYPtr. */      int padY;                   /* Integer value corresponding to padYPtr. */
176      Tk_Anchor anchor;           /* Value of -anchor option: specifies where      Tk_Anchor anchor;           /* Value of -anchor option: specifies where
177                                   * text/bitmap should be displayed inside                                   * text/bitmap should be displayed inside
178                                   * button region. */                                   * button region. */
179      Tk_Justify justify;         /* Value of -justify option: specifies how      Tk_Justify justify;         /* Value of -justify option: specifies how
180                                   * to align lines of multi-line text. */                                   * to align lines of multi-line text. */
181      int indicatorOn;            /* Value of -indicatoron option:  1 means      int indicatorOn;            /* Value of -indicatoron option:  1 means
182                                   * draw indicator in checkbuttons and                                   * draw indicator in checkbuttons and
183                                   * radiobuttons, 0 means don't draw it. */                                   * radiobuttons, 0 means don't draw it. */
184      Tk_3DBorder selectBorder;   /* Value of -selectcolor option: specifies      Tk_3DBorder selectBorder;   /* Value of -selectcolor option: specifies
185                                   * color for drawing indicator background, or                                   * color for drawing indicator background, or
186                                   * perhaps widget background, when selected. */                                   * perhaps widget background, when selected. */
187      int textWidth;              /* Width needed to display text as requested,      int textWidth;              /* Width needed to display text as requested,
188                                   * in pixels. */                                   * in pixels. */
189      int textHeight;             /* Height needed to display text as requested,      int textHeight;             /* Height needed to display text as requested,
190                                   * in pixels. */                                   * in pixels. */
191      Tk_TextLayout textLayout;   /* Saved text layout information. */      Tk_TextLayout textLayout;   /* Saved text layout information. */
192      int indicatorSpace;         /* Horizontal space (in pixels) allocated for      int indicatorSpace;         /* Horizontal space (in pixels) allocated for
193                                   * display of indicator. */                                   * display of indicator. */
194      int indicatorDiameter;      /* Diameter of indicator, in pixels. */      int indicatorDiameter;      /* Diameter of indicator, in pixels. */
195      enum defaultState defaultState;      enum defaultState defaultState;
196                                  /* Value of -default option, such as                                  /* Value of -default option, such as
197                                   * DEFAULT_NORMAL: specifies state                                   * DEFAULT_NORMAL: specifies state
198                                   * of default ring for buttons (normal,                                   * of default ring for buttons (normal,
199                                   * active, or disabled).  NULL for other                                   * active, or disabled).  NULL for other
200                                   * classes. */                                   * classes. */
201    
202      /*      /*
203       * For check and radio buttons, the fields below are used       * For check and radio buttons, the fields below are used
204       * to manage the variable indicating the button's state.       * to manage the variable indicating the button's state.
205       */       */
206    
207      Tcl_Obj *selVarNamePtr;     /* Value of -variable option: specifies name      Tcl_Obj *selVarNamePtr;     /* Value of -variable option: specifies name
208                                   * of variable used to control selected                                   * of variable used to control selected
209                                   * state of button. */                                   * state of button. */
210      Tcl_Obj *onValuePtr;        /* Value of -offvalue option: specifies value      Tcl_Obj *onValuePtr;        /* Value of -offvalue option: specifies value
211                                   * to store in variable when this button is                                   * to store in variable when this button is
212                                   * selected. */                                   * selected. */
213      Tcl_Obj *offValuePtr;       /* Value of -offvalue option: specifies value      Tcl_Obj *offValuePtr;       /* Value of -offvalue option: specifies value
214                                   * to store in variable when this button                                   * to store in variable when this button
215                                   * isn't selected.  Used only by                                   * isn't selected.  Used only by
216                                   * checkbuttons. */                                   * checkbuttons. */
217    
218      /*      /*
219       * Miscellaneous information:       * Miscellaneous information:
220       */       */
221    
222      Tk_Cursor cursor;           /* Value of -cursor option: if not None,      Tk_Cursor cursor;           /* Value of -cursor option: if not None,
223                                   * specifies current cursor for window. */                                   * specifies current cursor for window. */
224      Tcl_Obj *takeFocusPtr;      /* Value of -takefocus option;  not used in      Tcl_Obj *takeFocusPtr;      /* Value of -takefocus option;  not used in
225                                   * the C code, but used by keyboard traversal                                   * the C code, but used by keyboard traversal
226                                   * scripts. */                                   * scripts. */
227      Tcl_Obj *commandPtr;        /* Value of -command option: specifies script      Tcl_Obj *commandPtr;        /* Value of -command option: specifies script
228                                   * to execute when button is invoked.  If                                   * to execute when button is invoked.  If
229                                   * widget is label or has no command, this                                   * widget is label or has no command, this
230                                   * is NULL. */                                   * is NULL. */
231      int flags;                  /* Various flags;  see below for      int flags;                  /* Various flags;  see below for
232                                   * definitions. */                                   * definitions. */
233  } TkButton;  } TkButton;
234    
235  /*  /*
236   * Possible "type" values for buttons.  These are the kinds of   * Possible "type" values for buttons.  These are the kinds of
237   * widgets supported by this file.  The ordering of the type   * widgets supported by this file.  The ordering of the type
238   * numbers is significant:  greater means more features and is   * numbers is significant:  greater means more features and is
239   * used in the code.   * used in the code.
240   */   */
241    
242  #define TYPE_LABEL              0  #define TYPE_LABEL              0
243  #define TYPE_BUTTON             1  #define TYPE_BUTTON             1
244  #define TYPE_CHECK_BUTTON       2  #define TYPE_CHECK_BUTTON       2
245  #define TYPE_RADIO_BUTTON       3  #define TYPE_RADIO_BUTTON       3
246    
247  /*  /*
248   * Flag bits for buttons:   * Flag bits for buttons:
249   *   *
250   * REDRAW_PENDING:              Non-zero means a DoWhenIdle handler   * REDRAW_PENDING:              Non-zero means a DoWhenIdle handler
251   *                              has already been queued to redraw   *                              has already been queued to redraw
252   *                              this window.   *                              this window.
253   * SELECTED:                    Non-zero means this button is selected,   * SELECTED:                    Non-zero means this button is selected,
254   *                              so special highlight should be drawn.   *                              so special highlight should be drawn.
255   * GOT_FOCUS:                   Non-zero means this button currently   * GOT_FOCUS:                   Non-zero means this button currently
256   *                              has the input focus.   *                              has the input focus.
257   * BUTTON_DELETED:              Non-zero needs that this button has been   * BUTTON_DELETED:              Non-zero needs that this button has been
258   *                              deleted, or is in the process of being   *                              deleted, or is in the process of being
259   *                              deleted.   *                              deleted.
260   */   */
261    
262  #define REDRAW_PENDING          1  #define REDRAW_PENDING          1
263  #define SELECTED                2  #define SELECTED                2
264  #define GOT_FOCUS               4  #define GOT_FOCUS               4
265  #define BUTTON_DELETED          0x8  #define BUTTON_DELETED          0x8
266    
267  /*  /*
268   * Declaration of variables shared between the files in the button module.   * Declaration of variables shared between the files in the button module.
269   */   */
270    
271  extern TkClassProcs tkpButtonProcs;  extern TkClassProcs tkpButtonProcs;
272    
273  /*  /*
274   * Declaration of procedures used in the implementation of the button   * Declaration of procedures used in the implementation of the button
275   * widget.   * widget.
276   */   */
277    
278  #ifndef TkpButtonSetDefaults  #ifndef TkpButtonSetDefaults
279  extern void             TkpButtonSetDefaults _ANSI_ARGS_((  extern void             TkpButtonSetDefaults _ANSI_ARGS_((
280                              Tk_OptionSpec *specPtr));                              Tk_OptionSpec *specPtr));
281  #endif  #endif
282  extern void             TkButtonWorldChanged _ANSI_ARGS_((  extern void             TkButtonWorldChanged _ANSI_ARGS_((
283                              ClientData instanceData));                              ClientData instanceData));
284  extern void             TkpComputeButtonGeometry _ANSI_ARGS_((  extern void             TkpComputeButtonGeometry _ANSI_ARGS_((
285                              TkButton *butPtr));                              TkButton *butPtr));
286  extern TkButton *       TkpCreateButton _ANSI_ARGS_((Tk_Window tkwin));  extern TkButton *       TkpCreateButton _ANSI_ARGS_((Tk_Window tkwin));
287  #ifndef TkpDestroyButton  #ifndef TkpDestroyButton
288  extern void             TkpDestroyButton _ANSI_ARGS_((TkButton *butPtr));  extern void             TkpDestroyButton _ANSI_ARGS_((TkButton *butPtr));
289  #endif  #endif
290  #ifndef TkpDisplayButton  #ifndef TkpDisplayButton
291  extern void             TkpDisplayButton _ANSI_ARGS_((ClientData clientData));  extern void             TkpDisplayButton _ANSI_ARGS_((ClientData clientData));
292  #endif  #endif
293  extern int              TkInvokeButton  _ANSI_ARGS_((TkButton *butPtr));  extern int              TkInvokeButton  _ANSI_ARGS_((TkButton *butPtr));
294    
295  # undef TCL_STORAGE_CLASS  # undef TCL_STORAGE_CLASS
296  # define TCL_STORAGE_CLASS DLLIMPORT  # define TCL_STORAGE_CLASS DLLIMPORT
297    
298  #endif /* _TKBUTTON */  #endif /* _TKBUTTON */
299    
300  /* End of tkbutton.h */  /* End of tkbutton.h */

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

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25