| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| |
| |
|
|
| |
| if {[tk windowingsystem] eq "x11" || [tk windowingsystem] eq "aqua"} { |
|
|
| bind Scrollbar <Enter> { |
| if {$tk_strictMotif} { |
| set tk::Priv(activeBg) [%W cget -activebackground] |
| %W configure -activebackground [%W cget -background] |
| } |
| %W activate [%W identify %x %y] |
| } |
| bind Scrollbar <Motion> { |
| %W activate [%W identify %x %y] |
| } |
|
|
| |
| |
| |
| |
|
|
| bind Scrollbar <Leave> { |
| if {$tk_strictMotif && [info exists tk::Priv(activeBg)]} { |
| %W configure -activebackground $tk::Priv(activeBg) |
| } |
| %W activate {} |
| } |
| bind Scrollbar <1> { |
| tk::ScrollButtonDown %W %x %y |
| } |
| bind Scrollbar <B1-Motion> { |
| tk::ScrollDrag %W %x %y |
| } |
| bind Scrollbar <B1-B2-Motion> { |
| tk::ScrollDrag %W %x %y |
| } |
| bind Scrollbar <ButtonRelease-1> { |
| tk::ScrollButtonUp %W %x %y |
| } |
| bind Scrollbar <B1-Leave> { |
| |
| } |
| bind Scrollbar <B1-Enter> { |
| |
| } |
| bind Scrollbar <2> { |
| tk::ScrollButton2Down %W %x %y |
| } |
| bind Scrollbar <B1-2> { |
| |
| } |
| bind Scrollbar <B2-1> { |
| |
| } |
| bind Scrollbar <B2-Motion> { |
| tk::ScrollDrag %W %x %y |
| } |
| bind Scrollbar <ButtonRelease-2> { |
| tk::ScrollButtonUp %W %x %y |
| } |
| bind Scrollbar <B1-ButtonRelease-2> { |
| |
| } |
| bind Scrollbar <B2-ButtonRelease-1> { |
| |
| } |
| bind Scrollbar <B2-Leave> { |
| |
| } |
| bind Scrollbar <B2-Enter> { |
| |
| } |
| bind Scrollbar <Control-1> { |
| tk::ScrollTopBottom %W %x %y |
| } |
| bind Scrollbar <Control-2> { |
| tk::ScrollTopBottom %W %x %y |
| } |
|
|
| bind Scrollbar <<PrevLine>> { |
| tk::ScrollByUnits %W v -1 |
| } |
| bind Scrollbar <<NextLine>> { |
| tk::ScrollByUnits %W v 1 |
| } |
| bind Scrollbar <<PrevPara>> { |
| tk::ScrollByPages %W v -1 |
| } |
| bind Scrollbar <<NextPara>> { |
| tk::ScrollByPages %W v 1 |
| } |
| bind Scrollbar <<PrevChar>> { |
| tk::ScrollByUnits %W h -1 |
| } |
| bind Scrollbar <<NextChar>> { |
| tk::ScrollByUnits %W h 1 |
| } |
| bind Scrollbar <<PrevWord>> { |
| tk::ScrollByPages %W h -1 |
| } |
| bind Scrollbar <<NextWord>> { |
| tk::ScrollByPages %W h 1 |
| } |
| bind Scrollbar <Prior> { |
| tk::ScrollByPages %W hv -1 |
| } |
| bind Scrollbar <Next> { |
| tk::ScrollByPages %W hv 1 |
| } |
| bind Scrollbar <<LineStart>> { |
| tk::ScrollToPos %W 0 |
| } |
| bind Scrollbar <<LineEnd>> { |
| tk::ScrollToPos %W 1 |
| } |
| } |
|
|
| if {[tk windowingsystem] eq "aqua"} { |
| bind Scrollbar <MouseWheel> { |
| tk::ScrollByUnits %W v [expr {-(%D)}] |
| } |
| bind Scrollbar <Option-MouseWheel> { |
| tk::ScrollByUnits %W v [expr {-10 * (%D)}] |
| } |
| bind Scrollbar <Shift-MouseWheel> { |
| tk::ScrollByUnits %W h [expr {-(%D)}] |
| } |
| bind Scrollbar <Shift-Option-MouseWheel> { |
| tk::ScrollByUnits %W h [expr {-10 * (%D)}] |
| } |
| } else { |
| bind Scrollbar <MouseWheel> { |
| if {%D >= 0} { |
| tk::ScrollByUnits %W v [expr {-%D/30}] |
| } else { |
| tk::ScrollByUnits %W v [expr {(29-%D)/30}] |
| } |
| } |
| bind Scrollbar <Shift-MouseWheel> { |
| if {%D >= 0} { |
| tk::ScrollByUnits %W h [expr {-%D/30}] |
| } else { |
| tk::ScrollByUnits %W h [expr {(29-%D)/30}] |
| } |
| } |
| } |
|
|
| if {[tk windowingsystem] eq "x11"} { |
| bind Scrollbar <4> {tk::ScrollByUnits %W v -5} |
| bind Scrollbar <5> {tk::ScrollByUnits %W v 5} |
| bind Scrollbar <Shift-4> {tk::ScrollByUnits %W h -5} |
| bind Scrollbar <Shift-5> {tk::ScrollByUnits %W h 5} |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| proc tk::ScrollButtonDown {w x y} { |
| variable ::tk::Priv |
| set Priv(relief) [$w cget -activerelief] |
| $w configure -activerelief sunken |
| set element [$w identify $x $y] |
| if {$element eq "slider"} { |
| ScrollStartDrag $w $x $y |
| } else { |
| ScrollSelect $w $element initial |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| proc ::tk::ScrollButtonUp {w x y} { |
| variable ::tk::Priv |
| tk::CancelRepeat |
| if {[info exists Priv(relief)]} { |
| |
| $w configure -activerelief $Priv(relief) |
| ScrollEndDrag $w $x $y |
| $w activate [$w identify $x $y] |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| proc ::tk::ScrollSelect {w element repeat} { |
| variable ::tk::Priv |
| if {![winfo exists $w]} return |
| switch -- $element { |
| "arrow1" {ScrollByUnits $w hv -1} |
| "trough1" {ScrollByPages $w hv -1} |
| "trough2" {ScrollByPages $w hv 1} |
| "arrow2" {ScrollByUnits $w hv 1} |
| default {return} |
| } |
| if {$repeat eq "again"} { |
| set Priv(afterId) [after [$w cget -repeatinterval] \ |
| [list tk::ScrollSelect $w $element again]] |
| } elseif {$repeat eq "initial"} { |
| set delay [$w cget -repeatdelay] |
| if {$delay > 0} { |
| set Priv(afterId) [after $delay \ |
| [list tk::ScrollSelect $w $element again]] |
| } |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
|
|
| proc ::tk::ScrollStartDrag {w x y} { |
| variable ::tk::Priv |
|
|
| if {[$w cget -command] eq ""} { |
| return |
| } |
| set Priv(pressX) $x |
| set Priv(pressY) $y |
| set Priv(initValues) [$w get] |
| set iv0 [lindex $Priv(initValues) 0] |
| if {[llength $Priv(initValues)] == 2} { |
| set Priv(initPos) $iv0 |
| } elseif {$iv0 == 0} { |
| set Priv(initPos) 0.0 |
| } else { |
| set Priv(initPos) [expr {(double([lindex $Priv(initValues) 2])) \ |
| / [lindex $Priv(initValues) 0]}] |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| proc ::tk::ScrollDrag {w x y} { |
| variable ::tk::Priv |
|
|
| if {$Priv(initPos) eq ""} { |
| return |
| } |
| set delta [$w delta [expr {$x - $Priv(pressX)}] [expr {$y - $Priv(pressY)}]] |
| if {[$w cget -jump]} { |
| if {[llength $Priv(initValues)] == 2} { |
| $w set [expr {[lindex $Priv(initValues) 0] + $delta}] \ |
| [expr {[lindex $Priv(initValues) 1] + $delta}] |
| } else { |
| set delta [expr {round($delta * [lindex $Priv(initValues) 0])}] |
| eval [list $w] set [lreplace $Priv(initValues) 2 3 \ |
| [expr {[lindex $Priv(initValues) 2] + $delta}] \ |
| [expr {[lindex $Priv(initValues) 3] + $delta}]] |
| } |
| } else { |
| ScrollToPos $w [expr {$Priv(initPos) + $delta}] |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
|
|
| proc ::tk::ScrollEndDrag {w x y} { |
| variable ::tk::Priv |
|
|
| if {$Priv(initPos) eq ""} { |
| return |
| } |
| if {[$w cget -jump]} { |
| set delta [$w delta [expr {$x - $Priv(pressX)}] \ |
| [expr {$y - $Priv(pressY)}]] |
| ScrollToPos $w [expr {$Priv(initPos) + $delta}] |
| } |
| set Priv(initPos) "" |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| proc ::tk::ScrollByUnits {w orient amount} { |
| set cmd [$w cget -command] |
| if {$cmd eq "" || ([string first \ |
| [string index [$w cget -orient] 0] $orient] < 0)} { |
| return |
| } |
| set info [$w get] |
| if {[llength $info] == 2} { |
| uplevel #0 $cmd scroll $amount units |
| } else { |
| uplevel #0 $cmd [expr {[lindex $info 2] + $amount}] |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| proc ::tk::ScrollByPages {w orient amount} { |
| set cmd [$w cget -command] |
| if {$cmd eq "" || ([string first \ |
| [string index [$w cget -orient] 0] $orient] < 0)} { |
| return |
| } |
| set info [$w get] |
| if {[llength $info] == 2} { |
| uplevel #0 $cmd scroll $amount pages |
| } else { |
| uplevel #0 $cmd [expr {[lindex $info 2] + $amount*([lindex $info 1] - 1)}] |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| proc ::tk::ScrollToPos {w pos} { |
| set cmd [$w cget -command] |
| if {$cmd eq ""} { |
| return |
| } |
| set info [$w get] |
| if {[llength $info] == 2} { |
| uplevel #0 $cmd moveto $pos |
| } else { |
| uplevel #0 $cmd [expr {round([lindex $info 0]*$pos)}] |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
|
|
| proc ::tk::ScrollTopBottom {w x y} { |
| variable ::tk::Priv |
| set element [$w identify $x $y] |
| if {[string match *1 $element]} { |
| ScrollToPos $w 0 |
| } elseif {[string match *2 $element]} { |
| ScrollToPos $w 1 |
| } |
|
|
| |
|
|
| set Priv(relief) [$w cget -activerelief] |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| proc ::tk::ScrollButton2Down {w x y} { |
| variable ::tk::Priv |
| if {![winfo exists $w]} { |
| return |
| } |
| set element [$w identify $x $y] |
| if {[string match {arrow[12]} $element]} { |
| ScrollButtonDown $w $x $y |
| return |
| } |
| ScrollToPos $w [$w fraction $x $y] |
| set Priv(relief) [$w cget -activerelief] |
|
|
| |
| |
| |
|
|
| update idletasks |
| if {[winfo exists $w]} { |
| $w configure -activerelief sunken |
| $w activate slider |
| ScrollStartDrag $w $x $y |
| } |
| } |
|
|