1
0
Fork 0
This repository has been archived on 2019-12-23. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
arduinisten/arduino-0018-windows/hardware/tools/avr/share/redhat/gui/canvas.tcl

30 lines
759 B
Tcl
Raw Normal View History

2010-03-30 21:53:44 +02:00
# canvas.tcl - Handy canvas-related commands.
# Copyright (C) 1997 Cygnus Solutions.
# Written by Tom Tromey <tromey@cygnus.com>.
# Set scroll region on canvas.
proc set_scroll_region {canvas} {
set bbox [$canvas bbox all]
if {[llength $bbox]} then {
set sr [lreplace $bbox 0 1 0 0]
} else {
set sr {0 0 0 0}
}
# Don't include borders in the scrollregion.
set delta [expr {2 * ([$canvas cget -borderwidth]
+ [$canvas cget -highlightthickness])}]
set ww [winfo width $canvas]
if {[lindex $sr 2] < $ww} then {
set sr [lreplace $sr 2 2 [expr {$ww - $delta}]]
}
set wh [winfo height $canvas]
if {[lindex $sr 3] < $wh} then {
set sr [lreplace $sr 3 3 [expr {$wh - $delta}]]
}
$canvas configure -scrollregion $sr
}