#!/home/people/tkys/Eos/util/ALPHALINUX5/bin/bltwish
#!../bltwish

source bltDemo.tcl

image create photo activeIcon -file ./images/ofolder.gif
image create photo normalIcon -file ./images/folder.gif

image create photo openGadget -file ./images/mini-book2.gif
image create photo closeGadget -file ./images/mini-book1.gif

image create photo bgTexture -file ./images/rain.gif

set imageList {}
foreach f [glob ./images/mini-*.gif] {
    lappend imageList [image create photo -file $f]
}

#option add *Hierbox.Tile	bgTexture
option add *Hierbox.ScrollTile  yes

option add *xHierbox.openCommand	{
    set path /home/gah/src/blt/%P
    if { [file isdirectory $path] } {
	cd $path
	set files [glob -nocomplain * */. ]
	if { $files != "" } {
	    eval %W insert -at %n end $files
	}
    }
}

option add *xHierbox.closeCommand {
    eval %W delete %n 0 end
}

option add *icons	"normalIcon activeIcon"

hierbox .h  \
    -yscrollcommand { .vs set } \
    -xscrollcommand { .hs set } 

scrollbar .vs -orient vertical -command { .h yview }
scrollbar .hs -orient horizontal -command { .h xview }
table . \
    0,0 .h  -fill both \
    0,1 .vs -fill y \
    1,0 .hs -fill x

table configure . c1 r1 -resize none

.h configure -separator "/" -trim "."  

set top [pwd]/..

.h entry configure root -label [file tail $top] 

cd $top

catch { exec find . } files
set files  [lsort [split $files \n]]

eval .h insert end $files

.h find -glob -name *.gif -exec { 
     %W entry configure %n -image [image create photo -file $top/%P]
}

focus .h
.h sort root -recurse

set nodes [.h find -glob -name *.c]
eval .h entry configure $nodes -labelcolor red 
