summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2003-02-25 01:39:56 (GMT)
committerhobbs <hobbs>2003-02-25 01:39:56 (GMT)
commit3cbdddcb83366ade6f30adef2061fcfb28acdb55 (patch)
tree4c002f4cc3ea18cc700eb27eda04aa292d125d7b
parent98924f4e12ca81ef22e7b29614b69db1503887f2 (diff)
downloadtk-3cbdddcb83366ade6f30adef2061fcfb28acdb55.zip
tk-3cbdddcb83366ade6f30adef2061fcfb28acdb55.tar.gz
tk-3cbdddcb83366ade6f30adef2061fcfb28acdb55.tar.bz2
* unix/tkUnixButton.c (TkpDisplayButton): Correct visual display
of disabled check/radiobutton to be more distinctive on unix. * tests/unixButton.test: [Bug #669595] (hintermayer)
-rw-r--r--ChangeLog7
-rw-r--r--tests/unixButton.test44
-rw-r--r--unix/tkUnixButton.c46
3 files changed, 70 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index 8207760..e72af98 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2003-02-24 Jeff Hobbs <jeffh@ActiveState.com>
+ * unix/tkUnixButton.c (TkpDisplayButton): Correct visual display
+ of disabled check/radiobutton to be more distinctive on unix.
+ * tests/unixButton.test: [Bug #669595] (hintermayer)
+
+ * doc/panedwindow.n: clarified the need to use 'update idle' when
+ adding unmapped windows. Needs further examination. [Bug #605105]
+
* generic/tkEntry.c (SpinboxWidgetObjCmd, EntryWidgetObjCmd):
* tests/entry.test: return 1 if selection is present even if
* tests/spinbox.test: entry/spinbox is disabled, as selection get
diff --git a/tests/unixButton.test b/tests/unixButton.test
index 85f9259..6899720 100644
--- a/tests/unixButton.test
+++ b/tests/unixButton.test
@@ -8,7 +8,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: unixButton.test,v 1.5 2002/07/13 20:28:35 dgp Exp $
+# RCS: @(#) $Id: unixButton.test,v 1.6 2003/02/25 01:39:56 hobbs Exp $
package require tcltest 2.1
namespace import -force tcltest::configure
@@ -163,21 +163,37 @@ test unixbutton-1.11 {TkpComputeButtonGeometry procedure} unix {
list [winfo reqwidth .b2] [winfo reqheight .b2]
} {27 37}
+test unixbutton-2.1 {disabled coloring check, bug 669595} unix {
+ # this was just a visual bug, but at least this shows the visual
+ deleteWindows
+ set on 1
+ set off 0
+ label .l -text "The following widgets should\
+ \nshow significant visible diffs\
+ \nfor selected vs unselected."
+ checkbutton .cb0 -anchor w -state disabled \
+ -text Unselected -variable off
+ checkbutton .cb1 -anchor w -state disabled \
+ -text Selected -variable on
+ checkbutton .cb2 -anchor w -state disabled \
+ -text Unselected -variable off -disabledforeground ""
+ checkbutton .cb3 -anchor w -state disabled \
+ -text Selected -variable on -disabledforeground ""
+ radiobutton .rb0 -anchor w -state disabled \
+ -text Unselected -variable off
+ radiobutton .rb1 -anchor w -state disabled \
+ -text Selected -variable on -value 1
+ radiobutton .rb2 -anchor w -state disabled \
+ -text Unselected -variable off -disabledforeground ""
+ radiobutton .rb3 -anchor w -state disabled \
+ -text Selected -variable on -value 1 -disabledforeground ""
+ pack .l .cb0 .cb1 .cb2 .cb3 .rb0 .rb1 .rb2 .rb3 -side top -fill x
+ after 400
+ set on
+} 1
+
deleteWindows
# cleanup
::tcltest::cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c
index 4a5887d..c9d8448 100644
--- a/unix/tkUnixButton.c
+++ b/unix/tkUnixButton.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: tkUnixButton.c,v 1.10 2002/08/28 01:08:06 drh Exp $
+ * RCS: @(#) $Id: tkUnixButton.c,v 1.11 2003/02/25 01:39:57 hobbs Exp $
*/
#include "tkButton.h"
@@ -349,15 +349,24 @@ TkpDisplayButton(clientData)
dim -= 2*butPtr->borderWidth;
if (butPtr->flags & SELECTED) {
GC gc;
- if (butPtr->state != STATE_DISABLED &&
- butPtr->selectBorder != NULL) {
- gc = Tk_3DBorderGC(tkwin, butPtr->selectBorder,
- TK_3D_FLAT_GC);
+ if (butPtr->state != STATE_DISABLED) {
+ if (butPtr->selectBorder != NULL) {
+ gc = Tk_3DBorderGC(tkwin, butPtr->selectBorder,
+ TK_3D_FLAT_GC);
+ } else {
+ gc = Tk_3DBorderGC(tkwin, butPtr->normalBorder,
+ TK_3D_FLAT_GC);
+ }
} else {
- gc = Tk_3DBorderGC(tkwin, butPtr->normalBorder,
- TK_3D_FLAT_GC);
+ if (butPtr->disabledFg != NULL) {
+ gc = butPtr->disabledGC;
+ } else {
+ gc = butPtr->normalTextGC;
+ XSetForeground(butPtr->display, butPtr->disabledGC,
+ Tk_3DBorderColor(butPtr->normalBorder)->pixel);
+ }
}
-
+
XFillRectangle(butPtr->display, pixmap, gc, x, y,
(unsigned int) dim, (unsigned int) dim);
} else {
@@ -381,13 +390,24 @@ TkpDisplayButton(clientData)
if (butPtr->flags & SELECTED) {
GC gc;
- if (butPtr->state != STATE_DISABLED &&
- butPtr->selectBorder != NULL) {
- gc = Tk_3DBorderGC(tkwin, butPtr->selectBorder, TK_3D_FLAT_GC);
+ if (butPtr->state != STATE_DISABLED) {
+ if (butPtr->selectBorder != NULL) {
+ gc = Tk_3DBorderGC(tkwin, butPtr->selectBorder,
+ TK_3D_FLAT_GC);
+ } else {
+ gc = Tk_3DBorderGC(tkwin, butPtr->normalBorder,
+ TK_3D_FLAT_GC);
+ }
} else {
- gc = Tk_3DBorderGC(tkwin, butPtr->normalBorder, TK_3D_FLAT_GC);
+ if (butPtr->disabledFg != NULL) {
+ gc = butPtr->disabledGC;
+ } else {
+ gc = butPtr->normalTextGC;
+ XSetForeground(butPtr->display, butPtr->disabledGC,
+ Tk_3DBorderColor(butPtr->normalBorder)->pixel);
+ }
}
-
+
XFillPolygon(butPtr->display, pixmap, gc, points, 4, Convex,
CoordModeOrigin);
} else {