summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authortreectrl <treectrl>2003-01-28 23:48:24 (GMT)
committertreectrl <treectrl>2003-01-28 23:48:24 (GMT)
commit7d0eea43cec7214d5af811610c07032691d4c023 (patch)
treec5c6308c9cf3846feb6df3fe767da4bf852f579a /library
parent06ccbb96ec385a898b0a472ebf450fe66861dd9f (diff)
downloadtktreectrl-7d0eea43cec7214d5af811610c07032691d4c023.zip
tktreectrl-7d0eea43cec7214d5af811610c07032691d4c023.tar.gz
tktreectrl-7d0eea43cec7214d5af811610c07032691d4c023.tar.bz2
Implement 'scan mark' and 'scan dragto' stuff.
Diffstat (limited to 'library')
-rw-r--r--library/treectrl.tcl36
1 files changed, 33 insertions, 3 deletions
diff --git a/library/treectrl.tcl b/library/treectrl.tcl
index 181e058..0e2adf5 100644
--- a/library/treectrl.tcl
+++ b/library/treectrl.tcl
@@ -141,11 +141,20 @@ bind TreeCtrl <KeyPress-Return> {
# Additional Tk bindings that aren't part of the Motif look and feel:
-bind TreeCtrl <KeyPress-2> {
- %W scan mark %x %y
+bind TreeCtrl <ButtonPress-2> {
+ TreeCtrl::ScanMark %W %x %y
}
bind TreeCtrl <Button2-Motion> {
- %W scan dragto %x %y
+ TreeCtrl::ScanDrag %W %x %y
+}
+
+if {$tcl_platform(platform) eq "windows"} {
+ bind TreeCtrl <Control-ButtonPress-3> {
+ TreeCtrl::ScanMark %W %x %y
+ }
+ bind TreeCtrl <Control-Button3-Motion> {
+ TreeCtrl::ScanDrag %W %x %y
+ }
}
# The MouseWheel will typically only fire on Windows. However,
@@ -837,3 +846,24 @@ proc ::TreeCtrl::MarqueeEnd {w x y} {
return
}
+proc ::TreeCtrl::ScanMark {w x y} {
+ variable Priv
+ $w scan mark $x $y
+ set Priv(x) $x
+ set Priv(y) $y
+ set Priv(mouseMoved) 0
+ return
+}
+
+proc ::TreeCtrl::ScanDrag {w x y} {
+ variable Priv
+ if {![info exists Priv(x)]} { set Priv(x) $x }
+ if {![info exists Priv(y)]} { set Priv(y) $y }
+ if {($x != $Priv(x)) || ($y != $Priv(y))} {
+ set Priv(mouseMoved) 1
+ }
+ if {[info exists Priv(mouseMoved)] && $Priv(mouseMoved)} {
+ $w scan dragto $x $y
+ }
+ return
+}