/usr/share/doc/tix/examples/tixwidgets.tcl is in tix-dev 8.4.3-7.
This file is owned by root:root, with mode 0o644.
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 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 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | # -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# tixDemo --
#
# This is a demo program of all the available Tix widgets. If
# have installed Tix properly, you can execute this program
# by changing to this directory and executing
# the following in csh
#
# % env TIX_LIBRARY=../library tixwish tixwidgets.tcl
#
# Or this in sh
#
# $ TIX_LIBRARY=../library tixwish tixwidgets.tcl
#
#----------------------------------------------------------------------
#
# This file has not been properly documented. It is NOT intended
# to be used as an introductory demo program about Tix
# programming. For such demos, please see the files in the
# demos/samples directory or go to the "Samples" page in the
# "widget demo"
#
#
# 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.
#
package require Tix
tix initstyle
tk appname "TixDemo#[pid]"
proc tixDemo:MkMainWindow {w} {
global demo auto_path demo_dir
# add this directory to the auto_path
lappend auto_path $demo_dir
tix addbitmapdir [file join $demo_dir bitmaps]
toplevel $w
wm title $w "Tix Widget Demonstration"
wm geometry $w 830x566+100+100
set demo(balloon) [tixBalloon .demos_balloon]
set menu [tixDemo:MkMainMenu $w]
set frame2 [tixDemo:MkMainNoteBook $w]
set frame3 [tixDemo:MkMainStatus $w]
$w configure -menu $menu
pack $frame3 -side bottom -fill x
pack $frame2 -side top -expand yes -fill both -padx 4 -pady 4
$demo(balloon) config -statusbar $demo(statusbar)
set demo(notebook) $frame2
}
proc tixDemo:MkMainMenu {top} {
global useBallons
set m [menu $top.menu -tearoff 0]
$m add cascade -label "File" -menu $m.file -underline 0
$m add cascade -label "Help" -menu $m.help -underline 0
menu $m.file -tearoff 0
$m.file add command -label "Open ... " -command tixDemo:FileOpen \
-underline 1 -accelerator "Ctrl+O"
$m.file add sep
$m.file add command -label "Exit " -command tixDemo:Exit \
-underline 1 -accelerator "Ctrl+X"
menu $m.help -tearoff 0
$m.help add checkbutton -under 0 -label "Balloon Help " \
-variable useBallons -onvalue 1 -offvalue 0
trace variable useBallons w tixDemo:BalloonHelp
set useBallons 1
return $m
}
# Create the main display area of the widget programm. This area should
# utilize the "tixNoteBook" widget once it is available. But now
# we use the cheap substitute "tixStackWindow"
#
proc tixDemo:MkMainNoteBook {top} {
global demo
set hasGL 0
option add *TixNoteBook.tagPadX 6
option add *TixNoteBook.tagPadY 4
option add *TixNoteBook.borderWidth 2
set w [tixNoteBook $top.f2 -ipadx 5 -ipady 5]
$w add wel -createcmd [list tixDemo:CreatePage tixDemo:MkWelcome $w wel] \
-label "Welcome" -under 0
$w add cho -createcmd [list tixDemo:CreatePage MkChoosers $w cho] \
-label "Choosers" -under 0
$w add scr -createcmd [list tixDemo:CreatePage MkScroll $w scr] \
-label "Scrolled Widgets" -under 0
# There currently is no MkManag.tcl that this expects ?!? - JH
# $w add mgr -createcmd [list tixDemo:CreatePage MkManager $w mgr] \
# -label "Manager Widgets" -under 0
$w add dir -createcmd [list tixDemo:CreatePage MkDirList $w dir] \
-label "Directory List" -under 0
$w add exp -createcmd [list tixDemo:CreatePage MkSample $w exp] \
-label "Run Sample Programs" -under 0
if {$hasGL} {
$w add glw -createcmd [list MkGL $w glw] -tag "GL Widgets"
}
return $w
}
proc tixDemo:CreatePage {command w name} {
tixBusy $w on
set code [catch {$command $w $name} err]
tixBusy $w off
return -code $code $err
}
proc tixDemo:MkMainStatus {top} {
global demo demo_dir
set w [frame $top.f3 -relief raised -bd 1]
set demo(statusbar) \
[label $w.status -relief sunken -bd 1]
tixForm $demo(statusbar) -padx 3 -pady 3 -left 0 -right %70
$w.status configure -text [file native $demo_dir]
return $w
}
proc tixDemo:Status {msg} {
global demo
$demo(statusbar) configure -text $msg
}
proc tixDemo:MkWelcome {nb page} {
set w [$nb subwidget $page]
set bar [tixDemo:MkWelcomeBar $w]
set text [tixDemo:MkWelcomeText $w]
pack $bar -side top -fill x -padx 2 -pady 2
pack $text -side top -fill both -expand yes
}
proc tixDemo:MkWelcomeBar {top} {
global demo
set w [frame $top.bar -bd 2 -relief groove]
# Create and configure comboBox 1
#
tixComboBox $w.cbx1 -command [list tixDemo:MainTextFont $top] \
-options {
entry.width 15
listbox.height 3
}
tixComboBox $w.cbx2 -command [list tixDemo:MainTextFont $top] \
-options {
entry.width 4
listbox.height 3
}
set demo(welfont) $w.cbx1
set demo(welsize) $w.cbx2
$w.cbx1 insert end "Courier"
$w.cbx1 insert end "Helvetica"
$w.cbx1 insert end "Lucida"
$w.cbx1 insert end "Times Roman"
$w.cbx2 insert end 8
$w.cbx2 insert end 10
$w.cbx2 insert end 12
$w.cbx2 insert end 14
$w.cbx2 insert end 18
$w.cbx1 pick 1
$w.cbx2 pick 3
# Pack the comboboxes together
#
pack $w.cbx1 $w.cbx2 -side left -padx 4 -pady 4
$demo(balloon) bind $w.cbx1\
-msg "Choose\na font" -statusmsg "Choose a font for this page"
$demo(balloon) bind $w.cbx2\
-msg "Point size" -statusmsg "Choose the font size for this page"
tixDoWhenIdle tixDemo:MainTextFont $top
return $w
}
proc tixDemo:MkWelcomeText {top} {
global demo tix_version
set w [tixScrolledWindow $top.f3 -scrollbar auto]
set win [$w subwidget window]
label $win.title -font [list times -18 bold] \
-bd 0 -width 30 -anchor n\
-text "Welcome to TIX version $tix_version"
message $win.msg -font [list helvetica -14 bold] \
-bd 0 -width 400 -anchor n\
-text "\
Tix $tix_version is a library of mega-widgets based on TK. This program \
demonstrates the widgets in the Tix widget. You can choose the pages \
in this window to look at the corresponding widgets. \
To quit this program, choose the \"File | Exit\" command."
pack $win.title -expand yes -fill both -padx 10 -pady 10
pack $win.msg -expand yes -fill both -padx 10 -pady 10
set demo(welmsg) $win.msg
return $w
}
proc tixDemo:MainTextFont {w args} {
global demo
if {![info exists demo(welmsg)]} {
return
}
set font [$demo(welfont) cget -value]
set point [$demo(welsize) cget -value]
case $font {
"Courier" {
set f courier
}
"Helvetica" {
set f helvetica
}
"Lucida" {
set f lucida
}
default {
set f times
}
}
set xfont [list $f -$point]
if [catch {$demo(welmsg) config -font $xfont} err] {
puts \a$err
}
}
proc tixDemo:FileOpen {} {
global demo demo_dir
set filedlg [tix filedialog tixExFileSelectDialog]
if {![info exists demo(filedialog)]} {
$filedlg subwidget fsbox config -pattern *.tcl
$filedlg subwidget fsbox config -directory [file join $demo_dir samples]
$filedlg config -command tixDemo:FileOpen:Doit
set demo(filedialog) $filedlg
}
$filedlg config -title "Open Tix Sample Programs"
wm transient $filedlg ""
wm deiconify $filedlg
after idle raise $filedlg
$filedlg popup
tixPushGrab $filedlg
}
proc tixDemo:FileOpen:Doit {filename} {
global demo
tixPopGrab
LoadFile $filename
$demo(filedialog) popdown
}
#----------------------------------------------------------------------
# Balloon Help
#----------------------------------------------------------------------
proc tixDemo:BalloonHelp {args} {
global demo useBallons
if {$useBallons} {
$demo(balloon) config -state "both"
} else {
$demo(balloon) config -state "none"
}
}
#----------------------------------------------------------------------
# Self-testing
#
# The following code are called by the Tix test suite. It opens
# every page in the demo program.
#----------------------------------------------------------------------
proc tixDemo:SelfTest {} {
global demo testConfig
if ![info exists testConfig] {
return
}
tixDemo:MkMainWindow .widget
update
foreach p [$demo(notebook) pages] {
$demo(notebook) raise $p
update
}
destroy .widget
}
proc tixDemo:Exit {} {
destroy .widget
}
#----------------------------------------------------------------------
# Start!
#----------------------------------------------------------------------
if {![info exists testConfig]} {
#
# If the testConfig variable exists, we are driven by the regression
# test. In that case, don't open the main window. The test program will
# call Widget:SelfTest
#
set kids [winfo children .]
wm withdraw .
set ::demo_dir [file normalize [file dirname [info script]]]
tixDemo:MkMainWindow .widget
wm transient .widget ""
if {[llength $kids] < 1} {bind .widget <Destroy> "exit"}
}
|