summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tk.h22
-rw-r--r--generic/tk3d.c6
-rw-r--r--generic/tkButton.c37
-rw-r--r--generic/tkButton.h32
-rw-r--r--generic/tkOldConfig.c40
5 files changed, 98 insertions, 39 deletions
diff --git a/generic/tk.h b/generic/tk.h
index cd31a16..62fab06 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tk.h,v 1.41 2000/05/10 00:09:38 ericm Exp $
+ * RCS: @(#) $Id: tk.h,v 1.42 2000/05/13 00:39:07 ericm Exp $
*/
#ifndef _TK
@@ -201,11 +201,11 @@ typedef struct Tk_OptionSpec {
* carefully.
*/
-#define TK_OPTION_NULL_OK 1
-#define TK_OPTION_DONT_SET_DEFAULT 8
+#define TK_OPTION_NULL_OK (1 << 0)
+#define TK_OPTION_DONT_SET_DEFAULT (1 << 3)
/* This widget allows the link relief */
-#define TK_OPTION_LINK_OK (1 << 9)
+#define TK_OPTION_LINK_OK (1 << 6)
/*
* Macro to use to fill in "offset" fields of the Tk_OptionSpec.
@@ -363,14 +363,14 @@ typedef enum {
* tkOldConfig.c (internal-use-only flags are defined there).
*/
-#define TK_CONFIG_NULL_OK 1
-#define TK_CONFIG_COLOR_ONLY 2
-#define TK_CONFIG_MONO_ONLY 4
-#define TK_CONFIG_DONT_SET_DEFAULT 8
-#define TK_CONFIG_OPTION_SPECIFIED 0x10
-#define TK_CONFIG_USER_BIT 0x100
+#define TK_CONFIG_NULL_OK (1 << 0)
+#define TK_CONFIG_COLOR_ONLY (1 << 1)
+#define TK_CONFIG_MONO_ONLY (1 << 2)
+#define TK_CONFIG_DONT_SET_DEFAULT (1 << 3)
+#define TK_CONFIG_OPTION_SPECIFIED (1 << 4)
/* This widget allows the link relief */
-#define TK_CONFIG_LINK_OK (1 << 9)
+#define TK_CONFIG_LINK_OK (1 << 6)
+#define TK_CONFIG_USER_BIT 0x100
#endif /* __NO_OLD_CONFIG */
/*
diff --git a/generic/tk3d.c b/generic/tk3d.c
index 5147e95..98375f6 100644
--- a/generic/tk3d.c
+++ b/generic/tk3d.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tk3d.c,v 1.8 2000/05/11 22:37:06 hobbs Exp $
+ * RCS: @(#) $Id: tk3d.c,v 1.9 2000/05/13 00:39:07 ericm Exp $
*/
#include "tk3d.h"
@@ -665,8 +665,6 @@ Tk_GetRelief(interp, name, reliefPtr)
} else if ((c == 'g') && (strncmp(name, "groove", length) == 0)
&& (length >= 2)) {
*reliefPtr = TK_RELIEF_GROOVE;
- } else if ((c == 'l') && (strncmp(name, "link", length) == 0)) {
- *reliefPtr = TK_RELIEF_LINK;
} else if ((c == 'r') && (strncmp(name, "raised", length) == 0)
&& (length >= 2)) {
*reliefPtr = TK_RELIEF_RAISED;
@@ -680,7 +678,7 @@ Tk_GetRelief(interp, name, reliefPtr)
char buf[200];
sprintf(buf, "bad relief type \"%.50s\": must be %s",
- name, "flat, groove, link, raised, ridge, solid, or sunken");
+ name, "flat, groove, raised, ridge, solid, or sunken");
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_ERROR;
}
diff --git a/generic/tkButton.c b/generic/tkButton.c
index 51d928d..e3c9d86 100644
--- a/generic/tkButton.c
+++ b/generic/tkButton.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkButton.c,v 1.5 2000/05/10 00:09:39 ericm Exp $
+ * RCS: @(#) $Id: tkButton.c,v 1.6 2000/05/13 00:39:07 ericm Exp $
*/
#include "tkButton.h"
@@ -43,6 +43,15 @@ static char *stateStrings[] = {
};
/*
+ * The following table defines the legal values for the -compound option.
+ * It is used with the "enum compound" declaration in tkButton.h
+ */
+
+static char *compoundStrings[] = {
+ "bottom", "center", "left", "none", "right", "top", (char *) NULL
+};
+
+/*
* Information used for parsing configuration options. There is a
* separate table for each of the four widget classes.
*/
@@ -63,6 +72,9 @@ static Tk_OptionSpec labelOptionSpecs[] = {
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
DEF_BUTTON_BORDER_WIDTH, Tk_Offset(TkButton, borderWidthPtr),
Tk_Offset(TkButton, borderWidth), 0, 0, 0},
+ {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
+ DEF_BUTTON_COMPOUND, -1, Tk_Offset(TkButton, compound), 0,
+ (ClientData) compoundStrings, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_BUTTON_CURSOR, -1, Tk_Offset(TkButton, cursor),
TK_OPTION_NULL_OK, 0, 0},
@@ -149,6 +161,9 @@ static Tk_OptionSpec buttonOptionSpecs[] = {
{TK_OPTION_STRING, "-command", "command", "Command",
DEF_BUTTON_COMMAND, Tk_Offset(TkButton, commandPtr), -1,
TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
+ DEF_BUTTON_COMPOUND, -1, Tk_Offset(TkButton, compound), 0,
+ (ClientData) compoundStrings, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_BUTTON_CURSOR, -1, Tk_Offset(TkButton, cursor),
TK_OPTION_NULL_OK, 0, 0},
@@ -192,6 +207,12 @@ static Tk_OptionSpec buttonOptionSpecs[] = {
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
DEF_BUTTON_RELIEF, -1, Tk_Offset(TkButton, relief),
TK_OPTION_LINK_OK, 0, 0},
+ {TK_OPTION_INT, "-repeatdelay", "repeatDelay", "RepeatDelay",
+ DEF_BUTTON_REPEAT_DELAY, -1, Tk_Offset(TkButton, repeatDelay),
+ 0, 0, 0},
+ {TK_OPTION_INT, "-repeatinterval", "repeatInterval", "RepeatInterval",
+ DEF_BUTTON_REPEAT_INTERVAL, -1, Tk_Offset(TkButton, repeatInterval),
+ 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-state", "state", "State",
DEF_BUTTON_STATE, -1, Tk_Offset(TkButton, state),
0, (ClientData) stateStrings, 0},
@@ -239,6 +260,9 @@ static Tk_OptionSpec checkbuttonOptionSpecs[] = {
{TK_OPTION_STRING, "-command", "command", "Command",
DEF_BUTTON_COMMAND, Tk_Offset(TkButton, commandPtr), -1,
TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
+ DEF_BUTTON_COMPOUND, -1, Tk_Offset(TkButton, compound), 0,
+ (ClientData) compoundStrings, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_BUTTON_CURSOR, -1, Tk_Offset(TkButton, cursor),
TK_OPTION_NULL_OK, 0, 0},
@@ -340,6 +364,9 @@ static Tk_OptionSpec radiobuttonOptionSpecs[] = {
{TK_OPTION_STRING, "-command", "command", "Command",
DEF_BUTTON_COMMAND, Tk_Offset(TkButton, commandPtr), -1,
TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
+ DEF_BUTTON_COMPOUND, -1, Tk_Offset(TkButton, compound), 0,
+ (ClientData) compoundStrings, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_BUTTON_CURSOR, -1, Tk_Offset(TkButton, cursor),
TK_OPTION_NULL_OK, 0, 0},
@@ -686,7 +713,7 @@ ButtonCreate(clientData, interp, objc, objv, type)
butPtr->flags = 0;
Tk_CreateEventHandler(butPtr->tkwin,
- ExposureMask|StructureNotifyMask|FocusChangeMask,
+ ExposureMask|StructureNotifyMask|FocusChangeMask|EnterWindowMask|LeaveWindowMask,
ButtonEventProc, (ClientData) butPtr);
if (Tk_InitOptions(interp, (char *) butPtr, optionTable, tkwin)
@@ -1370,6 +1397,12 @@ ButtonEventProc(clientData, eventPtr)
goto redraw;
}
}
+ } else if (eventPtr->type == EnterNotify) {
+ butPtr->flags |= MOUSE_IN_BUTTON;
+ goto redraw;
+ } else if (eventPtr->type == LeaveNotify) {
+ butPtr->flags &= ~MOUSE_IN_BUTTON;
+ goto redraw;
}
return;
diff --git a/generic/tkButton.h b/generic/tkButton.h
index ae24bae..cb774f9 100644
--- a/generic/tkButton.h
+++ b/generic/tkButton.h
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkButton.h,v 1.5 1999/04/16 01:51:11 stanton Exp $
+ * RCS: @(#) $Id: tkButton.h,v 1.6 2000/05/13 00:39:07 ericm Exp $
*/
#ifndef _TKBUTTON
@@ -25,6 +25,15 @@
#endif
/*
+ * Legal values for the "compound" field of TkButton records.
+ */
+
+enum compound {
+ COMPOUND_BOTTOM, COMPOUND_CENTER, COMPOUND_LEFT, COMPOUND_NONE,
+ COMPOUND_RIGHT, COMPOUND_TOP
+};
+
+/*
* Legal values for the "state" field of TkButton records.
*/
@@ -226,6 +235,15 @@ typedef struct {
* to execute when button is invoked. If
* widget is label or has no command, this
* is NULL. */
+ int compound; /* Value of -compound option; specifies whether
+ * the button should show both an image and
+ * text, and, if so, how. */
+ int repeatDelay; /* Value of -repeatdelay option; specifies
+ * the number of ms after which the button will
+ * start to auto-repeat its command. */
+ int repeatInterval; /* Value of -repeatinterval option; specifies
+ * the number of ms between auto-repeat
+ * invocataions of the button command. */
int flags; /* Various flags; see below for
* definitions. */
} TkButton;
@@ -255,13 +273,15 @@ typedef struct {
* BUTTON_DELETED: Non-zero needs that this button has been
* deleted, or is in the process of being
* deleted.
+ * MOUSE_IN_BUTTON: Non-zero means that the mouse is currently
+ * over the button.
*/
-#define REDRAW_PENDING 1
-#define SELECTED 2
-#define GOT_FOCUS 4
-#define BUTTON_DELETED 0x8
-
+#define REDRAW_PENDING (1 << 0)
+#define SELECTED (1 << 1)
+#define GOT_FOCUS (1 << 2)
+#define BUTTON_DELETED (1 << 3)
+#define MOUSE_IN_BUTTON (1 << 4)
/*
* Declaration of variables shared between the files in the button module.
*/
diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c
index 135e83c..3a373c0 100644
--- a/generic/tkOldConfig.c
+++ b/generic/tkOldConfig.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkOldConfig.c,v 1.7 2000/05/10 00:09:39 ericm Exp $
+ * RCS: @(#) $Id: tkOldConfig.c,v 1.8 2000/05/13 00:39:07 ericm Exp $
*/
#include "tkPort.h"
@@ -483,24 +483,32 @@ DoConfig(interp, tkwin, specPtr, value, valueIsUid, widgRec)
}
case TK_CONFIG_RELIEF:
uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
- if (Tk_GetRelief(interp, uid, (int *) ptr) != TCL_OK) {
- return TCL_ERROR;
- }
-
/*
- * Not all widgets allow the link relief. If the given
- * relief is "link" and this widget does not support it,
- * display the "invalid relief" error message and return
- * TCL_ERROR.
+ * In order that error messages be handled properly, we let
+ * GetRelief do the first pass check on the relief
+ * string. If it fails there, and the option spec doesn't
+ * allow for LINK relief, return an error. If the option spec
+ * does allow LINK relief, see if the string matches "link".
*/
-
- if ((*ptr == TK_RELIEF_LINK) && \
- ((specPtr->specFlags & TK_CONFIG_LINK_OK) == 0)) {
- Tcl_SetResult(interp, "invalid relief \"link\": must be "
- "flat, groove, raised, ridge, solid, or sunken",
- TCL_STATIC);
- return TCL_ERROR;
+
+ if (Tk_GetRelief(interp, uid, (int *) ptr) != TCL_OK) {
+ if ((specPtr->specFlags & TK_CONFIG_LINK_OK) == 0) {
+ return TCL_ERROR;
+ } else {
+ if (uid[0] == 'l' && strcmp(uid, "link") == 0) {
+ *ptr = TK_RELIEF_LINK;
+ Tcl_ResetResult(interp);
+ } else {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "bad relief \"",
+ uid, "\": must be flat, groove, link, "
+ "raised, ridge, solid, or sunken",
+ (char *)NULL);
+ return TCL_ERROR;
+ }
+ }
}
+
break;
case TK_CONFIG_CURSOR:
case TK_CONFIG_ACTIVE_CURSOR: {