summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authordrh <drh@sqlite.org>2002-08-28 01:08:06 (GMT)
committerdrh <drh@sqlite.org>2002-08-28 01:08:06 (GMT)
commit62d94160aed093a9505d60181a1509e69bd02bb6 (patch)
tree5960f61fed46a9f73cf486909c92874ca51c7171 /unix
parentcba98af9a6ea332576939b71f74b5ffbdb4c61f3 (diff)
downloadtk-62d94160aed093a9505d60181a1509e69bd02bb6.zip
tk-62d94160aed093a9505d60181a1509e69bd02bb6.tar.gz
tk-62d94160aed093a9505d60181a1509e69bd02bb6.tar.bz2
Fix for bug #582457: make radio and checkbuttons work like Windows whenmacosx_8_4_premerge_2002_08_31_trunkmacosx_8_4_merge_2002_08_30_trunk
-relief is sunken, -offrelief is flat, and -overrelief is raised.
Diffstat (limited to 'unix')
-rw-r--r--unix/tkUnixButton.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c
index bac7785..4a5887d 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.9 2002/06/17 10:54:29 drh Exp $
+ * RCS: @(#) $Id: tkUnixButton.c,v 1.10 2002/08/28 01:08:06 drh Exp $
*/
#include "tkButton.h"
@@ -115,13 +115,40 @@ TkpDisplayButton(clientData)
/*
* Override the relief specified for the button if this is a
- * checkbutton or radiobutton and there's no indicator.
+ * checkbutton or radiobutton and there's no indicator. The new
+ * relief is as follows:
+ * If the button is select --> "sunken"
+ * If relief==overrelief --> relief
+ * Otherwise --> overrelief
+ *
+ * The effect we are trying to achieve is as follows:
+ *
+ * value mouse-over? --> relief
+ * ------- ------------ --------
+ * off no flat
+ * off yes raised
+ * on no sunken
+ * on yes sunken
+ *
+ * This is accomplished by configuring the checkbutton or radiobutton
+ * like this:
+ *
+ * -indicatoron 0 -overrelief raised -offrelief flat
+ *
+ * Bindings (see library/button.tcl) will copy the -overrelief into
+ * -relief on mouseover. Hence, we can tell if we are in mouse-over by
+ * comparing relief against overRelief. This is an aweful kludge, but
+ * it gives use the desired behavior while keeping the code backwards
+ * compatible.
*/
relief = butPtr->relief;
if ((butPtr->type >= TYPE_CHECK_BUTTON) && !butPtr->indicatorOn) {
- relief = (butPtr->flags & SELECTED) ? TK_RELIEF_SUNKEN
- : butPtr->offRelief;
+ if (butPtr->flags & SELECTED) {
+ relief = TK_RELIEF_SUNKEN;
+ } else if (butPtr->overRelief != relief) {
+ relief = butPtr->offRelief;
+ }
}
offset = (butPtr->type == TYPE_BUTTON) && !Tk_StrictMotif(butPtr->tkwin);