#!../tree_wish -f
# -*-Tcl-*-
#
# dirtree4 - same as dirtree3, but with horizontal layout
# 

source dirtree3


# Toggle the layout of the tree between vertical and horizontal

proc ToggleLayout {canvas tree} {
    if {[$tree cget -layout] == "horizontal"} {
        $tree config -layout vertical
    } else {
        $tree config -layout horizontal
    }
    
    # change the layout of the nodes so that the bitmap is on top for
    # vertical trees and at left for horizontal trees
    foreach i [$canvas find withtag text] {
        set dir [lindex [$canvas gettags $i] 0]
        LayoutNode $canvas $tree $dir
        $tree nodeconfig $dir
    }
}


ToggleLayout $canvas $tree
