Import build of Tcl/Tk 8.6.8

This commit is contained in:
Steve Dower
2018-02-22 22:59:06 +00:00
parent f62dd320ed
commit 4ee57ea08c
2576 changed files with 365752 additions and 0 deletions

View File

@@ -0,0 +1,280 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: MkChoose.tcl,v 1.4 2004/03/28 02:44:56 hobbs Exp $
#
# MkChoose.tcl --
#
# This file implements the "Choosers" page in the widget demo
#
# 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.
#
proc MkChoosers {nb page} {
set w [$nb subwidget $page]
set name [tixOptionName $w]
option add *$name*TixLabelFrame*label.padX 4
tixLabelFrame $w.til -label "Chooser Widgets"
tixLabelFrame $w.cbx -label "tixComboBox"
tixLabelFrame $w.ctl -label "tixControl"
tixLabelFrame $w.sel -label "tixSelect"
tixLabelFrame $w.opt -label "tixOptionMenu"
tixLabelFrame $w.fil -label "tixFileEntry"
tixLabelFrame $w.fbx -label "tixFileSelectBox"
tixLabelFrame $w.tbr -label "Tool Bar"
MkTitle [$w.til subwidget frame]
MkCombo [$w.cbx subwidget frame]
MkControl [$w.ctl subwidget frame]
MkSelect [$w.sel subwidget frame]
MkOptMenu [$w.opt subwidget frame]
MkFileBox [$w.fbx subwidget frame]
MkFileEnt [$w.fil subwidget frame]
MkToolBar [$w.tbr subwidget frame]
#
# First column: comBox and selector
tixForm $w.cbx -top 0 -left 0 -right %33
tixForm $w.sel -left 0 -right &$w.cbx -top $w.cbx
tixForm $w.opt -left 0 -right &$w.cbx -top $w.sel -bottom -1
#
# Second column: title .. etc
tixForm $w.til -left $w.cbx -right %66 -top 0
tixForm $w.ctl -left $w.cbx -right &$w.til -top $w.til
tixForm $w.fil -left $w.cbx -right &$w.til -top $w.ctl
tixForm $w.tbr -left $w.cbx -right &$w.til -top $w.fil -bottom -1
#
# Third column: file selection
tixForm $w.fbx -left %66 -right -1 -top 0
}
#----------------------------------------------------------------------
# ComboBox
#----------------------------------------------------------------------
proc MkCombo {w} {
set name [tixOptionName $w]
option add *$name*TixComboBox*label.width 10
option add *$name*TixComboBox*label.anchor e
option add *$name*TixComboBox*entry.width 14
tixComboBox $w.static -label "Static" \
-editable false
tixComboBox $w.editable -label "Editable" \
-editable true
tixComboBox $w.history -label "History" \
-editable true -history true -anchor e
$w.static insert end January
$w.static insert end February
$w.static insert end March
$w.static insert end April
$w.static insert end May
$w.static insert end June
$w.static insert end July
$w.static insert end August
$w.static insert end September
$w.static insert end October
$w.static insert end November
$w.static insert end December
$w.editable insert end "America"
$w.editable insert end "Britain"
$w.editable insert end "China"
$w.editable insert end "Denmark"
$w.editable insert end "Egypt"
$w.history insert end "/usr/bin/mail"
$w.history insert end "/etc/profile"
$w.history insert end "/home/d/doe/Mail/letter"
pack $w.static $w.editable $w.history -side top -padx 5 -pady 3
}
#----------------------------------------------------------------------
# The Control widgets
#----------------------------------------------------------------------
set states {Alabama "New York" Pennsylvania Washington}
proc stCmd {w by value} {
global states
set index [lsearch $states $value]
set len [llength $states]
set index [expr {$index + $by}]
if {$index < 0} {
set index [expr {$len -1}]
}
if {$index >= $len} {
set index 0
}
return [lindex $states $index]
}
proc stValidate {w value} {
global states
if {[lsearch $states $value] == -1} {
return [lindex $states 0]
} else {
return $value
}
}
proc MkControl {w} {
set name [tixOptionName $w]
option add *$name*TixControl*label.width 10
option add *$name*TixControl*label.anchor e
option add *$name*TixControl*entry.width 13
tixControl $w.simple -label Numbers
tixControl $w.spintext -label States \
-incrcmd [list stCmd $w.spintext 1] \
-decrcmd [list stCmd $w.spintext -1] \
-validatecmd [list stValidate .d] \
-value "Alabama"
pack $w.simple $w.spintext -side top -padx 5 -pady 3
}
#----------------------------------------------------------------------
# The Select Widgets
#----------------------------------------------------------------------
proc MkSelect {w} {
set name [tixOptionName $w]
option add *$name*TixSelect*label.anchor c
option add *$name*TixSelect*orientation vertical
option add *$name*TixSelect*labelSide top
tixSelect $w.sel1 -label "Mere Mortals" -allowzero true -radio true
tixSelect $w.sel2 -label "Geeks" -allowzero true -radio false
$w.sel1 add eat -text Eat
$w.sel1 add work -text Work
$w.sel1 add play -text Play
$w.sel1 add party -text Party
$w.sel1 add sleep -text Sleep
$w.sel2 add eat -text Eat
$w.sel2 add prog1 -text Program
$w.sel2 add prog2 -text Program
$w.sel2 add prog3 -text Program
$w.sel2 add sleep -text Sleep
pack $w.sel1 $w.sel2 -side left -padx 5 -pady 3 -fill x
}
#----------------------------------------------------------------------
# The OptMenu Widget
#----------------------------------------------------------------------
proc MkOptMenu {w} {
set name [tixOptionName $w]
option add *$name*TixOptionMenu*label.anchor e
tixOptionMenu $w.menu -label "File Format : " \
-options {
menubutton.width 15
}
$w.menu add command text -label "Plain Text"
$w.menu add command post -label "PostScript"
$w.menu add command format -label "Formatted Text"
$w.menu add command html -label "HTML"
$w.menu add separator sep
$w.menu add command tex -label "LaTeX"
$w.menu add command rtf -label "Rich Text Format"
pack $w.menu -padx 5 -pady 3 -fill x
}
#----------------------------------------------------------------------
# FileEntry
#----------------------------------------------------------------------
proc MkFileEnt {w} {
set name [tixOptionName $w]
message $w.msg \
-relief flat -width 240 -anchor n\
-text {Press the "open file" icon button and a\
TixFileSelectDialog will popup.}
tixFileEntry $w.ent -label "Select a file : "
pack $w.msg -side top -expand yes -fill both -padx 3 -pady 3
pack $w.ent -side top -fill x -padx 3 -pady 3
}
proc MkFileBox {w} {
set name [tixOptionName $w]
message $w.msg \
-relief flat -width 240 -anchor n\
-text {The TixFileSelectBox is Motif-style file selection\
box with various enhancements. For example, you can adjust the\
size of the two listboxes and your past selections are recorded.}
tixFileSelectBox $w.box
pack $w.msg -side top -expand yes -fill both -padx 3 -pady 3
pack $w.box -side top -fill x -padx 3 -pady 3
}
#----------------------------------------------------------------------
# Tool Bar
#----------------------------------------------------------------------
proc MkToolBar {w} {
set name [tixOptionName $w]
option add $name*TixSelect*frame.borderWidth 1
message $w.msg -relief flat -width 240 -anchor n\
-text {The Select widget is also good for arranging buttons\
in a tool bar.}
frame $w.bar -bd 2 -relief raised
tixSelect $w.font -allowzero true -radio false -label {}
tixSelect $w.para -allowzero false -radio true -label {}
$w.font add bold -bitmap [tix getbitmap bold]
$w.font add italic -bitmap [tix getbitmap italic]
$w.font add underline -bitmap [tix getbitmap underlin]
$w.font add capital -bitmap [tix getbitmap capital]
$w.para add left -bitmap [tix getbitmap leftj]
$w.para add right -bitmap [tix getbitmap rightj]
$w.para add center -bitmap [tix getbitmap centerj]
$w.para add justify -bitmap [tix getbitmap justify]
pack $w.msg -side top -expand yes -fill both -padx 3 -pady 3
pack $w.bar -side top -fill x -padx 3 -pady 3
pack $w.para $w.font -in $w.bar -side left -padx 4 -pady 3
}
#----------------------------------------------------------------------
# Title
#----------------------------------------------------------------------
proc MkTitle {w} {
set name [tixOptionName $w]
option add $name*TixSelect*frame.borderWidth 1
message $w.msg \
-relief flat -width 240 -anchor n\
-text {There are many types of "choose" widgets that allow\
the user to input different type of information.}
pack $w.msg -side top -expand yes -fill both -padx 3 -pady 3
}

View File

@@ -0,0 +1,69 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: MkDirLis.tcl,v 1.4 2004/03/28 02:44:56 hobbs Exp $
#
# MkDirLis.tcl --
#
# This file implements the "Directory List" page in the widget demo
#
# 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.
#
proc MkDirList {nb page} {
set w [$nb subwidget $page]
set name [tixOptionName $w]
option add *$name*TixLabelFrame*label.padX 4
tixLabelFrame $w.dir -label "tixDirList"
tixLabelFrame $w.fsbox -label "tixExFileSelectBox"
MkDirListWidget [$w.dir subwidget frame]
MkExFileWidget [$w.fsbox subwidget frame]
tixForm $w.dir -top 0 -left 0 -right %40 -bottom -1
tixForm $w.fsbox -top 0 -left %40 -right -1 -bottom -1
}
proc MkDirListWidget {w} {
set name [tixOptionName $w]
message $w.msg \
-relief flat -width 240 -anchor n\
-text "The TixDirList widget gives a graphical representation of\
the file system directory and makes it easy for the user\
to choose and access directories."
tixDirList $w.dirlist -options {
hlist.padY 1
hlist.width 25
hlist.height 16
}
pack $w.msg -side top -expand yes -fill both -padx 3 -pady 3
pack $w.dirlist -side top -padx 3 -pady 3
}
proc MkExFileWidget {w} {
set name [tixOptionName $w]
message $w.msg \
-relief flat -width 240 -anchor n\
-text {The TixExFileSelectBox widget is more user friendly \
than the Motif style FileSelectBox.}
tixExFileSelectBox $w.exfsbox -bd 2 -relief raised
pack $w.msg -side top -expand yes -fill both -padx 3 -pady 3
pack $w.exfsbox -side top -padx 3 -pady 3
}

View File

@@ -0,0 +1,270 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: MkSample.tcl,v 1.3 2001/12/09 05:34:59 idiscovery Exp $
#
# MkSample.tcl --
#
# This file implements the "Sample" page in the widget demo
#
# 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.
#
#
#
set tix_demo_running 1
set samples_dir [file join $demo_dir samples]
set sample_filename {}
uplevel #0 source [list [file join $samples_dir AllSampl.tcl]]
proc MkSample {nb page} {
global tixOption
#----------------------------------------------------------------------
set w [$nb subwidget $page]
set pane [tixPanedWindow $w.pane -orient horizontal]
pack $pane -expand yes -fill both
set f1 [$pane add 1 -expand 1]
set f2 [$pane add 2 -expand 3]
$f1 config -relief flat
$f2 config -relief flat
# Left pane: the Tree:
#
set lab [label $f1.lab -text "Select a sample program:" -anchor w]
set tree [tixTree $f1.slb \
-options {
hlist.selectMode single
hlist.width 40
}]
$tree config \
-command "Sample:Action $w $tree run" \
-browsecmd "Sample:Action $w $tree browse"
pack $lab -side top -fill x -padx 5 -pady 5
pack $tree -side top -fill both -expand yes -padx 5
# Right pane: the Text
#
set labe [tixLabelEntry $f2.lab -label "Source:" -options {
label.anchor w
}]
$labe subwidget entry config -state disabled
set stext [tixScrolledText $f2.stext]
set f3 [frame $f2.f3]
set run [button $f3.run -text "Run ..." \
-command "Sample:Action $w $tree run"]
set view [button $f3.view -text "View Source in Browser ..." \
-command "Sample:Action $w $tree view"]
pack $run $view -side left -fill y -pady 2
pack $labe -side top -fill x -padx 7 -pady 2
pack $f3 -side bottom -fill x -padx 7
pack $stext -side top -fill both -expand yes -padx 7
#
# Set up the text subwidget
set text [$stext subwidget text]
bind $text <Up> "%W yview scroll -1 unit"
bind $text <Down> "%W yview scroll 1 unit"
bind $text <Left> "%W xview scroll -1 unit"
bind $text <Right> "%W xview scroll 1 unit"
bind $text <Tab> {focus [tk_focusNext %W]; break}
bindtags $text "$text Text [winfo toplevel $text] all"
$text config -bg [$tree subwidget hlist cget -bg] \
-state disabled -font $tixOption(fixed_font) -wrap none
$run config -state disabled
$view config -state disabled
global demo
set demo(w:run) $run
set demo(w:view) $view
set demo(w:tree) $tree
set demo(w:lab1) $labe
set demo(w:stext) $stext
set hlist [$tree subwidget hlist]
$hlist config -separator "." -width 30 -drawbranch 0 \
-wideselect false
set style [tixDisplayStyle imagetext -refwindow $hlist \
-fg $tixOption(fg) -padx 4]
set file [tix getimage textfile]
set folder [tix getimage openfold]
ForAllSamples root "" \
[list AddSampleToHList $tree $hlist $style $file $folder]
}
# AddSampleToHList --
#
# A callback from ForAllSamples. Add all the possible sample files
# into the Tree widget.
#
proc AddSampleToHList {tree hlist style file folder token type text dest} {
case $type {
d {
return [$hlist addchild $token -itemtype imagetext -style $style \
-image $folder -text $text]
}
done {
if {![tixStrEq $token ""]} {
$tree setmode $token close
$tree close $token
}
}
f {
return [$hlist addchild $token -itemtype imagetext \
-image $file -text $text -data [list $text $dest]]
}
}
}
proc Sample:Action {w slb action args} {
global samples demo_dir demo samples_dir
set hlist [$slb subwidget hlist]
set ent [$hlist info anchor]
if {$ent == ""} {
$demo(w:run) config -state disabled
$demo(w:view) config -state disabled
return
}
if {[$hlist info data $ent] == {}} {
# This is just a comment
$demo(w:run) config -state disabled
$demo(w:view) config -state disabled
return
} else {
$demo(w:run) config -state normal
$demo(w:view) config -state normal
}
set theSample [$hlist info data $ent]
set title [lindex $theSample 0]
set prog [lindex $theSample 1]
case $action {
"run" {
RunProg $title $prog
}
"view" {
LoadFile [file join $samples_dir $prog]
}
"browse" {
# Bring up a short description of the sample program
# in the scrolled text about
set text [$demo(w:stext) subwidget text]
uplevel #0 set sample_filename [list [file join $samples_dir $prog]]
tixWidgetDoWhenIdle ReadFileWhenIdle $text
$demo(w:lab1) subwidget entry config -state normal
$demo(w:lab1) subwidget entry delete 0 end
$demo(w:lab1) subwidget entry insert end [file join $samples_dir $prog]
$demo(w:lab1) subwidget entry xview end
$demo(w:lab1) subwidget entry config -state disabled
}
}
}
proc RunProg {title prog} {
global samples demo_dir demo samples_dir
set w .[lindex [split $prog .] 0]
set w [string tolower $w]
if [winfo exists $w] {
wm deiconify $w
raise $w
return
}
uplevel #0 source [list [file join $samples_dir $prog]]
toplevel $w
wm title $w $title
RunSample $w
}
proc LoadFile {filename} {
global tixOption
set tmp $filename
regsub -all . $filename _ tmp
set w [string tolower .$tmp]
if [winfo exists $w] {
wm deiconify $w
raise $w
return
}
toplevel $w
wm title $w "Source View: $filename"
button $w.b -text Close -command "destroy $w"
set t [tixScrolledText $w.text]
tixForm $w.b -left 0 -bottom -0 -padx 4 -pady 4
tixForm $w.text -left 0 -right -0 -top 0 -bottom $w.b
$t subwidget text config -highlightcolor [$t cget -bg] -bd 2 \
-bg [$t cget -bg] -font $tixOption(fixed_font)
if {$filename == {}} {
return
}
set text [$w.text subwidget text]
$text config -wrap none
ReadFile $text $filename
}
proc ReadFileWhenIdle {text} {
global sample_filename
if ![file isdir $sample_filename] {
ReadFile $text $sample_filename
}
}
proc ReadFile {text filename} {
set oldState [$text cget -state]
$text config -state normal
$text delete 0.0 end
set fd [open $filename {RDONLY}]
$text delete 1.0 end
while {![eof $fd]} {
$text insert end [gets $fd]\n
}
close $fd
$text see 1.0
$text config -state $oldState
}

View File

@@ -0,0 +1,160 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: MkScroll.tcl,v 1.3 2001/12/09 05:34:59 idiscovery Exp $
#
# MkScroll.tcl --
#
# This file implements the "Scrolled Widgets" page in the widget demo
#
# 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.
#
proc MkScroll {nb page} {
set w [$nb subwidget $page]
set name [tixOptionName $w]
option add *$name*TixLabelFrame*label.padX 4
tixLabelFrame $w.sls -label "tixScrolledListBox"
tixLabelFrame $w.swn -label "tixScrolledWindow"
tixLabelFrame $w.stx -label "tixScrolledText"
MkSList [$w.sls subwidget frame]
MkSText [$w.stx subwidget frame]
MkSWindow [$w.swn subwidget frame]
tixForm $w.sls -top 0 -left 0 -right %33 -bottom -1
tixForm $w.swn -top 0 -left $w.sls -right %66 -bottom -1
tixForm $w.stx -top 0 -left $w.swn -right -1 -bottom -1
}
#----------------------------------------------------------------------
# ScrolledListBox
#----------------------------------------------------------------------
proc MkSList {w} {
frame $w.top -width 300 -height 330
frame $w.bot
message $w.top.msg \
-relief flat -width 200 -anchor n\
-text {This TixScrolledListBox is configured so that it uses\
scrollbars only when it is necessary. Use the handles to\
resize the listbox and watch the scrollbars automatically\
appear and disappear.}
set list [tixScrolledListBox $w.top.list -scrollbar auto]
place $list -x 50 -y 150 -width 120 -height 80
$list subwidget listbox insert end Alabama
$list subwidget listbox insert end California
$list subwidget listbox insert end Montana
$list subwidget listbox insert end "New Jersy"
$list subwidget listbox insert end "New York"
$list subwidget listbox insert end Pennsylvania
$list subwidget listbox insert end Washington
set rh [tixResizeHandle $w.top.r -relief raised \
-handlesize 8 -gridded true -minwidth 50 -minheight 30]
button $w.bot.btn -text Reset -command "SList:Reset $rh $list"
pack propagate $w.top 0
pack $w.top.msg -fill x
pack $w.bot.btn -anchor c
pack $w.top -expand yes -fill both
pack $w.bot -fill both
bind $list <Map> "tixDoWhenIdle $rh attachwidget $list"
}
proc SList:Reset {rh list} {
place $list -x 50 -y 150 -width 120 -height 80
update
$rh attachwidget $list
}
#----------------------------------------------------------------------
# ScrolledWindow
#----------------------------------------------------------------------
proc MkSWindow {w} {
global demo_dir
frame $w.top -width 330 -height 330
frame $w.bot
message $w.top.msg \
-relief flat -width 200 -anchor n\
-text {The TixScrolledWindow widget allows you\
to scroll any kind of TK widget. It is more versatile\
than a scrolled canvas widget}
set win [tixScrolledWindow $w.top.win -scrollbar auto]
set f [$win subwidget window]
set image [image create photo -file $demo_dir/bitmaps/tix.gif]
label $f.b1 -image $image
pack $f.b1 -expand yes -fill both
place $win -x 30 -y 150 -width 190 -height 120
set rh [tixResizeHandle $w.top.r -relief raised \
-handlesize 8 -gridded true -minwidth 50 -minheight 30]
button $w.bot.btn -text Reset -command "SWindow:Reset $rh $win"
pack propagate $w.top 0
pack $w.top.msg -fill x
pack $w.bot.btn -anchor c
pack $w.top -expand yes -fill both
pack $w.bot -fill both
bind $win <Map> "tixDoWhenIdle $rh attachwidget $win"
}
proc SWindow:Reset {rh win} {
place $win -x 30 -y 150 -width 190 -height 120
update
$rh attachwidget $win
}
#----------------------------------------------------------------------
# ScrolledText
#----------------------------------------------------------------------
proc MkSText {w} {
frame $w.top -width 330 -height 330
frame $w.bot
message $w.top.msg \
-relief flat -width 200 -anchor n\
-text {The TixScrolledWindow widget allows you\
to scroll any kind of TK widget. It is more versatile\
than a scrolled canvas widget}
set win [tixScrolledText $w.top.win -scrollbar both]
$win subwidget text config -wrap none
place $win -x 30 -y 150 -width 190 -height 100
set rh [tixResizeHandle $w.top.r -relief raised \
-handlesize 8 -gridded true -minwidth 50 -minheight 30]
button $w.bot.btn -text Reset -command "SText:Reset $rh $win"
pack propagate $w.top 0
pack $w.top.msg -fill x
pack $w.bot.btn -anchor c
pack $w.top -expand yes -fill both
pack $w.bot -fill both
bind $win <Map> "tixDoWhenIdle $rh attachwidget $win"
}
proc SText:Reset {rh win} {
place $win -x 30 -y 150 -width 190 -height 100
update
$rh attachwidget $win
}

View File

@@ -0,0 +1,50 @@
/* XPM */
static char * about_xpm[] = {
"50 40 7 1",
" s None c None",
". c black",
"X c white",
"o c gray70",
"O c navy",
"+ c red",
"@ c yellow",
" ",
" ",
" ",
" ................................. ",
" ..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXoo. ",
" .XooooooooooooooooooooooooooooooXo. ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXooXo. ",
" ..oooooooooooooooooooooooooooooooXo. ",
" ...............................XoXo. ",
" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo. ",
" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo. ",
" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo. ",
" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo. ",
" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo.++++ ",
" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo+++ ",
" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.Xo+++++ ",
" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.Xo++++++ ",
" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.Xo+++ + ",
" .OOOOO@@@@@OOOOOOOOOOOOOOOOOOO.Xo++. ",
" .OOOOOOO@OOOOO@OOOOOOOOOOOOOOO.XoXo. ",
" .OOOOOOO@OOOOOOOOOOOOOOOOOOOOO.XoXo. ",
" .OOOOOOO@OOOO@@OOO@OOO@OOOOOOO.XoXo. ",
" .OOOOOOO@OOOOO@OOOO@O@OOOOOOOO.XoXo. ",
" .OOOOOOO@OOOOO@OOOOO@OOOOOOOOO.XoXo. ",
" .OOOOOOO@OOOOO@OOOOO@OOOOOOOOO.XoXo. ",
" .OOOOOOO@OOOOO@OOOO@O@OOOOOOOO.XoXo. ",
" .OOOOOOO@OOOO@@@OO@OOO@OOOOOOO.XoXo. ",
" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo. ",
" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo. ",
" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo. ",
" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo. ",
" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo. ",
" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XoXo. ",
" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.Xo.. ",
" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.Xo ",
" OOOOOOOOOOOOOOOOOOOOOOOOOOOOO.X. ",
" ............................. ",
" ",
" ",
" "};

View File

@@ -0,0 +1,6 @@
#define bold_width 16
#define bold_height 16
static unsigned char bold_bits[] = {
0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x0f, 0x18, 0x1c, 0x18, 0x18,
0x18, 0x18, 0x18, 0x1c, 0xf8, 0x0f, 0xf8, 0x0f, 0x18, 0x18, 0x18, 0x30,
0x18, 0x30, 0x18, 0x38, 0xfc, 0x3f, 0xfc, 0x1f};

View File

@@ -0,0 +1,6 @@
#define capital_width 16
#define capital_height 16
static unsigned char capital_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x08, 0x30, 0x0c, 0x30, 0x06,
0x30, 0x03, 0xb0, 0x01, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x01, 0xb0, 0x03,
0x30, 0x07, 0x30, 0x0e, 0x30, 0x1c, 0x00, 0x00};

View File

@@ -0,0 +1,6 @@
#define centerj_width 16
#define centerj_height 16
static unsigned char centerj_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3e, 0x00, 0x00, 0xc0, 0x0d,
0x00, 0x00, 0x58, 0x77, 0x00, 0x00, 0xb0, 0x3b, 0x00, 0x00, 0xdc, 0xf7,
0x00, 0x00, 0xf0, 0x3e, 0x00, 0x00, 0xd8, 0x7e};

View File

@@ -0,0 +1,22 @@
/* XPM */
static char * code_xpm[] = {
"30 15 4 1",
" c gray94",
". c #c0c0ff",
"X c #606060",
"o c black",
" ",
" ............................X",
" ............................X",
" ...ooo............o.........X",
" ..o...o...........o.........X",
" ..o...............o.........X",
" ..o......ooo...oooo..ooo....X",
" ..o.....o...o.o...o.o...o...X",
" ..o.....o...o.o...o.ooooo...X",
" ..o.....o...o.o...o.o.......X",
" ..o...o.o...o.o...o.o...o...X",
" ...ooo...ooo...oooo..ooo....X",
" ............................X",
" ............................X",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"};

View File

@@ -0,0 +1,14 @@
#define combobox_width 32
#define combobox_height 32
static unsigned char combobox_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xfc, 0xff, 0xff, 0x3e, 0x04, 0x00, 0x80, 0x2a, 0x04, 0x00, 0x80, 0x2a,
0x04, 0x00, 0x80, 0x2a, 0x04, 0x00, 0x80, 0x2b, 0xfc, 0xff, 0xff, 0x3e,
0x08, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x3e, 0x08, 0x00, 0x00, 0x2a,
0x28, 0x49, 0x00, 0x2a, 0x08, 0x00, 0x00, 0x3e, 0x08, 0x00, 0x00, 0x22,
0x08, 0x00, 0x00, 0x22, 0x28, 0x49, 0x12, 0x22, 0x08, 0x00, 0x00, 0x22,
0x08, 0x00, 0x00, 0x22, 0x08, 0x00, 0x00, 0x22, 0x28, 0x49, 0x02, 0x22,
0x08, 0x00, 0x00, 0x3e, 0x08, 0x00, 0x00, 0x2a, 0x08, 0x00, 0x00, 0x2a,
0xf8, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

View File

@@ -0,0 +1,49 @@
/* XPM */
static char * combobox_xpm[] = {
"50 40 6 1",
" s None c None",
". c black",
"X c white",
"o c #FFFF80808080",
"O c gray70",
"+ c #808000008080",
" ",
" ",
" ",
" .................................... XXXXXXX ",
" .ooooooooooooooooooooooooooooooooooX X . . ",
" .ooooooooooooooooooooooooooooooooooX X . . ",
" .oooo.oooooooooooooooooooooooooooooX X . . ",
" .oo.o..oo.o.oo.o.ooooooooooooooooooX X . . ",
" .o..o.o.o.oo.oo.oo.ooooooooooooooooX X ... . ",
" .oo.oo.oo.o.oo.ooo.ooooooooooooooooX X . . ",
" .ooooooooooooooooooooooooooooooooooX X . ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X...... ",
" ",
" ",
" ",
" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ",
" X............................................ ",
" X.OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOX.OOOOX. ",
" X.O+OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOX.OX OX. ",
" X.O++OOO+OO+++OOOOOOOOOOOOOOOOOOOOOOOX.X ..X. ",
" X.O+O+O+OOO+O+OOOOOOOOOOOOOOOOOOOOOOOX.OOOOX. ",
" X.O++OOO+OO+++OOOOOOOOOOOOOOOOOOOOOOOX.OOOOX. ",
" X.OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOX.XXXXX. ",
" X.O.....X..........................OOX.X .X. ",
" X.OX...XXX.X.XX.XX.................OOX.X .X. ",
" X.OX.X..X..X.XX..XX.X..............OOX.X .X. ",
" X.O.X...X..X.X...X..X..............OOX.X .X. ",
" X.OOOOOOOOOOOOOOOOOOOOOOOO+OOOOOOOOOOX.X .X. ",
" X.OOOOOOOOO+OOO+OOOOO+OOOO+OOOOOOOOOOX.X .X. ",
" X.O+++OO+OO+O+OO++O++OO+OO+OOOOOOOOOOX.X...X. ",
" X.OO+OO++OO+O+OO+OOO+OO+O++OOOOOOOOOOX.OOOOX. ",
" X.OOOOOOOO+OOOOO++OO+OOOOOOOOOOOOOOOOX.OOOOX. ",
" X.OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOX.X .X. ",
" X.OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOX.O .OX. ",
" X.OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOX.OOOOX. ",
" X.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.XXXXX. ",
" X............................................ ",
" ",
" ",
" "};

View File

@@ -0,0 +1,14 @@
#define drivea_width 32
#define drivea_height 32
static unsigned char drivea_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xf8, 0xff, 0xff, 0x1f, 0x08, 0x00, 0x00, 0x18, 0xa8, 0xaa, 0xaa, 0x1a,
0x48, 0x55, 0xd5, 0x1d, 0xa8, 0xaa, 0xaa, 0x1b, 0x48, 0x55, 0x55, 0x1d,
0xa8, 0xfa, 0xaf, 0x1a, 0xc8, 0xff, 0xff, 0x1d, 0xa8, 0xfa, 0xaf, 0x1a,
0x48, 0x55, 0x55, 0x1d, 0xa8, 0xaa, 0xaa, 0x1a, 0x48, 0x55, 0x55, 0x1d,
0xa8, 0xaa, 0xaa, 0x1a, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

View File

@@ -0,0 +1,43 @@
/* XPM */
static char * drivea_xpm[] = {
/* width height ncolors chars_per_pixel */
"32 32 5 1",
/* colors */
" s None c None",
". c #000000000000",
"X c white",
"o c #c000c000c000",
"O c #800080008000",
/* pixels */
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" .......................... ",
" .XXXXXXXXXXXXXXXXXXXXXXXo. ",
" .XooooooooooooooooooooooO. ",
" .Xooooooooooooooooo..oooO. ",
" .Xooooooooooooooooo..oooO. ",
" .XooooooooooooooooooooooO. ",
" .Xoooooooo.......oooooooO. ",
" .Xoo...................oO. ",
" .Xoooooooo.......oooooooO. ",
" .XooooooooooooooooooooooO. ",
" .XooooooooooooooooooooooO. ",
" .XooooooooooooooooooooooO. ",
" .XooooooooooooooooooooooO. ",
" .oOOOOOOOOOOOOOOOOOOOOOOO. ",
" .......................... ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

View File

@@ -0,0 +1,48 @@
/* XPM */
static char * exit_xpm[] = {
"50 40 5 1",
" s None c None",
". c black",
"X c white",
"o c #000080800000",
"O c yellow",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ....................................... ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX. ",
" .XoooooooooooooooooooooooooooooooooooX. ",
" .XoooooooooooooooooooooooooooooooooooX. ",
" .XoooooooooooooooooooooooOoooooooooooX. ",
" .XoooooooooooooooooooooooOOooooooooooX. ",
" .XoooooooooooooooooooooooOOOoooooooooX. ",
" .XoooooOOOOOOOOOOOOOOOOOOOOOOooooooooX. ",
" .XoooooOOOOOOOOOOOOOOOOOOOOOOOoooooooX. ",
" .XoooooOOOOOOOOOOOOOOOOOOOOOOOOooooooX. ",
" .XoooooOOOOOOOOOOOOOOOOOOOOOOOOOoooooX. ",
" .XoooooOOOOOOOOOOOOOOOOOOOOOOOOooooooX. ",
" .XoooooOOOOOOOOOOOOOOOOOOOOOOOoooooooX. ",
" .XoooooOOOOOOOOOOOOOOOOOOOOOOooooooooX. ",
" .XoooooooooooooooooooooooOOOoooooooooX. ",
" .XoooooooooooooooooooooooOOooooooooooX. ",
" .XoooooooooooooooooooooooOoooooooooooX. ",
" .XoooooooooooooooooooooooooooooooooooX. ",
" .XoooooooooooooooooooooooooooooooooooX. ",
" .XoooooooooooooooooooooooooooooooooooX. ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX. ",
" ....................................... ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

View File

@@ -0,0 +1,14 @@
#define filebox_width 32
#define filebox_height 32
static unsigned char filebox_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x3f, 0x04, 0x00, 0x00, 0x20,
0xe4, 0xff, 0xff, 0x27, 0x24, 0x00, 0x00, 0x24, 0x24, 0x00, 0x00, 0x24,
0xe4, 0xff, 0xff, 0x27, 0x04, 0x00, 0x00, 0x20, 0xe4, 0x7f, 0xfe, 0x27,
0x24, 0x50, 0x02, 0x25, 0x24, 0x40, 0x02, 0x24, 0x24, 0x50, 0x02, 0x25,
0x24, 0x40, 0x02, 0x24, 0x24, 0x50, 0x02, 0x25, 0x24, 0x40, 0x02, 0x24,
0x24, 0x50, 0x02, 0x25, 0xe4, 0x7f, 0xfe, 0x27, 0x04, 0x00, 0x00, 0x20,
0xe4, 0xff, 0xff, 0x27, 0x24, 0x00, 0x00, 0x24, 0x24, 0x00, 0x00, 0x24,
0xe4, 0xff, 0xff, 0x27, 0x04, 0x00, 0x00, 0x20, 0xfc, 0xff, 0xff, 0x3f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

View File

@@ -0,0 +1,49 @@
/* XPM */
static char * filebox_xpm[] = {
"50 40 6 1",
" s None c None",
". c white",
"X c gray80",
"o c black",
"O c #FFFF80808080",
"+ c gray70",
" ",
" ",
" ",
" ............................................ ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
" .XXooXooXoXooXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
" .XXooXooXoXooXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
" .XXooooooooooooooooooooooooooooooooooooo.XXo ",
" .XXoOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XXo ",
" .XXoOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.XXo ",
" .XX......................................XXo ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
" .XXoooooooooooooooo.XXXXoooooooooooooooo.XXo ",
" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ",
" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ",
" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ",
" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ",
" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ",
" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ",
" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ",
" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ",
" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ",
" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ",
" .XXo+++++++++++++++.XXXXo+++++++++++++++.XXo ",
" .XX.................XXXX.................XXo ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
" .XXooXooXoXooXoXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
" .XXooXooXoXooXoXooXXXXXXXXXXXXXXXXXXXXXXXXXo ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
" .XXoooooooooooooooooooooooooooooooooooooo.Xo ",
" .XXoOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.Xo ",
" .XXoOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.Xo ",
" .XX.......................................Xo ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
" .ooooooooooooooooooooooooooooooooooooooooooo ",
" ",
" ",
" "};

View File

@@ -0,0 +1,14 @@
#define drivea_width 32
#define drivea_height 32
static unsigned char drivea_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xf8, 0xff, 0xff, 0x1f, 0x08, 0x00, 0x00, 0x18, 0xa8, 0xaa, 0xaa, 0x1a,
0x48, 0x55, 0xd5, 0x1d, 0xa8, 0xaa, 0xaa, 0x1b, 0x48, 0x55, 0x55, 0x1d,
0xa8, 0xfa, 0xaf, 0x1a, 0xc8, 0xff, 0xff, 0x1d, 0xa8, 0xfa, 0xaf, 0x1a,
0x48, 0x55, 0x55, 0x1d, 0xa8, 0xaa, 0xaa, 0x1a, 0x48, 0x55, 0x55, 0x1d,
0xa8, 0xaa, 0xaa, 0x1a, 0xf8, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0x1f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

View File

@@ -0,0 +1,43 @@
/* XPM */
static char * drivea_xpm[] = {
/* width height ncolors chars_per_pixel */
"32 32 5 1",
/* colors */
" s None c None",
". c #000000000000",
"X c white",
"o c #c000c000c000",
"O c #800080008000",
/* pixels */
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" .......................... ",
" .XXXXXXXXXXXXXXXXXXXXXXXo. ",
" .XooooooooooooooooooooooO. ",
" .Xooooooooooooooooo..oooO. ",
" .Xooooooooooooooooo..oooO. ",
" .XooooooooooooooooooooooO. ",
" .Xoooooooo.......oooooooO. ",
" .Xoo...................oO. ",
" .Xoooooooo.......oooooooO. ",
" .XooooooooooooooooooooooO. ",
" .XooooooooooooooooooooooO. ",
" .XooooooooooooooooooooooO. ",
" .XooooooooooooooooooooooO. ",
" .oOOOOOOOOOOOOOOOOOOOOOOO. ",
" .......................... ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

View File

@@ -0,0 +1,6 @@
#define italic_width 16
#define italic_height 16
static unsigned char italic_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x80, 0x3f, 0x00, 0x06, 0x00, 0x06,
0x00, 0x03, 0x00, 0x03, 0x80, 0x01, 0x80, 0x01, 0xc0, 0x00, 0xc0, 0x00,
0x60, 0x00, 0x60, 0x00, 0xfc, 0x01, 0xfc, 0x01};

View File

@@ -0,0 +1,6 @@
#define justify_width 16
#define justify_height 16
static unsigned char justify_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xdb, 0x00, 0x00, 0x7c, 0xdb,
0x00, 0x00, 0xbc, 0xf7, 0x00, 0x00, 0xdc, 0xde, 0x00, 0x00, 0x6c, 0xdf,
0x00, 0x00, 0x6c, 0xef, 0x00, 0x00, 0xdc, 0xdf};

View File

@@ -0,0 +1,6 @@
#define leftj_width 16
#define leftj_height 16
static unsigned char leftj_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x6d, 0x00, 0x00, 0xdc, 0x01,
0x00, 0x00, 0xec, 0x0e, 0x00, 0x00, 0xfc, 0x7e, 0x00, 0x00, 0xdc, 0x03,
0x00, 0x00, 0x6c, 0x3b, 0x00, 0x00, 0x6c, 0x1f};

View File

@@ -0,0 +1,14 @@
#define netw_width 32
#define netw_height 32
static unsigned char netw_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, 0x02, 0x40,
0x00, 0x00, 0xfa, 0x5f, 0x00, 0x00, 0x0a, 0x50, 0x00, 0x00, 0x0a, 0x52,
0x00, 0x00, 0x0a, 0x52, 0x00, 0x00, 0x8a, 0x51, 0x00, 0x00, 0x0a, 0x50,
0x00, 0x00, 0x4a, 0x50, 0x00, 0x00, 0x0a, 0x50, 0x00, 0x00, 0x0a, 0x50,
0x00, 0x00, 0xfa, 0x5f, 0x00, 0x00, 0x02, 0x40, 0xfe, 0x7f, 0x52, 0x55,
0x02, 0x40, 0xaa, 0x6a, 0xfa, 0x5f, 0xfe, 0x7f, 0x0a, 0x50, 0xfe, 0x7f,
0x0a, 0x52, 0x80, 0x00, 0x0a, 0x52, 0x80, 0x00, 0x8a, 0x51, 0x80, 0x00,
0x0a, 0x50, 0x80, 0x00, 0x4a, 0x50, 0x80, 0x00, 0x0a, 0x50, 0xe0, 0x03,
0x0a, 0x50, 0x20, 0x02, 0xfa, 0xdf, 0x3f, 0x03, 0x02, 0x40, 0xa0, 0x02,
0x52, 0x55, 0xe0, 0x03, 0xaa, 0x6a, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00,
0xfe, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

View File

@@ -0,0 +1,45 @@
/* XPM */
static char * netw_xpm[] = {
/* width height ncolors chars_per_pixel */
"32 32 7 1",
/* colors */
" s None c None",
". c #000000000000",
"X c white",
"o c #c000c000c000",
"O c #404040",
"+ c blue",
"@ c red",
/* pixels */
" ",
" .............. ",
" .XXXXXXXXXXXX. ",
" .XooooooooooO. ",
" .Xo.......XoO. ",
" .Xo.++++o+XoO. ",
" .Xo.++++o+XoO. ",
" .Xo.++oo++XoO. ",
" .Xo.++++++XoO. ",
" .Xo.+o++++XoO. ",
" .Xo.++++++XoO. ",
" .Xo.XXXXXXXoO. ",
" .XooooooooooO. ",
" .Xo@ooo....oO. ",
" .............. .XooooooooooO. ",
" .XXXXXXXXXXXX. .XooooooooooO. ",
" .XooooooooooO. .OOOOOOOOOOOO. ",
" .Xo.......XoO. .............. ",
" .Xo.++++o+XoO. @ ",
" .Xo.++++o+XoO. @ ",
" .Xo.++oo++XoO. @ ",
" .Xo.++++++XoO. @ ",
" .Xo.+o++++XoO. @ ",
" .Xo.++++++XoO. ..... ",
" .Xo.XXXXXXXoO. .XXX. ",
" .XooooooooooO.@@@@@@.X O. ",
" .Xo@ooo....oO. .OOO. ",
" .XooooooooooO. ..... ",
" .XooooooooooO. ",
" .OOOOOOOOOOOO. ",
" .............. ",
" "};

View File

@@ -0,0 +1,14 @@
#define netw_width 32
#define netw_height 32
static unsigned char netw_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, 0x02, 0x40,
0x00, 0x00, 0xfa, 0x5f, 0x00, 0x00, 0x0a, 0x50, 0x00, 0x00, 0x0a, 0x52,
0x00, 0x00, 0x0a, 0x52, 0x00, 0x00, 0x8a, 0x51, 0x00, 0x00, 0x0a, 0x50,
0x00, 0x00, 0x4a, 0x50, 0x00, 0x00, 0x0a, 0x50, 0x00, 0x00, 0x0a, 0x50,
0x00, 0x00, 0xfa, 0x5f, 0x00, 0x00, 0x02, 0x40, 0xfe, 0x7f, 0x52, 0x55,
0x02, 0x40, 0xaa, 0x6a, 0xfa, 0x5f, 0xfe, 0x7f, 0x0a, 0x50, 0xfe, 0x7f,
0x0a, 0x52, 0x80, 0x00, 0x0a, 0x52, 0x80, 0x00, 0x8a, 0x51, 0x80, 0x00,
0x0a, 0x50, 0x80, 0x00, 0x4a, 0x50, 0x80, 0x00, 0x0a, 0x50, 0xe0, 0x03,
0x0a, 0x50, 0x20, 0x02, 0xfa, 0xdf, 0x3f, 0x03, 0x02, 0x40, 0xa0, 0x02,
0x52, 0x55, 0xe0, 0x03, 0xaa, 0x6a, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00,
0xfe, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

View File

@@ -0,0 +1,45 @@
/* XPM */
static char * netw_xpm[] = {
/* width height ncolors chars_per_pixel */
"32 32 7 1",
/* colors */
" s None c None",
". c #000000000000",
"X c white",
"o c #c000c000c000",
"O c #404040",
"+ c blue",
"@ c red",
/* pixels */
" ",
" .............. ",
" .XXXXXXXXXXXX. ",
" .XooooooooooO. ",
" .Xo.......XoO. ",
" .Xo.++++o+XoO. ",
" .Xo.++++o+XoO. ",
" .Xo.++oo++XoO. ",
" .Xo.++++++XoO. ",
" .Xo.+o++++XoO. ",
" .Xo.++++++XoO. ",
" .Xo.XXXXXXXoO. ",
" .XooooooooooO. ",
" .Xo@ooo....oO. ",
" .............. .XooooooooooO. ",
" .XXXXXXXXXXXX. .XooooooooooO. ",
" .XooooooooooO. .OOOOOOOOOOOO. ",
" .Xo.......XoO. .............. ",
" .Xo.++++o+XoO. @ ",
" .Xo.++++o+XoO. @ ",
" .Xo.++oo++XoO. @ ",
" .Xo.++++++XoO. @ ",
" .Xo.+o++++XoO. @ ",
" .Xo.++++++XoO. ..... ",
" .Xo.XXXXXXXoO. .XXX. ",
" .XooooooooooO.@@@@@@.X O. ",
" .Xo@ooo....oO. .OOO. ",
" .XooooooooooO. ..... ",
" .XooooooooooO. ",
" .OOOOOOOOOOOO. ",
" .............. ",
" "};

View File

@@ -0,0 +1,48 @@
/* XPM */
static char * optmenu_xpm[] = {
"50 40 5 1",
" s None c None",
". c white",
"X c gray80",
"o c gray50",
"O c black",
" ",
" ",
" .............................. ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
" .XXXOXOXXOXXOXXXXOOXXXXXXXXXXo ",
" .XXXOXOXXOXOXXXOXXOXXXXXXXXXXo ",
" .XXXXOXXOXXOXXXOXXXOXXXXXXXXXo ",
" .XXXXOXXXOXXOOXXOXOXXXXXXXXXXo ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo.............o ",
" .............................o o ",
" ..XXXOXXXXXOXXXXXXXXOXXXXXXXOo o ",
" ..XXOXOXOXXOXOXXXOXXOXXXXXXXOo ...... o ",
" ..XXXOXXXOXXOXXXOXXXOXXXXXXXOo . o o ",
" ..XXOXXXOXXXOXOXXOXXOXXXXXXXOo . o o ",
" ..XXXXXXXXXXXXXXXXXXXXXXXXXXOo .ooooo o ",
" .OOOOOOOOOOOOOOOOOOOOOOOOOOOOo o ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo o ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXooooooooooooooo ",
" .XXXXOXXXXXOXXXXXXXXXXXXXXXXXo ",
" .XXXOXXXXXXXXXOXXXXXXXXXXXXXXo ",
" .XXXXOXXOXXOXOXOXXXXXXXXXXXXXo ",
" .XXXXXOXXOXOXXXXXXXXXXXXXXXXXo ",
" .XXXXXXXXXXXXXOXXXXXXXXXXXXXXo ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
" .XXXOXOXXXXXXXOXOXXXXXOXXXXXXo ",
" .XXXXXOXOXOXXOXXXXXOXXOXXXXXXo ",
" .XXXXOXXOXOXOXXXOXOXOXXOXXXXXo ",
" .XXXOXXXXOXXOXXXOXXOXXXXOXXXXo ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
" .XXXXXXXXXXXXXXXXXXXXXXXXXXXXo ",
" oooooooooooooooooooooooooooooo ",
" ",
" ",
" ",
" "};

View File

@@ -0,0 +1,6 @@
#define rightj_width 16
#define rightj_height 16
static unsigned char rightj_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xdb, 0x00, 0x00, 0x70, 0xdb,
0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0xd8, 0xde, 0x00, 0x00, 0xc0, 0xdd,
0x00, 0x00, 0xa0, 0xef, 0x00, 0x00, 0xd8, 0xde};

View File

@@ -0,0 +1,52 @@
/* XPM */
static char * select_xpm[] = {
"50 40 9 1",
" s None c None",
". c black",
"X c gray95",
"o c gray50",
"O c gray70",
"+ c navy",
"@ c #000080800000",
"# c #808000000000",
"$ c white",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" .............................................. ",
" .XXXXXXXXXXooooooooooooXXXXXXXXXXXoXXXXXXXXXX. ",
" .X ooOOOOOOOOOOXX oX o. ",
" .X ooOOOOOOOOOOXX oX o. ",
" .X ++++ ooOOOOOOOOOOXX ... oX @ o. ",
" .X +++++ ooOOOOOOOOOOXX . . oX @@@ o. ",
" .X +++ + ooOOOOOOOOOOXX . . oX @ @ o. ",
" .X + + ooOO#####OOOXX . . oX @ @ o. ",
" .X + + ooOO#OOO##OOXX . oX @ @ o. ",
" .X + + ooO##OOOO##OXX . oX @ @ o. ",
" .X ++ ++ ooO###OOO#OOXX . oX @ @ o. ",
" .X +++++++ ooO#######OOXX . oX @ @ o. ",
" .X + + ooO##O#OO#OOXX . oX @ @ o. ",
" .X + ++ ooO##OOOOO#OXX . . oX @ @ o. ",
" .X + + ooOO#OOOOO#OXX . . oX @ @@ o. ",
" .X + ++ ooOO#OOOOO#OXX .... oX @@@@@ o. ",
" .X ooOO######OOXX oX o. ",
" .X ooOOOOOOOOOOXX $oX o. ",
" .XoooooooooooXXXXXXXXXXXoooooooooooXooooooooo. ",
" .............................................. ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1,6 @@
#define underline_width 16
#define underline_height 16
static unsigned char underline_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x1c, 0x38, 0x1c,
0x30, 0x0c, 0x30, 0x0c, 0x30, 0x0c, 0x30, 0x0c, 0x30, 0x0c, 0x70, 0x0e,
0xf0, 0x0f, 0xe0, 0x07, 0x00, 0x00, 0xf8, 0x1f};

View File

@@ -0,0 +1,201 @@
# -*-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
}
}

View File

@@ -0,0 +1,187 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: ArrowBtn.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates how to write a new Tix widget class.
#
# ArrowBtn.tcl --
#
# Arrow Button: a sample Tix widget.
#
set arrow(n) [image create bitmap -data {
#define up_width 15
#define up_height 15
static unsigned char up_bits[] = {
0x80, 0x00, 0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0f, 0xfc, 0x1f,
0xfe, 0x3f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00};
}]
set arrow(w) [image create bitmap -data {
#define left_width 15
#define left_height 15
static unsigned char left_bits[] = {
0x00, 0x00, 0x40, 0x00, 0x60, 0x00, 0x70, 0x00, 0x78, 0x00, 0x7c, 0x00,
0xfe, 0x3f, 0xff, 0x3f, 0xfe, 0x3f, 0x7c, 0x00, 0x78, 0x00, 0x70, 0x00,
0x60, 0x00, 0x40, 0x00, 0x00, 0x00};
}]
set arrow(s) [image create bitmap -data {
#define down_width 15
#define down_height 15
static unsigned char down_bits[] = {
0x00, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
0xc0, 0x01, 0xc0, 0x01, 0xfe, 0x3f, 0xfc, 0x1f, 0xf8, 0x0f, 0xf0, 0x07,
0xe0, 0x03, 0xc0, 0x01, 0x80, 0x00};
}]
set arrow(e) [image create bitmap -data {
#define right_width 15
#define right_height 15
static unsigned char right_bits[] = {
0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x1f,
0xfe, 0x3f, 0xfe, 0x7f, 0xfe, 0x3f, 0x00, 0x1f, 0x00, 0x0f, 0x00, 0x07,
0x00, 0x03, 0x00, 0x01, 0x00, 0x00};
}]
tixWidgetClass tixArrowButton {
-classname TixArrowButton
-superclass tixPrimitive
-method {
flash invoke invert
}
-flag {
-direction -state
}
-configspec {
{-direction direction Direction e tixArrowButton:CheckDirection}
{-state state State normal}
}
-alias {
{-dir -direction}
}
}
proc tixArrowButton:InitWidgetRec {w} {
upvar #0 $w data
tixChainMethod $w InitWidgetRec
set data(count) 0
}
proc tixArrowButton:ConstructWidget {w} {
upvar #0 $w data
global arrow
tixChainMethod $w ConstructWidget
set data(w:button) [button $w.button -image $arrow($data(-direction))]
pack $data(w:button) -expand yes -fill both
}
proc tixArrowButton:SetBindings {w} {
upvar #0 $w data
tixChainMethod $w SetBindings
bind $data(w:button) <1> "tixArrowButton:IncrCount $w"
}
proc tixArrowButton:IncrCount {w} {
upvar #0 $w data
incr data(count)
}
proc tixArrowButton:CheckDirection {dir} {
if {[lsearch {n w s e} $dir] != -1} {
return $dir
} else {
error "wrong direction value \"$dir\""
}
}
proc tixArrowButton:flash {w} {
upvar #0 $w data
$data(w:button) flash
}
proc tixArrowButton:invoke {w} {
upvar #0 $w data
$data(w:button) invoke
}
proc tixArrowButton:invert {w} {
upvar #0 $w data
set curDirection $data(-direction)
case $curDirection {
n {
set newDirection s
}
s {
set newDirection n
}
e {
set newDirection w
}
w {
set newDirection e
}
}
$w config -direction $newDirection
}
proc tixArrowButton:config-direction {w value} {
upvar #0 $w data
global arrow
$data(w:button) configure -image $arrow($value)
}
proc tixArrowButton:config-state {w value} {
upvar #0 $w data
global arrow
$data(w:button) configure -state $value
}
#----------------------------------------------------------------------
#
# Instantiate several widgets of the tixArrowButton class
#
#----------------------------------------------------------------------
proc RunSample {w} {
set top [frame $w.top -border 1 -relief raised]
tixArrowButton $top.a -dir w
tixArrowButton $top.b -dir e
pack $top.a $top.b -side left -expand yes -fill both -padx 50 -pady 10
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> "exit"
}

View File

@@ -0,0 +1,48 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: Balloon.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixBalloon widget, which provides
# a interesting way to give help tips about elements in your user interface.
# Your can display the help message in a "balloon" and a status bar widget.
#
proc RunSample {w} {
# Create the status bar widget
#
label $w.status -width 40 -relief sunken -bd 1
pack $w.status -side bottom -fill y -padx 2 -pady 1
# These are two a mysterious widgets that need some explanation
#
button $w.button1 -text " Something Unexpected " \
-command "destroy $w"
button $w.button2 -text " Something Else Unexpected " \
-command "destroy $w.button2"
pack $w.button1 $w.button2 -side top -expand yes
# Create the balloon widget and associate it with the widgets that we want
# to provide tips for:
tixBalloon $w.b -statusbar $w.status
$w.b bind $w.button1 -balloonmsg "Close window" \
-statusmsg "Press this button to close this window"
$w.b bind $w.button2 -balloonmsg "Self-destruct\nButton" \
-statusmsg "Press this button and it will get rid of itself"
}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> {if {"%W" == ".demo"} exit}
}

View File

@@ -0,0 +1,57 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: BtnBox.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixButtonBox widget, which is a
# group of TK buttons. You can use it to manage the buttons in a dialog box,
# for example.
#
proc RunSample {w} {
# Create the label on the top of the dialog box
#
label $w.top -padx 20 -pady 10 -border 1 -relief raised -anchor c -text \
"This dialog box is\n a demostration of the\n tixButtonBox widget"
# Create the button box and add a few buttons in it. Set the
# -width of all the buttons to the same value so that they
# appear in the same size.
#
# Note that the -text, -underline, -command and -width options are all
# standard options of the button widgets.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text OK -underline 0 -command "destroy $w" -width 5
$w.box add close -text Close -underline 0 -command "destroy $w" -width 5
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
# "after 0" is used so that the key bindings won't interfere with
# tkTraverseMenu
#
bind [winfo toplevel $w] <Alt-o> \
"after 0 tkButtonInvoke [$w.box subwidget ok]"
bind [winfo toplevel $w] <Alt-c> \
"after 0 tkButtonInvoke [$w.box subwidget close]"
bind [winfo toplevel $w] <Escape> \
"after 0 tkButtonInvoke [$w.box subwidget close]"
focus [$w.box subwidget ok]
}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,80 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: CObjView.tcl,v 1.4 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This program demonstrates the use of the CObjView (Canvas Object
# View) class.
#
# $Id: CObjView.tcl,v 1.4 2001/12/09 05:31:07 idiscovery Exp $
proc RunSample {w} {
label $w.lab -justify left -text \
"Click on the buttons to add or delete canvas
objects randomally. Notice the scrollbars automatically
adjust to include all objects in the scroll-region."
pack $w.lab -anchor c -padx 10 -pady 6 -side top
frame $w.f
pack $w.f -side bottom -fill y
tixCObjView $w.c
pack $w.c -expand yes -fill both -padx 4 -pady 2 -side top
button $w.add -command "CVDemo_Add $w.c" -text Add -width 6
button $w.del -command "CVDemo_Delete $w.c" -text Delete -width 6
button $w.exit -command "destroy $w" -text Exit -width 6
pack $w.add $w.del $w.exit -side left -padx 20 -pady 10 \
-anchor c -expand yes -in $w.f
}
proc CVDemo_Add {cov} {
# Generate four pseudo random numbers (x,y,w,h) to define the coordinates
# of a rectangle object in the canvas.
#
set colors {red green blue white black gray yellow}
set x [expr int(rand() * 400) - 120]
set y [expr int(rand() * 400) - 120]
set w [expr int(rand() * 120)]
set h [expr int(rand() * 120)]
# Create the canvas object
#
$cov subwidget canvas create rectangle $x $y [expr $x+$w] [expr $y+$h] \
-fill [lindex $colors [expr int(rand() * [llength $colors])]]
# Call the adjustscrollregion command to set the scroll bars so that all
# objects are included in the scroll-region
#
$cov adjustscrollregion
}
proc CVDemo_Delete {cov} {
set px [lindex [time update] 0]
set w [$cov subwidget canvas]
set items [$w find withtag all]
if [string compare $items ""] {
# There are items in the canvas, randomally delete one of them
# and re-adjust the scroll-region
#
set toDelete [expr $px % [llength $items]]
$w delete [lindex $items $toDelete]
$cov adjustscrollregion
}
}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> {after 10 exit}
}

View File

@@ -0,0 +1,179 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: ChkList.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This program demonstrates the use of the tixCheckList widget.
#
proc RunSample {w} {
set top [frame $w.f -bd 1 -relief raised]
set box [tixButtonBox $w.b -bd 1 -relief raised]
pack $box -side bottom -fill both
pack $top -side top -fill both -expand yes
#------------------------------------------------------------
# Create the 1st CheckList (Multiple Selection)
#
set f [frame $top.f1]
pack $f -side left -expand yes -fill both -padx 4
set l [label $f.l -text "Choose languages: "]
pack $l -side top -fill x -padx 4 -pady 4
set c1 [tixCheckList $f.c -scrollbar auto]
pack $c1 -expand yes -fill both -padx 4 -pady 4
set b1 [button $f.btn -text "Results >>" -command "ChkList_Result $c1"]
pack $b1 -anchor c
#------------------------------------------------------------
# Create the 2nd CheckList (Single Selection, using the -radio option)
#
set f [frame $top.f2]
pack $f -side left -expand yes -fill both -padx 4
set l [label $f.l -text "Choose one language: "]
pack $l -side top -fill x -padx 4 -pady 4
set c2 [tixCheckList $f.c -scrollbar auto -radio true]
pack $c2 -expand yes -fill both -padx 4 -pady 4
# Fill up the two checklists with languages
#
set names(1) "Ada"
set names(2) "BCPL"
set names(3) "C"
set names(4) "Dylan"
set names(5) "Eiffel"
set names(6) "Fortran"
set names(7) "Incr Tcl"
set names(8) "Python"
set names(9) "Scheme"
set names(0) "TCL"
set h1 [$c1 subwidget hlist]
set h2 [$c2 subwidget hlist]
foreach ent {1 2 3 4 5 6 7 8 9 0} {
$h1 add $ent -itemtype imagetext -text $names($ent)
}
foreach ent {1 2 3 4 5 6 7 8 9 0} {
$h2 add $ent -itemtype imagetext -text $names($ent)
$c2 setstatus $ent off
}
$c1 setstatus 1 on
$c1 setstatus 2 on
$c1 setstatus 3 default
$c1 setstatus 4 off
$c1 setstatus 5 off
$c1 setstatus 6 on
$c1 setstatus 7 off
$c1 setstatus 8 on
$c1 setstatus 9 on
$c1 setstatus 0 default
#------------------------------------------------------------
# Create the 3nd CheckList (a tree). Also, we disable some
# sub-selections if the top-level selections are not selected.
# i.e., if the user doesn't like any functional languages,
# make sure he doesn't select Lisp.
#
set f [frame $top.f3]
pack $f -side left -expand yes -fill both -padx 4
set l [label $f.l -text "Choose languages: "]
pack $l -side top -fill x -padx 4 -pady 4
set c3 [tixCheckList $f.c -scrollbar auto -options {
hlist.indicator 1
hlist.indent 20
}]
pack $c3 -expand yes -fill both -padx 4 -pady 4
set h3 [$c3 subwidget hlist]
$h3 add 0 -itemtype imagetext -text "Functional Languages"
$h3 add 1 -itemtype imagetext -text "Imperative Languages"
$h3 add 0.0 -itemtype imagetext -text Lisp
$h3 add 0.1 -itemtype imagetext -text Scheme
$h3 add 1.0 -itemtype imagetext -text C
$h3 add 1.1 -itemtype imagetext -text Python
$c3 setstatus 0 on
$c3 setstatus 1 on
$c3 setstatus 0.0 off
$c3 setstatus 0.1 off
$c3 setstatus 1.0 on
$c3 setstatus 1.1 off
$c3 config -browsecmd "ChkList:Monitor $c3"
$c3 config -command "ChkList:Monitor $c3"
$c3 autosetmode
global chklist tixOption
set chklist(disabled) [tixDisplayStyle imagetext -fg $tixOption(disabled_fg) \
-refwindow [$c3 subwidget hlist]]
set chklist(normal) [tixDisplayStyle imagetext -fg black \
-refwindow [$c3 subwidget hlist]]
# Create the buttons
#
$box add ok -text Ok -command "destroy $w" -width 6
$box add cancel -text Cancel -command "destroy $w" -width 6
}
proc ChkList_Result {clist} {
tixDemo:Status "Selected items: [$clist getselection on]"
tixDemo:Status "Unselected items: [$clist getselection off]"
tixDemo:Status "Default items: [$clist getselection default]"
}
# This function monitors if any of the two "general groups"
# (functional and imperative languages) are de-selected. If so, it
# sets all the sub-selections to non-selectable by setting their -state
# to disabled.
#
proc ChkList:Monitor {c3 ent} {
global chklist
set h [$c3 subwidget hlist]
if {[$c3 getstatus 0] == "on"} {
set state normal
} else {
set state disabled
}
$h entryconfig 0.0 -state $state -style $chklist($state)
$h entryconfig 0.1 -state $state -style $chklist($state)
if {[$c3 getstatus 1] == "on"} {
set state normal
} else {
set state disabled
}
$h entryconfig 1.0 -state $state -style $chklist($state)
$h entryconfig 1.1 -state $state -style $chklist($state)
}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,64 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: CmpImg.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the compound images: it uses compound
# images to display a text string together with a pixmap inside
# buttons
#
proc RunSample {w} {
set img0 [tix getimage network]
set img1 [tix getimage harddisk]
button $w.hdd -padx 4 -pady 1 -width 120
button $w.net -padx 4 -pady 1 -width 120
# Create the first image: we create a line, then put a string,
# a space and a image into this line, from left to right.
# The result: we have a one-line image that consists of three
# individual items
#
set hdd_img [image create compound -window $w.hdd]
$hdd_img add line
$hdd_img add text -text "Hard Disk" -underline 0
$hdd_img add space -width 7
$hdd_img add image -image $img1
# Put this image into the first button
#
$w.hdd config -image $hdd_img
# Create the second compound image. Very similar to what we did above
#
set net_img [image create compound -window $w.net]
$net_img add line
$net_img add text -text "Network" -underline 0
$net_img add space -width 7
$net_img add image -image $img0
$w.net config -image $net_img
# The button to close the window
#
button $w.clo -pady 1 -text Close -command "destroy $w"
pack $w.hdd $w.net $w.clo -side left -padx 10 -pady 10 -fill y -expand yes
}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,182 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: CmpImg1.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixNoteBook widget, which allows
# you to lay out your interface using a "notebook" metaphore
#
proc RunSample {w} {
# We use these options to set the sizes of the subwidgets inside the
# notebook, so that they are well-aligned on the screen.
#
set name [tixOptionName $w]
option add *$name*TixControl*entry.width 10
option add *$name*TixControl*label.width 18
option add *$name*TixControl*label.anchor e
option add *$name*TixNoteBook*tabPadX 8
# Create the notebook widget and set its backpagecolor to gray.
# Note that the -backpagecolor option belongs to the "nbframe"
# subwidget.
tixNoteBook $w.nb -ipadx 6 -ipady 6
$w config -bg gray
$w.nb subwidget nbframe config -backpagecolor gray -tabpady 0
# Create the two tabs on the notebook. The -underline option
# puts a underline on the first character of the labels of the tabs.
# Keyboard accelerators will be defined automatically according
# to the underlined character.
#
global network_pixmap hard_disk_pixmap
set img0 [image create pixmap -data $network_pixmap]
set img1 [image create pixmap -data $hard_disk_pixmap]
set hd_img [image create compound -window [$w.nb subwidget nbframe]]
$hd_img add line
$hd_img add text -text "Hard Disk" -underline 0
$hd_img add space -width 7
$hd_img add image -image $img1
$w.nb add hard_disk -image $hd_img
set net_img [image create compound -window [$w.nb subwidget nbframe]]
$net_img add line
$net_img add text -text "Network" -underline 0
$net_img add space -width 7
$net_img add image -image $img0
$w.nb add network -image $net_img
# Create the first page
#
set f [$w.nb subwidget hard_disk]
tixControl $f.a -value 12 -label "Access Time: "
tixControl $f.w -value 400 -label "Write Throughput: "
tixControl $f.r -value 400 -label "Read Throughput: "
tixControl $f.c -value 1021 -label "Capacity: "
pack $f.a $f.w $f.r $f.c -side top -padx 20 -pady 2
# Create the second page
#
set f [$w.nb subwidget network]
tixControl $f.a -value 12 -label "Access Time: "
tixControl $f.w -value 400 -label "Write Throughput: "
tixControl $f.r -value 400 -label "Read Throughput: "
tixControl $f.c -value 1021 -label "Capacity: "
tixControl $f.u -value 10 -label "Users: "
pack $f.a $f.w $f.r $f.c $f.u -side top -padx 20 -pady 2
pack $w.nb -expand yes -fill both -padx 5 -pady 5
}
set network_pixmap {/* XPM */
static char * netw_xpm[] = {
/* width height ncolors chars_per_pixel */
"32 32 7 1",
/* colors */
" s None c None",
". c #000000000000",
"X c white",
"o c #c000c000c000",
"O c #404040",
"+ c blue",
"@ c red",
/* pixels */
" ",
" .............. ",
" .XXXXXXXXXXXX. ",
" .XooooooooooO. ",
" .Xo.......XoO. ",
" .Xo.++++o+XoO. ",
" .Xo.++++o+XoO. ",
" .Xo.++oo++XoO. ",
" .Xo.++++++XoO. ",
" .Xo.+o++++XoO. ",
" .Xo.++++++XoO. ",
" .Xo.XXXXXXXoO. ",
" .XooooooooooO. ",
" .Xo@ooo....oO. ",
" .............. .XooooooooooO. ",
" .XXXXXXXXXXXX. .XooooooooooO. ",
" .XooooooooooO. .OOOOOOOOOOOO. ",
" .Xo.......XoO. .............. ",
" .Xo.++++o+XoO. @ ",
" .Xo.++++o+XoO. @ ",
" .Xo.++oo++XoO. @ ",
" .Xo.++++++XoO. @ ",
" .Xo.+o++++XoO. @ ",
" .Xo.++++++XoO. ..... ",
" .Xo.XXXXXXXoO. .XXX. ",
" .XooooooooooO.@@@@@@.X O. ",
" .Xo@ooo....oO. .OOO. ",
" .XooooooooooO. ..... ",
" .XooooooooooO. ",
" .OOOOOOOOOOOO. ",
" .............. ",
" "};}
set hard_disk_pixmap {/* XPM */
static char * drivea_xpm[] = {
/* width height ncolors chars_per_pixel */
"32 32 5 1",
/* colors */
" s None c None",
". c #000000000000",
"X c white",
"o c #c000c000c000",
"O c #800080008000",
/* pixels */
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" .......................... ",
" .XXXXXXXXXXXXXXXXXXXXXXXo. ",
" .XooooooooooooooooooooooO. ",
" .Xooooooooooooooooo..oooO. ",
" .Xooooooooooooooooo..oooO. ",
" .XooooooooooooooooooooooO. ",
" .Xoooooooo.......oooooooO. ",
" .Xoo...................oO. ",
" .Xoooooooo.......oooooooO. ",
" .XooooooooooooooooooooooO. ",
" .XooooooooooooooooooooooO. ",
" .XooooooooooooooooooooooO. ",
" .XooooooooooooooooooooooO. ",
" .oOOOOOOOOOOOOOOOOOOOOOOO. ",
" .......................... ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,136 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: CmpImg2.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates how to use the compound image inside NoteBook
# widgets. This file is basically a cross-over of NoteBook.tcl and CmpImg.tcl
#
proc RunSample {w} {
# Create the notebook widget and set its backpagecolor to gray.
# Note that the -backpagecolor option belongs to the "nbframe"
# subwidget.
tixNoteBook $w.nb -ipadx 6 -ipady 6
$w config -bg gray
$w.nb subwidget nbframe config -backpagecolor gray -tabpady 0
# Create the two compound images
#
#
# these are two Tix built-in images
#
set img0 [tix getimage network]
set img1 [tix getimage harddisk]
# Create the first image:
#
# Notice that the -window option must be set to the nbframe
# subwidget of the notebook because the image will be displayed
# in that widget.
#
set hdd_img [image create compound -window [$w.nb subwidget nbframe] \
-pady 0]
$hdd_img add line
$hdd_img add image -image $img1
$hdd_img add space -width 7
$hdd_img add text -text "Hard Disk" -underline 0
# Create the second compound image. Very similar to what we did above
#
set net_img [image create compound -window [$w.nb subwidget nbframe] \
-pady 0]
$net_img add line
$net_img add image -image $img0
$net_img add space -width 7
$net_img add text -text "Network" -underline 0
#
# Now create the pages
#
# We use these options to set the sizes of the subwidgets inside the
# notebook, so that they are well-aligned on the screen.
#
set name [tixOptionName $w]
option add *$name*TixControl*entry.width 10
option add *$name*TixControl*label.width 18
option add *$name*TixControl*label.anchor e
# Create the two tabs on the notebook. The -underline option
# puts a underline on the first character of the labels of the tabs.
# Keyboard accelerators will be defined automatically according
# to the underlined character.
#
$w.nb add hard_disk -image $hdd_img
$w.nb add network -image $net_img
pack $w.nb -expand yes -fill both -padx 5 -pady 5 -side top
#----------------------------------------
# Create the first page
#----------------------------------------
set f [$w.nb subwidget hard_disk]
# Create two frames: one for the common buttons, one for the
# other widgets
#
frame $f.f
frame $f.common
pack $f.f -side left -padx 2 -pady 2 -fill both -expand yes
pack $f.common -side right -padx 2 -pady 2 -fill y
# Create the controls that only belong to this page
#
tixControl $f.f.a -value 12 -label "Access Time: "
tixControl $f.f.w -value 400 -label "Write Throughput: "
tixControl $f.f.r -value 400 -label "Read Throughput: "
tixControl $f.f.c -value 1021 -label "Capacity: "
pack $f.f.a $f.f.w $f.f.r $f.f.c -side top -padx 20 -pady 2
# Create the common buttons
#
CreateCommonButtons $w $f.common
#----------------------------------------
# Create the second page
#----------------------------------------
set f [$w.nb subwidget network]
frame $f.f
frame $f.common
pack $f.f -side left -padx 2 -pady 2 -fill both -expand yes
pack $f.common -side right -padx 2 -pady 2 -fill y
tixControl $f.f.a -value 12 -label "Access Time: "
tixControl $f.f.w -value 400 -label "Write Throughput: "
tixControl $f.f.r -value 400 -label "Read Throughput: "
tixControl $f.f.c -value 1021 -label "Capacity: "
tixControl $f.f.u -value 10 -label "Users: "
pack $f.f.a $f.f.w $f.f.r $f.f.c $f.f.u -side top -padx 20 -pady 2
CreateCommonButtons $w $f.common
}
proc CreateCommonButtons {w f} {
button $f.ok -text OK -width 6 -command "destroy $w"
button $f.cancel -text Cancel -width 6 -command "destroy $w"
pack $f.ok $f.cancel -side top -padx 2 -pady 2
}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,90 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: CmpImg3.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# Demonstrates how to use compound images to display icons in a canvas widget.
#
proc RunSample {w} {
set top [frame $w.f -bd 1 -relief raised]
set box [tixButtonBox $w.b -bd 1 -relief raised]
pack $box -side bottom -fill both
pack $top -side top -fill both -expand yes
label $top.lab -text "Drag the icons"
pack $top.lab -anchor c -side top -pady 4
# Create the canvas to display the icons
#
set c [canvas $top.c -relief sunken -bd 1]
pack $c -side top -expand yes -fill both -padx 4 -pady 4
# create several compound images in the canvas
#
set network [tix getimage network]
set harddisk [tix getimage harddisk]
set cmp_1 [image create compound -window $c -bd 1]
$cmp_1 add image -image $network
$cmp_1 add line
$cmp_1 add text -text " Network "
set cmp_2 [image create compound -window $c -bd 1]
$cmp_2 add image -image $harddisk
$cmp_2 add line
$cmp_2 add text -text " Hard disk "
set cmp_3 [image create compound -window $c -bd 1 \
-background #c0c0ff -relief raised \
-showbackground 1]
$cmp_3 add image -image $network
$cmp_3 add line
$cmp_3 add text -text " Network 2 "
$c create image 50 50 -image $cmp_1
$c create image 150 50 -image $cmp_2
$c create image 250 50 -image $cmp_3
bind $c <1> "itemStartDrag $c %x %y"
bind $c <B1-Motion> "itemDrag $c %x %y"
# Create the buttons
#
$box add ok -text Ok -command "destroy $w" -width 6
$box add cancel -text Cancel -command "destroy $w" -width 6
}
proc itemStartDrag {c x y} {
global lastX lastY
$c raise current
set lastX [$c canvasx $x]
set lastY [$c canvasy $y]
}
proc itemDrag {c x y} {
global lastX lastY
set x [$c canvasx $x]
set y [$c canvasy $y]
$c move current [expr $x-$lastX] [expr $y-$lastY]
set lastX $x
set lastY $y
}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,125 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: CmpImg4.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates how to use the compound image to add
# colors in Notebook tabs.
#
proc RunSample {w} {
# Create the notebook widget and set its backpagecolor to gray.
# Note that the -backpagecolor option belongs to the "nbframe"
# subwidget.
tixNoteBook $w.nb -ipadx 6 -ipady 6
# $w config -bg gray
# $w.nb subwidget nbframe config -backpagecolor gray -tabpady 0
# Create the two compound images --
#
# Create the first image:
#
# Notice that the -window option must be set to the nbframe
# subwidget of the notebook because the image will be displayed
# in that widget.
#
set hdd_img [image create compound -window [$w.nb subwidget nbframe] \
-pady 4 -padx 4 -bg #f09090 -showbackground 1]
$hdd_img add line
$hdd_img add text -text "Hard Disk" -underline 0 -padx 6 -pady 4
# Create the second compound image. Very similar to what we did above
#
set net_img [image create compound -window [$w.nb subwidget nbframe] \
-pady 4 -pady 4 -bg #9090f0 -showbackground 1]
$net_img add line
$net_img add text -text "Network" -underline 0 -padx 6 -pady 4
#
# Now create the pages
#
# We use these options to set the sizes of the subwidgets inside the
# notebook, so that they are well-aligned on the screen.
#
set name [tixOptionName $w]
option add *$name*TixControl*entry.width 10
option add *$name*TixControl*label.width 18
option add *$name*TixControl*label.anchor e
# Create the two tabs on the notebook. The -underline option
# puts a underline on the first character of the labels of the tabs.
# Keyboard accelerators will be defined automatically according
# to the underlined character.
#
$w.nb add hard_disk -image $hdd_img
$w.nb add network -image $net_img
pack $w.nb -expand yes -fill both -padx 5 -pady 5 -side top
#----------------------------------------
# Create the first page
#----------------------------------------
set f [$w.nb subwidget hard_disk]
# Create two frames: one for the common buttons, one for the
# other widgets
#
frame $f.f
frame $f.common
pack $f.f -side left -padx 2 -pady 2 -fill both -expand yes
pack $f.common -side right -padx 2 -pady 2 -fill y
# Create the controls that only belong to this page
#
tixControl $f.f.a -value 12 -label "Access Time: "
tixControl $f.f.w -value 400 -label "Write Throughput: "
tixControl $f.f.r -value 400 -label "Read Throughput: "
tixControl $f.f.c -value 1021 -label "Capacity: "
pack $f.f.a $f.f.w $f.f.r $f.f.c -side top -padx 20 -pady 2
# Create the common buttons
#
CreateCommonButtons $w $f.common
#----------------------------------------
# Create the second page
#----------------------------------------
set f [$w.nb subwidget network]
frame $f.f
frame $f.common
pack $f.f -side left -padx 2 -pady 2 -fill both -expand yes
pack $f.common -side right -padx 2 -pady 2 -fill y
tixControl $f.f.a -value 12 -label "Access Time: "
tixControl $f.f.w -value 400 -label "Write Throughput: "
tixControl $f.f.r -value 400 -label "Read Throughput: "
tixControl $f.f.c -value 1021 -label "Capacity: "
tixControl $f.f.u -value 10 -label "Users: "
pack $f.f.a $f.f.w $f.f.r $f.f.c $f.f.u -side top -padx 20 -pady 2
CreateCommonButtons $w $f.common
}
proc CreateCommonButtons {w f} {
button $f.ok -text OK -width 6 -command "destroy $w"
button $f.cancel -text Cancel -width 6 -command "destroy $w"
pack $f.ok $f.cancel -side top -padx 2 -pady 2
}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,119 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: ComboBox.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixComboBox widget, which is close
# to the MS Window Combo Box control.
#
proc RunSample {w} {
# Create the comboboxes on the top of the dialog box
#
frame $w.top -border 1 -relief raised
# $w.top.a is a drop-down combo box. It is not editable -- who wants
# to invent new months?
#
# [Hint] The -options switch sets the options of the subwidgets.
# [Hint] We set the label.width subwidget option of both comboboxes to
# be 10 so that their labels appear to be aligned.
#
tixComboBox $w.top.a -label "Month: " -dropdown true \
-command cbx:select_month -editable false -variable demo_month \
-options {
listbox.height 6
label.width 10
label.anchor e
}
# $w.top.b is a non-drop-down combo box. It is not editable: we provide
# four choices for the user, but he can enter an alternative year if he
# wants to.
#
# [Hint] Use the padY and anchor options of the label subwidget to
# aligh the label with the entry subwidget.
# [Hint] Notice that you should use padY (the NAME of the option) and not
# pady (the SWITCH of the option).
#
tixComboBox $w.top.b -label "Year: " -dropdown false \
-command cbx:select_year -editable true -variable demo_year \
-options {
listbox.height 4
label.padY 5
label.width 10
label.anchor ne
}
pack $w.top.a -side top -anchor w
pack $w.top.b -side top -anchor w
# Insert the choices into the combo boxes
#
$w.top.a insert end January
$w.top.a insert end February
$w.top.a insert end March
$w.top.a insert end April
$w.top.a insert end May
$w.top.a insert end June
$w.top.a insert end July
$w.top.a insert end August
$w.top.a insert end September
$w.top.a insert end October
$w.top.a insert end November
$w.top.a insert end December
$w.top.b insert end 1992
$w.top.b insert end 1993
$w.top.b insert end 1994
$w.top.b insert end 1995
# Use "tixSetSilent" to set the values of the combo box if you
# don't want your -command procedures (cbx:select_month and
# cbx:select_year) to be called.
#
tixSetSilent $w.top.a January
tixSetSilent $w.top.b 1995
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "cbx:okcmd $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
}
proc cbx:select_year {args} {
tixDemo:Status "you have selected \"$args\""
}
proc cbx:select_month {s} {
tixDemo:Status "you have selected \"$s\""
}
proc cbx:okcmd {w} {
global demo_month demo_year
tixDemo:Status "The month selected is $demo_month of $demo_year"
destroy $w
}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,133 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: Control.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixControl widget -- it is an
# entry widget with up/down arrow buttons. You can use the arrow buttons
# to adjust the value inside the entry widget.
#
# This example program uses three Control widgets. One lets you select
# integer values; one lets you select floating point values and the last
# one lets you select a few names.
#
proc RunSample {w} {
# Create the tixControls on the top of the dialog box
#
frame $w.top -border 1 -relief raised
# $w.top.a allows only integer values
#
# [Hint] The -options switch sets the options of the subwidgets.
# [Hint] We set the label.width subwidget option of the Controls to
# be 16 so that their labels appear to be aligned.
#
global demo_maker demo_thrust demo_num_engins
set demo_maker P&W
set demo_thrust 20000.0
set demo_num_engins 2
tixControl $w.top.a -label "Number of Engines: " -integer true \
-variable demo_num_engins -min 1 -max 4\
-options {
entry.width 10
label.width 20
label.anchor e
}
tixControl $w.top.b -label "Thrust: " -integer false \
-min 10000.0 -max 60000.0 -step 500\
-variable demo_thrust \
-options {
entry.width 10
label.width 20
label.anchor e
}
tixControl $w.top.c -label "Engin Maker: " \
-incrcmd "ctl:adjust_maker $w.top.c +1" \
-decrcmd "ctl:adjust_maker $w.top.c -1" \
-validatecmd "ctl:validate_maker $w.top.c" \
-value "P&W" \
-options {
entry.width 10
label.width 20
label.anchor e
}
pack $w.top.a $w.top.b $w.top.c -side top -anchor w
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "ctl:okcmd $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
}
set ctl_makers {GE P&W "Rolls Royce"}
# This procedure gets called when the user presses the up/down arrow buttons.
# We return the "previous" or "next" engin maker according to the "$by"
# argument
#
proc ctl:adjust_maker {w by value} {
global ctl_makers
set index [lsearch $ctl_makers $value]
set len [llength $ctl_makers]
set index [expr $index $by]
if {$index < 0} {
set index [expr $len -1]
}
if {$index >= $len} {
set index 0
}
return [lindex $ctl_makers $index]
}
proc ctl:validate_maker {w value} {
global ctl_makers
if {[lsearch $ctl_makers $value] == -1} {
return [lindex $ctl_makers 0]
} else {
return $value
}
}
proc ctl:okcmd {w} {
global demo_maker demo_thrust demo_num_engins
tixDemo:Status "You selected $demo_num_engins engin(s) of thrust $demo_thrust made \
by $demo_maker"
destroy $w
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,90 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: DirDlg.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixDirSelectDialog widget:
# it allows the user to select a directory.
#
proc RunSample {w} {
# Create an entry for the user to input a directory. If he can't
# bother to type in the name, he can press the "Browse ..." button
# and call up the diretcory dialog
#
frame $w.top -border 1 -relief raised
tixLabelEntry $w.top.ent -label "Select A Directory:" -labelside top \
-options {
entry.width 25
entry.textVariable demo_ddlg_dirname
label.anchor w
}
bind [$w.top.ent subwidget entry] <Return> "ddlg:okcmd $w"
uplevel #0 set demo_ddlg_dirname {}
button $w.top.btn -text "Browse ..." -command "ddlg:browse"
pack $w.top.ent -side left -expand yes -fill x -anchor s -padx 4 -pady 4
pack $w.top.btn -side left -anchor s -padx 4 -pady 4
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "ddlg:okcmd $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
}
# Pop up a directory selection dialog
#
proc ddlg:browse {} {
set dialog .dirdlg_popup
if ![winfo exists $dialog] {
tixDirSelectDialog $dialog
}
$dialog config -command ddlg:select_dir
$dialog popup
}
proc ddlg:select_dir {dir} {
global demo_ddlg_dirname
set demo_ddlg_dirname $dir
}
proc ddlg:okcmd {w} {
global demo_ddlg_dirname
if {$demo_ddlg_dirname != {}} {
tixDemo:Status "You have selected the directory $demo_ddlg_dirname"
} else {
tixDemo:Status "You haven't selected any directory"
}
destroy $w
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,91 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: DirList.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixDirList widget -- you can
# use it for the user to select a directory. For example, an installation
# program can use the tixDirList widget to ask the user to select the
# installation directory for an application.
#
proc RunSample {w} {
# Create the tixDirList and the tixLabelEntry widgets on the on the top
# of the dialog box
#
frame $w.top -border 1 -relief raised
# Create the DirList widget. By default it will show the current
# directory (returned by [pwd])
#
#
tixDirList $w.top.dir
# When the user presses the ".." button, the selected directory
# is "transferred" into the entry widget
#
button $w.top.btn -text " >> " -pady 0 \
-command "dlist:copy_name $w.top.dir"
# We use a LabelEntry to hold the installation directory. The user
# can choose from the DirList widget, or he can type in the directory
# manually
#
tixLabelEntry $w.top.ent -label "Installation Directory:" -labelside top \
-options {
entry.width 25
entry.textVariable demo_dlist_dir
label.anchor w
}
bind [$w.top.ent subwidget entry] <Return> "dlist:okcmd $w"
uplevel #0 set demo_dlist_dir [list [pwd]]
pack $w.top.dir -side left -expand yes -fill both -padx 4 -pady 4
pack $w.top.btn -side left -anchor s -padx 4 -pady 4
pack $w.top.ent -side left -fill x -anchor s -padx 4 -pady 4
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "dlist:okcmd $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
}
proc dlist:copy_name {w} {
global demo_dlist_dir
set demo_dlist_dir [$w cget -value]
}
proc dlist:okcmd {w} {
global demo_dlist_dir
tixDemo:Status "You have selected the directory $demo_dlist_dir"
destroy $w
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> "exit"
}

View File

@@ -0,0 +1,92 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: DirTree.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixDirTree widget -- you can
# use it for the user to select a directory. For example, an installation
# program can use the tixDirList widget to ask the user to select the
# installation directory for an application.
#
proc RunSample {w} {
# Create the tixDirTree and the tixLabelEntry widgets on the on the top
# of the dialog box
#
frame $w.top -border 1 -relief raised
# Create the DirTree widget. By default it will show the current
# directory (returned by [pwd])
#
#
tixDirTree $w.top.dir -browsecmd "dtree:browse $w.top.ent"
# When the user presses the ".." button, the selected directory
# is "transferred" into the entry widget
#
# We use a LabelEntry to hold the installation directory. The user
# can choose from the DirTree widget, or he can type in the directory
# manually
#
tixLabelEntry $w.top.ent -label "Installation Directory:" -labelside top \
-options {
entry.width 25
entry.textVariable demo_dtree_dir
label.anchor w
}
bind [$w.top.ent subwidget entry] <Return> "dtree:okcmd $w"
uplevel #0 set demo_dtree_dir [list [pwd]]
pack $w.top.dir -side left -expand yes -fill both -padx 4 -pady 4
pack $w.top.ent -side left -fill x -anchor c -padx 4 -pady 4
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "dtree:okcmd $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
}
proc dtree:browse {ent filename} {
uplevel #0 set demo_dtree_dir $filename
}
proc dtree:copy_name {w} {
global demo_dtree_dir
set demo_dtree_dir [$w cget -value]
}
proc dtree:okcmd {w} {
global demo_dtree_dir
tixDemo:Status "You have selected the directory $demo_dtree_dir"
destroy $w
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> "exit"
}

View File

@@ -0,0 +1,50 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: DragDrop.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the Drag+Drop features in Tix. Drag+Drop is still
# experimental in Tix. Please don't use. For your eyes only.
#
#
proc RunSample {w} {
text $w.d -height 5
$w.d insert end {Quick and dirty example:
click on any node on on the directory lists and drag. You can see the
cursor change its shape. The "dropsite" of the directory lists will be
highlighted when you drag the cursor accorss the directory nodes.
Nothing will happen when you drop. }
pack $w.d -padx 10 -pady 5
tixDirList $w.d1; pack $w.d1 -fill both -padx 10 -pady 5 \
-side left
tixDirList $w.d2; pack $w.d2 -fill both -padx 10 -pady 5 \
-side left
button $w.b -text "Close" -command "destroy $w"
pack $w.b -side left -anchor c -expand yes
$w.d1 subwidget hlist config -selectmode dragdrop
$w.d2 subwidget hlist config -selectmode dragdrop
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> "exit"
}

View File

@@ -0,0 +1,149 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: DynTree.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates how to use the TixTree widget to display
# dynamic hierachical data (the files in the Unix file system)
#
proc RunSample {w} {
# We create the frame and the ScrolledHList widget
# at the top of the dialog box
#
frame $w.top -relief raised -bd 1
# Create a TixTree widget to display the hypothetical DOS disk drive
#
#
tixTree $w.top.a -options {
hlist.separator "/"
hlist.width 35
hlist.height 25
}
pack $w.top.a -expand yes -fill both -padx 10 -pady 10 -side left
set tree $w.top.a
set hlist [$tree subwidget hlist]
$tree config -opencmd "DynTree:OpenDir $tree"
# Add the root directory the TixTree widget
DynTree:AddDir $tree /
# The / directory is added in the "open" mode. The user can open it
# and then browse its subdirectories ...
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "destroy $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
}
proc DynTree:AddDir {tree dir} {
set hlist [$tree subwidget hlist]
if {$dir == "/"} {
set text /
} else {
set text [file tail $dir]
}
$hlist add $dir -itemtype imagetext \
-text $text -image [tix getimage folder]
catch {
# We need a catch here because the directory may not be readable by us
#
$tree setmode $dir none
if {[glob -nocomplain $dir/*] != {}} {
$tree setmode $dir open
}
}
}
# This command is called whenever the user presses the (+) indicator or
# double clicks on a directory whose mode is "open". It loads the files
# inside that directory into the Tree widget.
#
# Note we didn't specify the -closecmd option for the Tree widget, so it
# performs the default action when the user presses the (-) indicator or
# double clicks on a directory whose mode is "close": hide all of its child
# entries
#
proc DynTree:OpenDir {tree dir} {
set PWD [pwd]
set hlist [$tree subwidget hlist]
if {[$hlist info children $dir] != {}} {
# We have already loaded this directory. Let's just
# show all the child entries
#
# Note: since we load the directory only once, it will not be
# refreshed if the you add or remove files from this
# directory.
#
foreach kid [$hlist info children $dir] {
$hlist show entry $kid
}
return
}
if [catch {cd $dir}] {
# We can't read that directory, better not do anything
cd $PWD
return
}
set files [lsort [glob -nocomplain *]]
foreach f $files {
if [file isdirectory $f] {
if {$dir == "/"} {
set subdir /$f
} else {
set subdir $dir/$f
}
DynTree:AddDir $tree $subdir
} else {
if {$dir == "/"} {
set file /$f
} else {
set file $dir/$f
}
$hlist add $file -itemtype imagetext \
-text $f -image [tix getimage file]
}
}
cd $PWD
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,104 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: EFileDlg.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixExFileSelectDialog widget --
# This is a neat file selection dialog that will make your apps look
# real good!
#
proc RunSample {w} {
# Create an entry for the user to input a filename. If he can't
# bother to type in the name, he can press the "Browse ..." button
# and call up the file dialog
#
frame $w.top -border 1 -relief raised
tixLabelEntry $w.top.ent -label "Select A File:" -labelside top \
-options {
entry.width 25
entry.textVariable demo_efdlg_filename
label.anchor w
}
bind [$w.top.ent subwidget entry] <Return> "efdlg:okcmd $w"
uplevel #0 set demo_efdlg_filename {}
button $w.top.btn -text "Browse ..." -command "efdlg:browse"
pack $w.top.ent -side left -expand yes -fill x -anchor s -padx 4 -pady 4
pack $w.top.btn -side left -anchor s -padx 4 -pady 4
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "efdlg:okcmd $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
}
# Pop up a file selection dialog
#
proc efdlg:browse {} {
# [Hint]
# The best way to use an ExFileSelectDialog is not to create one yourself
# but to call the command "tix filedialog". This command creates one file
# dialog box that is shared by different parts of the application.
# This way, your application can save resources because it doesn't
# need to create a lot of file dialog boxes even if it needs to input
# file names at a lot of different occasions.
#
set dialog [tix filedialog tixExFileSelectDialog]
$dialog config -command efdlg:select_file
$dialog subwidget fsbox config -filetypes {
{{*} {* -- All files}}
{{*.txt} {*.txt -- Text files}}
{{*.c} {*.c -- C source files}}
}
wm transient $dialog ""
$dialog popup
}
proc efdlg:select_file {file} {
global demo_efdlg_filename
set demo_efdlg_filename $file
}
proc efdlg:okcmd {w} {
global demo_efdlg_filename
if {$demo_efdlg_filename != {}} {
tixDemo:Status "You have selected the file $demo_efdlg_filename"
} else {
tixDemo:Status "You haven't selected any file"
}
destroy $w
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,281 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: EditGrid.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# Demonstrates the use of editable entries in a Grid widget.
#
proc RunSample {w} {
global editgrid
wm title $w "Doe Inc. Performance"
wm geometry $w 640x300
label $w.lab -justify left -text \
"The left column is calculated automatically. To calculate the right column,
press the \"Calculate\" button"
pack $w.lab -side top -anchor c -padx 3 -pady 3
# Create the buttons
#
set f [frame $w.f -relief flat]
pack $f -side right -fill y
set add [button $f.add -text "Add Row" -width 9 \
-command "EditGrid_addRow"]
set edit [button $f.edit -text "Edit" -width 9 \
-command "EditGrid_edit"]
set cal [button $f.cal -text "Calculate" -width 9 \
-command "EditGrid_calculate"]
set close [button $f.close -text "Close" -width 9 \
-command "destroy $w"]
pack $add -side top -padx 10
pack $edit -side top -padx 10
pack $cal -side top -padx 10 -pady 2
pack $close -side bottom -padx 10
# Create the grid and set options to make it editable.
#
tixScrolledGrid $w.g -bd 0
pack $w.g -expand yes -fill both -padx 3 -pady 3
set grid [$w.g subwidget grid]
$grid config \
-formatcmd "EditGrid_format $grid" \
-editnotifycmd "EditGrid_editNotify" \
-editdonecmd "EditGrid_editDone" \
-selectunit cell \
-selectmode single
# Insert some initial data
#
$grid set 0 1 -text "City #1"
$grid set 0 2 -text "City #2"
$grid set 0 3 -text "City #3"
$grid set 0 5 -text "Combined"
$grid set 2 0 -text "Population"
$grid set 4 0 -text "Avg. Income"
$grid set 2 1 -text 125
$grid set 2 2 -text 81
$grid set 2 3 -text 724
$grid set 4 1 -text 24432.12
$grid set 4 2 -text 18290.24
$grid set 4 3 -text 18906.34
# Global data used by other EditGrid_ procedures.
#
set editgrid(g) $grid
set editgrid(top) 1
set editgrid(bot) 3
set editgrid(result) 5
EditGrid_calPop
EditGrid_calIncome
}
# EditGrid_edit --
#
# Prompts the user to edit a cell.
#
proc EditGrid_edit {} {
global editgrid
set grid $editgrid(g)
set ent [$grid anchor get]
if [string comp $ent ""] {
$grid edit set [lindex $ent 0] [lindex $ent 1]
}
}
# EditGrid_addRow --
#
# Adds a new row to the table.
#
proc EditGrid_addRow {} {
global editgrid
set grid $editgrid(g)
$grid edit apply
$grid move row $editgrid(result) $editgrid(result) 1
incr editgrid(bot)
set editgrid(result) [expr $editgrid(bot) + 2]
$grid set 0 $editgrid(bot) -text "City #$editgrid(bot)"
$grid set 2 $editgrid(bot) -text 0
$grid set 4 $editgrid(bot) -text 0.0
EditGrid_calPop
EditGrid_calIncome
}
# EditGrid_calPop --
#
# Calculates the total population
#
proc EditGrid_calPop {} {
global editgrid
set grid $editgrid(g)
set pop 0
for {set i $editgrid(top)} {$i <= $editgrid(bot)} {incr i} {
incr pop [$grid entrycget 2 $i -text]
}
$grid set 2 $editgrid(result) -text $pop
}
# EditGrid_calIncome --
#
# Calculates the average income.
#
proc EditGrid_calIncome {} {
global editgrid
set grid $editgrid(g)
set income 0
set total_pop 0
for {set i $editgrid(top)} {$i <= $editgrid(bot)} {incr i} {
set pop [$grid entrycget 2 $i -text]
set inc [$grid entrycget 4 $i -text]
set income [expr $income + $pop.0 * $inc]
incr total_pop $pop
}
$grid set 4 $editgrid(result) -text [expr $income/$total_pop]
}
# EditGrid_calculate --
#
# Recalculates both columns.
#
proc EditGrid_calculate {} {
global editgrid
set grid $editgrid(g)
$grid edit apply
EditGrid_calIncome
}
# EditGrid_editNotify --
#
# Returns true if an entry can be edited.
#
proc EditGrid_editNotify {x y} {
global editgrid
set grid $editgrid(g)
if {$x == 2 || $x == 4} {
if {$y >= $editgrid(top) && $y <= $editgrid(bot)} {
set editgrid(oldValue) [$grid entrycget $x $y -text]
return 1
}
}
return 0
}
# EditGrid_editDone --
#
# Gets called when the user is done editing an entry.
#
proc EditGrid_editDone {x y} {
global editgrid
set grid $editgrid(g)
if {$x == 2} {
set pop [$grid entrycget $x $y -text]
if [catch {
format %d $pop
}] {
$grid entryconfig $x $y -text $editgrid(oldValue)
tk_dialog .editGridWarn "" \
"$pop is not an valid integer. Try again" \
warning 0 Ok
} else {
$grid entryconfig 4 $editgrid(result) -text "-"
EditGrid_calPop
}
} else {
set income [$grid entrycget $x $y -text]
if [catch {
format %f $income
}] {
$grid entryconfig $x $y -text $editgrid(oldValue)
tk_dialog .editGridWarn "" \
"$income is not an valid floating number. Try again" \
warning 0 Ok
} else {
$grid entryconfig 4 $editgrid(result) -text "-"
}
}
}
# EditGrid_format --
#
# This command is called whenever the background of the grid
# needs to be reformatted. The x1, y1, x2, y2 sprcifies the four
# corners of the area that needs to be reformatted.
#
proc EditGrid_format {w area x1 y1 x2 y2} {
global editgrid
set bg(s-margin) gray65
set bg(x-margin) gray65
set bg(y-margin) gray65
set bg(main) gray20
case $area {
main {
foreach col {2 4} {
$w format border $col 1 $col $editgrid(bot) \
-relief flat -filled 1 -yon 1 -yoff 1\
-bd 0 -bg #b0b0f0 -selectbackground #a0b0ff
$w format border $col 2 $col $editgrid(bot) \
-relief flat -filled 1 -yon 1 -yoff 1\
-bd 0 -bg #80b080 -selectbackground #80b0ff
}
$w format grid $x1 $y1 $x2 $y2 \
-relief raised -bd 1 -bordercolor $bg($area) -filled 0 -bg red\
-xon 1 -yon 1 -xoff 0 -yoff 0 -anchor se
}
y-margin {
$w format border $x1 $y1 $x2 $y2 \
-fill 1 -relief raised -bd 1 -bg $bg($area) \
-selectbackground gray80
}
default {
$w format border $x1 $y1 $x2 $y2 \
-filled 1 \
-relief raised -bd 1 -bg $bg($area) \
-selectbackground gray80
}
}
# case $area {
# {main y-margin} {
# set y [expr $editgrid(bot) + 1]
# $w format border 0 $y 100 $y -bg black -filled 1 -bd 0
# }
# }
}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,98 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: FileDlg.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixFileSelectDialog widget --
# This is a neat file selection dialog that looks like the Motif
# file-selection dialog widget. I know that Motif sucks, but
# tixFileSelectDialog looks neat nevertheless.
#
proc RunSample {w} {
# Create an entry for the user to input a filename. If he can't
# bother to type in the name, he can press the "Browse ..." button
# and call up the file dialog
#
frame $w.top -border 1 -relief raised
tixLabelEntry $w.top.ent -label "Select A File:" -labelside top \
-options {
entry.width 25
entry.textVariable demo_fdlg_filename
label.anchor w
}
bind [$w.top.ent subwidget entry] <Return> "fdlg:okcmd $w"
uplevel #0 set demo_fdlg_filename {}
button $w.top.btn -text "Browse ..." -command "fdlg:browse"
pack $w.top.ent -side left -expand yes -fill x -anchor s -padx 4 -pady 4
pack $w.top.btn -side left -anchor s -padx 4 -pady 4
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "fdlg:okcmd $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
}
# Pop up a file selection dialog
#
proc fdlg:browse {} {
# [Hint]
# The best way to use an FileSelectDialog is not to create one yourself
# but to call the command "tix filedialog". This command creates one file
# dialog box that is shared by different parts of the application.
# This way, your application can save resources because it doesn't
# need to create a lot of file dialog boxes even if it needs to input
# file names at a lot of different occasions.
#
set dialog [tix filedialog tixFileSelectDialog]
$dialog config -command fdlg:select_file
$dialog popup
}
proc fdlg:select_file {file} {
global demo_fdlg_filename
set demo_fdlg_filename $file
}
proc fdlg:okcmd {w} {
global demo_fdlg_filename
if {$demo_fdlg_filename != {}} {
tixDemo:Status "You have selected the file $demo_fdlg_filename"
} else {
tixDemo:Status "You haven't selected any file"
}
destroy $w
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,81 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: FileEnt.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixFileEntry widget -- an
# easy of letting the user select a filename
#
proc RunSample {w} {
# Create the tixFileEntry's on the top of the dialog box
#
frame $w.top -border 1 -relief raised
global demo_fent_from demo_fent_to
tixFileEntry $w.top.a -label "Move File From: " \
-variable demo_fent_from \
-options {
entry.width 25
label.width 16
label.underline 10
label.anchor e
}
tixFileEntry $w.top.b -label "To: " \
-variable demo_fent_to \
-options {
entry.width 25
label.underline 0
label.width 16
label.anchor e
}
pack $w.top.a $w.top.b -side top -anchor w -pady 3
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "fent:okcmd $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
# Let's set some nice bindings for keyboard accelerators
#
bind $w <Alt-f> "focus $w.top.a"
bind $w <Alt-t> "focus $w.top.b"
bind $w <Alt-o> "[$w.box subwidget ok] invoke; break"
bind $w <Alt-c> "[$w.box subwidget cancel] invoke; break"
}
proc fent:okcmd {w} {
global demo_fent_from demo_fent_to
# tixDemo:Status "You wanted to move file from $demo_fent_from to $demo_fent_to"
destroy $w
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,159 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: HList1.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixHList widget -- you can
# use to display data in a tree structure. For example, your family tree
#
#
proc RunSample {w} {
# Create the tixHList and the tixLabelEntry widgets on the on the top
# of the dialog box
#
# [Hint] We create the tixHList and and the scrollbar by ourself,
# but it is more convenient to use the tixScrolledHlist widget
# which does all the chores for us.
#
# [Hint] Use of the -browsecmd and -command options:
# We want to set the tixLabelEntry accordingly whenever the user
# single-clicks on an entry in the HList box. Also, when the user
# double-clicks, we want to print out the selection and close
# the dialog box
#
frame $w.top -border 1 -relief raised
tixHList $w.top.h -yscrollcommand "$w.top.s set" -separator / \
-browsecmd "hlist1:browse $w.top.h" \
-command "hlist1:activate $w.top.h"\
-wideselection false \
-indent 15
scrollbar $w.top.s -command "$w.top.h yview" -takefocus 0
# Some icons for our list entries
#
global folder1 folder2
set img1 [image create bitmap -data $folder1]
set img2 [image create bitmap -data $folder2]
# Put our directories into the HList entry
#
set h $w.top.h
set dirs {
/
/lib
/pkg
/usr
/usr/lib
/usr/local
/usr/local/lib
/pkg/lib
}
foreach d $dirs {
$h add $d -itemtype imagetext -text $d -image $img2 -data $d
# We only want the user to select the directories that
# ends by "lib"
if {![string match "*lib" $d]} {
$h entryconfig $d -state disabled -image $img1
}
}
# We use a LabelEntry to hold the installation directory. The user
# can choose from the DirList widget, or he can type in the directory
# manually
#
tixLabelEntry $w.top.e -label "Installation Directory:" -labelside top \
-options {
entry.width 25
entry.textVariable demo_hlist_dir
label.anchor w
}
bind [$w.top.e subwidget entry] <Return> "hlist:okcmd $w"
# Set the default value
#
uplevel #0 set demo_hlist_dir /usr/local/lib
$h anchor set /usr/local/lib
$h select set /usr/local/lib
pack $w.top.h -side left -expand yes -fill both -padx 2 -pady 2
pack $w.top.s -side left -fill y -pady 2
pack $w.top.e -side left -expand yes -fill x -anchor s -padx 4 -pady 2
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "hlist:okcmd $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
}
# In an actual program, you may want to tell the user how much space he has
# left in this directory
#
#
proc hlist1:browse {w dir} {
global demo_hlist_dir
set demo_hlist_dir [$w entrycget $dir -data]
}
# In an actual program, you will install your favorit application
# in the selected directory
#
proc hlist1:activate {w dir} {
global demo_hlist_dir
set demo_hlist_dir [$w entrycget $dir -data]
tixDemo:Status "You have selected the directory $demo_hlist_dir"
destroy [winfo toplevel $w]
}
proc hlist:okcmd {w} {
global demo_hlist_dir
tixDemo:Status "You have selected the directory $demo_hlist_dir"
destroy $w
}
set folder1 {
#define foo_width 16
#define foo_height 12
static unsigned char foo_bits[] = {
0x00, 0x00, 0x00, 0x3e, 0xfe, 0x41, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40,
0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0xfe, 0x7f, 0x00, 0x00};}
set folder2 {
#define foo_width 16
#define foo_height 12
static unsigned char foo_bits[] = {
0x00, 0x00, 0x00, 0x00, 0xfe, 0x7f, 0x02, 0x40, 0x02, 0x44, 0xf2, 0x4f,
0xf2, 0x5f, 0xf2, 0x4f, 0x02, 0x44, 0x02, 0x40, 0xfe, 0x7f, 0x00, 0x00};
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,94 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: LabEntry.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixLabelEntry widget -- an entry that
# come with a label at its side, so you don't need to create
# extra frames on your own and do the messy hierarchical packing. This
# example is adapted from the tixControl example, except now you don't
# have arrow buttons to adjust the values for you ...
#
proc RunSample {w} {
# Create the tixLabelEntrys on the top of the dialog box
#
frame $w.top -border 1 -relief raised
# $w.top.a allows only integer values
#
# [Hint] The -options switch sets the options of the subwidgets.
# [Hint] We set the label.width subwidget option of the Controls to
# be 16 so that their labels appear to be aligned.
#
global lent_demo_maker lent_demo_thrust lent_demo_num_engins
set lent_demo_maker P&W
set lent_demo_thrust 20000.0
set lent_demo_num_engins 2
tixLabelEntry $w.top.a -label "Number of Engines: " \
-options {
entry.width 10
label.width 20
label.anchor e
entry.textVariable lent_demo_num_engins
}
tixLabelEntry $w.top.b -label "Thrust: "\
-options {
entry.width 10
label.width 20
label.anchor e
entry.textVariable lent_demo_thrust
}
tixLabelEntry $w.top.c -label "Engin Maker: " \
-options {
entry.width 10
label.width 20
label.anchor e
entry.textVariable lent_demo_maker
}
pack $w.top.a $w.top.b $w.top.c -side top -anchor w
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "labe:okcmd $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
}
proc labe:okcmd {w} {
global lent_demo_maker lent_demo_thrust lent_demo_num_engins
tixDemo:Status "You selected $lent_demo_num_engins engin(s) of thrust $lent_demo_thrust made \
by $lent_demo_maker"
destroy $w
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,85 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: LabFrame.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixLabelFrame widget -- a frame that
# come with a label at its side. It looks nifty when you use the set the
# -labelside option to "acrosstop". Note that a lot of Tix widgets, such
# as tixComboBox or tixControl, have the -labelside and -label options. So
# you can use these options to achieve the same effect as in this file
#
proc RunSample {w} {
# Create the radiobuttons at the top of the dialog box, put them
# inside two tixLabelFrames:
#
frame $w.top -border 1 -relief raised
tixLabelFrame $w.top.a -label Font: -labelside acrosstop -options {
label.padX 5
}
tixLabelFrame $w.top.b -label Size: -labelside acrosstop -options {
label.padX 5
}
pack $w.top.a $w.top.b -side left -expand yes -fill both
# Create the radiobuttons inside the left frame.
#
# [Hint] You *must* create the new widgets inside the "frame"
# subwidget, *not* as immediate children of $w.top.a!
#
set f [$w.top.a subwidget frame]
foreach color {Red Green Blue Yellow Orange Purple} {
set lower [string tolower $color]
radiobutton $f.$lower -text $color -variable demo_color \
-relief flat -value $lower -bd 2 -pady 0 -width 7 -anchor w
pack $f.$lower -side top -pady 0 -anchor w -padx 6
}
# Create the radiobuttons inside the right frame.
#
set f [$w.top.b subwidget frame]
foreach point {8 10 12 14 18 24} {
set lower [string tolower $point]
radiobutton $f.$lower -text $point -variable demo_point \
-relief flat -value $lower -bd 2 -pady 0 -width 4 -anchor w
pack $f.$lower -side top -pady 0 -anchor w -padx 8
}
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "labf:okcmd $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
}
proc labf:okcmd {w} {
destroy $w
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,86 @@
#
# $Id: ListNBK.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This program demonstrates the ListBoteBook widget, which is very similar
# to a NoteBook widget but uses an HList instead of page tabs to list the
# pages.
proc RunSample {w} {
set top [frame $w.f -bd 1 -relief raised]
set box [tixButtonBox $w.b -bd 1 -relief raised]
pack $box -side bottom -fill both
pack $top -side top -fill both -expand yes
#----------------------------------------------------------------------
# Create the ListNoteBook with nice icons
#----------------------------------------------------------------------
tixListNoteBook $top.n -ipadx 6 -ipady 6
set img0 [tix getimage harddisk]
set img1 [tix getimage network]
$top.n subwidget hlist add hard_disk -itemtype imagetext \
-image $img0 -text "Hard Disk" -under 0
$top.n subwidget hlist add network -itemtype imagetext \
-image $img1 -text "Network" -under 0
$top.n add hard_disk
$top.n add network
#
# Create the widgets inside the two pages
# We use these options to set the sizes of the subwidgets inside the
# notebook, so that they are well-aligned on the screen.
#
set name [tixOptionName $w]
option add *$name*TixControl*entry.width 10
option add *$name*TixControl*label.width 18
option add *$name*TixControl*label.anchor e
set f [$top.n subwidget hard_disk]
tixControl $f.a -value 12 -label "Access Time: "
tixControl $f.w -value 400 -label "Write Throughput: "
tixControl $f.r -value 400 -label "Read Throughput: "
tixControl $f.c -value 1021 -label "Capacity: "
pack $f.a $f.w $f.r $f.c -side top -padx 20 -pady 2
set f [$top.n subwidget network]
tixControl $f.a -value 12 -label "Access Time: "
tixControl $f.w -value 400 -label "Write Throughput: "
tixControl $f.r -value 400 -label "Read Throughput: "
tixControl $f.c -value 1021 -label "Capacity: "
tixControl $f.u -value 10 -label "Users: "
pack $f.a $f.w $f.r $f.c $f.u -side top -padx 20 -pady 2
pack $top.n -expand yes -fill both -padx 5 -pady 5
# Create the buttons
#
$box add ok -text Ok -command "destroy $w" -width 6
$box add cancel -text Cancel -command "destroy $w" -width 6
}
#----------------------------------------------------------------------
# Start-up code
#----------------------------------------------------------------------
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,77 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: Meter.tcl,v 1.4 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This program demonstrates the use of the tixMeter widget -- it is
# used to display the progress of a background job
#
proc RunSample {w} {
set top [frame $w.f -bd 1 -relief raised]
set box [tixButtonBox $w.b -bd 1 -relief raised]
pack $box -side bottom -fill both
pack $top -side top -fill both -expand yes
# Create the Meter and the Label
#
label $top.lab -text "Work in progress ...."
tixMeter $top.met -value 0 -text 0%
pack $top.lab -side top -padx 50 -pady 10 -anchor c
pack $top.met -side top -padx 50 -pady 10 -anchor c
# Create the buttons
#
$box add cancel -text Cancel -command "destroy $w" \
-width 6 -under 0
$box add restart -text Restart -width 6 -under 0
$box subwidget restart config -command \
"Meter:Start $top.met [$box subwidget cancel] [$box subwidget restart]"
$box subwidget restart invoke
}
proc Meter:Start {meter cancel restart} {
$restart config -state disabled
$cancel config -text Cancel
after 40 Meter:BackgroundJob $meter 0 $cancel $restart
}
proc Meter:BackgroundJob {meter progress cancel restart} {
if ![winfo exists $meter] {
# the window has already been destroyed
#
return
}
set progress [expr $progress + 0.02]
set text [expr int($progress*100.0)]%
$meter config -value $progress -text $text
if {$progress < 1.0} {
after 40 Meter:BackgroundJob $meter $progress $cancel $restart
} else {
$cancel config -text OK -under 0
$restart config -state normal
}
}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> {if {"%W" == ".demo"} exit}
}

View File

@@ -0,0 +1,102 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: NoteBook.tcl,v 1.4 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixNoteBook widget, which allows
# you to lay out your interface using a "notebook" metaphore
#
proc RunSample {w} {
# We use these options to set the sizes of the subwidgets inside the
# notebook, so that they are well-aligned on the screen.
#
set name [tixOptionName $w]
option add *$name*TixControl*entry.width 10
option add *$name*TixControl*label.width 18
option add *$name*TixControl*label.anchor e
# Create the notebook widget and set its backpagecolor to gray.
# Note that the -backpagecolor option belongs to the "nbframe"
# subwidget.
tixNoteBook $w.nb -ipadx 6 -ipady 6
# $w config -bg gray
# $w.nb subwidget nbframe config -backpagecolor gray
# Create the two tabs on the notebook. The -underline option
# puts a underline on the first character of the labels of the tabs.
# Keyboard accelerators will be defined automatically according
# to the underlined character.
#
$w.nb add hard_disk -label "Hard Disk" -underline 0
$w.nb add network -label "Network" -underline 0
pack $w.nb -expand yes -fill both -padx 5 -pady 5 -side top
#----------------------------------------
# Create the first page
#----------------------------------------
set f [$w.nb subwidget hard_disk]
# Create two frames: one for the common buttons, one for the
# other widgets
#
frame $f.f
frame $f.common
pack $f.f -side left -padx 2 -pady 2 -fill both -expand yes
pack $f.common -side right -padx 2 -pady 2 -fill y
# Create the controls that only belong to this page
#
tixControl $f.f.a -value 12 -label "Access Time: "
tixControl $f.f.w -value 400 -label "Write Throughput: "
tixControl $f.f.r -value 400 -label "Read Throughput: "
tixControl $f.f.c -value 1021 -label "Capacity: "
pack $f.f.a $f.f.w $f.f.r $f.f.c -side top -padx 20 -pady 2
# Create the common buttons
#
CreateCommonButtons $w $f.common
#----------------------------------------
# Create the second page
#----------------------------------------
set f [$w.nb subwidget network]
frame $f.f
frame $f.common
pack $f.f -side left -padx 2 -pady 2 -fill both -expand yes
pack $f.common -side right -padx 2 -pady 2 -fill y
tixControl $f.f.a -value 12 -label "Access Time: "
tixControl $f.f.w -value 400 -label "Write Throughput: "
tixControl $f.f.r -value 400 -label "Read Throughput: "
tixControl $f.f.c -value 1021 -label "Capacity: "
tixControl $f.f.u -value 10 -label "Users: "
pack $f.f.a $f.f.w $f.f.r $f.f.c $f.f.u -side top -padx 20 -pady 2
CreateCommonButtons $w $f.common
}
proc CreateCommonButtons {w f} {
button $f.ok -text OK -width 6 -command "destroy $w"
button $f.cancel -text Cancel -width 6 -command "destroy $w"
pack $f.ok $f.cancel -side top -padx 2 -pady 2
}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> {if {"%W" == ".demo"} exit}
}

View File

@@ -0,0 +1,103 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: OptMenu.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixOptionMenu widget -- you can
# use it for the user to choose from a fixed set of options
#
set opt_options {text formatted post html tex rtf}
set opt_labels(text) "Plain Text"
set opt_labels(formatted) "Formatted Text"
set opt_labels(post) "PostScript"
set opt_labels(html) "HTML"
set opt_labels(tex) "LaTeX"
set opt_labels(rtf) "Rich Text Format"
proc RunSample {w} {
catch {uplevel #0 unset demo_opt_from}
catch {uplevel #0 unset demo_opt_to }
# Create the tixOptionMenu's on the top of the dialog box
#
frame $w.top -border 1 -relief raised
tixOptionMenu $w.top.from -label "From File Format : " \
-variable demo_opt_from \
-options {
label.width 19
label.anchor e
menubutton.width 15
}
tixOptionMenu $w.top.to -label "To File Format : " \
-variable demo_opt_to \
-options {
label.width 19
label.anchor e
menubutton.width 15
}
# Add the available options to the two OptionMenu widgets
#
# [Hint] You have to add the options first before you set the
# global variables "demo_opt_from" and "demo_opt_to". Otherwise
# the OptionMenu widget will complain about "unknown options"!
#
global opt_options opt_labels
foreach opt $opt_options {
$w.top.from add command $opt -label $opt_labels($opt)
$w.top.to add command $opt -label $opt_labels($opt)
}
uplevel #0 set demo_opt_from html
uplevel #0 set demo_opt_to post
pack $w.top.from $w.top.to -side top -anchor w -pady 3 -padx 6
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "opt:okcmd $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
# Let's set some nice bindings for keyboard accelerators
#
bind $w <Alt-f> "focus $w.top.from"
bind $w <Alt-t> "focus $w.top.to"
bind $w <Alt-o> "[$w.box subwidget ok] invoke; break"
bind $w <Alt-c> "[$w.box subwidget cancel] invoke; break"
}
proc opt:okcmd {w} {
global demo_opt_from demo_opt_to opt_labels
tixDemo:Status "You wanted to convert file from $opt_labels($demo_opt_from) to $opt_labels($demo_opt_to)"
destroy $w
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> {if {"%W" == ".demo"} exit}
}

View File

@@ -0,0 +1,112 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: PanedWin.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixPanedWindow widget. This program
# is a dummy news reader: the user can adjust the sizes of the list
# of artical names and the size of the text widget that shows the body
# of the article
#
proc RunSample {w} {
# We create the frame at the top of the dialog box
#
frame $w.top -relief raised -bd 1
# Use a LabelEntry widget to show the name of the newsgroup
# [Hint] We disable the entry widget so that the user can't
# mess up with the name of the newsgroup
#
tixLabelEntry $w.top.name -label "Newsgroup: " -options {
entry.width 25
}
$w.top.name subwidget entry insert 0 "comp.lang.tcl"
$w.top.name subwidget entry config -state disabled
pack $w.top.name -side top -anchor c -fill x -padx 14 -pady 6
# Now use a PanedWindow to contain the list and text widgets
#
tixPanedWindow $w.top.pane -paneborderwidth 0
pack $w.top.pane -side top -expand yes -fill both -padx 10 -pady 10
set p1 [$w.top.pane add list -min 70 -size 100]
set p2 [$w.top.pane add text -min 70]
tixScrolledListBox $p1.list
$p1.list subwidget listbox config -font [tix option get fixed_font]
tixScrolledText $p2.text
$p2.text subwidget text config -font [tix option get fixed_font]
pack $p1.list -expand yes -fill both -padx 4 -pady 6
pack $p2.text -expand yes -fill both -padx 4 -pady 6
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "destroy $w" \
-width 8
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 8
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
# Put the junk inside the listbox and the tetx widget
#
$p1.list subwidget listbox insert end \
" 12324 Re: TK is good for your health" \
"+ 12325 Re: TK is good for your health" \
"+ 12326 Re: Tix is even better for your health (Was: TK is good...)" \
" 12327 Re: Tix is even better for your health (Was: TK is good...)" \
"+ 12328 Re: Tix is even better for your health (Was: TK is good...)" \
" 12329 Re: Tix is even better for your health (Was: TK is good...)" \
"+ 12330 Re: Tix is even better for your health (Was: TK is good...)"
$p2.text subwidget text config -wrap none -bg \
[$p1.list subwidget listbox cget -bg]
$p2.text subwidget text insert end {
Mon, 19 Jun 1995 11:39:52 comp.lang.tcl Thread 34 of 220
Lines 353 A new way to put text and bitmaps together iNo responses
ioi@blue.seas.upenn.edu Ioi K. Lam at University of Pennsylvania
Hi,
I have implemented a new image type called "compound". It allows you
to glue together a bunch of bitmaps, images and text strings together
to form a bigger image. Then you can use this image with widgets that
support the -image option. This way you can display very fancy stuffs
in your GUI. For example, you can display a text string string
together with a bitmap, at the same time, inside a TK button widget. A
screenshot of compound images can be found at the bottom of this page:
http://www.cis.upenn.edu/~ioi/tix/screenshot.html
You can also you is in other places such as putting fancy bitmap+text
in menus, tabs of tixNoteBook widgets, etc. This feature will be
included in the next release of Tix (4.0b1). Count on it to make jazzy
interfaces!}
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> {if {"%W" == ".demo"} exit}
}

View File

@@ -0,0 +1,73 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: PopMenu.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixPopupMenu widget.
#
proc RunSample {w} {
# We create the frame and the button, then we'll bind the PopupMenu
# to both widgets. The result is, when you press the right mouse
# button over $w.top or $w.top.but, the PopupMenu will come up.
#
frame $w.top -relief raised -bd 1
button $w.top.but -text {Press the right mouse button over
this button or its surrounding area}
pack $w.top.but -expand yes -fill both -padx 50 -pady 50
tixPopupMenu $w.top.p -title "Popup Test"
$w.top.p bind $w.top
$w.top.p bind $w.top.but
# Set the entries inside the PopupMenu widget.
# [Hint] You have to manipulate the "menu" subwidget.
# $w.top.p itself is NOT a menu widget.
# [Hint] Watch carefully how the sub-menu is created
#
set menu [$w.top.p subwidget menu]
$menu add command -label Desktop -under 0
$menu add command -label Select -under 0
$menu add command -label Find -under 0
$menu add command -label System -under 1
$menu add command -label Help -under 0
$menu add cascade -label More -menu $menu.m1
menu $menu.m1
$menu.m1 add command -label Hello
pack $w.top.but -side top -padx 40 -pady 50
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "destroy $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> {if {"%W" == ".demo"} exit}
}

View File

@@ -0,0 +1,135 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: SGrid0.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# A very simple demonstration of the tixGrid widget
#
proc RunSample {w} {
wm title $w "The First Grid Example"
wm geometry $w 480x300
set top [frame $w.f -bd 1 -relief raised]
set box [tixButtonBox $w.b -bd 1 -relief raised]
pack $box -side bottom -fill both
pack $top -side top -fill both -expand yes
label $top.lab -text "This widget is still under alpha
Please ignore the debug messages
Not all features have been implemented" -justify left
pack $top.lab -side top -anchor c -padx 3 -pady 3
MakeGrid $top
# Create the buttons
#
$box add ok -text Ok -command "destroy $w" -width 6
$box add cancel -text Cancel -command "destroy $w" -width 6
}
# This command is called whenever the background of the grid needs to
# be reformatted. The x1, y1, x2, y2 specifies the four corners of the area
# that needs to be reformatted.
#
# area:
# x-margin: the horizontal margin
# y-margin: the vertical margin
# s-margin: the overlap area of the x- and y-margins
# main: The rest
#
proc SimpleFormat {w area x1 y1 x2 y2} {
global margin
set bg(s-margin) gray65
set bg(x-margin) gray65
set bg(y-margin) gray65
set bg(main) gray20
case $area {
main {
# The "grid" format is consecutive boxes without 3d borders
#
$w format grid $x1 $y1 $x2 $y2 \
-relief raised -bd 1 -bordercolor $bg($area) -filled 0 -bg red\
-xon 1 -yon 1 -xoff 0 -yoff 0 -anchor se
}
{x-margin y-margin s-margin} {
# border specifies consecutive 3d borders
#
$w format border $x1 $y1 $x2 $y2 \
-fill 1 -relief raised -bd 1 -bg $bg($area) \
-selectbackground gray80
}
}
}
# Print a number in $ format
#
#
proc Dollar {s} {
set n [string len $s]
set start [expr $n % 3]
if {$start == 0} {
set start 3
}
set str ""
for {set i 0} {$i < $n} {incr i} {
if {$start == 0} {
append str ","
set start 3
}
incr start -1
append str [string index $s $i]
}
return $str
}
proc MakeGrid {w} {
# Create the grid
#
tixScrolledGrid $w.g -bd 0
pack $w.g -expand yes -fill both -padx 3 -pady 3
set grid [$w.g subwidget grid]
$grid config -formatcmd "SimpleFormat $grid"
# Set the size of the columns
#
$grid size col 0 -size 10char
$grid size col 1 -size auto
$grid size col 2 -size auto
$grid size col 3 -size auto
$grid size col 4 -size auto
# set the default size of the column and rows. these sizes will be used
# if the size of a row or column has not be set via the "size col ?"
# command
$grid size col default -size 5char
$grid size row default -size 1.1char -pad0 3
for {set x 0} {$x < 10} {incr x} {
for {set y 0} {$y < 10} {incr y} {
$grid set $x $y -itemtype text -text ($x,$y)
}
}
}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,215 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: SGrid1.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# Demonstrates the tixGrid widget
#
proc RunSample {w} {
wm title $w "Doe Inc. Performance"
wm geometry $w 640x300
set top [frame $w.f -bd 1 -relief raised]
set box [tixButtonBox $w.b -bd 1 -relief raised]
pack $box -side bottom -fill both
pack $top -side top -fill both -expand yes
label $top.lab -text "This widget is still under alpha
Please ignore the debug messages
Not all features have been implemented" -justify left
pack $top.lab -side top -anchor c -padx 3 -pady 3
MakeGrid $top
# Create the buttons
#
$box add ok -text Ok -command "destroy $w" -width 6
$box add cancel -text Cancel -command "destroy $w" -width 6
}
# This command is called whenever the background of the grid needs to
# be reformatted. The x1, y1, x2, y2 sprcifies the four corners of the area
# that needs to be reformatted.
#
proc gformat {w area x1 y1 x2 y2} {
set bg(s-margin) gray65
set bg(x-margin) gray65
set bg(y-margin) gray65
set bg(main) gray20
case $area {
main {
for {set y [expr ($y1/2) * 2]} {$y <= $y2} {incr y 2} {
$w format border $x1 $y $x2 $y \
-relief flat -filled 1\
-bd 0 -bg #80b080 -selectbackground #80b0ff
}
$w format grid $x1 $y1 $x2 $y2 \
-relief raised -bd 1 -bordercolor $bg($area) -filled 0 -bg red\
-xon 1 -yon 1 -xoff 0 -yoff 0 -anchor se
}
y-margin {
$w format border $x1 $y1 $x2 $y2 \
-fill 1 -relief raised -bd 1 -bg $bg($area) \
-selectbackground gray80
}
default {
$w format border $x1 $y1 $x2 $y2 \
-filled 1 \
-relief raised -bd 1 -bg $bg($area) \
-selectbackground gray80
}
}
}
# Print a number in $ format
#
#
proc Dollar {s} {
set n [string len $s]
set start [expr $n % 3]
if {$start == 0} {
set start 3
}
set str ""
for {set i 0} {$i < $n} {incr i} {
if {$start == 0} {
append str ","
set start 3
}
incr start -1
append str [string index $s $i]
}
return $str
}
proc MakeGrid {w} {
# data format {year revenue profit}
#
set data {
{1970 1000000000 1000000}
{1971 1100000000 2000000}
{1972 1200000000 3000000}
{1973 1300000000 4000000}
{1974 1400000000 5000000}
{1975 1500000000 6000000}
{1976 1600000000 7000000}
{1977 1700000000 8000000}
{1978 1800000000 9000000}
{1979 1900000000 10000000}
{1980 2000000000 11000000}
{1981 2100000000 22000000}
{1982 2200000000 33000000}
{1983 2300000000 44000000}
{1984 2400000000 55000000}
{1985 3500000000 36000000}
{1986 4600000000 57000000}
{1987 5700000000 68000000}
{1988 6800000000 79000000}
{1989 7900000000 90000000}
{1990 13000000000 111000000}
{1991 14100000000 122000000}
{1992 16200000000 233000000}
{1993 28300000000 344000000}
{1994 29400000000 455000000}
{1995 38500000000 536000000}
}
set headers {
"Revenue ($)"
"Rev. Growth (%)"
"Profit ($)"
"Profit Growth (%)"
}
# Create the grid
#
tixScrolledGrid $w.g -bd 0
pack $w.g -expand yes -fill both -padx 3 -pady 3
set grid [$w.g subwidget grid]
$grid config -formatcmd "gformat $grid"
# Set the size of the columns
#
$grid size col 0 -size 10char
$grid size col 1 -size auto
$grid size col 2 -size auto
$grid size col 3 -size auto
$grid size col 4 -size auto
# set the default size of the column and rows. these sizes will be used
# if the size of a row or column has not be set via the "size col ?"
# command
$grid size col default -size 5char
$grid size row default -size 1.1char -pad0 3
set margin [tixDisplayStyle text -refwindow $grid \
-anchor c -padx 3 -font [tix option get bold_font]]
set dollar [tixDisplayStyle text -refwindow $grid \
-anchor e]
# Create the headers
#
set x 1
foreach h $headers {
$grid set $x 0 -itemtype text -text $h -style $margin
incr x
}
# Insert the data, year by year
#
set lastRevn {}
set lastProf {}
set i 1
foreach line $data {
set year [lindex $line 0]
set revn [lindex $line 1]
set prof [lindex $line 2]
if {$lastRevn != {}} {
set rgrowth \
[format %4.2f [expr ($revn.0-$lastRevn)/$lastRevn*100.0]]
} else {
set rgrowth "-"
}
if {$lastProf != {}} {
set pgrowth \
[format %4.2f [expr ($prof.0-$lastProf)/$lastProf*100.0]]
} else {
set pgrowth "-"
}
$grid set 0 $i -itemtype text -style $margin -text $year
$grid set 1 $i -itemtype text -style $dollar -text [Dollar $revn]
$grid set 2 $i -itemtype text -style $dollar -text $rgrowth
$grid set 3 $i -itemtype text -style $dollar -text [Dollar $prof]
$grid set 4 $i -itemtype text -style $dollar -text $pgrowth
set lastRevn $revn.0
set lastProf $prof.0
incr i
}
}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,111 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: SHList.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixScrolledHList widget.
#
proc RunSample {w} {
# We create the frame and the ScrolledHList widget
# at the top of the dialog box
#
frame $w.top -relief raised -bd 1
# Put a simple hierachy into the HList (two levels). Use colors and
# separator widgets (frames) to make the list look fancy
#
tixScrolledHList $w.top.a
pack $w.top.a -expand yes -fill both -padx 10 -pady 10 -side left
# This is our little relational database
#
set bosses {
{jeff "Jeff Waxman"}
{john "John Lee"}
{peter "Peter Kenson"}
}
set employees {
{alex john "Alex Kellman"}
{alan john "Alan Adams"}
{andy peter "Andreas Crawford"}
{doug jeff "Douglas Bloom"}
{jon peter "Jon Baraki"}
{chris jeff "Chris Geoffrey"}
{chuck jeff "Chuck McLean"}
}
set hlist [$w.top.a subwidget hlist]
# Let configure the appearance of the HList subwidget
#
$hlist config -separator "." -width 25 -drawbranch 0 -indent 10
set index 0
foreach line $bosses {
if {$index != 0} {
frame $hlist.sep$index -bd 2 -height 2 -width 150 -relief sunken \
-bg [$hlist cget -bg]
$hlist addchild {} -itemtype window \
-window $hlist.sep$index -state disabled
}
$hlist add [lindex $line 0] -itemtype text \
-text [lindex $line 1]
incr index
}
foreach line $employees {
# "." is the separator character we chose above
#
set entrypath [lindex $line 1].[lindex $line 0]
# ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
# parent entryPath / child's name
$hlist add $entrypath -text [lindex $line 2]
# [Hint] Make sure the [lindex $line 1].[lindex $line 0] you choose
# are unique names. If you cannot be sure of this (because of
# the structure of your database, e.g.) you can use the
# "addchild" widget command instead:
#
# $hlist addchild [lindex $line 1] -text [lindex $line 2]
# ^^^^^^^^^^^^^^^^
# parent entryPath
}
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "destroy $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind .demo <Destroy> exit
}

View File

@@ -0,0 +1,159 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: SHList2.tcl,v 1.4 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates how to use multiple columns and multiple styles
# in the tixHList widget
#
# In a tixHList widget, you can have one ore more columns.
#
proc RunSample {w} {
# We create the frame and the ScrolledHList widget
# at the top of the dialog box
#
frame $w.top -relief raised -bd 1
# Put a simple hierachy into the HList (two levels). Use colors and
# separator widgets (frames) to make the list look fancy
#
tixScrolledHList $w.top.a -options {
hlist.columns 3
hlist.header true
}
pack $w.top.a -expand yes -fill both -padx 10 -pady 10 -side left
set hlist [$w.top.a subwidget hlist]
# Create the title for the HList widget
# >> Notice that we have set the hlist.header subwidget option to true
# so that the header is displayed
#
# First some styles for the headers
set style(header) [tixDisplayStyle text -refwindow $hlist \
-fg black -anchor c \
-padx 8 -pady 2\
-font [tix option get bold_font ]]
$hlist header create 0 -itemtype text -text Name \
-style $style(header)
$hlist header create 1 -itemtype text -text Position \
-style $style(header)
# Notice that we use 3 columns in the hlist widget. This way when the user
# expands the windows wide, the right side of the header doesn't look
# chopped off. The following line ensures that the 3 column header is
# not shown unless the hlist window is wider than its contents.
#
$hlist column width 2 0
# This is our little relational database
#
set boss {doe "John Doe" Director}
set managers {
{jeff "Jeff Waxman" Manager}
{john "John Lee" Manager}
{peter "Peter Kenson" Manager}
}
set employees {
{alex john "Alex Kellman" Clerk}
{alan john "Alan Adams" Clerk}
{andy peter "Andreas Crawford" Salesman}
{doug jeff "Douglas Bloom" Clerk}
{jon peter "Jon Baraki" Salesman}
{chris jeff "Chris Geoffrey" Clerk}
{chuck jeff "Chuck McLean" Cleaner}
}
set style(mgr_name) [tixDisplayStyle text -refwindow $hlist \
-font [tix option get bold_font ]]
set style(mgr_posn) [tixDisplayStyle text -refwindow $hlist \
-padx 8]
set style(empl_name) [tixDisplayStyle text -refwindow $hlist \
-font [tix option get bold_font ]]
set style(empl_posn) [tixDisplayStyle text -refwindow $hlist \
-padx 8 ]
# Let configure the appearance of the HList subwidget
#
$hlist config -separator "." -width 25 -drawbranch 0 -indent 10
$hlist column width 0 -char 20
# Create the boss
#
$hlist add . -itemtype text -text [lindex $boss 1] \
-style $style(mgr_name)
$hlist item create . 1 -itemtype text -text [lindex $boss 2] \
-style $style(mgr_posn)
# Create the managers
#
set index 0
foreach line $managers {
set row [$hlist add .[lindex $line 0] -itemtype text \
-text [lindex $line 1] -style $style(mgr_name)]
$hlist item create $row 1 -itemtype text -text [lindex $line 2] \
-style $style(mgr_posn)
incr index
}
foreach line $employees {
# "." is the separator character we chose above
#
set entrypath .[lindex $line 1].[lindex $line 0]
# ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
# parent entryPath / child's name
set row [$hlist add $entrypath -text [lindex $line 2] \
-style $style(empl_name)]
$hlist item create $row 1 -itemtype text -text [lindex $line 3] \
-style $style(empl_posn)
# [Hint] Make sure the .[lindex $line 1].[lindex $line 0] you choose
# are unique names. If you cannot be sure of this (because of
# the structure of your database, e.g.) you can use the
# "addchild" widget command instead:
#
# $hlist addchild [lindex $line 1] -text [lindex $line 2]
# ^^^^^^^^^^^^^^^^
# parent entryPath
}
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "destroy $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind .demo <Destroy> exit
}

View File

@@ -0,0 +1,84 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: SListBox.tcl,v 1.4 2008/02/27 22:17:27 hobbs Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixScrolledListBox widget.
#
proc RunSample {w} {
# We create the frame and the two ScrolledListBox widgets
# at the top of the dialog box
#
frame $w.top -relief raised -bd 1
# The first ScrolledListBox widget always shows both scrollbars
#
tixScrolledListBox $w.top.a -scrollbar both
pack $w.top.a -expand yes -fill both -padx 10 -pady 10 -side left
# The second ScrolledListBox widget shows the scrollbars only when
# needed.
#
# [Hint] See how you can use the -options switch to set the options
# for the subwidgets
#
tixScrolledListBox $w.top.b -scrollbar auto -options {
listbox.font 8x13
}
pack $w.top.b -expand yes -fill both -padx 10 -pady 10 -side left
# Put the elements inside the two listboxes: notice that you need
# to insert inside the "listbox" subwidget of the ScrolledListBox.
# $w.top.a itself does NOT have an "insert" command.
#
$w.top.a subwidget listbox insert 0 \
Alabama Alaska Arizona Arkansas California \
Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Illinois \
Indiana Iowa Kansas Kentucky Louisiana Maine Maryland \
Massachusetts Michigan Minnesota Mississippi Missouri \
Montana Nebraska Nevada "New Hampshire" "New Jersey" "New Mexico" \
"New York" "North Carolina" "North Dakota" \
Ohio Oklahoma Oregon Pennsylvania "Rhode Island" \
"South Carolina" "South Dakota" \
Tennessee Texas Utah Vermont Virginia Washington \
"West Virginia" Wisconsin Wyoming
raise [$w.top.a subwidget listbox ]
$w.top.b subwidget listbox insert 0 \
Alabama Alaska Arizona Arkansas California \
Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Illinois \
Indiana Iowa Kansas Kentucky
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "destroy $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,57 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: STList1.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# Demonstrates the scrolled tlist widget
#
proc RunSample {w} {
set top [frame $w.f -bd 1 -relief raised]
set box [tixButtonBox $w.b -bd 1 -relief raised]
pack $box -side bottom -fill both
pack $top -side top -fill both -expand yes
# Create the scrolled tlist
#
tixScrolledTList $top.st -options {
tlist.orient vertical
tlist.selectMode single
}
pack $top.st -expand yes -fill both -padx 10 -pady 10
# Insert a list of numbers into the tlist subwidget
#
set tlist [$top.st subwidget tlist]
set numbers {
one two three fours five six seven eight nine ten eleven
twelve thirdteen fourteen
}
foreach num $numbers {
$tlist insert end -itemtype imagetext -text $num \
-image [tix getimage openfold]
}
# Create the buttons
#
$box add ok -text Ok -command "destroy $w" -width 6
$box add cancel -text Cancel -command "destroy $w" -width 6
}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,85 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: STList2.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# Demonstrates the scrolled tlist widget
#
proc RunSample {w} {
set top [frame $w.f -bd 1 -relief raised]
set box [tixButtonBox $w.b -bd 1 -relief raised]
pack $box -side bottom -fill both
pack $top -side top -fill both -expand yes
# Create the Paned Window to contain two scrolled tlist's
#
set p [tixPanedWindow $top.p -orient horizontal]
pack $p -expand yes -fill both -padx 4 -pady 4
set p1 [$p add pane1 -expand 1]
set p2 [$p add pane2 -expand 1]
$p1 config -relief flat
$p2 config -relief flat
# Create a TList with vertical orientation
#
tixScrolledTList $p1.st -options {
tlist.orient vertical
tlist.selectMode single
}
label $p1.lab -text "Vertical Orientation"
pack $p1.lab -anchor c -side top -pady 2
pack $p1.st -expand yes -fill both -padx 10 -pady 10
# Create a TList with horizontal orientation
#
tixScrolledTList $p2.st -options {
tlist.orient horizontal
tlist.selectMode single
}
label $p2.lab -text "Horizontal Orientation"
pack $p2.lab -anchor c -side top -pady 2
pack $p2.st -expand yes -fill both -padx 10 -pady 10
# Insert a list of numbers into the two tlist subwidget's
#
set vt [$p1.st subwidget tlist]
set ht [$p2.st subwidget tlist]
set numbers {
one two three fours five six seven eight nine ten eleven
twelve thirdteen fourteen
}
foreach num $numbers {
$vt insert end -itemtype imagetext -text $num \
-image [tix getimage openfold]
$ht insert end -itemtype imagetext -text $num \
-image [tix getimage openfold]
}
# Create the buttons
#
$box add ok -text Ok -command "destroy $w" -width 6
$box add cancel -text Cancel -command "destroy $w" -width 6
}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,112 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: STList3.tcl,v 1.4 2004/03/28 02:44:56 hobbs Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# Demonstrates the use of DirTree with the TList
#
proc RunSample {w} {
set top [frame $w.f -bd 1 -relief raised]
set box [tixButtonBox $w.b -bd 1 -relief raised]
pack $box -side bottom -fill both
pack $top -side top -fill both -expand yes
# Create the Paned Window to contain the dirtree and scrolled tlist
#
set p [tixPanedWindow $top.p -orient horizontal]
pack $p -expand yes -fill both -padx 4 -pady 4
set p1 [$p add pane1 -expand 1]
set p2 [$p add pane2 -expand 4]
$p1 config -relief flat
$p2 config -relief flat
# Create a DirTree
#
tixDirTree $p1.dirtree -options {
hlist.width 28
}
pack $p1.dirtree -expand yes -fill both -padx 4 -pady 4
# Create a TList
# NOTE: we set the width of the tlist to 60 characters, since we'll have
# quite a few files to display
#
tixScrolledTList $p2.st -options {
tlist.orient vertical
tlist.selectMode single
tlist.width 60
tlist.height 25
}
pack $p2.st -expand yes -fill both -padx 4 -pady 4
set tlist [$p2.st subwidget tlist]
# setup the callbacks: when the user selects a directory, we'll display
# its content in the tlist widget
$p1.dirtree config \
-browsecmd [list TList:listdir $tlist] \
-command [list TList:listdir $tlist]
# List the directory now
#
TList:listdir $tlist [pwd]
# Create the buttons
#
$box add ok -text Ok -command [list destroy $w] -width 6
$box add cancel -text Cancel -command [list destroy $w] -width 6
}
proc TList:listdir {w dir} {
$w delete 0 end
if {[catch {glob -nocomplain -directory $dir *} entries]} {
# The user has entered an invalid directory
# %% todo: prompt error, go back to last succeed directory
return
}
set files ""
foreach fname [lsort -dictionary $entries] {
if {[file isdirectory $fname]} {
set image [tix getimage folder]
} else {
lappend files [file tail $fname]
continue
}
$w insert end -itemtype imagetext \
-text [file tail $fname] -image $image
}
foreach fname $files {
switch -glob -- $fname {
{*.[ch]} { set image [tix getimage srcfile] }
*.tcl -
*.o { set image [tix getimage file] }
default { set image [tix getimage textfile] }
}
$w insert end -itemtype imagetext -text $fname -image $image
}
}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,75 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: SText.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixScrolledText widget.
#
proc RunSample {w} {
# We create the frame and the ScrolledText widget
# at the top of the dialog box
#
frame $w.top -relief raised -bd 1
# Create a Scrolled Text widget.
#
tixScrolledText $w.top.a
pack $w.top.a -expand yes -fill both -padx 10 -pady 10 -side left
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "destroy $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
# Put the junk inside the text subwidget of the ScrolledText widget
#
$w.top.a subwidget text insert end {
Mon, 19 Jun 1995 11:39:52 comp.lang.tcl Thread 34 of 220
Lines 353 A new way to put text and bitmaps together
ioi@xpi.com Ioi K. Lam at Expert Interface Technologies
Hi,
I have implemented a new image type called "compound". It allows you
to glue together a bunch of bitmaps, images and text strings together
to form a bigger image. Then you can use this image with widgets that
support the -image option. This way you can display very fancy stuffs
in your GUI. For example, you can display a text string string
together with a bitmap, at the same time, inside a TK button widget. A
screenshot of compound images can be found at the bottom of this page:
http://www.xpi.com/tix/screenshot.html
You can also you is in other places such as putting fancy bitmap+text
in menus, tabs of tixNoteBook widgets, etc. This feature will be
included in the next release of Tix (4.0b1). Count on it to make jazzy
interfaces!}
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,89 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: SWindow.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixScrolledWindow widget.
#
proc RunSample {w} {
# We create the frame and the ScrolledWindow widget
# at the top of the dialog box
#
frame $w.top -relief raised -bd 1
# Create a complex window inside the ScrolledWindow widget.
# ScrolledWindow are very convenient: unlink the canvas widget,
# you don't need to specify the scroll-redions for the
# ScrolledWindow. It will automatically adjust itself to fit
# size of the "window" subwidget
#
# [Hint] Be sure you create and pack new widgets inside the
# "window" subwidget and NOT inside $w.top.a itself!
#
tixScrolledWindow $w.top.a
pack $w.top.a -expand yes -fill both -padx 10 -pady 10 -side left
set f [$w.top.a subwidget window]
tixNoteBook $f.nb
pack $f.nb -expand yes -fill both -padx 20 -pady 20
$f.nb add image -label "Image" -underline 0
$f.nb add buttons -label "Buttons" -underline 0
# The first page: an image
#
global demo_dir
set p [$f.nb subwidget image]
set im [image create photo -file $demo_dir/bitmaps/tix.gif]
label $p.lab -image $im
pack $p.lab -padx 20 -pady 20
# The second page: buttons
#
set p [$f.nb subwidget buttons]
button $p.b1 -text "Welcome" -width 8
button $p.b2 -text "to" -width 8
button $p.b3 -text "the" -width 8
button $p.b4 -text "World" -width 8
button $p.b5 -text "of" -width 8
button $p.b6 -text "Tix" -width 8
pack $p.b1 $p.b2 $p.b3 $p.b4 $p.b5 $p.b6 -anchor c -side top
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "destroy $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
wm geometry $w 240x220
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,36 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: Sample.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# REPLACE WITH DESCRIPTION OF THIS DEMO.
#
proc RunSample {w} {
set top [frame $w.f -bd 1 -relief raised]
set box [tixButtonBox $w.b -bd 1 -relief raised]
pack $box -side bottom -fill both
pack $top -side top -fill both -expand yes
# Create the buttons
#
$box add ok -text Ok -command "destroy $w" -width 6
$box add cancel -text Cancel -command "destroy $w" -width 6
}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,114 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: Select.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixSelect widget.
#
proc RunSample {w} {
global demo_dir
# Create the frame on the top of the dialog box with two tixSelect
# widgets inside.
#
frame $w.top
# There can be one and only type of justification for any piece of text.
# So we set -radio to be true. Also, -allowzero is set to false: the user
# cannot select a "none" justification
#
tixSelect $w.top.just -allowzero false -radio true \
-label "Justification: "\
-options {
label.width 15
label.padx 4
label.anchor e
}
# The user can select one or many or none of the font attributes in
# the font Select widget, so we set -radio to false (can select one or
# many) and -allowzero to true (can select none)
#
tixSelect $w.top.font -allowzero true -radio false \
-label "Font: " \
-options {
label.width 15
label.padx 4
label.anchor e
}
pack $w.top.just $w.top.font -side top -expand yes -anchor c \
-padx 4 -pady 4
# Add the choices of available font attributes
#
#
$w.top.font add bold -bitmap @$demo_dir/bitmaps/bold.xbm
$w.top.font add italic -bitmap @$demo_dir/bitmaps/italic.xbm
$w.top.font add underline -bitmap @$demo_dir/bitmaps/underlin.xbm
$w.top.font add capital -bitmap @$demo_dir/bitmaps/capital.xbm
# Add the choices of available justification types
#
#
$w.top.just add left -bitmap @$demo_dir/bitmaps/leftj.xbm
$w.top.just add right -bitmap @$demo_dir/bitmaps/rightj.xbm
$w.top.just add center -bitmap @$demo_dir/bitmaps/centerj.xbm
$w.top.just add justified -bitmap @$demo_dir/bitmaps/justify.xbm
$w.top.font config -variable sel_font
$w.top.just config -variable sel_just
# Set the default value of the two Select widgets
#
#
global sel_just sel_font
set sel_just justified
set sel_font {bold underline}
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -width 6\
-command "sel:cmd $w; destroy $w"
$w.box add apply -text Apply -underline 0 -width 6\
-command "sel:cmd $w"
$w.box add cancel -text Cancel -underline 0 -width 6\
-command "destroy $w"
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
}
# This procedure is called whenever the user pressed the OK or the Apply button
#
#
proc sel:cmd {w} {
global sel_font sel_just
tixDemo:Status "The justification is $sel_just"
if {$sel_font == {}} {
tixDemo:Status "The font is normal"
} else {
tixDemo:Status "The font is $sel_font"
}
}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind .demo <Destroy> exit
}

View File

@@ -0,0 +1,65 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: StdBBox.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of the tixStdButtonBox widget, which is a
# group of "Standard" buttons for Motif-like dialog boxes.
#
proc RunSample {w} {
# Create the label on the top of the dialog box
#
label $w.top -padx 20 -pady 10 -border 1 -relief raised -text \
"This dialog box is\n a demostration of the\n tixStdButtonBox widget" \
-justify center -anchor c
# Create the button box. We also do some manipulation of the
# button widgets inside: we disable the help button and change
# the label string of the "apply" button to "Filter"
#
# Note that the -text, -underline, -command and -width options are all
# standard options of the button widgets.
#
tixStdButtonBox $w.box
$w.box subwidget ok config \
-command "tixDemo:Status {OK pressed}; destroy $w"
$w.box subwidget apply config -text "Filter" -underline 0 \
-command "tixDemo:Status {Filter pressed}"
$w.box subwidget cancel config \
-command "tixDemo:Status {Cancel pressed}; destroy $w"
$w.box subwidget help config -state disabled
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes -anchor c
# "after 0" is used so that the key bindings won't interfere with
# tkTraverseMenu
#
bind [winfo toplevel $w] <Alt-o> \
"after 0 tkButtonInvoke [$w.box subwidget ok]"
bind [winfo toplevel $w] <Alt-f> \
"after 0 tkButtonInvoke [$w.box subwidget apply]"
bind [winfo toplevel $w] <Alt-c> \
"after 0 tkButtonInvoke [$w.box subwidget cancel]"
bind [winfo toplevel $w] <Escape> \
"after 0 tkButtonInvoke [$w.box subwidget cancel]"
focus [$w.box subwidget apply]
}
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,91 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: Tree.tcl,v 1.4 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates how to use the TixTree widget to display
# hierachical data (A hypothetical DOS disk drive).
#
proc RunSample {w} {
# We create the frame and the ScrolledHList widget
# at the top of the dialog box
#
frame $w.top -relief raised -bd 1
# Create a TixTree widget to display the hypothetical DOS disk drive
#
#
tixTree $w.top.a -options {
separator "\\"
}
pack $w.top.a -expand yes -fill both -padx 10 -pady 10 -side left
set tree $w.top.a
set hlist [$w.top.a subwidget hlist]
# STEP (1) Add the directories into the TixTree widget (using the
# hlist subwidget)
set directories {
C:
C:\\Dos
C:\\Windows
C:\\Windows\\System
}
foreach d $directories {
set text [lindex [split $d \\] end]
$hlist add $d -itemtype imagetext \
-text $text -image [tix getimage folder]
}
# STEP (2) Use the "autosetmode" method of TixTree to indicate
# which entries can be opened or closed. The
# "autosetmode" command will call the "setmode" method
# to set the mode of each entry to the following:
#
# "open" : the entry has some children and the children are
# currently visible
# "close": the entry has some children and the children are
# currently INvisible
# "none": the entry does not have children.
#
# If you don't like the "autosetmode" method, you can always call
# "setmode" yourself, but that takes more work.
$tree autosetmode
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "destroy $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> {if {"%W" == ".demo"} exit}
}

View File

@@ -0,0 +1,89 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: Xpm.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of XPM images.
#
proc RunSample {w} {
set hard_disk_pixmap {/* XPM */
static char * drivea_xpm[] = {
/* width height ncolors chars_per_pixel */
"32 32 5 1",
/* colors */
" s None c None",
". c #000000000000",
"X c white",
"o c #c000c000c000",
"O c #800080008000",
/* pixels */
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" .......................... ",
" .XXXXXXXXXXXXXXXXXXXXXXXo. ",
" .XooooooooooooooooooooooO. ",
" .Xooooooooooooooooo..oooO. ",
" .Xooooooooooooooooo..oooO. ",
" .XooooooooooooooooooooooO. ",
" .Xoooooooo.......oooooooO. ",
" .Xoo...................oO. ",
" .Xoooooooo.......oooooooO. ",
" .XooooooooooooooooooooooO. ",
" .XooooooooooooooooooooooO. ",
" .XooooooooooooooooooooooO. ",
" .XooooooooooooooooooooooO. ",
" .oOOOOOOOOOOOOOOOOOOOOOOO. ",
" .......................... ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};
}
frame $w.top -relief raised -bd 1
button $w.top.b -image [image create pixmap -data $hard_disk_pixmap]
pack $w.top -expand yes -fill both
pack $w.top.b -expand yes -padx 20 -pady 20
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "destroy $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind $w <Destroy> exit
}

View File

@@ -0,0 +1,108 @@
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
#
# $Id: Xpm1.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
#
# Tix Demostration Program
#
# This sample program is structured in such a way so that it can be
# executed from the Tix demo program "widget": it must have a
# procedure called "RunSample". It should also have the "if" statment
# at the end of this file so that it can be run as a standalone
# program using tixwish.
# This file demonstrates the use of XPM images in the menu.
#
proc RunSample {w} {
set hard_disk_pixmap {/* XPM */
static char * drivea_xpm[] = {
/* width height ncolors chars_per_pixel */
"32 32 5 1",
/* colors */
" s None c None",
". c #000000000000",
"X c white",
"o c #c000c000c000",
"O c #800080008000",
/* pixels */
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" .......................... ",
" .XXXXXXXXXXXXXXXXXXXXXXXo. ",
" .XooooooooooooooooooooooO. ",
" .Xooooooooooooooooo..oooO. ",
" .Xooooooooooooooooo..oooO. ",
" .XooooooooooooooooooooooO. ",
" .Xoooooooo.......oooooooO. ",
" .Xoo...................oO. ",
" .Xoooooooo.......oooooooO. ",
" .XooooooooooooooooooooooO. ",
" .XooooooooooooooooooooooO. ",
" .XooooooooooooooooooooooO. ",
" .XooooooooooooooooooooooO. ",
" .oOOOOOOOOOOOOOOOOOOOOOOO. ",
" .......................... ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};
}
# We create the frame and the ScrolledText widget
# at the top of the dialog box
#
frame $w.top -relief raised -bd 1
set m [frame $w.top.menu -relief raised -bd 2]
set mb [menubutton $m.mb -text Options -menu $m.mb.m]
set menu [menu $mb.m]
pack $m -side top -fill x
pack $mb -side left -fill y
# Put the label there
#
set lab [label $w.top.label -text "Go to the \"Options\" menu" -anchor c]
pack $lab -padx 40 -pady 40 -fill both -expand yes
set image [image create pixmap -data $hard_disk_pixmap]
$menu add command -image $image \
-command "$lab config -image $image"
# Use a ButtonBox to hold the buttons.
#
tixButtonBox $w.box -orientation horizontal
$w.box add ok -text Ok -underline 0 -command "destroy $w" \
-width 6
$w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
-width 6
pack $w.box -side bottom -fill x
pack $w.top -side top -fill both -expand yes
wm geometry $w 300x300
}
# This "if" statement makes it possible to run this script file inside or
# outside of the main demo program "widget".
#
if {![info exists tix_demo_running]} {
wm withdraw .
set w .demo
toplevel $w; wm transient $w ""
RunSample $w
bind .demo <Destroy> exit
}

View File

@@ -0,0 +1,55 @@
# Tcl autoload index file, version 2.0
# This file is generated by the "auto_mkindex" command
# and sourced to set up indexing information for one or
# more commands. Typically each line is a command that
# sets an element in the auto_index array, where the
# element name is the name of a command and the value is
# a script that loads the command.
set auto_index(MkChoosers) [list source [file join $dir MkChoose.tcl]]
set auto_index(MkCombo) [list source [file join $dir MkChoose.tcl]]
set auto_index(stCmd) [list source [file join $dir MkChoose.tcl]]
set auto_index(stValidate) [list source [file join $dir MkChoose.tcl]]
set auto_index(MkControl) [list source [file join $dir MkChoose.tcl]]
set auto_index(MkSelect) [list source [file join $dir MkChoose.tcl]]
set auto_index(MkOptMenu) [list source [file join $dir MkChoose.tcl]]
set auto_index(MkFileEnt) [list source [file join $dir MkChoose.tcl]]
set auto_index(MkFileBox) [list source [file join $dir MkChoose.tcl]]
set auto_index(MkToolBar) [list source [file join $dir MkChoose.tcl]]
set auto_index(MkTitle) [list source [file join $dir MkChoose.tcl]]
set auto_index(MkDirList) [list source [file join $dir MkDirLis.tcl]]
set auto_index(MkDirListWidget) [list source [file join $dir MkDirLis.tcl]]
set auto_index(MkExFileWidget) [list source [file join $dir MkDirLis.tcl]]
set auto_index(MkManager) [list source [file join $dir MkManag.tcl]]
set auto_index(MkPanedWindow) [list source [file join $dir MkManag.tcl]]
set auto_index(MkNoteBook) [list source [file join $dir MkManag.tcl]]
set auto_index(CreateCommonButtons) [list source [file join $dir MkManag.tcl]]
set auto_index(MkSample) [list source [file join $dir MkSample.tcl]]
set auto_index(AddSampleToHList) [list source [file join $dir MkSample.tcl]]
set auto_index(Sample:Action) [list source [file join $dir MkSample.tcl]]
set auto_index(RunProg) [list source [file join $dir MkSample.tcl]]
set auto_index(LoadFile) [list source [file join $dir MkSample.tcl]]
set auto_index(ReadFileWhenIdle) [list source [file join $dir MkSample.tcl]]
set auto_index(ReadFile) [list source [file join $dir MkSample.tcl]]
set auto_index(MkScroll) [list source [file join $dir MkScroll.tcl]]
set auto_index(MkSList) [list source [file join $dir MkScroll.tcl]]
set auto_index(SList:Reset) [list source [file join $dir MkScroll.tcl]]
set auto_index(MkSWindow) [list source [file join $dir MkScroll.tcl]]
set auto_index(SWindow:Reset) [list source [file join $dir MkScroll.tcl]]
set auto_index(MkSText) [list source [file join $dir MkScroll.tcl]]
set auto_index(SText:Reset) [list source [file join $dir MkScroll.tcl]]
set auto_index(tixDemo:MkMainWindow) [list source [file join $dir tixwidgets.tcl]]
set auto_index(tixDemo:MkMainMenu) [list source [file join $dir tixwidgets.tcl]]
set auto_index(tixDemo:MkMainNoteBook) [list source [file join $dir tixwidgets.tcl]]
set auto_index(txiDemo:CreatePage) [list source [file join $dir tixwidgets.tcl]]
set auto_index(tixDemo:MkMainStatus) [list source [file join $dir tixwidgets.tcl]]
set auto_index(tixDemo:Status) [list source [file join $dir tixwidgets.tcl]]
set auto_index(tixDemo:MkWelcome) [list source [file join $dir tixwidgets.tcl]]
set auto_index(tixDemo:MkWelcomeBar) [list source [file join $dir tixwidgets.tcl]]
set auto_index(tixDemo:MkWelcomeText) [list source [file join $dir tixwidgets.tcl]]
set auto_index(tixDemo:MainTextFont) [list source [file join $dir tixwidgets.tcl]]
set auto_index(tixDemo:FileOpen) [list source [file join $dir tixwidgets.tcl]]
set auto_index(tixDemo:FileOpen:Doit) [list source [file join $dir tixwidgets.tcl]]
set auto_index(tixDemo:BalloonHelp) [list source [file join $dir tixwidgets.tcl]]
set auto_index(tixDemo:SelfTest) [list source [file join $dir tixwidgets.tcl]]
set auto_index(tixDemo:Exit) [list source [file join $dir tixwidgets.tcl]]

View File

@@ -0,0 +1,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"}
}

View File

@@ -0,0 +1,450 @@
#!/bin/sh
# the next line restarts using wish \
exec wish "$0" "$@"
# widget --
#
# This script demonstrates the various widgets provided by Tix,
# along with many of the features of the Tix library. This file
# only contains code to generate the main window for the
# application, which invokes individual demonstrations. The
# code for the actual demonstrations is contained in separate
# ".tcl" files in the samples/ subdirectory, which are sourced
# by this script as needed.
#
# Copyright (c) 1992-1994 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-2000 Scriptics Corporation.
# Copyright (c) 2000-2001 Tix Project Group.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
# $Id: widget,v 1.7 2008/03/17 22:58:51 hobbs Exp $
package require Tix
tix initstyle
eval destroy [winfo child .]
wm title . "Tix Widget Tour"
set tix_demo_running 1
set demo_dir [file dirname [info script]]
tix addbitmapdir [file join $demo_dir bitmaps]
# createMainWindow --
#
# Creates the main window, consisting of a menu bar and a text
# widget that explains how to use the program, plus lists all of
# the demos as hypertext items.
proc createMainWindow {} {
global tcl_platform old_cursor
switch $tcl_platform(platform) {
"windows" {
set font {Arial 12}
}
"unix" {
set font {Helvetica 12}
}
default {
set font {Helvetica 12}
}
}
menu .menuBar -tearoff 0
.menuBar add cascade -menu .menuBar.file -label "File" -underline 0
menu .menuBar.file -tearoff 0
# On the Mac use the specia .apple menu for the about item
if {$tcl_platform(platform) eq "macintosh"} {
.menuBar add cascade -menu .menuBar.apple
menu .menuBar.apple -tearoff 0
.menuBar.apple add command -label "About ..." -command "aboutBox"
} else {
.menuBar.file add command -label "About ..." -command "aboutBox"
.menuBar.file add sep
}
.menuBar.file add command -label "Exit" -command "exit"
. configure -menu .menuBar
frame .statusBar
label .statusBar.lab -text " " -relief sunken -bd 1 \
-font -*-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* -anchor w
label .statusBar.foo -width 8 -relief sunken -bd 1 \
-font -*-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* -anchor w
pack .statusBar.lab -side left -padx 2 -expand yes -fill both
pack .statusBar.foo -side left -padx 2
pack .statusBar -side bottom -fill x -pady 2
frame .textFrame
scrollbar .s -orient vertical -command {.t yview} -highlightthickness 0 \
-takefocus 1
pack .s -in .textFrame -side right -fill y
text .t -yscrollcommand {.s set} -wrap word -width 55 -height 30 \
-font $font \
-setgrid 1 -highlightthickness 0 -padx 4 -pady 2 -takefocus 0
pack .t -in .textFrame -expand y -fill both -padx 1
pack .textFrame -expand yes -fill both
if {$tcl_platform(platform) eq "windows"} {
#
# Make the scrollbar look win32
#
.textFrame config -bd 2 -relief sunken
.t config -bd 0
pack .t -padx 0
}
set old_cursor [.t cget -cursor]
# Create a bunch of tags to use in the text widget, such as those for
# section titles and demo descriptions. Also define the bindings for
# tags.
.t tag configure title -font {Helvetica 18 bold} -justify center
.t tag configure header -font {Helvetica 14 bold}
# We put some "space" characters to the left and right of each
# demo description so that the descriptions are highlighted only
# when the mouse cursor is right over them (but not when the
# cursor is to their left or right)
#
.t tag configure demospace -lmargin1 1c -lmargin2 1c -spacing1 1
.t tag configure codeicon -lmargin1 1c -lmargin2 1c
if {[winfo depth .] == 1} {
.t tag configure demo -lmargin1 1c -lmargin2 1c \
-underline 1
.t tag configure visited -lmargin1 1c -lmargin2 1c \
-underline 1
.t tag configure hot -background black -foreground white
} else {
.t tag configure demo -lmargin1 1c -lmargin2 1c \
-foreground blue -underline 1
.t tag configure visited -lmargin1 1c -lmargin2 1c \
-foreground #303080 -underline 1
.t tag configure hot -foreground red -underline 1
}
.t tag bind demo <ButtonRelease-1> {
invoke [.t index {@%x,%y}]
}
.t tag bind codeicon <ButtonRelease-1> {
showCode [.t index [list {@%x,%y} +2 chars]]
}
global lastLine
set lastLine ""
.t tag bind demo <Enter> {
set lastLine [.t index {@%x,%y linestart}]
.t tag add hot [list $lastLine +3 chars] \
[list $lastLine lineend -1 chars]
.t config -cursor hand2
showStatus run [.t index {@%x,%y}]
}
.t tag bind demo <Leave> {
.t tag remove hot 1.0 end
.t config -cursor $old_cursor
.statusBar.lab config -text ""
}
.t tag bind demo <Motion> {
set newLine [.t index {@%x,%y linestart}]
if {[string compare $newLine $lastLine] != 0} {
.t tag remove hot 1.0 end
set lastLine $newLine
set tags [.t tag names {@%x,%y}]
set i [lsearch -glob $tags demo-*]
if {$i >= 0} {
.t tag add hot [list $lastLine +3 chars] \
[list $lastLine lineend -1 chars]
}
}
showStatus run [.t index {@%x,%y}]
}
.t tag bind codeicon <Enter> {
.t config -cursor hand2
}
.t tag bind codeicon <Leave> {
.t config -cursor $old_cursor
}
.t tag bind codeicon <Motion> {
set tags [.t tag names [list {@%x,%y} +2 chars]]
set i [lsearch -glob $tags demo-*]
if {$i >= 0} {
showStatus code [.t index [list {@%x,%y} +2 chars]]
} else {
showStatus code ""
}
}
# Create the text for the text widget.
.t insert end "Tix Widget Tour\n" title
addNewLine .t
addText .t {
This program demonstrates the features of the Tix
library. Click on one of the highlighted lines below to run
the sample program and click on the
}
addSpace .t
.t image create end -image [tix getimage code]
addSpace .t
addText .t {
icon to view its source code.
}
addNewLine .t
addNewLine .t
addHeader .t "Hierachical ListBox"
addDemo .t HList1.tcl "Simple HList"
addDemo .t ChkList.tcl "CheckList"
addDemo .t SHList.tcl "ScrolledHList (1)"
addDemo .t SHList2.tcl "ScrolledHList (2)"
addDemo .t Tree.tcl "Simple Tree"
# TODO
# addDemo .t "Dynamic Tree" DynTree.tcl
addHeader .t "Tabular ListBox"
addDemo .t STList1.tcl "ScrolledTList (1)"
addDemo .t STList2.tcl "ScrolledTList (2)"
addDemo .t STList3.tcl "TList File Viewer"
addHeader .t "Grid Widget"
addDemo .t SGrid0.tcl "Simple Grid"
addDemo .t SGrid1.tcl "ScrolledGrid"
addDemo .t EditGrid.tcl "Editable Grid"
addHeader .t "Manager Widgets"
addDemo .t ListNBK.tcl ListNoteBook
addDemo .t NoteBook.tcl NoteBook
addDemo .t PanedWin.tcl PanedWindow
addHeader .t "Scrolled Widgets"
addDemo .t SListBox.tcl ScrolledListBox
addDemo .t SText.tcl ScrolledText
addDemo .t SWindow.tcl ScrolledWindow
addDemo .t CObjView.tcl "Canvas Object View"
addHeader .t "Miscellaneous Widgets"
addDemo .t Balloon.tcl Balloon
addDemo .t BtnBox.tcl ButtonBox
addDemo .t ComboBox.tcl ComboBox
addDemo .t Control.tcl Control
addDemo .t LabEntry.tcl LabelEntry
addDemo .t LabFrame.tcl LabelFrame
addDemo .t Meter.tcl Meter
addDemo .t OptMenu.tcl OptionMenu
addDemo .t PopMenu.tcl PopupMenu
addDemo .t Select.tcl Select
addDemo .t StdBBox.tcl StdButtonBox
addHeader .t "Image Types"
addDemo .t CmpImg.tcl "Compound image in buttons"
addDemo .t CmpImg3.tcl "Compound image in icons"
#addDemo .t CmpImg2.tcl "Compound image in notebook"
#addDemo .t CmpImg4.tcl \
# "Create color tabs in notebook using compound image"
addDemo .t Xpm.tcl "XPM pixmap image in buttons"
addDemo .t Xpm1.tcl "XPM pixmap image in menu"
.t configure -state disabled
focus .s
#
# Because .t is disabled and not focused, we have to do the
# following hacks to make the scrolling work well
#
bind .s <MouseWheel> {
.t yview scroll [expr {- (%D / 120) * 2}] units
}
bind .s <Up> {
.t yview scroll -1 units
}
bind .s <Down> {
.t yview scroll 1 units
}
bind .s <Prior> {
.t yview scroll -1 page
}
bind .s <Next> {
.t yview scroll 1 page
}
bind .s <Home> {
.t yview 1.0
}
bind .s <End> {
.t yview end
}
}
# invoke --
# This procedure is called when the user clicks on a demo description.
# It is responsible for invoking the demonstration.
#
# Arguments:
# index - The index of the character that the user clicked on.
proc invoke {index} {
global demo_dir
# Find out which sample to run
set tags [.t tag names $index]
set i [lsearch -glob $tags demo-*]
if {$i < 0} {
return
}
set demo [string range [lindex $tags $i] 5 end]
set title [string trim [.t get [list $index linestart +3 chars] \
[list $index lineend]]]
# Get the name of this sample
set w .[lindex [split $demo .] 0]
set w [string tolower $w]
if [winfo exists $w] {
wm deiconify $w
raise $w
return
}
# Load the sample if it's not running
set cursor [.t cget -cursor]
.t configure -cursor watch
update
uplevel #0 [list source [file join $demo_dir samples $demo]]
toplevel $w
wm title $w $title
RunSample $w
update
.t configure -cursor $cursor
.t tag add visited "$index linestart +1 chars" "$index lineend -1 chars"
}
# showStatus --
#
# Show the name of the demo program in the status bar. This procedure
# is called when the user moves the cursor over a demo description.
#
proc showStatus {which index} {
set tags [.t tag names $index]
set i [lsearch -glob $tags demo-*]
set cursor [.t cget -cursor]
if {$i < 0} {
.statusBar.lab config -text " "
set newcursor xterm
} else {
set demo [string range [lindex $tags $i] 5 end]
if {"$which" == "run"} {
set text "Run the \"$demo\" sample program"
} else {
set text "Show code of the \"$demo\" sample program"
}
.statusBar.lab config -text $text
set newcursor hand2
}
if [string compare $cursor $newcursor] {
.t config -cursor $newcursor
}
}
# showCode --
# This procedure is called when the user clicks on the "code" icon.
# It is responsible for displaying the code of the selected sample program.
#
# Arguments:
# index - The index of the character that the user clicked on.
proc showCode {index} {
global demo_dir
set tags [.t tag names $index]
set i [lsearch -glob $tags demo-*]
if {$i < 0} {
return
}
set cursor [.t cget -cursor]
.t configure -cursor watch
update
set demo [string range [lindex $tags $i] 5 end]
# Create the .code window
if {![winfo exists .code]} {
toplevel .code
frame .code.f
tixScrolledText .code.st
button .code.close -text Close -width 6 -command "wm withdraw .code"
pack .code.f -side bottom -fill x
pack .code.st -side top -fill both -expand yes
pack .code.close -in .code.f -side right -padx 10 -pady 10
}
set text [.code.st subwidget text]
$text delete 1.0 end
set fd [open [file join $demo_dir samples $demo]]
set data [read $fd]
close $fd
$text insert end $data
wm deiconify .code
wm title .code [file nativename [file join $demo_dir samples $demo]]
update
.t configure -cursor $cursor
}
proc addText {t text} {
regsub -all \n+ $text " " text
regsub -all {[ ]+} $text " " text
$t insert end [string trim $text]
}
proc addHeader {t text} {
addNewLine $t
$t insert end [string trim $text] header
addNewLine $t
}
proc addNewLine {t} {
$t insert end "\n" {demospace}
}
proc addSpace {t} {
$t insert end " " {demospace}
}
proc addDemo {t name text} {
$t insert end " " demospace
$t image create end -image [tix getimage code]
$t tag add codeicon [list end -2 chars] [list end -1 chars]
$t insert end " " demospace
$t insert end $text [list demo demo-$name]
$t insert end " " demospace
addNewLine $t
}
# aboutBox --
#
# Pops up a message box with an "about" message
#
proc aboutBox {} {
tk_messageBox -icon info -type ok -title "About Widget Tour" -message \
"Tix widget tour\n\nCopyright (c) 2000-2001 Tix Project Group."
}
#
# Start the program
#
createMainWindow