head	1.22;
access;
symbols
	core-8-5-9:1.19.4.3
	core-8-5-8:1.19.4.1
	macosx-cocoa-merge:1.19
	macosx-cocoa-premerge:1.19
	macosx-carbon-freeze:1.19
	core-8-5-7:1.19
	core-8-5-6:1.19
	core-8-6-b1:1.19
	core-8-6-a3:1.19
	core-8-5-5:1.19
	core-8-6-a2:1.19
	core-8-5-4:1.19
	core-8-5-3:1.19
	core-8-6-a1:1.19
	core-8-4-19:1.17.2.1
	core-8-5-branch:1.19.0.4
	core-8-5-2:1.19
	core-8-4-18:1.17.2.1
	core-8-5-1:1.19
	core-8-4-17:1.17.2.1
	core-8-5-0:1.19
	core-8-5-b3:1.19
	core-8-5-b2:1.19
	core-8-4-16:1.17.2.1
	core-8-5-b1:1.19
	core-stablilizer-merge:1.19
	core-stabilizer-branch:1.19.0.2
	core-stabilizer-merge:1.19
	core-8-4-15:1.17.2.1
	core-8-5-a6:1.19
	core-8-5-a5:1.19
	core-8-4-14:1.17.2.1
	core-8-5-a4:1.19
	core-8-4-13:1.17.2.1
	core-8-4-12:1.17
	core-8-4-11:1.17
	core-8-5-a3:1.18
	core-8-4-10:1.17
	core-8-4-9-branch:1.17.0.6
	core-8-5-a2:1.18
	core-8-4-9:1.17
	core-8-4-8:1.17
	core-8-4-7:1.17
	core-8-5-a1:1.17
	core-8-4-6:1.17
	core-8-4-5:1.17
	mistachkin-dev-branch:1.17.0.4
	core-8-4-4:1.17
	core-8-4-3:1.17
	core-8-4-branch:1.17.0.2
	core-8-4-2:1.17
	core-8-4-1:1.17
	core-8-3-5:1.6
	core-8-4-0:1.17
	macosx-8-4-merge-2002-08-31-trunk:1.15
	macosx-8-4-premerge-2002-08-31-branch:1.11.2.6
	macosx-8-4-premerge-2002-08-31-trunk:1.14
	macosx-8-4-merge-2002-08-30-branch:1.11.2.5
	macosx-8-4-merge-2002-08-30-trunk:1.14
	macosx-8-4-merge-2002-08-20-branch:1.11.2.4
	macosx-8-4-merge-2002-08-20-trunk:1.14
	core-8-4-b2:1.13
	core-8-4-b1:1.13
	macosx-premerge-6-9-02:1.11.2.2
	core-8-4-a4:1.12
	core-8-3-4:1.6
	macosx-8-4-branch:1.11.0.2
	macosx-8-4-branchpoint:1.11
	core-8-4-a3:1.11
	core-8-3-3:1.6
	dgp-privates-into-namespace:1.10.0.4
	tclpro-1-5-0:1.6
	core-8-4-win-speedup:1.10.0.2
	core-8-4-a2:1.10
	tclpro-1-4-1:1.6
	tclpro-1-4-0:1.6
	core-8-3-2:1.6
	ajuba-ajuba2-2-1-base:1.6
	ajuba-ajuba2-2-0:1.6
	core-8-4-a1:1.10
	core-8-3-1-branch:1.6.0.2
	core-8-3-1:1.6
	scriptics-sc-2-0-b5:1.6
	scriptics-sc-2-0-fixed:1.6
	scriptics-sc-2-0-b2:1.6
	scriptics-sc-2-0-b1:1.6
	core-8-3-0:1.6
	core-8-3-b2:1.6
	core-8-3-b1:1.6
	scriptics-sc-1-1:1.5
	scriptics-sc-1-1-b1:1.5
	core-8-2-3:1.5
	scriptics-sc-1-1-branch:1.5.0.8
	scriptics-sc-1-1-base:1.5
	scriptics-sc-1-0:1.5
	scriptics-sc-1-0-branch:1.5.0.6
	scriptics-sc-1-0-base:1.5
	core-8-2-2:1.5
	core-8-2-1:1.5
	scriptics-bc-1-0-b1:1.5
	core-8-2-1-branch:1.5.0.4
	scriptics-tclpro-1-3-0:1.5
	core-8-2-0:1.5
	core-8-2-b3-branch:1.5.0.2
	core-8-2-b3-base:1.5
	scriptics-tclpro-1-3-b4:1.4
	core-8-2-b2:1.4
	scriptics-tclpro-1-3-b3:1.4
	core-8-2-b1:1.4
	scriptics-tclpro-1-3-b2:1.4
	merge-to-mainline-5/21/99:1.4
	scriptics-tclpro-1-3-b2-branch:1.4.0.2
	core-8-1-1:1.4
	scriptics-tclpro-1-3-b1:1.4
	core-8-1-1-base:1.4
	core-8-1-0:1.4
	merge-to-mainline-4-29-99:1.4
	merge-to-mainline-4-23-99:1.4
	core-8-1-branch-old:1.1.0.4
	core-8-0-6-branch:1.3.0.6
	core-8-0-6-base:1.3
	core-8-0-5:1.3
	core-8-1-b3:1.1.4.3
	core-8-1-b2:1.1.4.2
	dev-8-1-stubs-branch:1.1.4.2.0.2
	dev-stubs-branch:1.3.0.4
	scriptics-tclpro-1-2:1.3
	scriptics-tclpro-1-2-b2:1.3
	core-8-1-merge-2/10/99:1.3
	core-8-0-5-branch:1.3.0.2
	core-8-0-5-base:1.3
	scriptics-tclpro-1-2-b1:1.3
	scriptics-tclpro-1-2-a1:1.3
	core-8-1-b1:1.1.4.2
	core-8-0-4:1.3
	core-8-1-a2:1.1.4.1
	core-8-0-2:1.1
	core-8-0-3:1.3;
locks; strict;
comment	@# @;


1.22
date	2010.08.03.23.13.03;	author hobbs;	state Exp;
branches;
next	1.21;

1.21
date	2010.05.03.11.59.11;	author dkf;	state Exp;
branches;
next	1.20;

1.20
date	2009.10.24.00.01.48;	author dkf;	state Exp;
branches;
next	1.19;

1.19
date	2005.07.25.09.06.01;	author dkf;	state Exp;
branches
	1.19.4.1;
next	1.18;

1.18
date	2004.03.17.18.15.44;	author das;	state Exp;
branches;
next	1.17;

1.17
date	2002.09.04.02.05.52;	author hobbs;	state Exp;
branches
	1.17.2.1;
next	1.16;

1.16
date	2002.09.02.22.00.53;	author hobbs;	state Exp;
branches;
next	1.15;

1.15
date	2002.08.31.06.12.28;	author das;	state Exp;
branches;
next	1.14;

1.14
date	2002.08.13.20.53.35;	author hobbs;	state Exp;
branches;
next	1.13;

1.13
date	2002.04.23.00.48.29;	author hobbs;	state Exp;
branches;
next	1.12;

1.12
date	2001.11.23.02.04.08;	author das;	state Exp;
branches;
next	1.11;

1.11
date	2001.08.01.16.21.11;	author dgp;	state Exp;
branches
	1.11.2.1;
next	1.10;

1.10
date	2000.05.25.17.19.57;	author ericm;	state Exp;
branches
	1.10.2.1
	1.10.4.1;
next	1.9;

1.9
date	2000.05.25.16.57.24;	author ericm;	state Exp;
branches;
next	1.8;

1.8
date	2000.05.17.21.17.21;	author ericm;	state Exp;
branches;
next	1.7;

1.7
date	2000.05.13.00.39.08;	author ericm;	state Exp;
branches;
next	1.6;

1.6
date	99.09.02.17.02.52;	author hobbs;	state Exp;
branches;
next	1.5;

1.5
date	99.08.09.16.52.06;	author hobbs;	state Exp;
branches;
next	1.4;

1.4
date	99.04.16.01.51.26;	author stanton;	state Exp;
branches;
next	1.3;

1.3
date	98.09.14.18.23.22;	author stanton;	state Exp;
branches;
next	1.2;

1.2
date	98.06.27.18.05.29;	author welch;	state Exp;
branches;
next	1.1;

1.1
date	98.04.01.09.55.07;	author rjohnson;	state Exp;
branches
	1.1.4.1;
next	;

1.1.4.1
date	98.09.29.00.25.29;	author stanton;	state Exp;
branches;
next	1.1.4.2;

1.1.4.2
date	98.09.30.02.17.30;	author stanton;	state Exp;
branches;
next	1.1.4.3;

1.1.4.3
date	99.04.06.03.52.50;	author stanton;	state Exp;
branches;
next	;

1.10.2.1
date	2002.04.06.01.02.01;	author hobbs;	state Exp;
branches;
next	;

1.10.4.1
date	2001.02.28.23.29.55;	author dgp;	state Exp;
branches;
next	;

1.11.2.1
date	2001.10.15.09.22.00;	author wolfsuit;	state Exp;
branches;
next	1.11.2.2;

1.11.2.2
date	2002.02.05.02.25.16;	author wolfsuit;	state Exp;
branches;
next	1.11.2.3;

1.11.2.3
date	2002.06.10.05.38.24;	author wolfsuit;	state Exp;
branches;
next	1.11.2.4;

1.11.2.4
date	2002.08.20.20.27.09;	author das;	state Exp;
branches;
next	1.11.2.5;

1.11.2.5
date	2002.08.21.12.28.55;	author das;	state Exp;
branches;
next	1.11.2.6;

1.11.2.6
date	2002.08.30.18.18.13;	author das;	state Exp;
branches;
next	;

1.17.2.1
date	2006.01.25.18.21.41;	author dgp;	state Exp;
branches;
next	;

1.19.4.1
date	2009.10.24.00.12.03;	author dkf;	state Exp;
branches;
next	1.19.4.2;

1.19.4.2
date	2010.05.03.12.06.14;	author dkf;	state Exp;
branches;
next	1.19.4.3;

1.19.4.3
date	2010.08.03.23.12.06;	author hobbs;	state Exp;
branches;
next	;


desc
@@


1.22
log
@        * library/button.tcl (::tk::CheckEnter): use uplevel set instead
        of set :: to work with other var resolvers (itcl). [AS Bug#87409]
@
text
@# button.tcl --
#
# This file defines the default bindings for Tk label, button,
# checkbutton, and radiobutton widgets and provides procedures
# that help in implementing those bindings.
#
# RCS: @@(#) $Id: button.tcl,v 1.21 2010/05/03 11:59:11 dkf Exp $
#
# Copyright (c) 1992-1994 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
# Copyright (c) 2002 ActiveState Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#

#-------------------------------------------------------------------------
# The code below creates the default class bindings for buttons.
#-------------------------------------------------------------------------

if {[tk windowingsystem] eq "aqua"} {
    bind Radiobutton <Enter> {
	tk::ButtonEnter %W
    }
    bind Radiobutton <1> {
	tk::ButtonDown %W
    }
    bind Radiobutton <ButtonRelease-1> {
	tk::ButtonUp %W
    }
    bind Checkbutton <Enter> {
	tk::ButtonEnter %W
    }
    bind Checkbutton <1> {
	tk::ButtonDown %W
    }
    bind Checkbutton <ButtonRelease-1> {
	tk::ButtonUp %W
    }
    bind Checkbutton <Leave> {
	tk::ButtonLeave %W
    }
}
if {"windows" eq $tcl_platform(platform)} {
    bind Checkbutton <equal> {
	tk::CheckRadioInvoke %W select
    }
    bind Checkbutton <plus> {
	tk::CheckRadioInvoke %W select
    }
    bind Checkbutton <minus> {
	tk::CheckRadioInvoke %W deselect
    }
    bind Checkbutton <1> {
	tk::CheckRadioDown %W
    }
    bind Checkbutton <ButtonRelease-1> {
	tk::ButtonUp %W
    }
    bind Checkbutton <Enter> {
	tk::CheckRadioEnter %W
    }
    bind Checkbutton <Leave> {
	tk::ButtonLeave %W
    }

    bind Radiobutton <1> {
	tk::CheckRadioDown %W
    }
    bind Radiobutton <ButtonRelease-1> {
	tk::ButtonUp %W
    }
    bind Radiobutton <Enter> {
	tk::CheckRadioEnter %W
    }
}
if {"x11" eq [tk windowingsystem]} {
    bind Checkbutton <Return> {
	if {!$tk_strictMotif} {
	    tk::CheckInvoke %W
	}
    }
    bind Radiobutton <Return> {
	if {!$tk_strictMotif} {
	    tk::CheckRadioInvoke %W
	}
    }
    bind Checkbutton <1> {
	tk::CheckInvoke %W
    }
    bind Radiobutton <1> {
	tk::CheckRadioInvoke %W
    }
    bind Checkbutton <Enter> {
	tk::CheckEnter %W
    }
    bind Radiobutton <Enter> {
	tk::ButtonEnter %W
    }
    bind Checkbutton <Leave> {
	tk::CheckLeave %W
    }
}

bind Button <space> {
    tk::ButtonInvoke %W
}
bind Checkbutton <space> {
    tk::CheckRadioInvoke %W
}
bind Radiobutton <space> {
    tk::CheckRadioInvoke %W
}

bind Button <FocusIn> {}
bind Button <Enter> {
    tk::ButtonEnter %W
}
bind Button <Leave> {
    tk::ButtonLeave %W
}
bind Button <1> {
    tk::ButtonDown %W
}
bind Button <ButtonRelease-1> {
    tk::ButtonUp %W
}

bind Checkbutton <FocusIn> {}

bind Radiobutton <FocusIn> {}
bind Radiobutton <Leave> {
    tk::ButtonLeave %W
}

if {"windows" eq $tcl_platform(platform)} {

#########################
# Windows implementation 
#########################

# ::tk::ButtonEnter --
# The procedure below is invoked when the mouse pointer enters a
# button widget.  It records the button we're in and changes the
# state of the button to active unless the button is disabled.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::ButtonEnter w {
    variable ::tk::Priv
    if {[$w cget -state] ne "disabled"} {

	# If the mouse button is down, set the relief to sunken on entry.
	# Overwise, if there's an -overrelief value, set the relief to that.

	set Priv($w,relief) [$w cget -relief]
	if {$Priv(buttonWindow) eq $w} {
	    $w configure -relief sunken -state active
	    set Priv($w,prelief) sunken
	} elseif {[set over [$w cget -overrelief]] ne ""} {
	    $w configure -relief $over
	    set Priv($w,prelief) $over
	}
    }
    set Priv(window) $w
}

# ::tk::ButtonLeave --
# The procedure below is invoked when the mouse pointer leaves a
# button widget.  It changes the state of the button back to inactive.
# Restore any modified relief too.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::ButtonLeave w {
    variable ::tk::Priv
    if {[$w cget -state] ne "disabled"} {
	$w configure -state normal
    }

    # Restore the original button relief if it was changed by Tk.
    # That is signaled by the existence of Priv($w,prelief).

    if {[info exists Priv($w,relief)]} {
	if {[info exists Priv($w,prelief)] && \
		$Priv($w,prelief) eq [$w cget -relief]} {
	    $w configure -relief $Priv($w,relief)
	}
	unset -nocomplain Priv($w,relief) Priv($w,prelief)
    }

    set Priv(window) ""
}

# ::tk::ButtonDown --
# The procedure below is invoked when the mouse button is pressed in
# a button widget.  It records the fact that the mouse is in the button,
# saves the button's relief so it can be restored later, and changes
# the relief to sunken.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::ButtonDown w {
    variable ::tk::Priv

    # Only save the button's relief if it does not yet exist.  If there
    # is an overrelief setting, Priv($w,relief) will already have been set,
    # and the current value of the -relief option will be incorrect.

    if {![info exists Priv($w,relief)]} {
	set Priv($w,relief) [$w cget -relief]
    }

    if {[$w cget -state] ne "disabled"} {
	set Priv(buttonWindow) $w
	$w configure -relief sunken -state active
	set Priv($w,prelief) sunken

	# If this button has a repeatdelay set up, get it going with an after
	after cancel $Priv(afterId)
	set delay [$w cget -repeatdelay]
	set Priv(repeated) 0
	if {$delay > 0} {
	    set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
	}
    }
}

# ::tk::ButtonUp --
# The procedure below is invoked when the mouse button is released
# in a button widget.  It restores the button's relief and invokes
# the command as long as the mouse hasn't left the button.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::ButtonUp w {
    variable ::tk::Priv
    if {$Priv(buttonWindow) eq $w} {
	set Priv(buttonWindow) ""

	# Restore the button's relief if it was cached.

	if {[info exists Priv($w,relief)]} {
	    if {[info exists Priv($w,prelief)] && \
		    $Priv($w,prelief) eq [$w cget -relief]} {
		$w configure -relief $Priv($w,relief)
	    }
	    unset -nocomplain Priv($w,relief) Priv($w,prelief)
	}

	# Clean up the after event from the auto-repeater
	after cancel $Priv(afterId)

	if {$Priv(window) eq $w && [$w cget -state] ne "disabled"} {
	    $w configure -state normal

	    # Only invoke the command if it wasn't already invoked by the
	    # auto-repeater functionality
	    if { $Priv(repeated) == 0 } {
		uplevel #0 [list $w invoke]
	    }
	}
    }
}

# ::tk::CheckRadioEnter --
# The procedure below is invoked when the mouse pointer enters a
# checkbutton or radiobutton widget.  It records the button we're in
# and changes the state of the button to active unless the button is
# disabled.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::CheckRadioEnter w {
    variable ::tk::Priv
    if {[$w cget -state] ne "disabled"} {
	if {$Priv(buttonWindow) eq $w} {
	    $w configure -state active
	}
	if {[set over [$w cget -overrelief]] ne ""} {
	    set Priv($w,relief)  [$w cget -relief]
	    set Priv($w,prelief) $over
	    $w configure -relief $over
	}
    }
    set Priv(window) $w
}

# ::tk::CheckRadioDown --
# The procedure below is invoked when the mouse button is pressed in
# a button widget.  It records the fact that the mouse is in the button,
# saves the button's relief so it can be restored later, and changes
# the relief to sunken.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::CheckRadioDown w {
    variable ::tk::Priv
    if {![info exists Priv($w,relief)]} {
	set Priv($w,relief) [$w cget -relief]
    }
    if {[$w cget -state] ne "disabled"} {
	set Priv(buttonWindow) $w
	set Priv(repeated) 0
	$w configure -state active
    }
}

}

if {"x11" eq [tk windowingsystem]} {

#####################
# Unix implementation
#####################

# ::tk::ButtonEnter --
# The procedure below is invoked when the mouse pointer enters a
# button widget.  It records the button we're in and changes the
# state of the button to active unless the button is disabled.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::ButtonEnter {w} {
    variable ::tk::Priv
    if {[$w cget -state] ne "disabled"} {
	# On unix the state is active just with mouse-over
	$w configure -state active

	# If the mouse button is down, set the relief to sunken on entry.
	# Overwise, if there's an -overrelief value, set the relief to that.

	set Priv($w,relief) [$w cget -relief]
	if {$Priv(buttonWindow) eq $w} {
	    $w configure -relief sunken
	    set Priv($w,prelief) sunken
	} elseif {[set over [$w cget -overrelief]] ne ""} {
	    $w configure -relief $over
	    set Priv($w,prelief) $over
	}
    }
    set Priv(window) $w
}

# ::tk::ButtonLeave --
# The procedure below is invoked when the mouse pointer leaves a
# button widget.  It changes the state of the button back to inactive.
# Restore any modified relief too.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::ButtonLeave w {
    variable ::tk::Priv
    if {[$w cget -state] ne "disabled"} {
	$w configure -state normal
    }

    # Restore the original button relief if it was changed by Tk.
    # That is signaled by the existence of Priv($w,prelief).

    if {[info exists Priv($w,relief)]} {
	if {[info exists Priv($w,prelief)] && \
		$Priv($w,prelief) eq [$w cget -relief]} {
	    $w configure -relief $Priv($w,relief)
	}
	unset -nocomplain Priv($w,relief) Priv($w,prelief)
    }

    set Priv(window) ""
}

# ::tk::ButtonDown --
# The procedure below is invoked when the mouse button is pressed in
# a button widget.  It records the fact that the mouse is in the button,
# saves the button's relief so it can be restored later, and changes
# the relief to sunken.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::ButtonDown w {
    variable ::tk::Priv

    # Only save the button's relief if it does not yet exist.  If there
    # is an overrelief setting, Priv($w,relief) will already have been set,
    # and the current value of the -relief option will be incorrect.

    if {![info exists Priv($w,relief)]} {
	set Priv($w,relief) [$w cget -relief]
    }

    if {[$w cget -state] ne "disabled"} {
	set Priv(buttonWindow) $w
	$w configure -relief sunken
	set Priv($w,prelief) sunken

	# If this button has a repeatdelay set up, get it going with an after
	after cancel $Priv(afterId)
	set delay [$w cget -repeatdelay]
	set Priv(repeated) 0
	if {$delay > 0} {
	    set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
	}
    }
}

# ::tk::ButtonUp --
# The procedure below is invoked when the mouse button is released
# in a button widget.  It restores the button's relief and invokes
# the command as long as the mouse hasn't left the button.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::ButtonUp w {
    variable ::tk::Priv
    if {$w eq $Priv(buttonWindow)} {
	set Priv(buttonWindow) ""

	# Restore the button's relief if it was cached.

	if {[info exists Priv($w,relief)]} {
	    if {[info exists Priv($w,prelief)] && \
		    $Priv($w,prelief) eq [$w cget -relief]} {
		$w configure -relief $Priv($w,relief)
	    }
	    unset -nocomplain Priv($w,relief) Priv($w,prelief)
	}

	# Clean up the after event from the auto-repeater
	after cancel $Priv(afterId)

	if {$Priv(window) eq $w && [$w cget -state] ne "disabled"} {
	    # Only invoke the command if it wasn't already invoked by the
	    # auto-repeater functionality
	    if { $Priv(repeated) == 0 } {
		uplevel #0 [list $w invoke]
	    }
	}
    }
}

}

if {[tk windowingsystem] eq "aqua"} {

####################
# Mac implementation
####################

# ::tk::ButtonEnter --
# The procedure below is invoked when the mouse pointer enters a
# button widget.  It records the button we're in and changes the
# state of the button to active unless the button is disabled.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::ButtonEnter {w} {
    variable ::tk::Priv
    if {[$w cget -state] ne "disabled"} {

	# If there's an -overrelief value, set the relief to that.

	if {$Priv(buttonWindow) eq $w} {
	    $w configure -state active
	} elseif {[set over [$w cget -overrelief]] ne ""} {
	    set Priv($w,relief)  [$w cget -relief]
	    set Priv($w,prelief) $over
	    $w configure -relief $over
	}
    }
    set Priv(window) $w
}

# ::tk::ButtonLeave --
# The procedure below is invoked when the mouse pointer leaves a
# button widget.  It changes the state of the button back to
# inactive.  If we're leaving the button window with a mouse button
# pressed (Priv(buttonWindow) == $w), restore the relief of the
# button too.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::ButtonLeave w {
    variable ::tk::Priv
    if {$w eq $Priv(buttonWindow)} {
	$w configure -state normal
    }

    # Restore the original button relief if it was changed by Tk.
    # That is signaled by the existence of Priv($w,prelief).

    if {[info exists Priv($w,relief)]} {
	if {[info exists Priv($w,prelief)] && \
		$Priv($w,prelief) eq [$w cget -relief]} {
	    $w configure -relief $Priv($w,relief)
	}
	unset -nocomplain Priv($w,relief) Priv($w,prelief)
    }

    set Priv(window) ""
}

# ::tk::ButtonDown --
# The procedure below is invoked when the mouse button is pressed in
# a button widget.  It records the fact that the mouse is in the button,
# saves the button's relief so it can be restored later, and changes
# the relief to sunken.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::ButtonDown w {
    variable ::tk::Priv

    if {[$w cget -state] ne "disabled"} {
	set Priv(buttonWindow) $w
	$w configure -state active

	# If this button has a repeatdelay set up, get it going with an after
	after cancel $Priv(afterId)
	set Priv(repeated) 0
	if { ![catch {$w cget -repeatdelay} delay] } {
	    if {$delay > 0} {
		set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
	    }
	}
    }
}

# ::tk::ButtonUp --
# The procedure below is invoked when the mouse button is released
# in a button widget.  It restores the button's relief and invokes
# the command as long as the mouse hasn't left the button.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::ButtonUp w {
    variable ::tk::Priv
    if {$Priv(buttonWindow) eq $w} {
	set Priv(buttonWindow) ""
	$w configure -state normal

	# Restore the button's relief if it was cached.

	if {[info exists Priv($w,relief)]} {
	    if {[info exists Priv($w,prelief)] && \
		    $Priv($w,prelief) eq [$w cget -relief]} {
		$w configure -relief $Priv($w,relief)
	    }
	    unset -nocomplain Priv($w,relief) Priv($w,prelief)
	}

	# Clean up the after event from the auto-repeater
	after cancel $Priv(afterId)

	if {$Priv(window) eq $w && [$w cget -state] ne "disabled"} {
	    # Only invoke the command if it wasn't already invoked by the
	    # auto-repeater functionality
	    if { $Priv(repeated) == 0 } {
		uplevel #0 [list $w invoke]
	    }
	}
    }
}

}

##################
# Shared routines
##################

# ::tk::ButtonInvoke --
# The procedure below is called when a button is invoked through
# the keyboard.  It simulate a press of the button via the mouse.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::ButtonInvoke w {
    if {[$w cget -state] ne "disabled"} {
	set oldRelief [$w cget -relief]
	set oldState [$w cget -state]
	$w configure -state active -relief sunken
	update idletasks
	after 100
	$w configure -state $oldState -relief $oldRelief
	uplevel #0 [list $w invoke]
    }
}

# ::tk::ButtonAutoInvoke --
#
#	Invoke an auto-repeating button, and set it up to continue to repeat.
#
# Arguments:
#	w	button to invoke.
#
# Results:
#	None.
#
# Side effects:
#	May create an after event to call ::tk::ButtonAutoInvoke.

proc ::tk::ButtonAutoInvoke {w} {
    variable ::tk::Priv
    after cancel $Priv(afterId)
    set delay [$w cget -repeatinterval]
    if {$Priv(window) eq $w} {
	incr Priv(repeated)
	uplevel #0 [list $w invoke]
    }
    if {$delay > 0} {
	set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
    }
}

# ::tk::CheckRadioInvoke --
# The procedure below is invoked when the mouse button is pressed in
# a checkbutton or radiobutton widget, or when the widget is invoked
# through the keyboard.  It invokes the widget if it
# isn't disabled.
#
# Arguments:
# w -		The name of the widget.
# cmd -		The subcommand to invoke (one of invoke, select, or deselect).

proc ::tk::CheckRadioInvoke {w {cmd invoke}} {
    if {[$w cget -state] ne "disabled"} {
	uplevel #0 [list $w $cmd]
    }
}

# Special versions of the handlers for checkbuttons on Unix that do the magic
# to make things work right when the checkbutton indicator is hidden;
# radiobuttons don't need this complexity.

# ::tk::CheckInvoke --
# The procedure below invokes the checkbutton, like ButtonInvoke, but handles
# what to do when the checkbutton indicator is missing. Only used on Unix.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::CheckInvoke {w} {
    variable ::tk::Priv
    if {[$w cget -state] ne "disabled"} {
	# Additional logic to switch the "selected" colors around if necessary
	# (when we're indicator-less).

	if {![$w cget -indicatoron] && [info exist Priv($w,selectcolor)]} {
	    if {[$w cget -selectcolor] eq $Priv($w,aselectcolor)} {
		$w configure -selectcolor $Priv($w,selectcolor)
	    } else {
		$w configure -selectcolor $Priv($w,aselectcolor)
	    }
	}
	uplevel #0 [list $w invoke]
    }
}

# ::tk::CheckEnter --
# The procedure below enters the checkbutton, like ButtonEnter, but handles
# what to do when the checkbutton indicator is missing. Only used on Unix.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::CheckEnter {w} {
    variable ::tk::Priv
    if {[$w cget -state] ne "disabled"} {
	# On unix the state is active just with mouse-over
	$w configure -state active

	# If the mouse button is down, set the relief to sunken on entry.
	# Overwise, if there's an -overrelief value, set the relief to that.

	set Priv($w,relief) [$w cget -relief]
	if {$Priv(buttonWindow) eq $w} {
	    $w configure -relief sunken
	    set Priv($w,prelief) sunken
	} elseif {[set over [$w cget -overrelief]] ne ""} {
	    $w configure -relief $over
	    set Priv($w,prelief) $over
	}

	# Compute what the "selected and active" color should be.

	if {![$w cget -indicatoron] && [$w cget -selectcolor] ne ""} {
	    set Priv($w,selectcolor) [$w cget -selectcolor]
	    lassign [winfo rgb $w [$w cget -selectcolor]]      r1 g1 b1
	    lassign [winfo rgb $w [$w cget -activebackground]] r2 g2 b2
	    set Priv($w,aselectcolor) \
		[format "#%04x%04x%04x" [expr {($r1+$r2)/2}] \
		     [expr {($g1+$g2)/2}] [expr {($b1+$b2)/2}]]
	    # use uplevel to work with other var resolvers
	    if {[uplevel #0 [list set [$w cget -variable]]]
		 eq [$w cget -onvalue]} {
		$w configure -selectcolor $Priv($w,aselectcolor)
	    }
	}
    }
    set Priv(window) $w
}

# ::tk::CheckLeave --
# The procedure below leaves the checkbutton, like ButtonLeave, but handles
# what to do when the checkbutton indicator is missing. Only used on Unix.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::CheckLeave {w} {
    variable ::tk::Priv
    if {[$w cget -state] ne "disabled"} {
	$w configure -state normal
    }

    # Restore the original button "selected" color; assume that the user
    # wasn't monkeying around with things too much.

    if {![$w cget -indicatoron] && [info exist Priv($w,selectcolor)]} {
	$w configure -selectcolor $Priv($w,selectcolor)
    }
    unset -nocomplain Priv($w,selectcolor) Priv($w,aselectcolor)

    # Restore the original button relief if it was changed by Tk. That is
    # signaled by the existence of Priv($w,prelief).

    if {[info exists Priv($w,relief)]} {
	if {[info exists Priv($w,prelief)] && \
		$Priv($w,prelief) eq [$w cget -relief]} {
	    $w configure -relief $Priv($w,relief)
	}
	unset -nocomplain Priv($w,relief) Priv($w,prelief)
    }

    set Priv(window) ""
}

return

# Local Variables:
# mode: tcl
# fill-column: 78
# End:
@


1.21
log
@	* library/button.tcl (CheckInvoke, CheckEnter): [Patch 1530276 redux]:
	Apply a bit more care to ensure that things continue to work correctly
	even when there is no -selectcolor defined.
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.20 2009/10/24 00:01:48 dkf Exp $
d707 3
a709 1
	    if {[set ::[$w cget -variable]] eq [$w cget -onvalue]} {
@


1.20
log
@[Patch 1530276]: Improve no-indicator check/radio buttons on Unix.
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.19 2005/07/25 09:06:01 dkf Exp $
d662 1
a662 1
	if {![$w cget -indicatoron]} {
d700 1
a700 1
	if {![$w cget -indicatoron]} {
@


1.19
log
@Apply some of the changes suggested in [Patch 1237759]
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.18 2004/03/17 18:15:44 das Exp $
d40 3
d63 3
d80 1
a80 1
	    tk::CheckRadioInvoke %W
d89 1
a89 1
	tk::CheckRadioInvoke %W
d95 1
a95 1
	tk::ButtonEnter %W
d100 3
a129 3
bind Checkbutton <Leave> {
    tk::ButtonLeave %W
}
d644 112
@


1.19.4.1
log
@[Patch 1530276]: Improve no-indicator check/radio buttons on Unix.
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.19 2005/07/25 09:06:01 dkf Exp $
a39 3
    bind Checkbutton <Leave> {
	tk::ButtonLeave %W
    }
a59 3
    bind Checkbutton <Leave> {
	tk::ButtonLeave %W
    }
d74 1
a74 1
	    tk::CheckInvoke %W
d83 1
a83 1
	tk::CheckInvoke %W
d89 1
a89 1
	tk::CheckEnter %W
a93 3
    bind Checkbutton <Leave> {
	tk::CheckLeave %W
    }
d121 3
a637 105

# Special versions of the handlers for checkbuttons on Unix that do the magic
# to make things work right when the checkbutton indicator is hidden;
# radiobuttons don't need this complexity.

# ::tk::CheckInvoke --
# The procedure below invokes the checkbutton, like ButtonInvoke, but handles
# what to do when the checkbutton indicator is missing. Only used on Unix.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::CheckInvoke {w} {
    variable ::tk::Priv
    if {[$w cget -state] ne "disabled"} {
	# Additional logic to switch the "selected" colors around if necessary
	# (when we're indicator-less).

	if {![$w cget -indicatoron]} {
	    if {[$w cget -selectcolor] eq $Priv($w,aselectcolor)} {
		$w configure -selectcolor $Priv($w,selectcolor)
	    } else {
		$w configure -selectcolor $Priv($w,aselectcolor)
	    }
	}
	uplevel #0 [list $w invoke]
    }
}

# ::tk::CheckEnter --
# The procedure below enters the checkbutton, like ButtonEnter, but handles
# what to do when the checkbutton indicator is missing. Only used on Unix.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::CheckEnter {w} {
    variable ::tk::Priv
    if {[$w cget -state] ne "disabled"} {
	# On unix the state is active just with mouse-over
	$w configure -state active

	# If the mouse button is down, set the relief to sunken on entry.
	# Overwise, if there's an -overrelief value, set the relief to that.

	set Priv($w,relief) [$w cget -relief]
	if {$Priv(buttonWindow) eq $w} {
	    $w configure -relief sunken
	    set Priv($w,prelief) sunken
	} elseif {[set over [$w cget -overrelief]] ne ""} {
	    $w configure -relief $over
	    set Priv($w,prelief) $over
	}

	# Compute what the "selected and active" color should be.

	if {![$w cget -indicatoron]} {
	    set Priv($w,selectcolor) [$w cget -selectcolor]
	    lassign [winfo rgb $w [$w cget -selectcolor]]      r1 g1 b1
	    lassign [winfo rgb $w [$w cget -activebackground]] r2 g2 b2
	    set Priv($w,aselectcolor) \
		[format "#%04x%04x%04x" [expr {($r1+$r2)/2}] \
		     [expr {($g1+$g2)/2}] [expr {($b1+$b2)/2}]]
	    if {[set ::[$w cget -variable]] eq [$w cget -onvalue]} {
		$w configure -selectcolor $Priv($w,aselectcolor)
	    }
	}
    }
    set Priv(window) $w
}

# ::tk::CheckLeave --
# The procedure below leaves the checkbutton, like ButtonLeave, but handles
# what to do when the checkbutton indicator is missing. Only used on Unix.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::CheckLeave {w} {
    variable ::tk::Priv
    if {[$w cget -state] ne "disabled"} {
	$w configure -state normal
    }

    # Restore the original button "selected" color; assume that the user
    # wasn't monkeying around with things too much.

    if {![$w cget -indicatoron] && [info exist Priv($w,selectcolor)]} {
	$w configure -selectcolor $Priv($w,selectcolor)
    }
    unset -nocomplain Priv($w,selectcolor) Priv($w,aselectcolor)

    # Restore the original button relief if it was changed by Tk. That is
    # signaled by the existence of Priv($w,prelief).

    if {[info exists Priv($w,relief)]} {
	if {[info exists Priv($w,prelief)] && \
		$Priv($w,prelief) eq [$w cget -relief]} {
	    $w configure -relief $Priv($w,relief)
	}
	unset -nocomplain Priv($w,relief) Priv($w,prelief)
    }

    set Priv(window) ""
}
@


1.19.4.2
log
@	* library/button.tcl (CheckInvoke, CheckEnter): [Patch 1530276 redux]:
	Apply a bit more care to ensure that things continue to work correctly
	even when there is no -selectcolor defined.
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.19.4.1 2009/10/24 00:12:03 dkf Exp $
d662 1
a662 1
	if {![$w cget -indicatoron] && [info exist Priv($w,selectcolor)]} {
d700 1
a700 1
	if {![$w cget -indicatoron] && [$w cget -selectcolor] ne ""} {
@


1.19.4.3
log
@        * library/button.tcl (::tk::CheckEnter): use uplevel set instead
        of set :: to work with other var resolvers (itcl). [AS Bug#87409]
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.19.4.2 2010/05/03 12:06:14 dkf Exp $
d707 1
a707 3
	    # use uplevel to work with other var resolvers
	    if {[uplevel #0 [list set [$w cget -variable]]]
		 eq [$w cget -onvalue]} {
@


1.18
log
@Removed support for Mac OS Classic platform [Patch 918139]
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.17 2002/09/04 02:05:52 hobbs Exp $
d21 1
a21 1
if {[string equal [tk windowingsystem] "aqua"]} {
d41 1
a41 1
if {[string equal "windows" $tcl_platform(platform)]} {
d71 1
a71 1
if {[string equal "x11" [tk windowingsystem]]} {
d130 1
a130 1
if {[string equal "windows" $tcl_platform(platform)]} {
d311 1
a311 1
if {[string equal "x11" [tk windowingsystem]]} {
d419 1
a419 1
    if {[string equal $w $Priv(buttonWindow)]} {
d447 1
a447 1
if {[string equal [tk windowingsystem] "aqua"]} {
@


1.17
log
@	* library/button.tcl: further restrict buttons to not resetting
	the "original" relief if it has changed in the interim.  This
	prevents code that simulated overrelief buttons from not working
	in 8.4.  [Bug #604270]
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.16 2002/09/02 22:00:53 hobbs Exp $
d21 1
a21 2
if {[string equal [tk windowingsystem] "classic"]
	|| [string equal [tk windowingsystem] "aqua"]} {
d447 1
a447 2
if {[string equal [tk windowingsystem] "classic"]
	|| [string equal [tk windowingsystem] "aqua"]} {
@


1.17.2.1
log
@        * library/bgerror.tcl:  Updates to use Tcl 8.4 features. [Patch 1237759]        * library/button.tcl:
        * library/choosedir.tcl:
        * library/clrpick.tcl:
        * library/comdlg.tcl:
        * library/console.tcl:
        * library/dialog.tcl:
        * library/entry.tcl:
        * library/focus.tcl:
        * library/listbox.tcl:
        * library/menu.tcl:
        * library/msgbox.tcl:
        * library/palette.tcl:
        * library/panedwindow.tcl:
        * library/safetk.tcl:
        * library/scale.tcl:
        * library/scrlbar.tcl:
        * library/spinbox.tcl:
        * library/tearoff.tcl:
        * library/text.tcl:
        * library/tk.tcl:
        * library/tkfbox.tcl:
        * library/xmfbox.tcl:
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.17 2002/09/04 02:05:52 hobbs Exp $
d21 2
a22 1
if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
d42 1
a42 1
if {"windows" eq $tcl_platform(platform)} {
d72 1
a72 1
if {"x11" eq [tk windowingsystem]} {
d131 1
a131 1
if {"windows" eq $tcl_platform(platform)} {
d312 1
a312 1
if {"x11" eq [tk windowingsystem]} {
d420 1
a420 1
    if {$w eq $Priv(buttonWindow)} {
d448 2
a449 1
if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
@


1.16
log
@	* library/button.tcl (::tk::ButtonLeave): correctly restore state
	of button to normal for unix bindings. [Bug #597920]
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.15 2002/08/31 06:12:28 das Exp $
d155 4
a158 2
	} elseif {[$w cget -overrelief] ne ""} {
	    $w configure -relief [$w cget -overrelief]
d178 2
a179 2
    # Restore the original button relief if it was changed.
    # That is signaled by the existence of Priv($w,relief).
d182 5
a186 2
	$w configure -relief $Priv($w,relief)
	unset Priv($w,relief)
d215 1
d243 5
a247 2
	    $w configure -relief $Priv($w,relief)
	    unset Priv($w,relief)
d280 4
a283 3
	if {[$w cget -overrelief] ne ""} {
	    set Priv($w,relief) [$w cget -relief]
	    $w configure -relief [$w cget -overrelief]
d338 4
a341 2
	} elseif {[$w cget -overrelief] ne ""} {
	    $w configure -relief [$w cget -overrelief]
d361 2
a362 2
    # Restore the original button relief if it was changed.
    # That is signaled by the existence of Priv($w,relief).
d365 5
a369 2
	$w configure -relief $Priv($w,relief)
	unset Priv($w,relief)
d398 1
d426 5
a430 2
	    $w configure -relief $Priv($w,relief)
	    unset Priv($w,relief)
d471 4
a474 3
	} elseif {[$w cget -overrelief] ne ""} {
	    set Priv($w,relief) [$w cget -relief]
	    $w configure -relief [$w cget -overrelief]
d496 2
a497 2
    # Restore the original button relief if it was changed.
    # That is signaled by the existence of Priv($w,relief).
d500 5
a504 2
	$w configure -relief $Priv($w,relief)
	unset Priv($w,relief)
d554 5
a558 2
	    $w configure -relief $Priv($w,relief)
	    unset Priv($w,relief)
@


1.15
log
@	*** macosx-8-4-branch merged into the mainline [tcl patch #602770] ***

	* generic/tk.decls:
	* generic/tkInt.decls: added new "aqua" specific entries to the
	stubs tables. Changed all "unix" entries to "x11" to allow us to
	distinguish and build both "aqua" on MacOSX and "x11" on MacOSX.

	* generic/tk.h: added a #ifnded RESOURCE_INCLUDED so that tk.h can
	be passed to the resource compiler.

	* generic/tkCmds.c (Tk_TkObjCmd): added [tk windowingsystem]
	subcommand: returns "x11" when running on X11, "win32" on Windows,
	"classic" on MacOS9 and "aqua" on MacOSX Aqua (i.e. Carbon)

	* generic/tkFont.c (TkFontGetFirstTextLayout): new private function
	returning the first chunk of a Tk_TextLayout, i.e. until the first
	font change on the first line (or the whole first line if there is
	no such font change).

	* generic/tkMain.c: made Tcl_ThreadDataKey static

	* library/demos/puzzle.tcl: fixed button metrics for aqua

	* tests/cursor.test: check for presence of arrow cursor instead of
	heart cursor

	* xlib/xcolors.c: changed xColors static initialization to more
	standard C

	* macosx/Wish.pbproj/jingham.pbxuser (new):
	* macosx/Wish.pbproj/project.pbxproj (new): project for Apple's
	ProjectBuilder IDE.

	* macosx/Makefile (new): simple makefile for building the project
	from the command line via the ProjectBuilder tool 'pbxbuild'.

	* macosx/tkMacOSXAppInit.c (new): macosx specific AppInit looking
	for a AppMain.tcl file in its bundled Resources/Scripts folder. If
	present, argv[1] is set to that file and the Scripts folder is
	added to the auto_path. This allows tk apps to embed scripts within
	their bundle directory structure.

	* macosx/tkMacOSXInit.c (new): macosx adapted version of
	tkUnixInit.c: we initialize & cache the Carbon native encoding
	(e.g. 'macRoman') and try to find the tk script library files
	inside Tk packaged as a framework.

	* macosx/tkMacOSXNotify.c (new): new macosx specific merged
	Carbon/select-based notifier.

	* macosx/tkMacOSXEvent.c (new):
	* macosx/tkMacOSXEvent.h (new):
	* macosx/tkMacOSXKeyEvent.c (new):
	* macosx/tkMacOSXMouseEvent.c (new):
	* macosx/tkMacOSXWindowEvent.c (new): new macosx specific event
	handling functionality.

	* macosx/tkMacOSX.h (new):
	* macosx/tkMacOSXBitmap.c (new):
	* macosx/tkMacOSXButton.c (new):
	* macosx/tkMacOSXClipboard.c (new):
	* macosx/tkMacOSXColor.c (new):
	* macosx/tkMacOSXConfig.c (new):
	* macosx/tkMacOSXCursor.c (new):
	* macosx/tkMacOSXDefault.h (new):
	* macosx/tkMacOSXDialog.c (new):
	* macosx/tkMacOSXDraw.c (new):
	* macosx/tkMacOSXEmbed.c (new):
	* macosx/tkMacOSXFont.c (new):
	* macosx/tkMacOSXHLEvents.c (new):
	* macosx/tkMacOSXInt.h (new):
	* macosx/tkMacOSXKeyboard.c (new):
	* macosx/tkMacOSXMenu.c (new):
	* macosx/tkMacOSXMenubutton.c (new):
	* macosx/tkMacOSXMenus.c (new):
	* macosx/tkMacOSXPort.h (new):
	* macosx/tkMacOSXRegion.c (new):
	* macosx/tkMacOSXScale.c (new):
	* macosx/tkMacOSXScrlbr.c (new):
	* macosx/tkMacOSXSubwindows.c (new):
	* macosx/tkMacOSXTest.c (new):
	* macosx/tkMacOSXUtil.c (new):
	* macosx/tkMacOSXUtil.h (new):
	* macosx/tkMacOSXWm.c (new):
	* macosx/tkMacOSXWm.h (new):
	* macosx/tkMacOSXXStubs.c (new): macosx ports of classic mac Tk
	implementation in tk/mac.

	* macosx/tkMacOSXSend.c (new): only send to local interp
	implemented currently.

	* macosx/tkMacOSXDebug.h (new):
	* macosx/tkMacOSXDebug.c (new): new macosx specific functions for
	debugging MacOS events, regions, etc.

	* macosx/tkAboutDlg.r (new):
	* macosx/tkMacOSXApplication.r (new):
	* macosx/tkMacOSXCursors.r (new):
	* macosx/tkMacOSXLibrary.r (new):
	* macosx/tkMacOSXMenu.r (new):
	* macosx/tkMacOSXResource.r (new):
	* macosx/tkMacOSXXCursors.r (new):
	* macosx/tclets.r (new): sources for Rez resource compiler.

	* macosx/Wish.icns (new): Wish application icon.

	* generic/tk.h:
	* generic/default.h:
	* generic/tkBind.c:
	* generic/tkCmds.c:
	* generic/tkGrab.c:
	* generic/tkPointer.c:
	* generic/tkPort.h:
	* generic/tkSelect.c:
	* generic/tkStubLib.c:
	* generic/tkTest.c:
	* generic/tkText.c:
	* generic/tkWindow.c:
	* unix/tkUnix3d.c:
	* xlib/xgc.c:
	* xlib/X11/X.h:
	* xlib/X11/Xlib.h:
	* xlib/X11/Xutil.h: added #includes and #ifdefs for macosx

	* library/bgerror.tcl:
	* library/button.tcl:
	* library/console.tcl:
	* library/dialog.tcl:
	* library/entry.tcl:
	* library/listbox.tcl:
	* library/menu.tcl:
	* library/msgbox.tcl:
	* library/scrlbar.tcl:
	* library/spinbox.tcl:
	* library/text.tcl:
	* library/tk.tcl:
	* library/demos/menu.tcl:
	* library/demos/menubu.tcl:
	* library/demos/widget: check [tk windowingsystem] instead of
	and/or in addition to $tcl_platform(platform).

	* generic/tkInt.h:
	* mac/tkMacBitmap.c:
	* mac/tkMacWm.c: added missing CONSTification

	* generic/tkIntDecls.h:
	* generic/tkIntPlatDecls.h:
	* generic/tkIntXlibDecls.h:
	* generic/tkPlatDecls.h:
	* generic/tkStubInit.c: regen
@
text
@d7 1
a7 1
# RCS: @@(#) $Id$
d345 1
a345 1
    if {[$w cget -state] eq "disabled"} {
@


1.14
log
@	* library/button.tcl: change the bindings to use Priv($w,relief)
	instead of just Priv(relief).  This ensures that neighboring
	buttons don't confuse (over)relief settings.
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.13 2002/04/23 00:48:29 hobbs Exp $
d21 2
a22 1
if {[string equal "macintosh" $tcl_platform(platform)]} {
d72 1
a72 1
if {[string equal "unix" $tcl_platform(platform)]} {
d302 1
a302 1
if {[string equal "unix" $tcl_platform(platform)]} {
d429 2
a430 1
if {[string equal "macintosh" $tcl_platform(platform)]} {
@


1.13
log
@	* library/button.tcl (ButtonLeave): corrected the 3
	implementations of ButtonLeave to check for Priv(relief) existing
	before trying to use it. [Patch #541849]
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.12 2001/11/23 02:04:08 das Exp $
d11 1
d21 1
a21 1
if {[string match "macintosh" $tcl_platform(platform)]} {
d41 1
a41 1
if {[string match "windows" $tcl_platform(platform)]} {
d71 1
a71 1
if {[string match "unix" $tcl_platform(platform)]} {
d130 1
a130 1
if {[string match "windows" $tcl_platform(platform)]} {
d146 1
a146 1
    if {[string compare [$w cget -state] "disabled"] } {
d151 3
a153 2
	if {[string equal $Priv(buttonWindow) $w]} {
	    $w configure -state active -relief sunken
a154 1
	    set Priv(relief) [$w cget -relief]
d163 2
a164 4
# button widget.  It changes the state of the button back to
# inactive.  If we're leaving the button window with a mouse button
# pressed (Priv(buttonWindow) == $w), restore the relief of the
# button too.
d171 1
a171 1
    if {[string compare [$w cget -state] "disabled"]} {
d175 2
a176 2
    # Restore the original button relief if the mouse button is down
    # or there is an -overrelief value.
d178 3
a180 3
    if {[info exists Priv(relief)] && (($Priv(buttonWindow) eq $w) || \
	    ([$w cget -overrelief] ne ""))} {
	$w configure -relief $Priv(relief)
a185 23
# ::tk::CheckRadioEnter --
# The procedure below is invoked when the mouse pointer enters a
# checkbutton or radiobutton widget.  It records the button we're in
# and changes the state of the button to active unless the button is
# disabled.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::CheckRadioEnter w {
    variable ::tk::Priv
    if {[string compare [$w cget -state] "disabled"]} {
	if {[string equal $Priv(buttonWindow) $w]} {
	    $w configure -state active
	}
	if { [string compare [$w cget -overrelief] ""] } {
	    set Priv(relief) [$w cget -relief]
	    $w configure -relief [$w cget -overrelief]
	}
    }
    set Priv(window) $w
}

a196 3
    # Only save the button's relief if it has no -overrelief value.  If there
    # is an overrelief setting, Priv(relief) will already have been set, and
    # the current value of the -relief option will be incorrect.
d198 6
a203 2
    if { [string equal [$w cget -overrelief] ""] } {
	set Priv(relief) [$w cget -relief]
d206 1
a206 1
    if {[string compare [$w cget -state] "disabled"]} {
a219 21
# ::tk::CheckRadioDown --
# The procedure below is invoked when the mouse button is pressed in
# a button widget.  It records the fact that the mouse is in the button,
# saves the button's relief so it can be restored later, and changes
# the relief to sunken.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::CheckRadioDown w {
    variable ::tk::Priv
    if { [string equal [$w cget -overrelief] ""] } {
	set Priv(relief) [$w cget -relief]
    }
    if {[string compare [$w cget -state] "disabled"]} {
	set Priv(buttonWindow) $w
	set Priv(repeated) 0
	$w configure -state active
    }
}

d230 1
a230 1
    if {[string equal $Priv(buttonWindow) $w]} {
d232 6
a237 8
	# Restore the button's relief.  If there is no overrelief, the
	# button relief goes back to its original value.  If there is an
	# overrelief, the relief goes to the overrelief (since the cursor is
	# still over the button).

	set relief [$w cget -overrelief]
	if { [string equal $relief  ""] } {
	    set relief $Priv(relief)
a238 1
	$w configure -relief $relief
a240 1

d243 1
a243 2
	if {[string equal $Priv(window) $w]
              && [string compare [$w cget -state] "disabled"]} {
d255 42
d299 3
a301 1
if {[string match "unix" $tcl_platform(platform)]} {
d317 2
a318 1
    if {[string compare [$w cget -state] "disabled"]} {
d324 3
a326 2
	if {[string equal $Priv(buttonWindow) $w]} {
	    $w configure -state active -relief sunken
a327 1
	    set Priv(relief) [$w cget -relief]
a330 1

d336 2
a337 4
# button widget.  It changes the state of the button back to
# inactive.  If we're leaving the button window with a mouse button
# pressed (Priv(buttonWindow) == $w), restore the relief of the
# button too.
d344 1
a344 1
    if {[string compare [$w cget -state] "disabled"]} {
d348 2
a349 2
    # Restore the original button relief if the mouse button is down
    # or there is an -overrelief value.
d351 3
a353 3
    if {[info exists Priv(relief)] && (($Priv(buttonWindow) eq $w) || \
	    ([$w cget -overrelief] ne ""))} {
	$w configure -relief $Priv(relief)
d371 3
a373 3
    # Only save the button's relief if it has no -overrelief value.  If there
    # is an overrelief setting, Priv(relief) will already have been set, and
    # the current value of the -relief option will be incorrect.
d375 2
a376 2
    if { [string equal [$w cget -overrelief] ""] } {
	set Priv(relief) [$w cget -relief]
d379 1
a379 1
    if {[string compare [$w cget -state] "disabled"]} {
d406 5
a410 8
	# Restore the button's relief.  If there is no overrelief, the
	# button relief goes back to its original value.  If there is an
	# overrelief, the relief goes to the overrelief (since the cursor is
	# still over the button).

	set relief [$w cget -overrelief]
	if { [string equal $relief  ""] } {
	    set relief $Priv(relief)
a411 1
	$w configure -relief $relief
d416 1
a416 3
	if {[string equal $w $Priv(window)] \
		&& [string compare [$w cget -state] "disabled"]} {

d428 1
a428 1
if {[string match "macintosh" $tcl_platform(platform)]} {
d444 5
a448 2
    if {[string compare [$w cget -state] "disabled"]} {
	if {[string equal $w $Priv(buttonWindow)]} {
d451 1
a451 1
	    set Priv(relief) [$w cget -relief]
d470 1
a470 1
    if {[string equal $w $Priv(buttonWindow)]} {
d473 7
a479 3
    if {[info exists Priv(relief)] && (($Priv(buttonWindow) eq $w) || \
	    ([$w cget -overrelief] ne ""))} {
	$w configure -relief $Priv(relief)
d481 1
d497 1
a497 1
    if {[string compare [$w cget -state] "disabled"]} {
d503 1
a503 1
    set Priv(repeated) 0
d522 2
a523 1
    if {[string equal $w $Priv(buttonWindow)]} {
a524 1
	set Priv(buttonWindow) ""
d526 5
a530 2
	if { [string compare [$w cget -overrelief] ""] } {
	    $w configure -relief [$w cget -overrelief]
d536 1
a536 2
	if {[string equal $w $Priv(window)]
              && [string compare [$w cget -state] "disabled"]} {
d560 1
a560 1
    if {[string compare [$w cget -state] "disabled"]} {
d588 1
a588 1
    if { [string equal $Priv(window) $w] } {
d608 1
a608 1
    if {[string compare [$w cget -state] "disabled"]} {
a611 1

@


1.12
log
@	**  upport to 8.4 of mac code changes for 8.3.3 & various new
	**  changes for 8.4, some already backported to 8.3.4 (patch #435660)

	see ChangeLog for details
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.11 2001/08/01 16:21:11 dgp Exp $
d152 1
a152 1
	} elseif { [string compare [$w cget -overrelief] ""] } {
d179 2
a180 2
    if {[string equal $Priv(buttonWindow) $w] || \
	    [string compare [$w cget -overrelief] ""] } {
d330 1
a330 1
	} elseif { [string compare [$w cget -overrelief] ""] } {
d354 1
a354 1
    
d358 2
a359 2
    if {[string equal $Priv(buttonWindow) $w] || \
	    [string compare [$w cget -overrelief] ""] } {
d460 1
a460 1
	} elseif { [string compare [$w cget -overrelief] ""] } {
d483 2
a484 1
    if { [string compare [$w cget -overrelief] ""] } {
@


1.11
log
@	Merged changes from feature branch dgp-privates-into-namespace,
	implementing TIP 44.  All Tk commands and variables matching
	tk[A-Z]* are now in the ::tk namespace.
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.10 2000/05/25 17:19:57 ericm Exp $
d507 1
a508 2
	    set delay [$w cget -repeatdelay]
	    set Priv(repeated) 0
@


1.11.2.1
log
@First checkin of support for Tk on Mac OS X.
@
text
@d7 1
a7 1
# RCS: @@(#) $Id$
d20 1
a20 2
if {[string equal $tcl_platform(windowingsystem) "classic"]
        || [string equal $tcl_platform(windowingsystem) "aqua"]} {
d70 1
a70 1
if {[string match "x11" $tcl_platform(windowingsystem)]} {
d306 1
a306 1
if {[string match "x11" $tcl_platform(windowingsystem)]} {
d441 1
a441 2
if {[string equal $tcl_platform(windowingsystem) "classic"]
        || [string equal $tcl_platform(windowingsystem) "aqua"]} {
@


1.11.2.2
log
@Merge with current TOT
Added support for the wm stackorder command
Fixed crash when selecting Menu items in the Application menu that we didn't
put there.
Added first bits of the use of CG for low-level drawing.  The line-drawing works,
the rest doesn't yet.  You have to set the file static useCGDrawing to 1 and
rebuild to activate this code.
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.11.2.1 2001/10/15 09:22:00 wolfsuit Exp $
a508 1
    set Priv(repeated) 0
d510 2
@


1.11.2.3
log
@Merging with TOT as of 06/09/2002.
@
text
@d7 1
a7 1
# RCS: @@(#) $Id$
d153 1
a153 1
	} elseif {[$w cget -overrelief] ne ""} {
d180 2
a181 2
    if {[info exists Priv(relief)] && (($Priv(buttonWindow) eq $w) || \
	    ([$w cget -overrelief] ne ""))} {
d331 1
a331 1
	} elseif {[$w cget -overrelief] ne ""} {
d355 1
a355 1

d359 2
a360 2
    if {[info exists Priv(relief)] && (($Priv(buttonWindow) eq $w) || \
	    ([$w cget -overrelief] ne ""))} {
d462 1
a462 1
	} elseif {[$w cget -overrelief] ne ""} {
d485 1
a485 2
    if {[info exists Priv(relief)] && (($Priv(buttonWindow) eq $w) || \
	    ([$w cget -overrelief] ne ""))} {
@


1.11.2.4
log
@merged with trunk at tag macosx-8-4-merge-2002-08-20-trunk
@
text
@a10 1
# Copyright (c) 2002 ActiveState Corporation.
d41 1
a41 1
if {[string equal "windows" $tcl_platform(platform)]} {
d71 1
a71 1
if {[string equal "x11" $tcl_platform(windowingsystem)]} {
d130 1
a130 1
if {[string equal "windows" $tcl_platform(platform)]} {
d146 1
a146 1
    if {[$w cget -state] ne "disabled"} {
d151 2
a152 3
	set Priv($w,relief) [$w cget -relief]
	if {$Priv(buttonWindow) eq $w} {
	    $w configure -relief sunken -state active
d154 1
d163 4
a166 2
# button widget.  It changes the state of the button back to inactive.
# Restore any modified relief too.
d173 1
a173 1
    if {[$w cget -state] ne "disabled"} {
d177 2
a178 2
    # Restore the original button relief if it was changed.
    # That is signaled by the existence of Priv($w,relief).
d180 3
a182 3
    if {[info exists Priv($w,relief)]} {
	$w configure -relief $Priv($w,relief)
	unset Priv($w,relief)
d188 23
d222 3
d226 2
a227 6
    # Only save the button's relief if it does not yet exist.  If there
    # is an overrelief setting, Priv($w,relief) will already have been set,
    # and the current value of the -relief option will be incorrect.

    if {![info exists Priv($w,relief)]} {
	set Priv($w,relief) [$w cget -relief]
d230 1
a230 1
    if {[$w cget -state] ne "disabled"} {
d244 21
d275 1
a275 1
    if {$Priv(buttonWindow) eq $w} {
d277 8
a284 6

	# Restore the button's relief if it was cached.

	if {[info exists Priv($w,relief)]} {
	    $w configure -relief $Priv($w,relief)
	    unset Priv($w,relief)
d286 1
d289 1
d292 2
a293 1
	if {$Priv(window) eq $w && [$w cget -state] ne "disabled"} {
a304 42
# ::tk::CheckRadioEnter --
# The procedure below is invoked when the mouse pointer enters a
# checkbutton or radiobutton widget.  It records the button we're in
# and changes the state of the button to active unless the button is
# disabled.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::CheckRadioEnter w {
    variable ::tk::Priv
    if {[$w cget -state] ne "disabled"} {
	if {$Priv(buttonWindow) eq $w} {
	    $w configure -state active
	}
	if {[$w cget -overrelief] ne ""} {
	    set Priv($w,relief) [$w cget -relief]
	    $w configure -relief [$w cget -overrelief]
	}
    }
    set Priv(window) $w
}

# ::tk::CheckRadioDown --
# The procedure below is invoked when the mouse button is pressed in
# a button widget.  It records the fact that the mouse is in the button,
# saves the button's relief so it can be restored later, and changes
# the relief to sunken.
#
# Arguments:
# w -		The name of the widget.

proc ::tk::CheckRadioDown w {
    variable ::tk::Priv
    if {![info exists Priv($w,relief)]} {
	set Priv($w,relief) [$w cget -relief]
    }
    if {[$w cget -state] ne "disabled"} {
	set Priv(buttonWindow) $w
	set Priv(repeated) 0
	$w configure -state active
    }
d307 1
a307 3
}

if {[string equal "x11" $tcl_platform(windowingsystem)]} {
d323 1
a323 2
    if {[$w cget -state] ne "disabled"} {
	# On unix the state is active just with mouse-over
d329 2
a330 3
	set Priv($w,relief) [$w cget -relief]
	if {$Priv(buttonWindow) eq $w} {
	    $w configure -relief sunken
d332 1
d336 1
d342 4
a345 2
# button widget.  It changes the state of the button back to inactive.
# Restore any modified relief too.
d352 1
a352 1
    if {[$w cget -state] eq "disabled"} {
d356 2
a357 2
    # Restore the original button relief if it was changed.
    # That is signaled by the existence of Priv($w,relief).
d359 3
a361 3
    if {[info exists Priv($w,relief)]} {
	$w configure -relief $Priv($w,relief)
	unset Priv($w,relief)
d379 3
a381 3
    # Only save the button's relief if it does not yet exist.  If there
    # is an overrelief setting, Priv($w,relief) will already have been set,
    # and the current value of the -relief option will be incorrect.
d383 2
a384 2
    if {![info exists Priv($w,relief)]} {
	set Priv($w,relief) [$w cget -relief]
d387 1
a387 1
    if {[$w cget -state] ne "disabled"} {
d414 8
a421 5
	# Restore the button's relief if it was cached.

	if {[info exists Priv($w,relief)]} {
	    $w configure -relief $Priv($w,relief)
	    unset Priv($w,relief)
d423 1
d428 3
a430 1
	if {$Priv(window) eq $w && [$w cget -state] ne "disabled"} {
d459 2
a460 5
    if {[$w cget -state] ne "disabled"} {

	# If there's an -overrelief value, set the relief to that.

	if {$Priv(buttonWindow) eq $w} {
d463 1
a463 1
	    set Priv($w,relief) [$w cget -relief]
d482 1
a482 1
    if {$w eq $Priv(buttonWindow)} {
d485 3
a487 7

    # Restore the original button relief if it was changed.
    # That is signaled by the existence of Priv($w,relief).

    if {[info exists Priv($w,relief)]} {
	$w configure -relief $Priv($w,relief)
	unset Priv($w,relief)
a488 1

d504 1
a504 1
    if {[$w cget -state] ne "disabled"} {
d510 1
a510 1
	set Priv(repeated) 0
d529 2
a530 1
    if {$Priv(buttonWindow) eq $w} {
a531 1
	$w configure -state normal
d533 2
a534 5
	# Restore the button's relief if it was cached.

	if {[info exists Priv($w,relief)]} {
	    $w configure -relief $Priv($w,relief)
	    unset Priv($w,relief)
d540 2
a541 1
	if {$Priv(window) eq $w && [$w cget -state] ne "disabled"} {
d565 1
a565 1
    if {[$w cget -state] ne "disabled"} {
d593 1
a593 1
    if {$Priv(window) eq $w} {
d613 1
a613 1
    if {[$w cget -state] ne "disabled"} {
d617 1
@


1.11.2.5
log
@whitespace & other cleanup
wish startup code cleanup induced by new support in tcl for standard MacOSX tcl package locations
renamed Tk_GetFirstTextLayout to private TkFontGetFirstTextLayout
@
text
@d22 1
a22 1
	|| [string equal $tcl_platform(windowingsystem) "aqua"]} {
d430 1
a430 1
	|| [string equal $tcl_platform(windowingsystem) "aqua"]} {
@


1.11.2.6
log
@various project cleanups & enhancements
added macosx/Makefile to facilitate building from cli
added [tk windowingsystem] and removed $::tcl_plaform(windowingsystem)
changed all runtime library references to the above
removed duplicate entries in tk.decls & tkInt.decls
CONSTification and other small changes in macosx/ to remove compiler warnings
@
text
@d21 2
a22 2
if {[string equal [tk windowingsystem] "classic"]
	|| [string equal [tk windowingsystem] "aqua"]} {
d72 1
a72 1
if {[string equal "x11" [tk windowingsystem]]} {
d302 1
a302 1
if {[string equal "x11" [tk windowingsystem]]} {
d429 2
a430 2
if {[string equal [tk windowingsystem] "classic"]
	|| [string equal [tk windowingsystem] "aqua"]} {
@


1.10
log
@* library/button.tcl: Tweaks for -overrelief handling on Windows.
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.9 2000/05/25 16:57:24 ericm Exp $
d22 1
a22 1
	tkButtonEnter %W
d25 1
a25 1
	tkButtonDown %W
d28 1
a28 1
	tkButtonUp %W
d31 1
a31 1
	tkButtonEnter %W
d34 1
a34 1
	tkButtonDown %W
d37 1
a37 1
	tkButtonUp %W
d42 1
a42 1
	tkCheckRadioInvoke %W select
d45 1
a45 1
	tkCheckRadioInvoke %W select
d48 1
a48 1
	tkCheckRadioInvoke %W deselect
d51 1
a51 1
	tkCheckRadioDown %W
d54 1
a54 1
	tkButtonUp %W
d57 1
a57 1
	tkCheckRadioEnter %W
d61 1
a61 1
	tkCheckRadioDown %W
d64 1
a64 1
	tkButtonUp %W
d67 1
a67 1
	tkCheckRadioEnter %W
d73 1
a73 1
	    tkCheckRadioInvoke %W
d78 1
a78 1
	    tkCheckRadioInvoke %W
d82 1
a82 1
	tkCheckRadioInvoke %W
d85 1
a85 1
	tkCheckRadioInvoke %W
d88 1
a88 1
	tkButtonEnter %W
d91 1
a91 1
	tkButtonEnter %W
d96 1
a96 1
    tkButtonInvoke %W
d99 1
a99 1
    tkCheckRadioInvoke %W
d102 1
a102 1
    tkCheckRadioInvoke %W
d107 1
a107 1
    tkButtonEnter %W
d110 1
a110 1
    tkButtonLeave %W
d113 1
a113 1
    tkButtonDown %W
d116 1
a116 1
    tkButtonUp %W
d121 1
a121 1
    tkButtonLeave %W
d126 1
a126 1
    tkButtonLeave %W
d135 1
a135 1
# tkButtonEnter --
d143 2
a144 2
proc tkButtonEnter w {
    global tkPriv
d150 1
a150 1
	if {[string equal $tkPriv(buttonWindow) $w]} {
d153 1
a153 1
	    set tkPriv(relief) [$w cget -relief]
d157 1
a157 1
    set tkPriv(window) $w
d160 1
a160 1
# tkButtonLeave --
d164 1
a164 1
# pressed (tkPriv(buttonWindow) == $w), restore the relief of the
d170 2
a171 2
proc tkButtonLeave w {
    global tkPriv
d179 1
a179 1
    if {[string equal $tkPriv(buttonWindow) $w] || \
d181 1
a181 1
	$w configure -relief $tkPriv(relief)
d184 1
a184 1
    set tkPriv(window) ""
d187 1
a187 1
# tkCheckRadioEnter --
d196 2
a197 2
proc tkCheckRadioEnter w {
    global tkPriv
d199 1
a199 1
	if {[string equal $tkPriv(buttonWindow) $w]} {
d203 1
a203 1
	    set tkPriv(relief) [$w cget -relief]
d207 1
a207 1
    set tkPriv(window) $w
d210 1
a210 1
# tkButtonDown --
d219 2
a220 2
proc tkButtonDown w {
    global tkPriv
d222 1
a222 1
    # is an overrelief setting, tkPriv(relief) will already have been set, and
d226 1
a226 1
	set tkPriv(relief) [$w cget -relief]
d230 1
a230 1
	set tkPriv(buttonWindow) $w
d234 1
a234 1
	after cancel $tkPriv(afterId)
d236 1
a236 1
	set tkPriv(repeated) 0
d238 1
a238 1
	    set tkPriv(afterId) [after $delay [list tkButtonAutoInvoke $w]]
d243 1
a243 1
# tkCheckRadioDown --
d252 2
a253 2
proc tkCheckRadioDown w {
    global tkPriv
d255 1
a255 1
	set tkPriv(relief) [$w cget -relief]
d258 2
a259 2
	set tkPriv(buttonWindow) $w
	set tkPriv(repeated) 0
d264 1
a264 1
# tkButtonUp --
d272 4
a275 4
proc tkButtonUp w {
    global tkPriv
    if {[string equal $tkPriv(buttonWindow) $w]} {
	set tkPriv(buttonWindow) ""
d283 1
a283 1
	    set relief $tkPriv(relief)
d289 1
a289 1
	after cancel $tkPriv(afterId)
d291 1
a291 1
	if {[string equal $tkPriv(window) $w]
d297 1
a297 1
	    if { $tkPriv(repeated) == 0 } {
d312 1
a312 1
# tkButtonEnter --
d320 2
a321 2
proc tkButtonEnter {w} {
    global tkPriv
d328 1
a328 1
	if {[string equal $tkPriv(buttonWindow) $w]} {
d331 1
a331 1
	    set tkPriv(relief) [$w cget -relief]
d336 1
a336 1
    set tkPriv(window) $w
d339 1
a339 1
# tkButtonLeave --
d343 1
a343 1
# pressed (tkPriv(buttonWindow) == $w), restore the relief of the
d349 2
a350 2
proc tkButtonLeave w {
    global tkPriv
d358 1
a358 1
    if {[string equal $tkPriv(buttonWindow) $w] || \
d360 1
a360 1
	$w configure -relief $tkPriv(relief)
d363 1
a363 1
    set tkPriv(window) ""
d366 1
a366 1
# tkButtonDown --
d375 2
a376 2
proc tkButtonDown w {
    global tkPriv
d379 1
a379 1
    # is an overrelief setting, tkPriv(relief) will already have been set, and
d383 1
a383 1
	set tkPriv(relief) [$w cget -relief]
d387 1
a387 1
	set tkPriv(buttonWindow) $w
d391 1
a391 1
	after cancel $tkPriv(afterId)
d393 1
a393 1
	set tkPriv(repeated) 0
d395 1
a395 1
	    set tkPriv(afterId) [after $delay [list tkButtonAutoInvoke $w]]
d400 1
a400 1
# tkButtonUp --
d408 4
a411 4
proc tkButtonUp w {
    global tkPriv
    if {[string equal $w $tkPriv(buttonWindow)]} {
	set tkPriv(buttonWindow) ""
d420 1
a420 1
	    set relief $tkPriv(relief)
d425 1
a425 1
	after cancel $tkPriv(afterId)
d427 1
a427 1
	if {[string equal $w $tkPriv(window)] \
d432 1
a432 1
	    if { $tkPriv(repeated) == 0 } {
d447 1
a447 1
# tkButtonEnter --
d455 2
a456 2
proc tkButtonEnter {w} {
    global tkPriv
d458 1
a458 1
	if {[string equal $w $tkPriv(buttonWindow)]} {
d461 1
a461 1
	    set tkPriv(relief) [$w cget -relief]
d465 1
a465 1
    set tkPriv(window) $w
d468 1
a468 1
# tkButtonLeave --
d472 1
a472 1
# pressed (tkPriv(buttonWindow) == $w), restore the relief of the
d478 3
a480 3
proc tkButtonLeave w {
    global tkPriv
    if {[string equal $w $tkPriv(buttonWindow)]} {
d484 1
a484 1
	$w configure -relief $tkPriv(relief)
d486 1
a486 1
    set tkPriv(window) ""
d489 1
a489 1
# tkButtonDown --
d498 2
a499 2
proc tkButtonDown w {
    global tkPriv
d502 1
a502 1
	set tkPriv(buttonWindow) $w
d506 1
a506 1
	after cancel $tkPriv(afterId)
d509 1
a509 1
	    set tkPriv(repeated) 0
d511 1
a511 1
		set tkPriv(afterId) [after $delay [list tkButtonAutoInvoke $w]]
d517 1
a517 1
# tkButtonUp --
d525 3
a527 3
proc tkButtonUp w {
    global tkPriv
    if {[string equal $w $tkPriv(buttonWindow)]} {
d529 1
a529 1
	set tkPriv(buttonWindow) ""
d536 1
a536 1
	after cancel $tkPriv(afterId)
d538 1
a538 1
	if {[string equal $w $tkPriv(window)]
d542 1
a542 1
	    if { $tkPriv(repeated) == 0 } {
d555 1
a555 1
# tkButtonInvoke --
d562 1
a562 1
proc tkButtonInvoke w {
d574 1
a574 1
# tkButtonAutoInvoke --
d585 1
a585 1
#	May create an after event to call tkButtonAutoInvoke.
d587 3
a589 3
proc tkButtonAutoInvoke {w} {
    global tkPriv
    after cancel $tkPriv(afterId)
d591 2
a592 2
    if { [string equal $tkPriv(window) $w] } {
	incr tkPriv(repeated)
d596 1
a596 1
	set tkPriv(afterId) [after $delay [list tkButtonAutoInvoke $w]]
d600 1
a600 1
# tkCheckRadioInvoke --
d610 1
a610 1
proc tkCheckRadioInvoke {w {cmd invoke}} {
@


1.10.2.1
log
@update to head
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.12 2001/11/23 02:04:08 das Exp $
d22 1
a22 1
	tk::ButtonEnter %W
d25 1
a25 1
	tk::ButtonDown %W
d28 1
a28 1
	tk::ButtonUp %W
d31 1
a31 1
	tk::ButtonEnter %W
d34 1
a34 1
	tk::ButtonDown %W
d37 1
a37 1
	tk::ButtonUp %W
d42 1
a42 1
	tk::CheckRadioInvoke %W select
d45 1
a45 1
	tk::CheckRadioInvoke %W select
d48 1
a48 1
	tk::CheckRadioInvoke %W deselect
d51 1
a51 1
	tk::CheckRadioDown %W
d54 1
a54 1
	tk::ButtonUp %W
d57 1
a57 1
	tk::CheckRadioEnter %W
d61 1
a61 1
	tk::CheckRadioDown %W
d64 1
a64 1
	tk::ButtonUp %W
d67 1
a67 1
	tk::CheckRadioEnter %W
d73 1
a73 1
	    tk::CheckRadioInvoke %W
d78 1
a78 1
	    tk::CheckRadioInvoke %W
d82 1
a82 1
	tk::CheckRadioInvoke %W
d85 1
a85 1
	tk::CheckRadioInvoke %W
d88 1
a88 1
	tk::ButtonEnter %W
d91 1
a91 1
	tk::ButtonEnter %W
d96 1
a96 1
    tk::ButtonInvoke %W
d99 1
a99 1
    tk::CheckRadioInvoke %W
d102 1
a102 1
    tk::CheckRadioInvoke %W
d107 1
a107 1
    tk::ButtonEnter %W
d110 1
a110 1
    tk::ButtonLeave %W
d113 1
a113 1
    tk::ButtonDown %W
d116 1
a116 1
    tk::ButtonUp %W
d121 1
a121 1
    tk::ButtonLeave %W
d126 1
a126 1
    tk::ButtonLeave %W
d135 1
a135 1
# ::tk::ButtonEnter --
d143 2
a144 2
proc ::tk::ButtonEnter w {
    variable ::tk::Priv
d150 1
a150 1
	if {[string equal $Priv(buttonWindow) $w]} {
d153 1
a153 1
	    set Priv(relief) [$w cget -relief]
d157 1
a157 1
    set Priv(window) $w
d160 1
a160 1
# ::tk::ButtonLeave --
d164 1
a164 1
# pressed (Priv(buttonWindow) == $w), restore the relief of the
d170 2
a171 2
proc ::tk::ButtonLeave w {
    variable ::tk::Priv
d179 1
a179 1
    if {[string equal $Priv(buttonWindow) $w] || \
d181 1
a181 1
	$w configure -relief $Priv(relief)
d184 1
a184 1
    set Priv(window) ""
d187 1
a187 1
# ::tk::CheckRadioEnter --
d196 2
a197 2
proc ::tk::CheckRadioEnter w {
    variable ::tk::Priv
d199 1
a199 1
	if {[string equal $Priv(buttonWindow) $w]} {
d203 1
a203 1
	    set Priv(relief) [$w cget -relief]
d207 1
a207 1
    set Priv(window) $w
d210 1
a210 1
# ::tk::ButtonDown --
d219 2
a220 2
proc ::tk::ButtonDown w {
    variable ::tk::Priv
d222 1
a222 1
    # is an overrelief setting, Priv(relief) will already have been set, and
d226 1
a226 1
	set Priv(relief) [$w cget -relief]
d230 1
a230 1
	set Priv(buttonWindow) $w
d234 1
a234 1
	after cancel $Priv(afterId)
d236 1
a236 1
	set Priv(repeated) 0
d238 1
a238 1
	    set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
d243 1
a243 1
# ::tk::CheckRadioDown --
d252 2
a253 2
proc ::tk::CheckRadioDown w {
    variable ::tk::Priv
d255 1
a255 1
	set Priv(relief) [$w cget -relief]
d258 2
a259 2
	set Priv(buttonWindow) $w
	set Priv(repeated) 0
d264 1
a264 1
# ::tk::ButtonUp --
d272 4
a275 4
proc ::tk::ButtonUp w {
    variable ::tk::Priv
    if {[string equal $Priv(buttonWindow) $w]} {
	set Priv(buttonWindow) ""
d283 1
a283 1
	    set relief $Priv(relief)
d289 1
a289 1
	after cancel $Priv(afterId)
d291 1
a291 1
	if {[string equal $Priv(window) $w]
d297 1
a297 1
	    if { $Priv(repeated) == 0 } {
d312 1
a312 1
# ::tk::ButtonEnter --
d320 2
a321 2
proc ::tk::ButtonEnter {w} {
    variable ::tk::Priv
d328 1
a328 1
	if {[string equal $Priv(buttonWindow) $w]} {
d331 1
a331 1
	    set Priv(relief) [$w cget -relief]
d336 1
a336 1
    set Priv(window) $w
d339 1
a339 1
# ::tk::ButtonLeave --
d343 1
a343 1
# pressed (Priv(buttonWindow) == $w), restore the relief of the
d349 2
a350 2
proc ::tk::ButtonLeave w {
    variable ::tk::Priv
d358 1
a358 1
    if {[string equal $Priv(buttonWindow) $w] || \
d360 1
a360 1
	$w configure -relief $Priv(relief)
d363 1
a363 1
    set Priv(window) ""
d366 1
a366 1
# ::tk::ButtonDown --
d375 2
a376 2
proc ::tk::ButtonDown w {
    variable ::tk::Priv
d379 1
a379 1
    # is an overrelief setting, Priv(relief) will already have been set, and
d383 1
a383 1
	set Priv(relief) [$w cget -relief]
d387 1
a387 1
	set Priv(buttonWindow) $w
d391 1
a391 1
	after cancel $Priv(afterId)
d393 1
a393 1
	set Priv(repeated) 0
d395 1
a395 1
	    set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
d400 1
a400 1
# ::tk::ButtonUp --
d408 4
a411 4
proc ::tk::ButtonUp w {
    variable ::tk::Priv
    if {[string equal $w $Priv(buttonWindow)]} {
	set Priv(buttonWindow) ""
d420 1
a420 1
	    set relief $Priv(relief)
d425 1
a425 1
	after cancel $Priv(afterId)
d427 1
a427 1
	if {[string equal $w $Priv(window)] \
d432 1
a432 1
	    if { $Priv(repeated) == 0 } {
d447 1
a447 1
# ::tk::ButtonEnter --
d455 2
a456 2
proc ::tk::ButtonEnter {w} {
    variable ::tk::Priv
d458 1
a458 1
	if {[string equal $w $Priv(buttonWindow)]} {
d461 1
a461 1
	    set Priv(relief) [$w cget -relief]
d465 1
a465 1
    set Priv(window) $w
d468 1
a468 1
# ::tk::ButtonLeave --
d472 1
a472 1
# pressed (Priv(buttonWindow) == $w), restore the relief of the
d478 3
a480 3
proc ::tk::ButtonLeave w {
    variable ::tk::Priv
    if {[string equal $w $Priv(buttonWindow)]} {
d484 1
a484 1
	$w configure -relief $Priv(relief)
d486 1
a486 1
    set Priv(window) ""
d489 1
a489 1
# ::tk::ButtonDown --
d498 2
a499 2
proc ::tk::ButtonDown w {
    variable ::tk::Priv
d502 1
a502 1
	set Priv(buttonWindow) $w
d506 1
a506 2
	after cancel $Priv(afterId)
    set Priv(repeated) 0
d508 2
d511 1
a511 1
		set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
d517 1
a517 1
# ::tk::ButtonUp --
d525 3
a527 3
proc ::tk::ButtonUp w {
    variable ::tk::Priv
    if {[string equal $w $Priv(buttonWindow)]} {
d529 1
a529 1
	set Priv(buttonWindow) ""
d536 1
a536 1
	after cancel $Priv(afterId)
d538 1
a538 1
	if {[string equal $w $Priv(window)]
d542 1
a542 1
	    if { $Priv(repeated) == 0 } {
d555 1
a555 1
# ::tk::ButtonInvoke --
d562 1
a562 1
proc ::tk::ButtonInvoke w {
d574 1
a574 1
# ::tk::ButtonAutoInvoke --
d585 1
a585 1
#	May create an after event to call ::tk::ButtonAutoInvoke.
d587 3
a589 3
proc ::tk::ButtonAutoInvoke {w} {
    variable ::tk::Priv
    after cancel $Priv(afterId)
d591 2
a592 2
    if { [string equal $Priv(window) $w] } {
	incr Priv(repeated)
d596 1
a596 1
	set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
d600 1
a600 1
# ::tk::CheckRadioInvoke --
d610 1
a610 1
proc ::tk::CheckRadioInvoke {w {cmd invoke}} {
@


1.10.4.1
log
@2001-02-28  Don Porter  <dgp@@users.sourceforge.net>

        BRANCH dgp-privates-into-namespace:  Feature branch to move all
        of Tk's private commands and variable into the ::tk namespace
        and its children.

        * doc/tkvars.n:  Documented private variable tkPriv renamed tk::Priv.

        * generic/tkBind.c:
        * generic/tkMenu.c:
        * generic/tkTextDisp.c:
        * library/bgerror.tcl:
        * library/button.tcl:
        * library/choosedir.tcl:
        * library/clrpick.tcl:
        * library/comdlg.tcl:
        * library/console.tcl:
        * library/dialog.tcl:
        * library/entry.tcl:
        * library/focus.tcl:
        * library/listbox.tcl:
        * library/menu.tcl:
        * library/msgbox.tcl:
        * library/optMenu.tcl:
        * library/palette.tcl:
        * library/scale.tcl:
        * library/scrlbar.tcl:
        * library/spinbox.tcl:
        * library/tclIndex:
        * library/tearoff.tcl:
        * library/text.tcl:
        * library/tk.tcl:
        * library/tkfbox.tcl:
        * library/xmfbox.tcl:
        * mac/tkMacMenu.c:
        * tests/clrpick.test:
        * tests/filebox.test:
        * tests/macMenu.test:
        * tests/menu.test:
        * tests/menuDraw.test:
        * tests/msgbox.test:
        * tests/text.test:
        * tests/textDisp.test:
        * tests/unixMenu.test:
        * tests/winMenu.test:
        * tests/xmfbox.test:
        * unix/tkUnixDialog.c:  All Tk commands matching ::tk[A-Z]* and
        all Tk private variables in the global namespace were renamed to
        live in the namespace ::tk or one of its children.
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.10 2000/05/25 17:19:57 ericm Exp $
d22 1
a22 1
	tk::ButtonEnter %W
d25 1
a25 1
	tk::ButtonDown %W
d28 1
a28 1
	tk::ButtonUp %W
d31 1
a31 1
	tk::ButtonEnter %W
d34 1
a34 1
	tk::ButtonDown %W
d37 1
a37 1
	tk::ButtonUp %W
d42 1
a42 1
	tk::CheckRadioInvoke %W select
d45 1
a45 1
	tk::CheckRadioInvoke %W select
d48 1
a48 1
	tk::CheckRadioInvoke %W deselect
d51 1
a51 1
	tk::CheckRadioDown %W
d54 1
a54 1
	tk::ButtonUp %W
d57 1
a57 1
	tk::CheckRadioEnter %W
d61 1
a61 1
	tk::CheckRadioDown %W
d64 1
a64 1
	tk::ButtonUp %W
d67 1
a67 1
	tk::CheckRadioEnter %W
d73 1
a73 1
	    tk::CheckRadioInvoke %W
d78 1
a78 1
	    tk::CheckRadioInvoke %W
d82 1
a82 1
	tk::CheckRadioInvoke %W
d85 1
a85 1
	tk::CheckRadioInvoke %W
d88 1
a88 1
	tk::ButtonEnter %W
d91 1
a91 1
	tk::ButtonEnter %W
d96 1
a96 1
    tk::ButtonInvoke %W
d99 1
a99 1
    tk::CheckRadioInvoke %W
d102 1
a102 1
    tk::CheckRadioInvoke %W
d107 1
a107 1
    tk::ButtonEnter %W
d110 1
a110 1
    tk::ButtonLeave %W
d113 1
a113 1
    tk::ButtonDown %W
d116 1
a116 1
    tk::ButtonUp %W
d121 1
a121 1
    tk::ButtonLeave %W
d126 1
a126 1
    tk::ButtonLeave %W
d135 1
a135 1
# ::tk::ButtonEnter --
d143 2
a144 2
proc ::tk::ButtonEnter w {
    variable ::tk::Priv
d150 1
a150 1
	if {[string equal $Priv(buttonWindow) $w]} {
d153 1
a153 1
	    set Priv(relief) [$w cget -relief]
d157 1
a157 1
    set Priv(window) $w
d160 1
a160 1
# ::tk::ButtonLeave --
d164 1
a164 1
# pressed (Priv(buttonWindow) == $w), restore the relief of the
d170 2
a171 2
proc ::tk::ButtonLeave w {
    variable ::tk::Priv
d179 1
a179 1
    if {[string equal $Priv(buttonWindow) $w] || \
d181 1
a181 1
	$w configure -relief $Priv(relief)
d184 1
a184 1
    set Priv(window) ""
d187 1
a187 1
# ::tk::CheckRadioEnter --
d196 2
a197 2
proc ::tk::CheckRadioEnter w {
    variable ::tk::Priv
d199 1
a199 1
	if {[string equal $Priv(buttonWindow) $w]} {
d203 1
a203 1
	    set Priv(relief) [$w cget -relief]
d207 1
a207 1
    set Priv(window) $w
d210 1
a210 1
# ::tk::ButtonDown --
d219 2
a220 2
proc ::tk::ButtonDown w {
    variable ::tk::Priv
d222 1
a222 1
    # is an overrelief setting, Priv(relief) will already have been set, and
d226 1
a226 1
	set Priv(relief) [$w cget -relief]
d230 1
a230 1
	set Priv(buttonWindow) $w
d234 1
a234 1
	after cancel $Priv(afterId)
d236 1
a236 1
	set Priv(repeated) 0
d238 1
a238 1
	    set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
d243 1
a243 1
# ::tk::CheckRadioDown --
d252 2
a253 2
proc ::tk::CheckRadioDown w {
    variable ::tk::Priv
d255 1
a255 1
	set Priv(relief) [$w cget -relief]
d258 2
a259 2
	set Priv(buttonWindow) $w
	set Priv(repeated) 0
d264 1
a264 1
# ::tk::ButtonUp --
d272 4
a275 4
proc ::tk::ButtonUp w {
    variable ::tk::Priv
    if {[string equal $Priv(buttonWindow) $w]} {
	set Priv(buttonWindow) ""
d283 1
a283 1
	    set relief $Priv(relief)
d289 1
a289 1
	after cancel $Priv(afterId)
d291 1
a291 1
	if {[string equal $Priv(window) $w]
d297 1
a297 1
	    if { $Priv(repeated) == 0 } {
d312 1
a312 1
# ::tk::ButtonEnter --
d320 2
a321 2
proc ::tk::ButtonEnter {w} {
    variable ::tk::Priv
d328 1
a328 1
	if {[string equal $Priv(buttonWindow) $w]} {
d331 1
a331 1
	    set Priv(relief) [$w cget -relief]
d336 1
a336 1
    set Priv(window) $w
d339 1
a339 1
# ::tk::ButtonLeave --
d343 1
a343 1
# pressed (Priv(buttonWindow) == $w), restore the relief of the
d349 2
a350 2
proc ::tk::ButtonLeave w {
    variable ::tk::Priv
d358 1
a358 1
    if {[string equal $Priv(buttonWindow) $w] || \
d360 1
a360 1
	$w configure -relief $Priv(relief)
d363 1
a363 1
    set Priv(window) ""
d366 1
a366 1
# ::tk::ButtonDown --
d375 2
a376 2
proc ::tk::ButtonDown w {
    variable ::tk::Priv
d379 1
a379 1
    # is an overrelief setting, Priv(relief) will already have been set, and
d383 1
a383 1
	set Priv(relief) [$w cget -relief]
d387 1
a387 1
	set Priv(buttonWindow) $w
d391 1
a391 1
	after cancel $Priv(afterId)
d393 1
a393 1
	set Priv(repeated) 0
d395 1
a395 1
	    set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
d400 1
a400 1
# ::tk::ButtonUp --
d408 4
a411 4
proc ::tk::ButtonUp w {
    variable ::tk::Priv
    if {[string equal $w $Priv(buttonWindow)]} {
	set Priv(buttonWindow) ""
d420 1
a420 1
	    set relief $Priv(relief)
d425 1
a425 1
	after cancel $Priv(afterId)
d427 1
a427 1
	if {[string equal $w $Priv(window)] \
d432 1
a432 1
	    if { $Priv(repeated) == 0 } {
d447 1
a447 1
# ::tk::ButtonEnter --
d455 2
a456 2
proc ::tk::ButtonEnter {w} {
    variable ::tk::Priv
d458 1
a458 1
	if {[string equal $w $Priv(buttonWindow)]} {
d461 1
a461 1
	    set Priv(relief) [$w cget -relief]
d465 1
a465 1
    set Priv(window) $w
d468 1
a468 1
# ::tk::ButtonLeave --
d472 1
a472 1
# pressed (Priv(buttonWindow) == $w), restore the relief of the
d478 3
a480 3
proc ::tk::ButtonLeave w {
    variable ::tk::Priv
    if {[string equal $w $Priv(buttonWindow)]} {
d484 1
a484 1
	$w configure -relief $Priv(relief)
d486 1
a486 1
    set Priv(window) ""
d489 1
a489 1
# ::tk::ButtonDown --
d498 2
a499 2
proc ::tk::ButtonDown w {
    variable ::tk::Priv
d502 1
a502 1
	set Priv(buttonWindow) $w
d506 1
a506 1
	after cancel $Priv(afterId)
d509 1
a509 1
	    set Priv(repeated) 0
d511 1
a511 1
		set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
d517 1
a517 1
# ::tk::ButtonUp --
d525 3
a527 3
proc ::tk::ButtonUp w {
    variable ::tk::Priv
    if {[string equal $w $Priv(buttonWindow)]} {
d529 1
a529 1
	set Priv(buttonWindow) ""
d536 1
a536 1
	after cancel $Priv(afterId)
d538 1
a538 1
	if {[string equal $w $Priv(window)]
d542 1
a542 1
	    if { $Priv(repeated) == 0 } {
d555 1
a555 1
# ::tk::ButtonInvoke --
d562 1
a562 1
proc ::tk::ButtonInvoke w {
d574 1
a574 1
# ::tk::ButtonAutoInvoke --
d585 1
a585 1
#	May create an after event to call ::tk::ButtonAutoInvoke.
d587 3
a589 3
proc ::tk::ButtonAutoInvoke {w} {
    variable ::tk::Priv
    after cancel $Priv(afterId)
d591 2
a592 2
    if { [string equal $Priv(window) $w] } {
	incr Priv(repeated)
d596 1
a596 1
	set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
d600 1
a600 1
# ::tk::CheckRadioInvoke --
d610 1
a610 1
proc ::tk::CheckRadioInvoke {w {cmd invoke}} {
@


1.9
log
@* 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.
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.8 2000/05/17 21:17:21 ericm Exp $
d198 4
a201 3
    if {[string compare [$w cget -state] "disabled"] \
	    && [string equal $tkPriv(buttonWindow) $w]} {
	$w configure -state active
d254 3
a256 1
    set tkPriv(relief) [$w cget -relief]
d259 1
@


1.8
log
@* doc/SetOptions.3: Added information about TK_OPTION_NULL_OK with
TK_OPTION_RELIEF.

* win/tkWinButton.c: Removed bits about TK_RELIEF_LINK.

* tests/button.test: Added tests for -overrelief; removed tests
for -relief link.

* mac/tkMacButton.c: Removed bits about TK_RELIEF_LINK.

* generic/tkOldConfig.c: Removed bits about TK_RELIEF_LINK.

* generic/tkConfig.c: Removed bits about TK_RELIEF_LINK; added
support for TK_OPTION_NULL_OK for TK_OPTION_RELIEF.

* library/button.tcl: Added binding support for -overrelief.

* generic/tk3d.c (Tk_GetRelief): Added branch for TK_RELIEF_NULL.

* generic/tkButton.c: Added -overrelief option; removed
Enter/Leave EventProc masks and handlers.

* generic/tk.h: Added TK_RELIEF_NULL definition, removed
TK_RELIEF_LINK.

* mac/tkMacDefault.h (DEF_BUTTON_OVER_RELIEF):
* win/tkWinDefault.h (DEF_BUTTON_OVER_RELIEF):
* unix/tkUnixDefault.h (DEF_BUTTON_OVER_RELIEF): Added default
value for the -overrelief option.
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.7 2000/05/13 00:39:08 ericm Exp $
d201 4
d503 6
a508 4
	set delay [$w cget -repeatdelay]
	set tkPriv(repeated) 0
	if {$delay > 0} {
	    set tkPriv(afterId) [after $delay [list tkButtonAutoInvoke $w]]
@


1.7
log
@* unix/tkUnixButton.c (TkpDisplayButton, TkpComputeButtonGeometry):
* mac/tkMacButton.c (TkpDisplayButton, TkpComputeButtonGeometry):
* win/tkWinButton.c (TkpDisplayButton, TkpComputeButtonGeometry):
Added code for drawing compound buttons.

* tests/button.test: Added configuration tests for -repeatdelay,
-repeatinterval, -compound.

* library/button.tcl: Added support for -repeatedelay,
-repeatinterval options.

* generic/tkOldConfig.c: Changed handling of link relief so that
proper error messages are used.

* generic/tkButton.h: Added -compound, -repeatdelay,
-repeatinterval options.

* generic/tkButton.c: Added event watchers for enter/leave events,
for link relief support.

* generic/tk3d.c: Changed handling of link relief so that proper
error messages are used.

* generic/tk.h: Changed values of
TK_OPTION_LINK_OK/TK_CONFIG_LINK_OK for link relief support.
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.6 1999/09/02 17:02:52 hobbs Exp $
d145 11
a155 3
    if {[string compare [$w cget -state] "disabled"] \
	    && [string equal $tkPriv(buttonWindow) $w]} {
	$w configure -state active -relief sunken
d175 6
a180 1
    if {[string equal $tkPriv(buttonWindow) $w]} {
d183 1
d216 8
a223 1
    set tkPriv(relief) [$w cget -relief]
d268 15
a282 1
	$w configure -relief $tkPriv(relief)
d316 4
d322 3
d327 1
d346 6
a351 1
    if {[string equal $tkPriv(buttonWindow) $w]} {
d354 1
d369 9
a377 1
    set tkPriv(relief) [$w cget -relief]
d404 13
a416 1
	$w configure -relief $tkPriv(relief)
d418 1
d450 1
a450 1
      if {[string equal $w $tkPriv(buttonWindow)]} {
d452 3
d475 3
d492 1
d520 8
@


1.6
log
@1999-09-01  Jeff Hobbs  <hobbs@@scriptics.com>

	* library/msgbox.tcl: changed the behavior of tk_messageBox on
	Unix to be more Windows like in handling of <Return> and the
	default button
	* library/button.tcl:
	* library/clrpick.tcl:
	* library/comdlg.tcl:
	* library/console.tcl:
	* library/dialog.tcl:
	* library/entry.tcl:
	* library/focus.tcl:
	* library/listbox.tcl:
	* library/menu.tcl:
	* library/msgbox.tcl:
	* library/palette.tcl:
	* library/safetk.tcl:
	* library/scale.tcl:
	* library/scrlbar.tcl:
	* library/tearoff.tcl:
	* library/text.tcl:
	* library/tk.tcl:
	* library/tkfbox.tcl:
	* library/xmfbox.tcl: updated commands to use [string] ops
	instead of expr equality operators
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.5 1999/08/09 16:52:06 hobbs Exp $
d206 8
d251 6
a256 1
	    uplevel #0 [list $w invoke]
d324 8
d348 1
d351 6
a356 1
	    uplevel #0 [list $w invoke]
d419 8
d445 5
a449 1
	    uplevel #0 [list $w invoke]
d476 26
@


1.5
log
@1999-08-09  Jeff Hobbs  <hobbs@@scriptics.com>

	* library/button.tcl: cleaned up programming (config -> configure)
	and fixed Windows relief bug [Bug: 664]
	* library/entry.tcl: changed Entry C/C/P to not use global data
	(now uses tkPriv(data)) [Bug: 1475]
	* library/listbox.tcl: fixed extended mode script error [Bug: 866]
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.4 1999/04/16 01:51:26 stanton Exp $
d146 1
a146 1
	    && ![string compare $tkPriv(buttonWindow) $w]} {
d167 1
a167 1
    if {![string compare $tkPriv(buttonWindow) $w]} {
d185 1
a185 1
	    && ![string compare $tkPriv(buttonWindow) $w]} {
d237 1
a237 1
    if {![string compare $tkPriv(buttonWindow) $w]} {
d240 1
a240 1
	if {![string compare $tkPriv(window) $w]
d268 1
a268 1
	if {![string compare $tkPriv(buttonWindow) $w]} {
d290 1
a290 1
    if {![string compare $tkPriv(buttonWindow) $w]} {
d324 1
a324 1
    if {![string compare $w $tkPriv(buttonWindow)]} {
d327 1
a327 1
	if {![string compare $w $tkPriv(window)] \
d353 1
a353 1
      if {![string compare $w $tkPriv(buttonWindow)]} {
d372 1
a372 1
    if {![string compare $w $tkPriv(buttonWindow)]} {
d405 1
a405 1
    if {![string compare $w $tkPriv(buttonWindow)]} {
d408 1
a408 1
	if {![string compare $w $tkPriv(window)]
@


1.4
log
@* Merged 8.1 branch into the main trunk
@
text
@d7 1
a7 1
# RCS: @@(#) $Id$
d145 3
a147 4
    if {[string compare [$w cget -state] "disabled"]} {
      if {![string compare $tkPriv(buttonWindow) $w]} {
	    $w configure -state active -relief sunken
	}
d165 1
a165 1
	$w config -state normal
d184 3
a186 4
    if {[string compare [$w cget -state] "disabled"]} {
      if {![string compare $tkPriv(buttonWindow) $w]} {
	    $w configure -state active
	}
d202 1
a202 1
    set tkPriv(relief) [lindex [$w conf -relief] 4]
d205 1
a205 1
	$w config -relief sunken -state active
d220 1
a220 1
    set tkPriv(relief) [lindex [$w conf -relief] 4]
d223 1
a223 1
	$w config -state active
d239 2
a240 1
      if {![string compare $tkPriv(window) $w]
d242 1
a242 1
	    $w config -relief $tkPriv(relief) -state normal
d267 2
a268 2
	$w config -state active
      if {![string compare $tkPriv(buttonWindow) $w]} {
d288 1
a288 1
	$w config -state normal
d307 1
a307 1
    set tkPriv(relief) [lindex [$w config -relief] 4]
d310 1
a310 1
	$w config -relief sunken
d326 3
a328 3
	$w config -relief $tkPriv(relief)
      if {![string compare $w $tkPriv(window)]
              && [string compare [$w cget -state] "disabled"]} {
d391 1
a391 1
	$w config -state active
d406 1
a406 1
	$w config -state normal
d408 1
a408 1
      if {![string compare $w $tkPriv(window)]
@


1.3
log
@Replaced SCCS strings, fixed binary files
@
text
@d20 1
a20 1
if {$tcl_platform(platform) == "macintosh"} {
d40 1
a40 1
if {$tcl_platform(platform) == "windows"} {
d70 1
a70 1
if {$tcl_platform(platform) == "unix"} {
d129 1
a129 1
if {$tcl_platform(platform) == "windows"} {
d145 2
a146 2
    if {[$w cget -state] != "disabled"} {
	if {$tkPriv(buttonWindow) == $w} {
d165 1
a165 1
    if {[$w cget -state] != "disabled"} {
d168 1
a168 1
    if {$w == $tkPriv(buttonWindow)} {
d185 2
a186 2
    if {[$w cget -state] != "disabled"} {
	if {$tkPriv(buttonWindow) == $w} {
d205 1
a205 1
    if {[$w cget -state] != "disabled"} {
d223 1
a223 1
    if {[$w cget -state] != "disabled"} {
d239 1
a239 1
    if {$w == $tkPriv(buttonWindow)} {
d241 2
a242 2
	if {($w == $tkPriv(window))
		&& ([$w cget -state] != "disabled")} {
d251 1
a251 1
if {$tcl_platform(platform) == "unix"} {
d267 1
a267 1
    if {[$w cget -state] != "disabled"} {
d269 1
a269 1
	if {$tkPriv(buttonWindow) == $w} {
d288 1
a288 1
    if {[$w cget -state] != "disabled"} {
d291 1
a291 1
    if {$w == $tkPriv(buttonWindow)} {
d309 1
a309 1
    if {[$w cget -state] != "disabled"} {
d325 1
a325 1
    if {$w == $tkPriv(buttonWindow)} {
d328 2
a329 2
	if {($w == $tkPriv(window))
		&& ([$w cget -state] != "disabled")} {
d337 1
a337 1
if {$tcl_platform(platform) == "macintosh"} {
d353 2
a354 2
    if {[$w cget -state] != "disabled"} {
	if {$tkPriv(buttonWindow) == $w} {
d373 1
a373 1
    if {$w == $tkPriv(buttonWindow)} {
d390 1
a390 1
    if {[$w cget -state] != "disabled"} {
d406 1
a406 1
    if {$w == $tkPriv(buttonWindow)} {
d409 2
a410 2
	if {($w == $tkPriv(window))
		&& ([$w cget -state] != "disabled")} {
d430 1
a430 1
    if {[$w cget -state] != "disabled"} {
d452 1
a452 1
    if {[$w cget -state] != "disabled"} {
@


1.2
log
@plugin update
@
text
@d7 1
a7 1
# SCCS: @@(#) button.tcl 1.22 96/11/14 14:49:11
@


1.1
log
@Initial revision
@
text
@d72 1
a72 1
	if !$tk_strictMotif {
d77 1
a77 1
	if !$tk_strictMotif {
@


1.1.4.1
log
@initial tk8.1a2 version
@
text
@d7 1
a7 1
# SCCS: @@(#) button.tcl 1.23 97/12/03 15:28:54
d72 1
a72 1
	if {!$tk_strictMotif} {
d77 1
a77 1
	if {!$tk_strictMotif} {
@


1.1.4.2
log
@Merged 8.0.3 changes into 8.1
@
text
@d7 1
a7 1
# RCS: @@(#) $Id: button.tcl,v 1.3 1998/09/14 18:23:22 stanton Exp $
@


1.1.4.3
log
@* library/bgerror.tcl:
* library/button.tcl:
* library/clrpick.tcl:
* library/console.tcl:
* library/dialog.tcl:
* library/entry.tcl:
* library/focus.tcl:
* library/listbox.tcl:
* library/menu.tcl:
* library/msgbox.tcl:
* library/palette.tcl:
* library/scale.tcl:
* library/scrlbar.tcl:
* library/tearoff.tcl:
* library/text.tcl:
* library/tk.tcl: Lots of minor performance improvements
contributed by Jeffrey Hobbs. [Bug: 1118]
@
text
@d7 1
a7 1
# RCS: @@(#) $Id$
d20 1
a20 1
if {[string match "macintosh" $tcl_platform(platform)]} {
d40 1
a40 1
if {[string match "windows" $tcl_platform(platform)]} {
d70 1
a70 1
if {[string match "unix" $tcl_platform(platform)]} {
d129 1
a129 1
if {[string match "windows" $tcl_platform(platform)]} {
d145 2
a146 2
    if {[string compare [$w cget -state] "disabled"]} {
      if {![string compare $tkPriv(buttonWindow) $w]} {
d165 1
a165 1
    if {[string compare [$w cget -state] "disabled"]} {
d168 1
a168 1
    if {![string compare $tkPriv(buttonWindow) $w]} {
d185 2
a186 2
    if {[string compare [$w cget -state] "disabled"]} {
      if {![string compare $tkPriv(buttonWindow) $w]} {
d205 1
a205 1
    if {[string compare [$w cget -state] "disabled"]} {
d223 1
a223 1
    if {[string compare [$w cget -state] "disabled"]} {
d239 1
a239 1
    if {![string compare $tkPriv(buttonWindow) $w]} {
d241 2
a242 2
      if {![string compare $tkPriv(window) $w]
              && [string compare [$w cget -state] "disabled"]} {
d251 1
a251 1
if {[string match "unix" $tcl_platform(platform)]} {
d267 1
a267 1
    if {[string compare [$w cget -state] "disabled"]} {
d269 1
a269 1
      if {![string compare $tkPriv(buttonWindow) $w]} {
d288 1
a288 1
    if {[string compare [$w cget -state] "disabled"]} {
d291 1
a291 1
    if {![string compare $tkPriv(buttonWindow) $w]} {
d309 1
a309 1
    if {[string compare [$w cget -state] "disabled"]} {
d325 1
a325 1
    if {![string compare $w $tkPriv(buttonWindow)]} {
d328 2
a329 2
      if {![string compare $w $tkPriv(window)]
              && [string compare [$w cget -state] "disabled"]} {
d337 1
a337 1
if {[string match "macintosh" $tcl_platform(platform)]} {
d353 2
a354 2
    if {[string compare [$w cget -state] "disabled"]} {
      if {![string compare $w $tkPriv(buttonWindow)]} {
d373 1
a373 1
    if {![string compare $w $tkPriv(buttonWindow)]} {
d390 1
a390 1
    if {[string compare [$w cget -state] "disabled"]} {
d406 1
a406 1
    if {![string compare $w $tkPriv(buttonWindow)]} {
d409 2
a410 2
      if {![string compare $w $tkPriv(window)]
              && [string compare [$w cget -state] "disabled"]} {
d430 1
a430 1
    if {[string compare [$w cget -state] "disabled"]} {
d452 1
a452 1
    if {[string compare [$w cget -state] "disabled"]} {
@


