Spaces:
Running
Running
File size: 4,800 Bytes
ba2f5d6 |
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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: AllSampl.tcl,v 1.4 2001/12/09 05:31:07 idiscovery Exp $
#
# AllSampl.tcl --
#
# This file is a directory of all the sample programs in the
# demos/samples subdirectory.
#
#
# Copyright (c) 1996, Expert Interface Technologies
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
#
# The following data structures contains information about the requirements
# of the sample programs, as well as the relationship/grouping of the sample
# programs.
#
# Each element in an info list has four parts: type, name, group/filename, and
# condition. A group or a file is loaded only if the conditions are met.
#
# types: "d" directory "f" file
# conditions:
# "i": an image type must exist
# "c": a command must exist
# "v": a variable must exist
set root {
{d "File Selectors" file }
{d "Hierachical ListBox" hlist }
{d "Tabular ListBox" tlist {c tixTList}}
{d "Grid Widget" grid {c tixGrid}}
{d "Manager Widgets" manager }
{d "Scrolled Widgets" scroll }
{d "Miscellaneous Widgets" misc }
{d "Image Types" image }
}
set image {
{d "Compound Image" cmpimg }
{d "XPM Image" xpm {i pixmap}}
}
set cmpimg {
{f "In Buttons" CmpImg.tcl }
{f "In NoteBook" CmpImg2.tcl }
{f "Notebook Color Tabs" CmpImg4.tcl }
{f "Icons" CmpImg3.tcl }
}
set xpm {
{f "In Button" Xpm.tcl {i pixmap}}
{f "In Menu" Xpm1.tcl {i pixmap}}
}
set file {
{f DirList DirList.tcl }
{f DirTree DirTree.tcl }
{f DirSelectDialog DirDlg.tcl }
{f ExFileSelectDialog EFileDlg.tcl }
{f FileSelectDialog FileDlg.tcl }
{f FileEntry FileEnt.tcl }
}
set hlist {
{f HList HList1.tcl }
{f CheckList ChkList.tcl {c tixCheckList}}
{f "ScrolledHList (1)" SHList.tcl }
{f "ScrolledHList (2)" SHList2.tcl }
{f Tree Tree.tcl }
{f "Tree (Dynamic)" DynTree.tcl {v win}}
}
set tlist {
{f "ScrolledTList (1)" STList1.tcl {c tixTList}}
{f "ScrolledTList (2)" STList2.tcl {c tixTList}}
}
global tcl_platform
# This demo hangs windows
if {$tcl_platform(platform) != "windows"} {
lappend tlist {f "TList File Viewer" STList3.tcl {c tixTList}}
}
set grid {
{f "Simple Grid" SGrid0.tcl {c tixGrid}}
{f "ScrolledGrid" SGrid1.tcl {c tixGrid}}
{f "Editable Grid" EditGrid.tcl {c tixGrid}}
}
set scroll {
{f ScrolledListBox SListBox.tcl }
{f ScrolledText SText.tcl }
{f ScrolledWindow SWindow.tcl }
{f "Canvas Object View" CObjView.tcl {c tixCObjView}}
}
set manager {
{f ListNoteBook ListNBK.tcl }
{f NoteBook NoteBook.tcl }
{f PanedWindow PanedWin.tcl }
}
set misc {
{f Balloon Balloon.tcl }
{f ButtonBox BtnBox.tcl }
{f ComboBox ComboBox.tcl }
{f Control Control.tcl }
{f LabelEntry LabEntry.tcl }
{f LabelFrame LabFrame.tcl }
{f Meter Meter.tcl {c tixMeter}}
{f OptionMenu OptMenu.tcl }
{f PopupMenu PopMenu.tcl }
{f Select Select.tcl }
{f StdButtonBox StdBBox.tcl }
}
# ForAllSamples --
#
# Iterates over all the samples that can be run on this platform.
#
# Arguments:
# name: For outside callers, it must be "root"
# token: An arbtrary string passed in by the caller.
# command: Command prefix to be executed for each node
# in the samples hierarchy. It should return the
# token of the node that it has just created, if any.
#
proc ForAllSamples {name token command} {
global $name win
if {[tix platform] == "windows"} {
set win 1
}
foreach line [set $name] {
set type [lindex $line 0]
set text [lindex $line 1]
set dest [lindex $line 2]
set cond [lindex $line 3]
case [lindex $cond 0] {
c {
set cmd [lindex $cond 1]
if {[info command $cmd] != $cmd} {
if ![auto_load $cmd] {
continue
}
}
}
i {
if {[lsearch [image types] [lindex $cond 1]] == -1} {
continue
}
}
v {
set doit 1
foreach var [lrange $cond 1 end] {
if [uplevel #0 info exists [list $var]] {
set doit 0
break
}
}
if !$doit {
continue
}
}
}
if {$type == "d"} {
set tok [eval $command [list $token] $type [list $text] \
[list $dest]]
ForAllSamples $dest $tok $command
eval $command [list $tok] done xx xx
} else {
set tok [eval $command [list $token] $type [list $text] \
[list $dest]]
}
}
}
proc DoAll {hlist {path ""}} {
catch {
set theSample [$hlist info data $path]
if {$theSample != {}} {
set title [lindex $theSample 0]
set prog [lindex $theSample 1]
RunProg $title $prog
update
}
}
foreach p [$hlist info children $path] {
DoAll $hlist $p
}
}
|