diff options
Diffstat (limited to 'library/ttk/treeview.tcl')
-rw-r--r-- | library/ttk/treeview.tcl | 53 |
1 files changed, 23 insertions, 30 deletions
diff --git a/library/ttk/treeview.tcl b/library/ttk/treeview.tcl index d2a1015..608cdf2 100644 --- a/library/ttk/treeview.tcl +++ b/library/ttk/treeview.tcl @@ -1,4 +1,4 @@ -# $Id: treeview.tcl,v 1.5 2008/04/25 19:08:32 jenglish Exp $ +# $Id: treeview.tcl,v 1.6 2008/05/23 20:20:06 jenglish Exp $ # # ttk::treeview widget bindings and utilities. # @@ -21,15 +21,6 @@ namespace eval ttk::treeview { # For pressmode == "heading" set State(heading) {} - - # Provide [lassign] if not already present - # (@@@ TODO: check if this is still needed after horrible-identify purge) - # - if {![llength [info commands lassign]]} { - proc lassign {vals args} { - uplevel 1 [list foreach $args $vals break] - } - } } ### Widget bindings. @@ -118,10 +109,9 @@ proc ttk::treeview::Motion {w x y} { set cursor {} set activeHeading {} - lassign [$w identify $x $y] what where detail - switch -- $what { + switch -- [$w identify region $x $y] { separator { set cursor $Cursors(hresize) } - heading { set activeHeading $where } + heading { set activeHeading [$w identify column $x $y] } } if {[$w cget -cursor] ne $cursor} { @@ -170,19 +160,20 @@ proc ttk::treeview::DoubleClick {w x y} { ## Press -- ButtonPress binding. # proc ttk::treeview::Press {w x y} { - lassign [$w identify $x $y] what where detail - focus $w ;# or: ClickToFocus? - - switch -- $what { + focus $w + switch -- [$w identify region $x $y] { nothing { } - heading { heading.press $w $where } - separator { resize.press $w $x $where } - cell - - row - - item { SelectOp $w $where choose } - } - if {$what eq "item" && [string match *indicator $detail]} { - Toggle $w $where + heading { heading.press $w $x $y } + separator { resize.press $w $x $y } + tree - + cell { + set item [$w identify item $x $y] + SelectOp $w $item choose + switch -glob -- [$w identify element $x $y] { + *indicator - + *disclosure { Toggle $w $item } + } + } } } @@ -208,10 +199,10 @@ proc ttk::treeview::Release {w x y} { ### Interactive column resizing. # -proc ttk::treeview::resize.press {w x column} { +proc ttk::treeview::resize.press {w x y} { variable State set State(pressMode) "resize" - set State(resizeColumn) $column + set State(resizeColumn) [$w identify column $x $y] } proc ttk::treeview::resize.drag {w x} { @@ -226,8 +217,9 @@ proc ttk::treeview::resize.release {w x} { ### Heading activation. # -proc ttk::treeview::heading.press {w column} { +proc ttk::treeview::heading.press {w x y} { variable State + set column [$w identify column $x $y] set State(pressMode) "heading" set State(heading) $column $w heading $column state pressed @@ -235,8 +227,9 @@ proc ttk::treeview::heading.press {w column} { proc ttk::treeview::heading.drag {w x y} { variable State - lassign [$w identify $x $y] what where detail - if {$what eq "heading" && $where eq $State(heading)} { + if { [$w identify region $x $y] eq "heading" + && [$w identify column $x $y] eq $State(heading) + } { $w heading $State(heading) state pressed } else { $w heading $State(heading) state !pressed |