summaryrefslogtreecommitdiffstats
path: root/win/tkWinButton.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2002-08-28 01:08:06 (GMT)
committerdrh <drh@noemail.net>2002-08-28 01:08:06 (GMT)
commit7e140d6c071ee633bf9cd1b45efc08252bb26974 (patch)
tree5960f61fed46a9f73cf486909c92874ca51c7171 /win/tkWinButton.c
parent0ef72c0fef6beda66f5f1e0516096e6425668a94 (diff)
downloadtk-7e140d6c071ee633bf9cd1b45efc08252bb26974.zip
tk-7e140d6c071ee633bf9cd1b45efc08252bb26974.tar.gz
tk-7e140d6c071ee633bf9cd1b45efc08252bb26974.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. FossilOrigin-Name: 9abdf011ca88bab450f8f209eef2613da8ec603f
Diffstat (limited to 'win/tkWinButton.c')
-rw-r--r--win/tkWinButton.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/win/tkWinButton.c b/win/tkWinButton.c
index a2b063b..4ca5054 100644
--- a/win/tkWinButton.c
+++ b/win/tkWinButton.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: tkWinButton.c,v 1.17 2002/07/24 19:15:10 hobbs Exp $
+ * RCS: @(#) $Id: tkWinButton.c,v 1.18 2002/08/28 01:08:06 drh Exp $
*/
#define OEMRESOURCE
@@ -383,13 +383,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;
+ }
}
/*