diff options
author | ericm <ericm> | 2000-05-10 00:09:38 (GMT) |
---|---|---|
committer | ericm <ericm> | 2000-05-10 00:09:38 (GMT) |
commit | 7ff73db610e3d2efd82c272471c0dfe16d5745b8 (patch) | |
tree | 36475aa7b20157ca2cd0fba5339eb61b1484aead /generic | |
parent | 5766ce10779959eb0437e49fc4bdb3045982a63d (diff) | |
download | tk-7ff73db610e3d2efd82c272471c0dfe16d5745b8.zip tk-7ff73db610e3d2efd82c272471c0dfe16d5745b8.tar.gz tk-7ff73db610e3d2efd82c272471c0dfe16d5745b8.tar.bz2 |
* doc/button.n: Added documentation for link relief.
* tests/button.test: Added tests for link relief for buttons.
* generic/tk.h (TK_CONFIG_LINK_OK): Added definition of
TK_RELIEF_LINK, TK_OPTION_LINK_OK and TK_CONFIG_LINK_OK. [RFE: 4348]
* generic/tk3d.c: Added support for link relief. [RFE: 4348]
* mac/tkMacButton.c (TkpDisplayButton):
* unix/tkUnixButton.c (TkpDisplayButton): Added support for link
relief. [RFE: 4348]
* generic/tkOldConfig.c (Tk_ConfigureWidget):
* generic/tkConfig.c (DoObjConfig): Added understanding of link
relief, which is allowed only for widgets that have
TK_OPTION_LINK_OK or TK_CONFIG_LINK_OK set for the "-relief"
option. [RFE: 4348]
* generic/tkButton.c: Added TK_OPTION_LINK_OK to "-relief" option
for buttons. [RFE: 4348]
* win/tkWinWm.c (EX_TRANSIENT_STYLE): Removed WS_EX_TOOLWINDOW
style bit, so that transient windows have full-size titlebars
(like the tk_getOpenFile dialog).
* win/tkWinMenu.c (GetMenuSeparatorGeometry): Tweaked height
requested for separator bars to be (linespace - (2*descent))
instead of just (linespace); this makes the separator occupy a
more correct amount of vertical space. [Bug: 5303].
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tk.h | 8 | ||||
-rw-r--r-- | generic/tk3d.c | 13 | ||||
-rw-r--r-- | generic/tkButton.c | 5 | ||||
-rw-r--r-- | generic/tkConfig.c | 30 | ||||
-rw-r--r-- | generic/tkOldConfig.c | 17 |
5 files changed, 62 insertions, 11 deletions
diff --git a/generic/tk.h b/generic/tk.h index a08c3fd..cd31a16 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.40 2000/05/03 00:18:35 hobbs Exp $ + * RCS: @(#) $Id: tk.h,v 1.41 2000/05/10 00:09:38 ericm Exp $ */ #ifndef _TK @@ -204,6 +204,9 @@ typedef struct Tk_OptionSpec { #define TK_OPTION_NULL_OK 1 #define TK_OPTION_DONT_SET_DEFAULT 8 +/* This widget allows the link relief */ +#define TK_OPTION_LINK_OK (1 << 9) + /* * Macro to use to fill in "offset" fields of the Tk_OptionSpec. * struct. Computes number of bytes from beginning of structure @@ -366,6 +369,8 @@ typedef enum { #define TK_CONFIG_DONT_SET_DEFAULT 8 #define TK_CONFIG_OPTION_SPECIFIED 0x10 #define TK_CONFIG_USER_BIT 0x100 +/* This widget allows the link relief */ +#define TK_CONFIG_LINK_OK (1 << 9) #endif /* __NO_OLD_CONFIG */ /* @@ -440,6 +445,7 @@ typedef enum { #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 8cbe0ee..805c6bc 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.6 1999/12/21 23:55:10 hobbs Exp $ + * RCS: @(#) $Id: tk3d.c,v 1.7 2000/05/10 00:09:38 ericm Exp $ */ #include "tk3d.h" @@ -20,8 +20,9 @@ * used by Tk_GetReliefFromObj. */ -static char *reliefStrings[] = {"flat", "groove", "raised", "ridge", "solid", - "sunken", (char *) NULL}; +static char *reliefStrings[] = {"flat", "groove", "raised", + "ridge", "solid", "sunken", + (char *) NULL}; /* * Forward declarations for procedures defined in this file: @@ -663,6 +664,8 @@ 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; @@ -676,7 +679,7 @@ Tk_GetRelief(interp, name, reliefPtr) char buf[200]; sprintf(buf, "bad relief type \"%.50s\": must be %s", - name, "flat, groove, raised, ridge, solid, or sunken"); + name, "flat, groove, link, raised, ridge, solid, or sunken"); Tcl_SetResult(interp, buf, TCL_VOLATILE); return TCL_ERROR; } @@ -718,6 +721,8 @@ Tk_NameOfRelief(relief) return "ridge"; } else if (relief == TK_RELIEF_SOLID) { return "solid"; + } else if (relief == TK_RELIEF_LINK) { + return "link"; } else { return "unknown relief"; } diff --git a/generic/tkButton.c b/generic/tkButton.c index 1d832c8..51d928d 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.4 2000/03/08 03:19:31 ericm Exp $ + * RCS: @(#) $Id: tkButton.c,v 1.5 2000/05/10 00:09:39 ericm Exp $ */ #include "tkButton.h" @@ -190,7 +190,8 @@ static Tk_OptionSpec buttonOptionSpecs[] = { DEF_BUTTON_PADY, Tk_Offset(TkButton, padYPtr), Tk_Offset(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", - DEF_BUTTON_RELIEF, -1, Tk_Offset(TkButton, relief), 0, 0, 0}, + DEF_BUTTON_RELIEF, -1, Tk_Offset(TkButton, relief), + TK_OPTION_LINK_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_BUTTON_STATE, -1, Tk_Offset(TkButton, state), 0, (ClientData) stateStrings, 0}, diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 471af9d..5739a7e 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.7 2000/04/25 01:02:30 hobbs Exp $ + * RCS: @(#) $Id: tkConfig.c,v 1.8 2000/05/10 00:09:39 ericm Exp $ */ /* @@ -804,10 +804,34 @@ DoObjConfig(interp, recordPtr, optionPtr, valuePtr, tkwin, savedOptionPtr) } case TK_OPTION_RELIEF: { int new; - + char *valueStr; + if (Tk_GetReliefFromObj(interp, valuePtr, &new) != TCL_OK) { - return TCL_ERROR; + /* + * 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) { + 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 9ee2a14..135e83c 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.6 2000/03/07 00:09:08 ericm Exp $ + * RCS: @(#) $Id: tkOldConfig.c,v 1.7 2000/05/10 00:09:39 ericm Exp $ */ #include "tkPort.h" @@ -486,6 +486,21 @@ DoConfig(interp, tkwin, specPtr, value, valueIsUid, widgRec) 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. + */ + + 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; + } break; case TK_CONFIG_CURSOR: case TK_CONFIG_ACTIVE_CURSOR: { |