/usr/share/blt2.5/demos/hierbox2.tcl is in blt-demo 2.5.3+dfsg-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | #!/usr/bin/wish8.6
package require BLT
# --------------------------------------------------------------------------
# Starting with Tcl 8.x, the BLT commands are stored in their own
# namespace called "blt". The idea is to prevent name clashes with
# Tcl commands and variables from other packages, such as a "table"
# command in two different packages.
#
# You can access the BLT commands in a couple of ways. You can prefix
# all the BLT commands with the namespace qualifier "blt::"
#
# blt::graph .g
# blt::table . .g -resize both
#
# or you can import all the command into the global namespace.
#
# namespace import blt::*
# graph .g
# table . .g -resize both
#
# --------------------------------------------------------------------------
if { $tcl_version >= 8.0 } {
namespace import blt::*
namespace import -force blt::tile::*
}
source scripts/demo.tcl
proc AddDirEntries { w dir } {
if { [file isdirectory $dir] } {
set files [glob -nocomplain $dir/*]
eval $w insert end [lsort $files]
set subdirs [glob -nocomplain $dir/*/]
eval $w entry configure [lsort $subdirs] -button yes
}
}
set imageList {}
foreach f [glob ./images/mini-*.gif] {
lappend imageList [image create photo -file $f]
}
set top ../
#option add *Hierbox.Tile bgTexture
option add *Hierbox.TileOffset yes
option add *forceGadgets no
option add *Hierbox.openCommand {
AddDirEntries %W "$top/%P"
}
option add *Hierbox.closeCommand {
eval %W delete %n 0 end
}
#image create photo openFolder -file images/open.gif
#image create photo closeFolder -file images/close.gif
#image create photo openFolder -file images/folder_blue_open.gif
#image create photo closeFolder -file images/folder_blue.gif
#option add *Hierbox.icons "closeFolder openFolder"
#option add *Hierbox.activeIcon ""
#option add *Hierbox.Button.activeForeground red
#option add *Hierbox.bindTags "Label all"
hierbox .h \
-selectmode multiple \
-hideroot yes \
-yscrollcommand { .vs set } \
-xscrollcommand { .hs set }
.h button configure -activebackground grey92
scrollbar .vs -orient vertical -command { .h yview }
scrollbar .hs -orient horizontal -command { .h xview }
button .test -text Test -command {
set index [.h curselection]
set names [eval .h get -full $index]
puts "selected names are $names"
}
button .quit -text Quit -command { exit 0 }
table . \
0,0 .h -fill both \
2,0 .quit \
0,1 .vs -fill y 1,0 .hs -fill x \
3,0 .test
table configure . c1 r1 r2 r3 -resize none
.h configure -separator "/" -trim $top \
-allowduplicates no
#.h entry configure 0 -label [file tail $top]
AddDirEntries .h $top
focus .h
set nodes [.h find -glob -name *.c]
eval .h entry configure $nodes -labelcolor red
wm protocol . WM_DELETE_WINDOW { destroy . }
#blt::bltdebug 100
|