OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / SGI / util / SGI / lib / blt2.4 / demos / tabset4
1 #!/home/people/tkys/Eos/util/SGI/bin/bltwish
2 #!../bltwish
3
4 source bltDemo.tcl
5 #bltdebug 100
6
7 source patterns.tcl
8
9 tabset .t \
10     -samewidth no \
11     -side bottom \
12     -textside bottom \
13     -bg red \
14     -tiers 1 \
15     -scrollincrement 10 \
16     -scrollcommand { .s set } \
17     -rotate 0 \
18     -selectcommand {  MakePhoto %W %n } \
19     -pagewidth 4i -pageheight 3.5i
20
21 scrollbar .s -command { .t view } -orient horizontal
22  
23 option clear
24 option add *Tabset.Tab.font -*-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*
25
26 set files [glob ./images/*.gif]
27 set files [lsort $files]
28 set vertFilter sinc
29 set horzFilter sinc
30
31
32 proc ResizePhoto { src dest maxSize } {
33     set maxSize [winfo fpixels . $maxSize]
34     set w [image width $src]
35     set h [image height $src]
36     set sw [expr double($maxSize) / $w]
37     set sh [expr double($maxSize) / $h]
38     set s [expr min($sw, $sh)]
39     set w [expr round($s * $w)]
40     set h [expr round($s * $h)]
41     $dest configure -width $w -height $h
42     
43     global horzFilter vertFilter
44     winop resample $src $dest $horzFilter $vertFilter
45 }
46
47 image create photo src
48 image create photo dest
49
50 label .t.label -image dest -bg purple
51
52 proc MakePhoto { w name } {
53     set file ./images/$name.gif
54     src configure -file $file
55     ResizePhoto src dest 3i
56     .t tab configure $name -window .t.label -padx 4m -pady 4m
57 }
58
59 table . \
60     .t 0,0 -fill both \
61     .s 1,0 -fill x 
62
63 table configure . r1 -resize none
64 focus .t
65
66 foreach f $files {
67     src configure -file $f
68     set f [file tail [file root $f]]
69     set thumb [image create photo]
70     ResizePhoto src $thumb 1i
71     .t insert end $f -image $thumb -fill none
72 }
73
74 .t focus 0
75 .t invoke 0