Import Tk 8.6.11

This commit is contained in:
Steve Dower
2021-03-30 00:54:10 +01:00
parent 42c69189d9
commit 070b8750b0
403 changed files with 21608 additions and 16269 deletions

View File

@@ -9,14 +9,35 @@ namespace eval ttk::scrollbar {
# State(first) -- value of -first at start of drag.
}
bind TScrollbar <ButtonPress-1> { ttk::scrollbar::Press %W %x %y }
bind TScrollbar <Button-1> { ttk::scrollbar::Press %W %x %y }
bind TScrollbar <B1-Motion> { ttk::scrollbar::Drag %W %x %y }
bind TScrollbar <ButtonRelease-1> { ttk::scrollbar::Release %W %x %y }
bind TScrollbar <ButtonPress-2> { ttk::scrollbar::Jump %W %x %y }
bind TScrollbar <Button-2> { ttk::scrollbar::Jump %W %x %y }
bind TScrollbar <B2-Motion> { ttk::scrollbar::Drag %W %x %y }
bind TScrollbar <ButtonRelease-2> { ttk::scrollbar::Release %W %x %y }
# Redirect scrollwheel bindings to the scrollbar widget
#
# The shift-bindings scroll left/right (not up/down)
# if a widget has both possibilities
set eventList [list <MouseWheel> <Shift-MouseWheel>]
switch [tk windowingsystem] {
aqua {
lappend eventList <Option-MouseWheel> <Shift-Option-MouseWheel>
}
x11 {
lappend eventList <Button-4> <Button-5> \
<Shift-Button-4> <Shift-Button-5>
# For tk 8.7, the event list will be extended by
# <Button-6> <Button-7>
}
}
foreach event $eventList {
bind TScrollbar $event [bind Scrollbar $event]
}
unset eventList event
proc ttk::scrollbar::Scroll {w n units} {
set cmd [$w cget -command]
if {$cmd ne ""} {
@@ -38,7 +59,7 @@ proc ttk::scrollbar::Press {w x y} {
set State(yPress) $y
switch -glob -- [$w identify $x $y] {
*uparrow -
*uparrow -
*leftarrow {
ttk::Repeatedly Scroll $w -1 units
}
@@ -46,6 +67,7 @@ proc ttk::scrollbar::Press {w x y} {
*rightarrow {
ttk::Repeatedly Scroll $w 1 units
}
*grip -
*thumb {
set State(first) [lindex [$w get] 0]
}
@@ -68,7 +90,7 @@ proc ttk::scrollbar::Press {w x y} {
proc ttk::scrollbar::Drag {w x y} {
variable State
if {![info exists State(first)]} {
# Initial buttonpress was not on the thumb,
# Initial buttonpress was not on the thumb,
# or something screwy has happened. In either case, ignore:
return;
}
@@ -83,7 +105,7 @@ proc ttk::scrollbar::Release {w x y} {
ttk::CancelRepeat
}
# scrollbar::Jump -- ButtonPress-2 binding for scrollbars.
# scrollbar::Jump -- Button-2 binding for scrollbars.
# Behaves exactly like scrollbar::Press, except that
# clicking in the trough jumps to the the selected position.
#
@@ -91,6 +113,7 @@ proc ttk::scrollbar::Jump {w x y} {
variable State
switch -glob -- [$w identify $x $y] {
*grip -
*thumb -
*trough {
set State(first) [$w fraction $x $y]