diff options
-rw-r--r-- | ChangeLog | 27 | ||||
-rw-r--r-- | doc/checkbutton.n | 25 | ||||
-rw-r--r-- | doc/label.n | 23 | ||||
-rw-r--r-- | doc/radiobutton.n | 25 | ||||
-rw-r--r-- | generic/tkButton.c | 14 | ||||
-rw-r--r-- | library/button.tcl | 16 | ||||
-rw-r--r-- | tests/button.test | 10 |
7 files changed, 109 insertions, 31 deletions
@@ -1,3 +1,30 @@ +2000-05-25 Eric Melski <ericm@scriptics.com> + + * doc/radiobutton.n: Added documentation for -overrelief option. + + * doc/checkbutton.n: Added documentation for -overrelief option. + + * doc/label.n: Added documentation for -state option. + + * generic/tkButton.c: Added -overrelief option for checkbuttons, + and radiobuttons. + + * library/button.tcl (tkButtonDown, macintosh version): Added + protection against querying the -repeatdelay option from a widget + that doesn't support it (ie, checkbuttons, radiobuttons, etc). + Other platforms use a different binding script for checkbuttons + and radiobuttons, so they don't have this issue. + (tkCheckRadioEnter, windows version): Added code to handle + -overrelief for check/radiobuttons on windows. + +2000-05-22 Eric Melski <ericm@scriptics.com> + + * generic/tkButton.c: Added -activeforeground, -activebackground + for labels, for the -state option. + + * doc/label.n: Added documentation for -state option, + -activeforeground, -activebackground. + 2000-05-22 Jeff Hobbs <hobbs@scriptics.com> * win/Makefile.in (install-libraries): corrected to install X diff --git a/doc/checkbutton.n b/doc/checkbutton.n index 822ae26..a11d9a3 100644 --- a/doc/checkbutton.n +++ b/doc/checkbutton.n @@ -5,7 +5,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: checkbutton.n,v 1.2 1998/09/14 18:22:55 stanton Exp $ +'\" RCS: @(#) $Id: checkbutton.n,v 1.3 2000/05/25 16:57:23 ericm Exp $ '\" .so man.macros .TH checkbutton n 4.4 Tk "Tk Built-In Commands" @@ -16,12 +16,14 @@ checkbutton \- Create and manipulate checkbutton widgets .SH SYNOPSIS \fBcheckbutton\fI pathName \fR?\fIoptions\fR? .SO -\-activebackground \-cursor \-highlightthickness \-takefocus -\-activeforeground \-disabledforeground \-image \-text -\-anchor \-font \-justify \-textvariable -\-background \-foreground \-padx \-underline -\-bitmap \-highlightbackground \-pady \-wraplength -\-borderwidth \-highlightcolor \-relief +\-activebackground \-activeforeground \-anchor +\-background \-bitmap \-borderwidth +\-cursor \-disabledforeground \-font +\-foreground \-highlightbackground \-highlightcolor +\-highlightthickness \-image \-justify +\-padx \-pady \-relief +\-takefocus \-text \-textvariable +\-underline \-wraplength .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-command command Command @@ -47,6 +49,15 @@ this button is deselected. Defaults to ``0''. .OP \-onvalue onValue Value Specifies value to store in the button's associated variable whenever this button is selected. Defaults to ``1''. +.VS 8.4 +.OP \-overrelief overRelief OverRelief +Specifies an alternative relief for the checkbutton, to be used when the +mouse cursor is over the widget. This option can be used to make +toolbar buttons, by configuring \fB\-relief flat \-overrelief +raised\fR. If the value of this option is the empty string, then no +alternative relief is used when the mouse cursor is over the checkbutton. +The empty string is the default value. +.VE 8.4 .OP \-selectcolor selectColor Background Specifies a background color to use when the button is selected. If \fBindicatorOn\fR is true then the color applies to the indicator. diff --git a/doc/label.n b/doc/label.n index 370f4f4..edc426b 100644 --- a/doc/label.n +++ b/doc/label.n @@ -5,7 +5,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: label.n,v 1.2 1998/09/14 18:22:57 stanton Exp $ +'\" RCS: @(#) $Id: label.n,v 1.3 2000/05/25 16:57:23 ericm Exp $ '\" .so man.macros .TH label n 4.0 Tk "Tk Built-In Commands" @@ -16,11 +16,14 @@ label \- Create and manipulate label widgets .SH SYNOPSIS \fBlabel\fR \fIpathName \fR?\fIoptions\fR? .SO -\-anchor \-font \-image \-takefocus -\-background \-foreground \-justify \-text -\-bitmap \-highlightbackground \-padx \-textvariable -\-borderwidth \-highlightcolor \-pady \-underline -\-cursor \-highlightthickness \-relief \-wraplength +\-activebackground \-activeforeground \-anchor +\-background \-bitmap \-borderwidth +\-cursor \-font \-foreground +\-highlightbackground \-highlightcolor \-highlightthickness +\-image \-justify \-padx +\-pady \-relief \-takefocus +\-text \-textvariable \-underline +\-wraplength .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-height height Height @@ -30,6 +33,14 @@ screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR); for text it is in lines of text. If this option isn't specified, the label's desired height is computed from the size of the image or bitmap or text being displayed in it. +.OP \-state state State +Specifies one of three states for the label: \fBnormal\fR, \fBactive\fR, +or \fBdisabled\fR. In normal state the button is displayed using the +\fBforeground\fR and \fBbackground\fR options. In active state +the label is displayed using the \fBactiveForeground\fR and +\fBactiveBackground\fR options. In the disabled state the +\fBdisabledForeground\fR and \fBbackground\fR options determine how +the button is displayed. .OP \-width width Width Specifies a desired width for the label. If an image or bitmap is being displayed in the label then the value is in diff --git a/doc/radiobutton.n b/doc/radiobutton.n index 5b4e85c..b9de0fd 100644 --- a/doc/radiobutton.n +++ b/doc/radiobutton.n @@ -5,7 +5,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: radiobutton.n,v 1.2 1998/09/14 18:22:59 stanton Exp $ +'\" RCS: @(#) $Id: radiobutton.n,v 1.3 2000/05/25 16:57:23 ericm Exp $ '\" .so man.macros .TH radiobutton n 4.4 Tk "Tk Built-In Commands" @@ -16,12 +16,14 @@ radiobutton \- Create and manipulate radiobutton widgets .SH SYNOPSIS \fBradiobutton\fR \fIpathName \fR?\fIoptions\fR? .SO -\-activebackground \-cursor \-highlightthickness \-takefocus -\-activeforeground \-disabledforeground \-image \-text -\-anchor \-font \-justify \-textvariable -\-background \-foreground \-padx \-underline -\-bitmap \-highlightbackground \-pady \-wraplength -\-borderwidth \-highlightcolor \-relief +\-activebackground \-activeforeground \-anchor +\-background \-bitmap \-borderwidth +\-cursor \-disabledforeground \-font +\-foreground \-highlightbackground \-highlightcolor +\-highlightthickness \-image \-justify +\-padx \-pady \-relief +\-takefocus \-text \-textvariable +\-underline \-wraplength .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-command command Command @@ -51,6 +53,15 @@ for the entire widget, in place of \fBbackground\fR or \fBactiveBackground\fR, whenever the widget is selected. If specified as an empty string then no special color is used for displaying when the widget is selected. +.VS 8.4 +.OP \-overrelief overRelief OverRelief +Specifies an alternative relief for the radiobutton, to be used when the +mouse cursor is over the widget. This option can be used to make +toolbar buttons, by configuring \fB\-relief flat \-overrelief +raised\fR. If the value of this option is the empty string, then no +alternative relief is used when the mouse cursor is over the radiobutton. +The empty string is the default value. +.VE 8.4 .OP \-selectimage selectImage SelectImage Specifies an image to display (in place of the \fBimage\fR option) when the radiobutton is selected. diff --git a/generic/tkButton.c b/generic/tkButton.c index 8f70e3d..b539552 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.7 2000/05/17 21:17:20 ericm Exp $ + * RCS: @(#) $Id: tkButton.c,v 1.8 2000/05/25 16:57:23 ericm Exp $ */ #include "tkButton.h" @@ -57,6 +57,12 @@ static char *compoundStrings[] = { */ static Tk_OptionSpec labelOptionSpecs[] = { + {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", + DEF_BUTTON_ACTIVE_BG_COLOR, -1, Tk_Offset(TkButton, activeBorder), + 0, (ClientData) DEF_BUTTON_ACTIVE_BG_MONO, 0}, + {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", + DEF_BUTTON_ACTIVE_FG_COLOR, -1, Tk_Offset(TkButton, activeFg), + TK_OPTION_NULL_OK, (ClientData) DEF_BUTTON_ACTIVE_FG_MONO, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_BUTTON_ANCHOR, -1, Tk_Offset(TkButton, anchor), 0, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", @@ -303,6 +309,9 @@ static Tk_OptionSpec checkbuttonOptionSpecs[] = { DEF_BUTTON_OFF_VALUE, Tk_Offset(TkButton, offValuePtr), -1, 0, 0, 0}, {TK_OPTION_STRING, "-onvalue", "onValue", "Value", DEF_BUTTON_ON_VALUE, Tk_Offset(TkButton, onValuePtr), -1, 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_LABCHKRAD_PADX, Tk_Offset(TkButton, padXPtr), Tk_Offset(TkButton, padX), 0, 0, 0}, @@ -404,6 +413,9 @@ static Tk_OptionSpec radiobuttonOptionSpecs[] = { 0, 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_LABCHKRAD_PADX, Tk_Offset(TkButton, padXPtr), Tk_Offset(TkButton, padX), 0, 0, 0}, diff --git a/library/button.tcl b/library/button.tcl index fddccc6..bccd232 100644 --- a/library/button.tcl +++ b/library/button.tcl @@ -4,7 +4,7 @@ # checkbutton, and radiobutton widgets and provides procedures # that help in implementing those bindings. # -# RCS: @(#) $Id: button.tcl,v 1.8 2000/05/17 21:17:21 ericm Exp $ +# RCS: @(#) $Id: button.tcl,v 1.9 2000/05/25 16:57:24 ericm Exp $ # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. @@ -198,6 +198,10 @@ proc tkCheckRadioEnter w { if {[string compare [$w cget -state] "disabled"] \ && [string equal $tkPriv(buttonWindow) $w]} { $w configure -state active + if { [string compare [$w cget -overrelief] ""] } { + set tkPriv(relief) [$w cget -relief] + $w configure -relief [$w cget -overrelief] + } } set tkPriv(window) $w } @@ -496,10 +500,12 @@ proc tkButtonDown w { # If this button has a repeatdelay set up, get it going with an after after cancel $tkPriv(afterId) - set delay [$w cget -repeatdelay] - set tkPriv(repeated) 0 - if {$delay > 0} { - set tkPriv(afterId) [after $delay [list tkButtonAutoInvoke $w]] + if { ![catch {$w cget -repeatdelay} delay] } { + set delay [$w cget -repeatdelay] + set tkPriv(repeated) 0 + if {$delay > 0} { + set tkPriv(afterId) [after $delay [list tkButtonAutoInvoke $w]] + } } } } diff --git a/tests/button.test b/tests/button.test index 1c34c5c..543f595 100644 --- a/tests/button.test +++ b/tests/button.test @@ -7,7 +7,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: button.test,v 1.8 2000/05/17 21:17:22 ericm Exp $ +# RCS: @(#) $Id: button.test,v 1.9 2000/05/25 16:57:24 ericm Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { source [file join [pwd] [file dirname [info script]] defs.tcl] @@ -51,9 +51,9 @@ update set i 1 foreach test { {-activebackground #012345 #012345 non-existent - {unknown color name "non-existent"} {0 1 1 1}} + {unknown color name "non-existent"} {1 1 1 1}} {-activeforeground #ff0000 #ff0000 non-existent - {unknown color name "non-existent"} {0 1 1 1}} + {unknown color name "non-existent"} {1 1 1 1}} {-anchor nw nw bogus {bad anchor "bogus": must be n, ne, e, se, s, sw, w, nw, or center} {1 1 1 1}} {-background #ff0000 #ff0000 non-existent {unknown color name "non-existent"} {1 1 1 1}} @@ -87,7 +87,7 @@ foreach test { {-justify right right bogus {bad justification "bogus": must be left, right, or center} {1 1 1 1}} {-offvalue lousy lousy {} {} {0 0 1 0}} {-offvalue fantastic fantastic {} {} {0 0 1 0}} - {-overrelief "" "" 1.5 {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken} {0 1 0 0}} + {-overrelief "" "" 1.5 {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken} {0 1 1 1}} {-padx 12m 12m 420x {bad screen distance "420x"} {1 1 1 1}} {-pady 12m 12m 420x {bad screen distance "420x"} {1 1 1 1}} {-repeatdelay 100 100 foo {expected integer but got "foo"} {0 1 0 0}} @@ -226,7 +226,7 @@ test button-4.13 {ButtonWidgetCmd procedure, "cget" option} { } {1 {unknown option "-onvalue"}} test button-4.14 {ButtonWidgetCmd procedure, "configure" option} { llength [.c configure] -} {37} +} {38} test button-4.15 {ButtonWidgetCmd procedure, "configure" option} { list [catch {.b configure -gorp} msg] $msg } {1 {unknown option "-gorp"}} |