#
# $Id: button.tcl,v 1.1 2003/12/29 00:02:39 jenglish Exp $
#
# Bindings for Buttons, Checkbuttons, and Radiobuttons:
#
# Notes: <Button1-Leave>, <Button1-Enter> only control the "pressed"
# state; widgets remain "active" if the pointer is dragged out.
# This doesn't seem to be conventional, but it's a nice way
# to provide extra feedback while the grab is active.
# (If the button is released off the widget, the grab deactivates and
# we get a <Leave> event then, which turns off the "active" state)
#
namespace eval tile {
foreach class {TButton TCheckbutton TRadiobutton} {
bind $class <Enter> { %W state active }
bind $class <Leave> { %W state !active }
bind $class <Key-space> { tile::activate %W }
bind $class <<Invoke>> { tile::activate %W }
bind $class <ButtonPress-1> { %W instate !disabled {focus %W;tile::arm %W} }
bind $class <Button1-Leave> { %W instate !disabled { tile::disarm %W } }
bind $class <Button1-Enter> { %W instate !disabled { tile::arm %W } }
bind $class <ButtonRelease-1> \
{ %W instate {!disabled pressed} { tile::disarm %W; %W invoke } }
}
# bind TCheckbutton <KeyPress-plus> { %W select }
# bind TCheckbutton <KeyPress-minus> { %W deselect }
}