summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorericm <ericm>2000-05-17 21:17:19 (GMT)
committerericm <ericm>2000-05-17 21:17:19 (GMT)
commit54e6352675121c47a41ffafce8b02911986cac96 (patch)
treecc806cc6c8cbd3daf45e4f418ada919e3ab812e0 /generic
parent2adfe2dab62fa99750852c0a35ff3dbedb810adc (diff)
downloadtk-54e6352675121c47a41ffafce8b02911986cac96.zip
tk-54e6352675121c47a41ffafce8b02911986cac96.tar.gz
tk-54e6352675121c47a41ffafce8b02911986cac96.tar.bz2
* doc/SetOptions.3: Added information about TK_OPTION_NULL_OK with
TK_OPTION_RELIEF. * win/tkWinButton.c: Removed bits about TK_RELIEF_LINK. * tests/button.test: Added tests for -overrelief; removed tests for -relief link. * mac/tkMacButton.c: Removed bits about TK_RELIEF_LINK. * generic/tkOldConfig.c: Removed bits about TK_RELIEF_LINK. * generic/tkConfig.c: Removed bits about TK_RELIEF_LINK; added support for TK_OPTION_NULL_OK for TK_OPTION_RELIEF. * library/button.tcl: Added binding support for -overrelief. * generic/tk3d.c (Tk_GetRelief): Added branch for TK_RELIEF_NULL. * generic/tkButton.c: Added -overrelief option; removed Enter/Leave EventProc masks and handlers. * generic/tk.h: Added TK_RELIEF_NULL definition, removed TK_RELIEF_LINK. * mac/tkMacDefault.h (DEF_BUTTON_OVER_RELIEF): * win/tkWinDefault.h (DEF_BUTTON_OVER_RELIEF): * unix/tkUnixDefault.h (DEF_BUTTON_OVER_RELIEF): Added default value for the -overrelief option.
Diffstat (limited to 'generic')
-rw-r--r--generic/tk.h9
-rw-r--r--generic/tk3d.c6
-rw-r--r--generic/tkButton.c15
-rw-r--r--generic/tkButton.h9
-rw-r--r--generic/tkConfig.c33
-rw-r--r--generic/tkOldConfig.c27
6 files changed, 25 insertions, 74 deletions
diff --git a/generic/tk.h b/generic/tk.h
index 62fab06..3b58cdd 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.42 2000/05/13 00:39:07 ericm Exp $
+ * RCS: @(#) $Id: tk.h,v 1.43 2000/05/17 21:17:20 ericm Exp $
*/
#ifndef _TK
@@ -204,9 +204,6 @@ typedef struct Tk_OptionSpec {
#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 << 6)
-
/*
* Macro to use to fill in "offset" fields of the Tk_OptionSpec.
* struct. Computes number of bytes from beginning of structure
@@ -368,8 +365,6 @@ typedef enum {
#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 << 6)
#define TK_CONFIG_USER_BIT 0x100
#endif /* __NO_OLD_CONFIG */
@@ -439,13 +434,13 @@ typedef enum {
* Relief values returned by Tk_GetRelief:
*/
+#define TK_RELIEF_NULL -1
#define TK_RELIEF_FLAT 0
#define TK_RELIEF_GROOVE 1
#define TK_RELIEF_RAISED 2
#define TK_RELIEF_RIDGE 3
#define TK_RELIEF_SOLID 4
#define TK_RELIEF_SUNKEN 5
-#define TK_RELIEF_LINK 6
/*
* "Which" argument values for Tk_3DBorderGC:
diff --git a/generic/tk3d.c b/generic/tk3d.c
index 98375f6..e6ba11a 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.9 2000/05/13 00:39:07 ericm Exp $
+ * RCS: @(#) $Id: tk3d.c,v 1.10 2000/05/17 21:17:20 ericm Exp $
*/
#include "tk3d.h"
@@ -720,8 +720,8 @@ Tk_NameOfRelief(relief)
return "ridge";
} else if (relief == TK_RELIEF_SOLID) {
return "solid";
- } else if (relief == TK_RELIEF_LINK) {
- return "link";
+ } else if (relief == TK_RELIEF_NULL) {
+ return "";
} else {
return "unknown relief";
}
diff --git a/generic/tkButton.c b/generic/tkButton.c
index e3c9d86..8f70e3d 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.6 2000/05/13 00:39:07 ericm Exp $
+ * RCS: @(#) $Id: tkButton.c,v 1.7 2000/05/17 21:17:20 ericm Exp $
*/
#include "tkButton.h"
@@ -198,6 +198,9 @@ static Tk_OptionSpec buttonOptionSpecs[] = {
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
DEF_BUTTON_JUSTIFY, -1, Tk_Offset(TkButton, justify), 0, 0, 0},
+ {TK_OPTION_RELIEF, "-overrelief", "overRelief", "OverRelief",
+ DEF_BUTTON_OVER_RELIEF, -1, Tk_Offset(TkButton, overRelief),
+ TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-padx", "padX", "Pad",
DEF_BUTTON_PADX, Tk_Offset(TkButton, padXPtr),
Tk_Offset(TkButton, padX), 0, 0, 0},
@@ -206,7 +209,7 @@ static Tk_OptionSpec buttonOptionSpecs[] = {
Tk_Offset(TkButton, padY), 0, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
DEF_BUTTON_RELIEF, -1, Tk_Offset(TkButton, relief),
- TK_OPTION_LINK_OK, 0, 0},
+ 0, 0, 0},
{TK_OPTION_INT, "-repeatdelay", "repeatDelay", "RepeatDelay",
DEF_BUTTON_REPEAT_DELAY, -1, Tk_Offset(TkButton, repeatDelay),
0, 0, 0},
@@ -713,7 +716,7 @@ ButtonCreate(clientData, interp, objc, objv, type)
butPtr->flags = 0;
Tk_CreateEventHandler(butPtr->tkwin,
- ExposureMask|StructureNotifyMask|FocusChangeMask|EnterWindowMask|LeaveWindowMask,
+ ExposureMask|StructureNotifyMask|FocusChangeMask,
ButtonEventProc, (ClientData) butPtr);
if (Tk_InitOptions(interp, (char *) butPtr, optionTable, tkwin)
@@ -1397,12 +1400,6 @@ 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 cb774f9..97cc1f0 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.6 2000/05/13 00:39:07 ericm Exp $
+ * RCS: @(#) $Id: tkButton.h,v 1.7 2000/05/17 21:17:20 ericm Exp $
*/
#ifndef _TKBUTTON
@@ -116,6 +116,10 @@ typedef struct {
int relief; /* Value of -relief option: specifies 3-d
* effect for border, such as
* TK_RELIEF_RAISED. */
+ int overRelief; /* Value of -overrelief option: specifies a 3-d
+ * effect for the border, such as
+ * TK_RELIEF_RAISED, to be used when the mouse
+ * is over the button. */
Tcl_Obj *highlightWidthPtr; /* Value of -highlightthickness option:
* specifies width in pixels of highlight to
* draw around widget when it has the focus.
@@ -273,15 +277,12 @@ 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 << 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/tkConfig.c b/generic/tkConfig.c
index 5739a7e..0f2bea5 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -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: tkConfig.c,v 1.8 2000/05/10 00:09:39 ericm Exp $
+ * RCS: @(#) $Id: tkConfig.c,v 1.9 2000/05/17 21:17:20 ericm Exp $
*/
/*
@@ -804,34 +804,15 @@ DoObjConfig(interp, recordPtr, optionPtr, valuePtr, tkwin, savedOptionPtr)
}
case TK_OPTION_RELIEF: {
int new;
- char *valueStr;
-
- if (Tk_GetReliefFromObj(interp, valuePtr, &new) != TCL_OK) {
- /*
- * In order that error messages be handled properly, we let
- * GetReliefFromObj 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 ((specPtr->flags & TK_OPTION_LINK_OK) == 0) {
+
+ if (nullOK && ObjectIsEmpty(valuePtr)) {
+ valuePtr = NULL;
+ new = TK_RELIEF_NULL;
+ } else {
+ if (Tk_GetReliefFromObj(interp, valuePtr, &new) != TCL_OK) {
return TCL_ERROR;
- } else {
- valueStr = Tcl_GetString(valuePtr);
- if (valueStr[0] == 'l' && strcmp(valueStr, "link") == 0) {
- new = TK_RELIEF_LINK;
- Tcl_ResetResult(interp);
- } else {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "bad relief \"",
- valueStr, "\": must be flat, groove, link, "
- "raised, ridge, solid, or sunken",
- (char *)NULL);
- return TCL_ERROR;
- }
}
}
-
if (internalPtr != NULL) {
*((int *) oldInternalPtr) = *((int *) internalPtr);
*((int *) internalPtr) = new;
diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c
index 3a373c0..61b1258 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.8 2000/05/13 00:39:07 ericm Exp $
+ * RCS: @(#) $Id: tkOldConfig.c,v 1.9 2000/05/17 21:17:21 ericm Exp $
*/
#include "tkPort.h"
@@ -483,32 +483,9 @@ DoConfig(interp, tkwin, specPtr, value, valueIsUid, widgRec)
}
case TK_CONFIG_RELIEF:
uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
- /*
- * 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 (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;
- }
- }
+ return TCL_ERROR;
}
-
break;
case TK_CONFIG_CURSOR:
case TK_CONFIG_ACTIVE_CURSOR: {