Import build of Tcl/Tk 8.6.8
585
win32/lib/tix8.4.3/Balloon.tcl
Normal file
@@ -0,0 +1,585 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: Balloon.tcl,v 1.7 2008/02/27 22:17:28 hobbs Exp $
|
||||
#
|
||||
# Balloon.tcl --
|
||||
#
|
||||
# The help widget. It provides both "balloon" type of help
|
||||
# message and "status bar" type of help message. You can use
|
||||
# this widget to indicate the function of the widgets inside
|
||||
# your application.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
|
||||
|
||||
tixWidgetClass tixBalloon {
|
||||
-classname TixBalloon
|
||||
-superclass tixShell
|
||||
-method {
|
||||
bind post unbind
|
||||
}
|
||||
-flag {
|
||||
-installcolormap -initwait -state -statusbar -cursor
|
||||
}
|
||||
-configspec {
|
||||
{-installcolormap installColormap InstallColormap false}
|
||||
{-initwait initWait InitWait 1000}
|
||||
{-state state State both}
|
||||
{-statusbar statusBar StatusBar ""}
|
||||
{-cursor cursor Cursor {}}
|
||||
}
|
||||
-default {
|
||||
{*background #ffff60}
|
||||
{*foreground black}
|
||||
{*borderWidth 0}
|
||||
{.borderWidth 1}
|
||||
{.background black}
|
||||
{*Label.anchor w}
|
||||
{*Label.justify left}
|
||||
}
|
||||
}
|
||||
# static seem to be -installcolormap -initwait -statusbar -cursor
|
||||
|
||||
# Class Record
|
||||
#
|
||||
global tixBalloon
|
||||
set tixBalloon(bals) ""
|
||||
|
||||
proc tixBalloon:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
global tixBalloon
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
|
||||
set data(isActive) 0
|
||||
set data(client) ""
|
||||
|
||||
lappend tixBalloon(bals) $w
|
||||
}
|
||||
|
||||
proc tixBalloon:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
if {[tk windowingsystem] eq "aqua"} {
|
||||
::tk::unsupported::MacWindowStyle style $w help none
|
||||
} else {
|
||||
wm overrideredirect $w 1
|
||||
}
|
||||
catch {wm attributes $w -topmost 1}
|
||||
wm positionfrom $w program
|
||||
wm withdraw $w
|
||||
|
||||
# Frame 1 : arrow
|
||||
frame $w.f1 -bd 0
|
||||
set data(w:label) [label $w.f1.lab -bd 0 -relief flat \
|
||||
-bitmap [tix getbitmap balarrow]]
|
||||
pack $data(w:label) -side left -padx 1 -pady 1
|
||||
|
||||
# Frame 2 : Message
|
||||
frame $w.f2 -bd 0
|
||||
set data(w:message) [label $w.f2.message -padx 0 -pady 0 -bd 0]
|
||||
pack $data(w:message) -side left -expand yes -fill both -padx 10 -pady 1
|
||||
|
||||
# Pack all
|
||||
pack $w.f1 -fill both
|
||||
pack $w.f2 -fill both
|
||||
|
||||
# This is an event tag used by the clients
|
||||
#
|
||||
bind TixBal$w <Destroy> [list tixBalloon:ClientDestroy $w %W]
|
||||
}
|
||||
|
||||
proc tixBalloon:Destructor {w} {
|
||||
global tixBalloon
|
||||
|
||||
set bals ""
|
||||
foreach b $tixBalloon(bals) {
|
||||
if {$w != $b} {
|
||||
lappend bals $b
|
||||
}
|
||||
}
|
||||
set tixBalloon(bals) $bals
|
||||
|
||||
tixChainMethod $w Destructor
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Config:
|
||||
#----------------------------------------------------------------------
|
||||
proc tixBalloon:config-state {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
set re {^(none|balloon|status|both)$}
|
||||
if {![regexp -- $re $value]} {
|
||||
error "invalid value $value, must be none, balloon, status, or both"
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# "RAW" event bindings:
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
bind all <B1-Motion> "+tixBalloon_XXMotion %X %Y 1"
|
||||
bind all <B2-Motion> "+tixBalloon_XXMotion %X %Y 2"
|
||||
bind all <B3-Motion> "+tixBalloon_XXMotion %X %Y 3"
|
||||
bind all <B4-Motion> "+tixBalloon_XXMotion %X %Y 4"
|
||||
bind all <B5-Motion> "+tixBalloon_XXMotion %X %Y 5"
|
||||
bind all <Any-Motion> "+tixBalloon_XXMotion %X %Y 0"
|
||||
# Should %b be 0? %b is illegal
|
||||
bind all <Leave> "+tixBalloon_XXMotion %X %Y 0"
|
||||
bind all <Button> "+tixBalloon_XXButton %X %Y %b"
|
||||
bind all <ButtonRelease> "+tixBalloon_XXButtonUp %X %Y %b"
|
||||
|
||||
proc tixBalloon_XXMotion {rootX rootY b} {
|
||||
global tixBalloon
|
||||
|
||||
foreach w $tixBalloon(bals) {
|
||||
tixBalloon:XXMotion $w $rootX $rootY $b
|
||||
}
|
||||
}
|
||||
|
||||
proc tixBalloon_XXButton {rootX rootY b} {
|
||||
global tixBalloon
|
||||
|
||||
foreach w $tixBalloon(bals) {
|
||||
tixBalloon:XXButton $w $rootX $rootY $b
|
||||
}
|
||||
}
|
||||
|
||||
proc tixBalloon_XXButtonUp {rootX rootY b} {
|
||||
global tixBalloon
|
||||
|
||||
foreach w $tixBalloon(bals) {
|
||||
tixBalloon:XXButtonUp $w $rootX $rootY $b
|
||||
}
|
||||
}
|
||||
|
||||
# return true if d is a descendant of w
|
||||
#
|
||||
proc tixIsDescendant {w d} {
|
||||
return [expr {$w eq "." || [string match $w.* $d]}]
|
||||
}
|
||||
|
||||
# All the button events are fine if the ballooned widget is
|
||||
# a descendant of the grabbing widget
|
||||
#
|
||||
proc tixBalloon:GrabBad {w cw} {
|
||||
global tixBalloon
|
||||
|
||||
set g [grab current $w]
|
||||
if {$g == ""} {
|
||||
return 0
|
||||
}
|
||||
if {[info exists tixBalloon(g_ignore,$g)]} {
|
||||
return 1
|
||||
}
|
||||
if {[info exists tixBalloon(g_ignore,[winfo class $g])]} {
|
||||
return 1
|
||||
}
|
||||
if {$g == $cw || [tixIsDescendant $g $cw]} {
|
||||
return 0
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
proc tixBalloon:XXMotion {w rootX rootY b} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {![info exists data(-state)]} {
|
||||
# puts "tixBalloon:XXMotion called without a state\n$w"
|
||||
set data(state) none
|
||||
return
|
||||
}
|
||||
if {$data(-state) eq "none"} {
|
||||
return
|
||||
}
|
||||
|
||||
if {$b == 0} {
|
||||
if {[info exists data(b:1)]} {unset data(b:1)}
|
||||
if {[info exists data(b:2)]} {unset data(b:2)}
|
||||
if {[info exists data(b:3)]} {unset data(b:3)}
|
||||
if {[info exists data(b:4)]} {unset data(b:4)}
|
||||
if {[info exists data(b:5)]} {unset data(b:5)}
|
||||
}
|
||||
|
||||
if {[llength [array names data b:*]]} {
|
||||
# Some buttons are down. Do nothing
|
||||
#
|
||||
return
|
||||
}
|
||||
|
||||
set cw [winfo containing -displayof $w $rootX $rootY]
|
||||
if {[tixBalloon:GrabBad $w $cw]} {
|
||||
return
|
||||
}
|
||||
|
||||
# Find the a client window that matches
|
||||
#
|
||||
if {$w eq $cw || [string match $w.* $cw]} {
|
||||
# Cursor moved over the balloon -- Ignore
|
||||
return
|
||||
}
|
||||
|
||||
while {$cw != ""} {
|
||||
if {[info exists data(m:$cw)]} {
|
||||
set client $cw
|
||||
break
|
||||
} else {
|
||||
set cw [winfo parent $cw]
|
||||
}
|
||||
}
|
||||
if {![info exists client]} {
|
||||
# The cursor is at a position covered by a non-client
|
||||
# Popdown the balloon if it is up
|
||||
if {$data(isActive)} {
|
||||
tixBalloon:Deactivate $w
|
||||
}
|
||||
set data(client) ""
|
||||
if {[info exists data(cancel)]} {
|
||||
unset data(cancel)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if {$data(client) ne $client} {
|
||||
if {$data(isActive)} {
|
||||
tixBalloon:Deactivate $w
|
||||
}
|
||||
set data(client) $client
|
||||
after $data(-initwait) tixBalloon:SwitchToClient $w $client
|
||||
}
|
||||
}
|
||||
|
||||
proc tixBalloon:XXButton {w rootX rootY b} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixBalloon:XXMotion $w $rootX $rootY $b
|
||||
|
||||
set data(b:$b) 1
|
||||
|
||||
if {$data(isActive)} {
|
||||
tixBalloon:Deactivate $w
|
||||
} else {
|
||||
set data(cancel) 1
|
||||
}
|
||||
}
|
||||
|
||||
proc tixBalloon:XXButtonUp {w rootX rootY b} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixBalloon:XXMotion $w $rootX $rootY $b
|
||||
if {[info exists data(b:$b)]} {
|
||||
unset data(b:$b)
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# "COOKED" event bindings:
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
# switch the balloon to a new client
|
||||
#
|
||||
proc tixBalloon:SwitchToClient {w client} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {![winfo exists $w]} {
|
||||
return
|
||||
}
|
||||
if {![winfo exists $client]} {
|
||||
return
|
||||
}
|
||||
if {$client ne $data(client)} {
|
||||
return
|
||||
}
|
||||
if {[info exists data(cancel)]} {
|
||||
unset data(cancel)
|
||||
return
|
||||
}
|
||||
|
||||
if {[tixBalloon:GrabBad $w $w]} {
|
||||
return
|
||||
}
|
||||
|
||||
tixBalloon:Activate $w
|
||||
}
|
||||
|
||||
proc tixBalloon:ClientDestroy {w client} {
|
||||
if {![winfo exists $w]} {
|
||||
return
|
||||
}
|
||||
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(client) eq $client} {
|
||||
tixBalloon:Deactivate $w
|
||||
set data(client) ""
|
||||
}
|
||||
|
||||
# Maybe thses have already been unset by the Destroy method
|
||||
#
|
||||
if {[info exists data(m:$client)]} {unset data(m:$client)}
|
||||
if {[info exists data(s:$client)]} {unset data(s:$client)}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Popping up balloon:
|
||||
#----------------------------------------------------------------------
|
||||
proc tixBalloon:Activate {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[tixBalloon:GrabBad $w $w]} {
|
||||
return
|
||||
}
|
||||
if {[winfo containing -displayof $w \
|
||||
[winfo pointerx $w] [winfo pointery $w]] == ""} {
|
||||
return
|
||||
}
|
||||
|
||||
if {![info exists data(-state)]} {
|
||||
# puts "tixBalloon:Activate called without a state\n$w"
|
||||
set data(state) none
|
||||
return
|
||||
}
|
||||
if {$data(-state) eq "none"} {
|
||||
return
|
||||
}
|
||||
|
||||
switch -exact -- $data(-state) {
|
||||
"both" {
|
||||
tixBalloon:PopUp $w
|
||||
tixBalloon:SetStatus $w
|
||||
}
|
||||
"balloon" {
|
||||
tixBalloon:PopUp $w
|
||||
}
|
||||
"status" {
|
||||
tixBalloon:SetStatus $w
|
||||
}
|
||||
}
|
||||
|
||||
set data(isActive) 1
|
||||
|
||||
after 200 tixBalloon:Verify $w
|
||||
}
|
||||
|
||||
|
||||
# %% Perhaps this is no more needed
|
||||
#
|
||||
proc tixBalloon:Verify {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {![winfo exists $w]} {
|
||||
return
|
||||
}
|
||||
if {!$data(isActive)} {
|
||||
return
|
||||
}
|
||||
|
||||
if {[tixBalloon:GrabBad $w $w]} {
|
||||
tixBalloon:Deactivate $w
|
||||
return
|
||||
}
|
||||
if {[winfo containing -displayof $w \
|
||||
[winfo pointerx $w] [winfo pointery $w]] == ""} {
|
||||
tixBalloon:Deactivate $w
|
||||
return
|
||||
}
|
||||
after 200 tixBalloon:Verify $w
|
||||
}
|
||||
|
||||
proc tixBalloon:Deactivate {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixBalloon:PopDown $w
|
||||
tixBalloon:ClearStatus $w
|
||||
set data(isActive) 0
|
||||
if {[info exists data(cancel)]} {
|
||||
unset data(cancel)
|
||||
}
|
||||
}
|
||||
|
||||
proc tixBalloon:PopUp {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[string is true -strict $data(-installcolormap)]} {
|
||||
wm colormapwindows [winfo toplevel $data(client)] $w
|
||||
}
|
||||
|
||||
# trick: the following lines allow the balloon window to
|
||||
# acquire a stable width and height when it is finally
|
||||
# put on the visible screen
|
||||
#
|
||||
set client $data(client)
|
||||
if {$data(m:$client) == ""} {return ""}
|
||||
|
||||
$data(w:message) config -text $data(m:$client)
|
||||
wm geometry $w +10000+10000
|
||||
wm deiconify $w
|
||||
raise $w
|
||||
update
|
||||
|
||||
# The windows may become destroyed as a result of the "update" command
|
||||
#
|
||||
if {![winfo exists $w]} {
|
||||
return
|
||||
}
|
||||
if {![winfo exists $client]} {
|
||||
return
|
||||
}
|
||||
# Put it on the visible screen
|
||||
#
|
||||
set x [expr {[winfo rootx $client]+[winfo width $client]/2}]
|
||||
set y [expr {int([winfo rooty $client]+[winfo height $client]/1.3)}]
|
||||
|
||||
set width [winfo reqwidth $w]
|
||||
set height [winfo reqheight $w]
|
||||
set scrwidth [winfo vrootwidth $w]
|
||||
set scrheight [winfo vrootheight $w]
|
||||
|
||||
# If the balloon is too far right, pull it back to the left
|
||||
#
|
||||
if {($x + $width) > $scrwidth} {
|
||||
set x [expr {$scrwidth - $width}]
|
||||
}
|
||||
|
||||
# If the balloon is too far left, pull it back to the right
|
||||
#
|
||||
if {$x < 0} {
|
||||
set x 0
|
||||
}
|
||||
|
||||
# If the listbox is below bottom of screen, put it upwards
|
||||
#
|
||||
if {($y + $height) > $scrheight} {
|
||||
set y [expr {$scrheight-$height}]
|
||||
}
|
||||
if {$y < 0} {
|
||||
set y 0
|
||||
}
|
||||
|
||||
wm geometry $w +$x+$y
|
||||
after idle raise $w
|
||||
}
|
||||
|
||||
proc tixBalloon:PopDown {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
# Close the balloon
|
||||
#
|
||||
wm withdraw $w
|
||||
|
||||
# We don't set the data(client) to be zero, so that the balloon
|
||||
# will re-appear only if you move out then in the client window
|
||||
# set data(client) ""
|
||||
}
|
||||
|
||||
proc tixBalloon:SetStatus {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {![winfo exists $data(-statusbar)]
|
||||
|| ![info exists data(s:$data(client))]} {
|
||||
return
|
||||
}
|
||||
|
||||
set vv [$data(-statusbar) cget -textvariable]
|
||||
if {$vv == ""} {
|
||||
$data(-statusbar) config -text $data(s:$data(client))
|
||||
} else {
|
||||
uplevel #0 set $vv [list $data(s:$data(client))]
|
||||
}
|
||||
}
|
||||
|
||||
proc tixBalloon:ClearStatus {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {![winfo exists $data(-statusbar)]} {
|
||||
return
|
||||
}
|
||||
|
||||
# Clear the StatusBar widget
|
||||
#
|
||||
set vv [$data(-statusbar) cget -textvariable]
|
||||
if {$vv == ""} {
|
||||
$data(-statusbar) config -text ""
|
||||
} else {
|
||||
uplevel #0 set $vv [list ""]
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# PublicMethods:
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
# %% if balloon is already popped-up for this client, change mesage
|
||||
#
|
||||
proc tixBalloon:bind {w client args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set alreadyBound [info exists data(m:$client)]
|
||||
|
||||
set opt(-balloonmsg) ""
|
||||
set opt(-statusmsg) ""
|
||||
set opt(-msg) ""
|
||||
|
||||
tixHandleOptions opt {-balloonmsg -msg -statusmsg} $args
|
||||
|
||||
if {$opt(-balloonmsg) != ""} {
|
||||
set data(m:$client) $opt(-balloonmsg)
|
||||
} else {
|
||||
set data(m:$client) $opt(-msg)
|
||||
}
|
||||
if {$opt(-statusmsg) != ""} {
|
||||
set data(s:$client) $opt(-statusmsg)
|
||||
} else {
|
||||
set data(s:$client) $opt(-msg)
|
||||
}
|
||||
|
||||
tixAppendBindTag $client TixBal$w
|
||||
}
|
||||
|
||||
proc tixBalloon:post {w client} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {![info exists data(m:$client)] || $data(m:$client) == ""} {
|
||||
return
|
||||
}
|
||||
tixBalloon:Enter $w $client
|
||||
incr data(fakeEnter)
|
||||
}
|
||||
|
||||
proc tixBalloon:unbind {w client} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[info exists data(m:$client)]} {
|
||||
if {[info exists data(m:$client)]} {unset data(m:$client)}
|
||||
if {[info exists data(s:$client)]} {unset data(s:$client)}
|
||||
|
||||
if {[winfo exists $client]} {
|
||||
catch {tixDeleteBindTag $client TixBal$w}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Utility function
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# $w can be a widget name or a classs name
|
||||
proc tixBalIgnoreWhenGrabbed {wc} {
|
||||
global tixBalloon
|
||||
set tixBalloon(g_ignore,$wc) ""
|
||||
}
|
||||
|
||||
tixBalIgnoreWhenGrabbed TixComboBox
|
||||
tixBalIgnoreWhenGrabbed Menu
|
||||
tixBalIgnoreWhenGrabbed Menubutton
|
||||
120
win32/lib/tix8.4.3/BtnBox.tcl
Normal file
@@ -0,0 +1,120 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: BtnBox.tcl,v 1.2 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# BtnBox.tcl --
|
||||
#
|
||||
# Implements the tixButtonBox widget
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
tixWidgetClass tixButtonBox {
|
||||
-superclass tixPrimitive
|
||||
-classname TixButtonBox
|
||||
-method {
|
||||
add invoke button buttons
|
||||
}
|
||||
-flag {
|
||||
-orientation -orient -padx -pady -state
|
||||
}
|
||||
-static {
|
||||
-orientation
|
||||
}
|
||||
-configspec {
|
||||
{-orientation orientation Orientation horizontal}
|
||||
{-padx padX Pad 0}
|
||||
{-pady padY Pad 0}
|
||||
{-state state State normal}
|
||||
}
|
||||
-alias {
|
||||
{-orient -orientation}
|
||||
}
|
||||
-default {
|
||||
{.borderWidth 1}
|
||||
{.relief raised}
|
||||
{.padX 5}
|
||||
{.padY 10}
|
||||
{*Button.anchor c}
|
||||
{*Button.padX 5}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixButtonBox:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
|
||||
set data(g:buttons) ""
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# CONFIG OPTIONS
|
||||
#----------------------------------------------------------------------
|
||||
proc tixButtonBox:config-padx {w arg} {
|
||||
upvar #0 $w data
|
||||
|
||||
foreach item $data(g:buttons) {
|
||||
pack configure $w.$item -padx $arg
|
||||
}
|
||||
}
|
||||
|
||||
proc tixButtonBox:config-pady {w arg} {
|
||||
upvar #0 $w data
|
||||
|
||||
foreach item $data(g:buttons) {
|
||||
pack configure $w.$item -pady $arg
|
||||
}
|
||||
}
|
||||
|
||||
proc tixButtonBox:config-state {w arg} {
|
||||
upvar #0 $w data
|
||||
|
||||
foreach item $data(g:buttons) {
|
||||
$w.$item config -state $arg
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Methods
|
||||
# WIDGET COMMANDS
|
||||
#----------------------------------------------------------------------
|
||||
proc tixButtonBox:add {w name args} {
|
||||
upvar #0 $w data
|
||||
|
||||
eval button $w.$name $args
|
||||
if {$data(-orientation) == "horizontal"} {
|
||||
pack $w.$name -side left -expand yes -fill y\
|
||||
-padx $data(-padx) -pady $data(-pady)
|
||||
} else {
|
||||
pack $w.$name -side top -expand yes -fill x\
|
||||
-padx $data(-padx) -pady $data(-pady)
|
||||
}
|
||||
|
||||
# allow for subwidget access
|
||||
#
|
||||
lappend data(g:buttons) $name
|
||||
set data(w:$name) $w.$name
|
||||
|
||||
return $w.$name
|
||||
}
|
||||
|
||||
proc tixButtonBox:button {w name args} {
|
||||
return [eval tixCallMethod $w subwidget $name $args]
|
||||
}
|
||||
|
||||
proc tixButtonBox:buttons {w args} {
|
||||
return [eval tixCallMethod $w subwidgets -group buttons $args]
|
||||
}
|
||||
|
||||
#
|
||||
# call the command
|
||||
proc tixButtonBox:invoke {w name} {
|
||||
upvar #0 $w data
|
||||
|
||||
$w.$name invoke
|
||||
}
|
||||
360
win32/lib/tix8.4.3/CObjView.tcl
Normal file
@@ -0,0 +1,360 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: CObjView.tcl,v 1.3 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# CObjView.tcl --
|
||||
#
|
||||
# This file implements the Canvas Object View widget. This is a base
|
||||
# class of IconView. It implements:
|
||||
|
||||
# (1) Automatic placement/adjustment of the scrollbars according
|
||||
# to the canvas objects inside the canvas subwidget. The
|
||||
# scrollbars are adjusted so that the canvas is just large
|
||||
# enough to see all the objects.
|
||||
#
|
||||
# (2) D+D bindings of the objects (%% not implemented)
|
||||
#
|
||||
# (3) Keyboard traversal of the objects (%% not implemented). By the
|
||||
# virtual method :SelectObject.
|
||||
#
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
tixWidgetClass tixCObjView {
|
||||
-classname TixCObjView
|
||||
-superclass tixScrolledWidget
|
||||
-method {
|
||||
adjustscrollregion
|
||||
}
|
||||
-flag {
|
||||
-xscrollincrement -yscrollincrement
|
||||
}
|
||||
-static {
|
||||
}
|
||||
-configspec {
|
||||
{-xscrollincrement xScrollIncrement ScrollIncrement 10}
|
||||
{-yscrollincrement yScrollIncrement ScrollIncrement 10}
|
||||
}
|
||||
-default {
|
||||
{.scrollbar auto}
|
||||
{*borderWidth 1}
|
||||
{*canvas.background #c3c3c3}
|
||||
{*canvas.highlightBackground #d9d9d9}
|
||||
{*canvas.relief sunken}
|
||||
{*canvas.takeFocus 1}
|
||||
{*Scrollbar.takeFocus 0}
|
||||
}
|
||||
-forcecall {
|
||||
-scrollbar
|
||||
}
|
||||
}
|
||||
|
||||
proc tixCObjView:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
set data(w:canvas) \
|
||||
[canvas $w.canvas]
|
||||
set data(w:hsb) \
|
||||
[scrollbar $w.hsb -orient horizontal]
|
||||
set data(w:vsb) \
|
||||
[scrollbar $w.vsb -orient vertical]
|
||||
|
||||
set data(pw:client) $data(w:canvas)
|
||||
|
||||
set data(xorig) 0
|
||||
set data(yorig) 0
|
||||
|
||||
set data(sx1) 0
|
||||
set data(sy1) 0
|
||||
set data(sx2) 0
|
||||
set data(sy2) 0
|
||||
}
|
||||
|
||||
proc tixCObjView:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
|
||||
# %% scan/drag of canvas??
|
||||
#
|
||||
# $data(w:canvas) config \
|
||||
# -xscrollcommand "tixCObjView:XScroll $w"\
|
||||
# -yscrollcommand "tixCObjView:YScroll $w"
|
||||
|
||||
$data(w:hsb) config -command "tixCObjView:UserScroll $w x"
|
||||
$data(w:vsb) config -command "tixCObjView:UserScroll $w y"
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# option configs
|
||||
#----------------------------------------------------------------------
|
||||
proc tixCObjView:config-takefocus {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
$data(w:canvas) config -takefocus $value
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Widget commands
|
||||
#----------------------------------------------------------------------
|
||||
proc tixCObjView:adjustscrollregion {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
set cW [tixWinWidth $data(w:canvas)]
|
||||
set cH [tixWinHeight $data(w:canvas)]
|
||||
|
||||
tixCObjView:GetScrollRegion $w $cW $cH 1 1
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Private Methods
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
proc tixCObjView:GeometryInfo {w cW cH} {
|
||||
upvar #0 $w data
|
||||
|
||||
set bd \
|
||||
[expr [$data(w:canvas) cget -bd] + [$data(w:canvas) cget -highlightthickness]]
|
||||
|
||||
incr cW -[expr {2*$bd}]
|
||||
incr cH -[expr {2*$bd}]
|
||||
|
||||
return [tixCObjView:GetScrollRegion $w $cW $cH 0 0]
|
||||
}
|
||||
|
||||
proc tixCObjView:PlaceWindow {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
set cW [tixWinWidth $data(w:canvas)]
|
||||
set cH [tixWinHeight $data(w:canvas)]
|
||||
|
||||
tixCObjView:GetScrollRegion $w $cW $cH 1 0
|
||||
|
||||
tixChainMethod $w PlaceWindow
|
||||
}
|
||||
|
||||
proc tixCObjView:GetScrollRegion {w cW cH setReg callConfig} {
|
||||
upvar #0 $w data
|
||||
|
||||
set x1max $data(xorig)
|
||||
set y1max $data(yorig)
|
||||
|
||||
set x2min [expr {$x1max + $cW - 1}]
|
||||
set y2min [expr {$y1max + $cH - 1}]
|
||||
|
||||
set bbox [$data(w:canvas) bbox all]
|
||||
|
||||
if {$bbox == ""} {
|
||||
set bbox {0 0 1 1}
|
||||
}
|
||||
|
||||
set x1 [lindex $bbox 0]
|
||||
set y1 [lindex $bbox 1]
|
||||
set x2 [lindex $bbox 2]
|
||||
set y2 [lindex $bbox 3]
|
||||
|
||||
set bd \
|
||||
[expr [$data(w:canvas) cget -bd] + [$data(w:canvas) cget -highlightthickness]]
|
||||
|
||||
incr x1 -$bd
|
||||
incr y1 -$bd
|
||||
incr x2 -$bd
|
||||
incr y2 -$bd
|
||||
|
||||
if {$x1 > $x1max} {
|
||||
set x1 $x1max
|
||||
}
|
||||
if {$y1 > $y1max} {
|
||||
set y1 $y1max
|
||||
}
|
||||
if {$x2 < $x2min} {
|
||||
set x2 $x2min
|
||||
}
|
||||
if {$y2 < $y2min} {
|
||||
set y2 $y2min
|
||||
}
|
||||
|
||||
set data(sx1) $x1
|
||||
set data(sy1) $y1
|
||||
set data(sx2) $x2
|
||||
set data(sy2) $y2
|
||||
|
||||
set sW [expr {$x2 - $x1 + 1}]
|
||||
set sH [expr {$y2 - $y1 + 1}]
|
||||
|
||||
# puts "sregion = {$x1 $y1 $x2 $y2}; sW=$sW; cW=$cW"
|
||||
|
||||
if {$sW > $cW} {
|
||||
set hsbSpec {0.5 1}
|
||||
} else {
|
||||
set hsbSpec {0 1}
|
||||
}
|
||||
if {$sH > $cH} {
|
||||
set vsbSpec {0.5 1}
|
||||
} else {
|
||||
set vsbSpec {0 1}
|
||||
}
|
||||
|
||||
if $setReg {
|
||||
tixCObjView:SetScrollBars $w $cW $cH $sW $sH
|
||||
}
|
||||
if $callConfig {
|
||||
tixWidgetDoWhenIdle tixScrolledWidget:Configure $w
|
||||
}
|
||||
|
||||
return [list $hsbSpec $vsbSpec]
|
||||
}
|
||||
|
||||
#xF = xFirst
|
||||
#
|
||||
proc tixCObjView:SetScrollBars {w cW cH sW sH} {
|
||||
upvar #0 $w data
|
||||
|
||||
# puts "$data(xorig) <--> $data(sx1)"
|
||||
|
||||
set xF [expr ($data(xorig).0-$data(sx1).0)/$sW.0]
|
||||
set xL [expr $cW.0/$sW.0 + $xF]
|
||||
|
||||
set yF [expr ($data(yorig).0-$data(sy1).0)/$sH.0]
|
||||
set yL [expr $cH.0/$sH.0 + $yF]
|
||||
|
||||
# puts "$xF $xL : $yF $yL"
|
||||
$data(w:hsb) set $xF $xL
|
||||
$data(w:vsb) set $yF $yL
|
||||
}
|
||||
|
||||
proc tixCObjView:UserScroll {w dir type args} {
|
||||
upvar #0 $w data
|
||||
|
||||
$data(w:canvas) config -xscrollincrement 1 -yscrollincrement 1
|
||||
|
||||
case $dir {
|
||||
x {
|
||||
set n $data(xorig)
|
||||
set orig $data(xorig)
|
||||
set s1 $data(sx1)
|
||||
set total [expr {$data(sx2)-$data(sx1)}]
|
||||
set page [tixWinWidth $data(w:canvas)]
|
||||
set min $data(sx1)
|
||||
set max [expr {$data(sx1)+$total-$page}]
|
||||
set inc $data(-xscrollincrement)
|
||||
}
|
||||
y {
|
||||
set n $data(yorig)
|
||||
set orig $data(yorig)
|
||||
set s1 $data(sy1)
|
||||
set total [expr {$data(sy2)-$data(sy1)}]
|
||||
set page [tixWinHeight $data(w:canvas)]
|
||||
set min $data(sy1)
|
||||
set max [expr {$data(sy1)+$total-$page}]
|
||||
set inc $data(-yscrollincrement)
|
||||
}
|
||||
}
|
||||
|
||||
case $type {
|
||||
scroll {
|
||||
set amt [lindex $args 0]
|
||||
set unit [lindex $args 1]
|
||||
|
||||
case $unit {
|
||||
units {
|
||||
incr n [expr int($inc)*$amt]
|
||||
}
|
||||
pages {
|
||||
incr n [expr {$page*$amt}]
|
||||
}
|
||||
}
|
||||
}
|
||||
moveto {
|
||||
set first [lindex $args 0]
|
||||
set n [expr round($first*$total)+$s1]
|
||||
}
|
||||
}
|
||||
|
||||
if {$n < $min} {
|
||||
set n $min
|
||||
}
|
||||
if {$n > $max} {
|
||||
set n $max
|
||||
}
|
||||
|
||||
# puts "n=$n min=$min max=$max"
|
||||
|
||||
case $dir {
|
||||
x {
|
||||
$data(w:canvas) xview scroll [expr {$n-$orig}] units
|
||||
set data(xorig) $n
|
||||
}
|
||||
y {
|
||||
$data(w:canvas) yview scroll [expr {$n-$orig}] units
|
||||
set data(yorig) $n
|
||||
}
|
||||
}
|
||||
|
||||
set cW [tixWinWidth $data(w:canvas)]
|
||||
set cH [tixWinHeight $data(w:canvas)]
|
||||
set sW [expr {$data(sx2)-$data(sx1)+1}]
|
||||
set sH [expr {$data(sy2)-$data(sy1)+1}]
|
||||
|
||||
tixCObjView:SetScrollBars $w $cW $cH $sW $sH
|
||||
}
|
||||
|
||||
# Junk
|
||||
#
|
||||
#
|
||||
proc tixCObjView:XScroll {w first last} {
|
||||
upvar #0 $w data
|
||||
|
||||
set sc [$data(w:canvas) cget -scrollregion]
|
||||
if {$sc == ""} {
|
||||
set x1 1
|
||||
set x2 [tixWinWidth $data(w:canvas)]
|
||||
} else {
|
||||
set x1 [lindex $sc 0]
|
||||
set x2 [lindex $sc 2]
|
||||
}
|
||||
|
||||
set W [expr {$x2 - $x1}]
|
||||
if {$W < 1} {
|
||||
set W 1
|
||||
}
|
||||
|
||||
$data(w:hsb) set $first $last
|
||||
|
||||
# tixWidgetDoWhenIdle tixScrolledWidget:Configure $w
|
||||
}
|
||||
|
||||
# Junk
|
||||
#
|
||||
proc tixCObjView:YScroll {w first last} {
|
||||
upvar #0 $w data
|
||||
|
||||
set sc [$data(w:canvas) cget -scrollregion]
|
||||
|
||||
if {$sc == ""} {
|
||||
set y1 1
|
||||
set y2 [tixWinHeight $data(w:canvas)]
|
||||
} else {
|
||||
set y1 [lindex $sc 1]
|
||||
set y2 [lindex $sc 3]
|
||||
}
|
||||
|
||||
set H [expr {$y2 - $y1}]
|
||||
if {$H < 1} {
|
||||
set H 1
|
||||
}
|
||||
|
||||
$data(w:vsb) set $first $last
|
||||
|
||||
# tixWidgetDoWhenIdle tixScrolledWidget:Configure $w
|
||||
}
|
||||
239
win32/lib/tix8.4.3/ChkList.tcl
Normal file
@@ -0,0 +1,239 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: ChkList.tcl,v 1.6 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# ChkList.tcl --
|
||||
#
|
||||
# This file implements the TixCheckList widget.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
|
||||
tixWidgetClass tixCheckList {
|
||||
-classname TixCheckList
|
||||
-superclass tixTree
|
||||
-method {
|
||||
getselection getstatus setstatus
|
||||
}
|
||||
-flag {
|
||||
-radio
|
||||
}
|
||||
-configspec {
|
||||
{-radio radio Radio false tixVerifyBoolean}
|
||||
|
||||
{-ignoreinvoke ignoreInvoke IgnoreInvoke true tixVerifyBoolean}
|
||||
}
|
||||
-static {
|
||||
-radio
|
||||
}
|
||||
-default {
|
||||
{.scrollbar auto}
|
||||
{.doubleClick false}
|
||||
{*Scrollbar.takeFocus 0}
|
||||
{*borderWidth 1}
|
||||
{*hlist.background #c3c3c3}
|
||||
{*hlist.drawBranch 1}
|
||||
{*hlist.height 10}
|
||||
{*hlist.highlightBackground #d9d9d9}
|
||||
{*hlist.indicator 1}
|
||||
{*hlist.indent 20}
|
||||
{*hlist.itemType imagetext}
|
||||
{*hlist.padX 3}
|
||||
{*hlist.padY 0}
|
||||
{*hlist.relief sunken}
|
||||
{*hlist.takeFocus 1}
|
||||
{*hlist.wideSelection 0}
|
||||
{*hlist.width 20}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixCheckList:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
|
||||
if {$data(-radio)} {
|
||||
set data(selected) ""
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Widget commands
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
# Helper function for getselection
|
||||
#
|
||||
proc tixCheckList:GetSel {w var ent mode} {
|
||||
upvar #0 $w data
|
||||
upvar $var img
|
||||
|
||||
set ents ""
|
||||
|
||||
catch {
|
||||
if {[$data(w:hlist) entrycget $ent -bitmap] eq $img($mode)} {
|
||||
lappend ents $ent
|
||||
}
|
||||
}
|
||||
|
||||
foreach child [$data(w:hlist) info children $ent] {
|
||||
set ents [concat $ents [tixCheckList:GetSel $w img $child $mode]]
|
||||
}
|
||||
|
||||
return $ents
|
||||
}
|
||||
|
||||
|
||||
# Mode can be on, off, default
|
||||
#
|
||||
proc tixCheckList:getselection {w {mode on}} {
|
||||
upvar #0 $w data
|
||||
|
||||
set img(on) [tix getbitmap ck_on]
|
||||
set img(off) [tix getbitmap ck_off]
|
||||
set img(default) [tix getbitmap ck_def]
|
||||
|
||||
set ents ""
|
||||
foreach child [$data(w:hlist) info children] {
|
||||
set ents [concat $ents [tixCheckList:GetSel $w img $child $mode]]
|
||||
}
|
||||
return $ents
|
||||
}
|
||||
|
||||
proc tixCheckList:getstatus {w ent} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[$data(w:hlist) entrycget $ent -itemtype] eq "imagetext"} {
|
||||
set img(on) [tix getbitmap ck_on]
|
||||
set img(off) [tix getbitmap ck_off]
|
||||
set img(default) [tix getbitmap ck_def]
|
||||
|
||||
set bitmap [$data(w:hlist) entrycget $ent -bitmap]
|
||||
|
||||
if {$bitmap eq $img(on)} {
|
||||
set status on
|
||||
}
|
||||
if {$bitmap eq $img(off)} {
|
||||
set status off
|
||||
}
|
||||
if {$bitmap eq $img(default)} {
|
||||
set status default
|
||||
}
|
||||
}
|
||||
|
||||
if {[info exists status]} {
|
||||
return $status
|
||||
} else {
|
||||
return "none"
|
||||
}
|
||||
}
|
||||
|
||||
proc tixCheckList:setstatus {w ent {mode on}} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(-radio)} {
|
||||
set status [tixCheckList:getstatus $w $ent]
|
||||
|
||||
if {$status eq $mode} {
|
||||
return
|
||||
}
|
||||
|
||||
if {$mode eq "on"} {
|
||||
if {$data(selected) != ""} {
|
||||
tixCheckList:Select $w $data(selected) off
|
||||
}
|
||||
set data(selected) $ent
|
||||
tixCheckList:Select $w $ent $mode
|
||||
} elseif {$mode eq "off"} {
|
||||
if {$data(selected) eq $ent} {
|
||||
return
|
||||
}
|
||||
tixCheckList:Select $w $ent $mode
|
||||
} else {
|
||||
tixCheckList:Select $w $ent $mode
|
||||
}
|
||||
} else {
|
||||
tixCheckList:Select $w $ent $mode
|
||||
}
|
||||
}
|
||||
|
||||
proc tixCheckList:Select {w ent mode} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[$data(w:hlist) entrycget $ent -itemtype] eq "imagetext"} {
|
||||
set img(on) ck_on
|
||||
set img(off) ck_off
|
||||
set img(default) ck_def
|
||||
|
||||
if [catch {
|
||||
set bitmap [tix getbitmap $img($mode)]
|
||||
$data(w:hlist) entryconfig $ent -bitmap $bitmap
|
||||
}] {
|
||||
# must be the "none" mode
|
||||
#
|
||||
catch {
|
||||
$data(w:hlist) entryconfig $ent -bitmap ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $mode
|
||||
}
|
||||
|
||||
proc tixCheckList:HandleCheck {w ent} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[$data(w:hlist) entrycget $ent -itemtype] eq "imagetext"} {
|
||||
set img(on) [tix getbitmap ck_on]
|
||||
set img(off) [tix getbitmap ck_off]
|
||||
set img(default) [tix getbitmap ck_def]
|
||||
|
||||
set curMode [tixCheckList:getstatus $w $ent]
|
||||
|
||||
case $curMode {
|
||||
on {
|
||||
tixCheckList:setstatus $w $ent off
|
||||
}
|
||||
off {
|
||||
tixCheckList:setstatus $w $ent on
|
||||
}
|
||||
none {
|
||||
return
|
||||
}
|
||||
default {
|
||||
tixCheckList:setstatus $w $ent on
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixCheckList:Command {w B} {
|
||||
upvar #0 $w data
|
||||
upvar $B bind
|
||||
|
||||
set ent [tixEvent flag V]
|
||||
tixCheckList:HandleCheck $w $ent
|
||||
|
||||
tixChainMethod $w Command $B
|
||||
}
|
||||
|
||||
proc tixCheckList:BrowseCmd {w B} {
|
||||
upvar #0 $w data
|
||||
upvar $B bind
|
||||
|
||||
set ent [tixEvent flag V]
|
||||
|
||||
case [tixEvent type] {
|
||||
{<ButtonPress-1> <space>} {
|
||||
tixCheckList:HandleCheck $w $ent
|
||||
}
|
||||
}
|
||||
|
||||
tixChainMethod $w BrowseCmd $B
|
||||
}
|
||||
1558
win32/lib/tix8.4.3/ComboBox.tcl
Normal file
33
win32/lib/tix8.4.3/Compat.tcl
Normal file
@@ -0,0 +1,33 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: Compat.tcl,v 1.3 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# Compat.tcl --
|
||||
#
|
||||
# This file wraps around many incompatibilities from Tix 3.6
|
||||
# to Tix 4.0.
|
||||
#
|
||||
# (1) "box" to "Box" changes
|
||||
# (2) "DlgBtns" to "ButtonBox" changes
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
foreach {old new} {
|
||||
tixDlgBtns tixButtonBox
|
||||
tixStdDlgBtns tixStdButtonBox
|
||||
tixCombobox tixComboBox
|
||||
tixFileSelectbox tixFileSelectBox
|
||||
tixScrolledListbox tixScrolledListBox
|
||||
} {
|
||||
interp alias {} $old {} $new
|
||||
}
|
||||
|
||||
proc tixInit {args} {
|
||||
eval tix config $args
|
||||
puts stderr "tixInit no longer needed for this version of Tix"
|
||||
}
|
||||
612
win32/lib/tix8.4.3/Console.tcl
Normal file
@@ -0,0 +1,612 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: Console.tcl,v 1.5 2008/02/27 22:17:28 hobbs Exp $
|
||||
#
|
||||
# Console.tcl --
|
||||
#
|
||||
# This code constructs the console window for an application.
|
||||
# It can be used by non-unix systems that do not have built-in
|
||||
# support for shells.
|
||||
#
|
||||
# This file was distributed as a part of Tk 4.1 by Sun
|
||||
# Microsystems, Inc. and subsequently modified by Expert
|
||||
# Interface Techonoligies and included as a part of Tix.
|
||||
#
|
||||
# Some of the functions in this file have been renamed from
|
||||
# using a "tk" prefix to a "tix" prefix to avoid namespace
|
||||
# conflict with the original file.
|
||||
#
|
||||
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
#
|
||||
# See the file "docs/license.tcltk" for information on usage and
|
||||
# redistribution of the original file "console.tcl". These license
|
||||
# terms do NOT apply to other files in the Tix distribution.
|
||||
#
|
||||
# See the file "license.terms" for information on usage and
|
||||
# redistribution * of this file, and for a DISCLAIMER OF ALL
|
||||
# WARRANTIES.
|
||||
|
||||
# tixConsoleInit --
|
||||
# This procedure constructs and configures the console windows.
|
||||
#
|
||||
# Arguments:
|
||||
# None.
|
||||
|
||||
foreach fun {tkTextSetCursor} {
|
||||
if {![llength [info commands $fun]]} {
|
||||
tk::unsupported::ExposePrivateCommand $fun
|
||||
}
|
||||
}
|
||||
unset fun
|
||||
|
||||
proc tixConsoleInit {} {
|
||||
global tcl_platform
|
||||
|
||||
uplevel #0 set tixConsoleTextFont Courier
|
||||
uplevel #0 set tixConsoleTextSize 14
|
||||
|
||||
set f [frame .f]
|
||||
set fontcb [tixComboBox $f.size -label "" -command "tixConsoleSetFont" \
|
||||
-variable tixConsoleTextFont \
|
||||
-options {
|
||||
entry.width 15
|
||||
listbox.height 5
|
||||
}]
|
||||
set sizecb [tixComboBox $f.font -label "" -command "tixConsoleSetFont" \
|
||||
-variable tixConsoleTextSize \
|
||||
-options {
|
||||
entry.width 4
|
||||
listbox.width 6
|
||||
listbox.height 5
|
||||
}]
|
||||
pack $fontcb $sizecb -side left
|
||||
pack $f -side top -fill x -padx 2 -pady 2
|
||||
foreach font {
|
||||
"Courier New"
|
||||
"Courier"
|
||||
"Helvetica"
|
||||
"Lucida"
|
||||
"Lucida Typewriter"
|
||||
"MS LineDraw"
|
||||
"System"
|
||||
"Times Roman"
|
||||
} {
|
||||
$fontcb subwidget listbox insert end $font
|
||||
}
|
||||
|
||||
for {set s 6} {$s < 25} {incr s} {
|
||||
$sizecb subwidget listbox insert end $s
|
||||
}
|
||||
|
||||
bind [$fontcb subwidget entry] <Escape> "focus .console"
|
||||
bind [$sizecb subwidget entry] <Escape> "focus .console"
|
||||
|
||||
text .console -yscrollcommand ".sb set" -setgrid true \
|
||||
-highlightcolor [. cget -bg] -highlightbackground [. cget -bg]
|
||||
scrollbar .sb -command ".console yview" -highlightcolor [. cget -bg] \
|
||||
-highlightbackground [. cget -bg]
|
||||
pack .sb -side right -fill both
|
||||
pack .console -fill both -expand 1 -side left
|
||||
|
||||
tixConsoleBind .console
|
||||
|
||||
.console tag configure stderr -foreground red
|
||||
.console tag configure stdin -foreground blue
|
||||
|
||||
focus .console
|
||||
|
||||
wm protocol . WM_DELETE_WINDOW { wm withdraw . }
|
||||
wm title . "Console"
|
||||
flush stdout
|
||||
.console mark set output [.console index "end - 1 char"]
|
||||
tkTextSetCursor .console end
|
||||
.console mark set promptEnd insert
|
||||
.console mark gravity promptEnd left
|
||||
|
||||
tixConsoleSetFont
|
||||
}
|
||||
|
||||
proc tixConsoleSetFont {args} {
|
||||
if ![winfo exists .console] tixConsoleInit
|
||||
|
||||
global tixConsoleTextFont tixConsoleTextSize
|
||||
|
||||
set font -*-$tixConsoleTextFont-medium-r-normal-*-$tixConsoleTextSize-*-*-*-*-*-*-*
|
||||
.console config -font $font
|
||||
}
|
||||
|
||||
# tixConsoleInvoke --
|
||||
# Processes the command line input. If the command is complete it
|
||||
# is evaled in the main interpreter. Otherwise, the continuation
|
||||
# prompt is added and more input may be added.
|
||||
#
|
||||
# Arguments:
|
||||
# None.
|
||||
|
||||
proc tixConsoleInvoke {args} {
|
||||
if ![winfo exists .console] tixConsoleInit
|
||||
|
||||
if {[.console dlineinfo insert] != {}} {
|
||||
set setend 1
|
||||
} else {
|
||||
set setend 0
|
||||
}
|
||||
set ranges [.console tag ranges input]
|
||||
set cmd ""
|
||||
if {$ranges != ""} {
|
||||
set pos 0
|
||||
while {[lindex $ranges $pos] != ""} {
|
||||
set start [lindex $ranges $pos]
|
||||
set end [lindex $ranges [incr pos]]
|
||||
append cmd [.console get $start $end]
|
||||
incr pos
|
||||
}
|
||||
}
|
||||
if {$cmd == ""} {
|
||||
tixConsolePrompt
|
||||
} elseif {[info complete $cmd]} {
|
||||
.console mark set output end
|
||||
.console tag delete input
|
||||
set err [catch {
|
||||
set result [interp record $cmd]
|
||||
} result]
|
||||
|
||||
if {$result != ""} {
|
||||
if {$err} {
|
||||
.console insert insert "$result\n" stderr
|
||||
} else {
|
||||
.console insert insert "$result\n"
|
||||
}
|
||||
}
|
||||
tixConsoleHistory reset
|
||||
tixConsolePrompt
|
||||
} else {
|
||||
tixConsolePrompt partial
|
||||
}
|
||||
if {$setend} {
|
||||
.console yview -pickplace insert
|
||||
}
|
||||
}
|
||||
|
||||
# tixConsoleHistory --
|
||||
# This procedure implements command line history for the
|
||||
# console. In general is evals the history command in the
|
||||
# main interpreter to obtain the history. The global variable
|
||||
# histNum is used to store the current location in the history.
|
||||
#
|
||||
# Arguments:
|
||||
# cmd - Which action to take: prev, next, reset.
|
||||
|
||||
set histNum 1
|
||||
proc tixConsoleHistory {cmd} {
|
||||
if ![winfo exists .console] tixConsoleInit
|
||||
|
||||
global histNum
|
||||
|
||||
switch $cmd {
|
||||
prev {
|
||||
incr histNum -1
|
||||
if {$histNum == 0} {
|
||||
set cmd {history event [expr [history nextid] -1]}
|
||||
} else {
|
||||
set cmd "history event $histNum"
|
||||
}
|
||||
if {[catch {interp eval $cmd} cmd]} {
|
||||
incr histNum
|
||||
return
|
||||
}
|
||||
.console delete promptEnd end
|
||||
.console insert promptEnd $cmd {input stdin}
|
||||
}
|
||||
next {
|
||||
incr histNum
|
||||
if {$histNum == 0} {
|
||||
set cmd {history event [expr [history nextid] -1]}
|
||||
} elseif {$histNum > 0} {
|
||||
set cmd ""
|
||||
set histNum 1
|
||||
} else {
|
||||
set cmd "history event $histNum"
|
||||
}
|
||||
if {$cmd != ""} {
|
||||
catch {interp eval $cmd} cmd
|
||||
}
|
||||
.console delete promptEnd end
|
||||
.console insert promptEnd $cmd {input stdin}
|
||||
}
|
||||
reset {
|
||||
set histNum 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# tixConsolePrompt --
|
||||
# This procedure draws the prompt. If tcl_prompt1 or tcl_prompt2
|
||||
# exists in the main interpreter it will be called to generate the
|
||||
# prompt. Otherwise, a hard coded default prompt is printed.
|
||||
#
|
||||
# Arguments:
|
||||
# partial - Flag to specify which prompt to print.
|
||||
|
||||
proc tixConsolePrompt {{partial normal}} {
|
||||
if ![winfo exists .console] tixConsoleInit
|
||||
|
||||
if {$partial == "normal"} {
|
||||
set temp [.console index "end - 1 char"]
|
||||
.console mark set output end
|
||||
if {[interp eval "info exists tcl_prompt1"]} {
|
||||
interp eval "eval \[set tcl_prompt1\]"
|
||||
} else {
|
||||
puts -nonewline "% "
|
||||
}
|
||||
} else {
|
||||
set temp [.console index output]
|
||||
.console mark set output end
|
||||
if {[interp eval "info exists tcl_prompt2"]} {
|
||||
interp eval "eval \[set tcl_prompt2\]"
|
||||
} else {
|
||||
puts -nonewline "> "
|
||||
}
|
||||
}
|
||||
|
||||
flush stdout
|
||||
.console mark set output $temp
|
||||
tkTextSetCursor .console end
|
||||
.console mark set promptEnd insert
|
||||
.console mark gravity promptEnd left
|
||||
}
|
||||
|
||||
# tixConsoleBind --
|
||||
# This procedure first ensures that the default bindings for the Text
|
||||
# class have been defined. Then certain bindings are overridden for
|
||||
# the class.
|
||||
#
|
||||
# Arguments:
|
||||
# None.
|
||||
|
||||
proc tixConsoleBind {win} {
|
||||
if ![winfo exists .console] tixConsoleInit
|
||||
|
||||
bindtags $win "$win Text . all"
|
||||
|
||||
# Ignore all Alt, Meta, and Control keypresses unless explicitly bound.
|
||||
# Otherwise, if a widget binding for one of these is defined, the
|
||||
# <KeyPress> class binding will also fire and insert the character,
|
||||
# which is wrong. Ditto for <Escape>.
|
||||
|
||||
bind $win <Alt-KeyPress> {# nothing }
|
||||
bind $win <Meta-KeyPress> {# nothing}
|
||||
bind $win <Control-KeyPress> {# nothing}
|
||||
bind $win <Escape> {# nothing}
|
||||
bind $win <KP_Enter> {# nothing}
|
||||
|
||||
bind $win <Tab> {
|
||||
tixConsoleInsert %W \t
|
||||
focus %W
|
||||
break
|
||||
}
|
||||
bind $win <Return> {
|
||||
%W mark set insert {end - 1c}
|
||||
tixConsoleInsert %W "\n"
|
||||
tixConsoleInvoke
|
||||
break
|
||||
}
|
||||
bind $win <Delete> {
|
||||
if {[%W tag nextrange sel 1.0 end] != ""} {
|
||||
%W tag remove sel sel.first promptEnd
|
||||
} else {
|
||||
if {[%W compare insert < promptEnd]} {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
bind $win <BackSpace> {
|
||||
if {[%W tag nextrange sel 1.0 end] != ""} {
|
||||
%W tag remove sel sel.first promptEnd
|
||||
} else {
|
||||
if {[%W compare insert <= promptEnd]} {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach left {Control-a Home} {
|
||||
bind $win <$left> {
|
||||
if {[%W compare insert < promptEnd]} {
|
||||
tkTextSetCursor %W {insert linestart}
|
||||
} else {
|
||||
tkTextSetCursor %W promptEnd
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
foreach right {Control-e End} {
|
||||
bind $win <$right> {
|
||||
tkTextSetCursor %W {insert lineend}
|
||||
break
|
||||
}
|
||||
}
|
||||
bind $win <Control-d> {
|
||||
if {[%W compare insert < promptEnd]} {
|
||||
break
|
||||
}
|
||||
}
|
||||
bind $win <Control-k> {
|
||||
if {[%W compare insert < promptEnd]} {
|
||||
%W mark set insert promptEnd
|
||||
}
|
||||
}
|
||||
bind $win <Control-t> {
|
||||
if {[%W compare insert < promptEnd]} {
|
||||
break
|
||||
}
|
||||
}
|
||||
bind $win <Meta-d> {
|
||||
if {[%W compare insert < promptEnd]} {
|
||||
break
|
||||
}
|
||||
}
|
||||
bind $win <Meta-BackSpace> {
|
||||
if {[%W compare insert <= promptEnd]} {
|
||||
break
|
||||
}
|
||||
}
|
||||
bind $win <Control-h> {
|
||||
if {[%W compare insert <= promptEnd]} {
|
||||
break
|
||||
}
|
||||
}
|
||||
foreach prev {Control-p Up} {
|
||||
bind $win <$prev> {
|
||||
tixConsoleHistory prev
|
||||
break
|
||||
}
|
||||
}
|
||||
foreach prev {Control-n Down} {
|
||||
bind $win <$prev> {
|
||||
tixConsoleHistory next
|
||||
break
|
||||
}
|
||||
}
|
||||
bind $win <Control-v> {
|
||||
if {[%W compare insert > promptEnd]} {
|
||||
catch {
|
||||
%W insert insert [selection get -displayof %W] {input stdin}
|
||||
%W see insert
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
bind $win <Insert> {
|
||||
catch {tixConsoleInsert %W [selection get -displayof %W]}
|
||||
break
|
||||
}
|
||||
bind $win <KeyPress> {
|
||||
tixConsoleInsert %W %A
|
||||
break
|
||||
}
|
||||
foreach left {Control-b Left} {
|
||||
bind $win <$left> {
|
||||
if {[%W compare insert == promptEnd]} {
|
||||
break
|
||||
}
|
||||
tkTextSetCursor %W insert-1c
|
||||
break
|
||||
}
|
||||
}
|
||||
foreach right {Control-f Right} {
|
||||
bind $win <$right> {
|
||||
tkTextSetCursor %W insert+1c
|
||||
break
|
||||
}
|
||||
}
|
||||
bind $win <Control-Up> {
|
||||
%W yview scroll -1 unit
|
||||
break;
|
||||
}
|
||||
bind $win <Control-Down> {
|
||||
%W yview scroll 1 unit
|
||||
break;
|
||||
}
|
||||
bind $win <Prior> {
|
||||
%W yview scroll -1 pages
|
||||
}
|
||||
bind $win <Next> {
|
||||
%W yview scroll 1 pages
|
||||
}
|
||||
bind $win <F9> {
|
||||
eval destroy [winfo child .]
|
||||
source $tix_library/Console.tcl
|
||||
}
|
||||
foreach copy {F16 Meta-w Control-i} {
|
||||
bind $win <$copy> {
|
||||
if {[selection own -displayof %W] == "%W"} {
|
||||
clipboard clear -displayof %W
|
||||
catch {
|
||||
clipboard append -displayof %W [selection get -displayof %W]
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
foreach paste {F18 Control-y} {
|
||||
bind $win <$paste> {
|
||||
catch {
|
||||
set clip [selection get -displayof %W -selection CLIPBOARD]
|
||||
set list [split $clip \n\r]
|
||||
tixConsoleInsert %W [lindex $list 0]
|
||||
foreach x [lrange $list 1 end] {
|
||||
%W mark set insert {end - 1c}
|
||||
tixConsoleInsert %W "\n"
|
||||
tixConsoleInvoke
|
||||
tixConsoleInsert %W $x
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# tixConsoleInsert --
|
||||
# Insert a string into a text at the point of the insertion cursor.
|
||||
# If there is a selection in the text, and it covers the point of the
|
||||
# insertion cursor, then delete the selection before inserting. Insertion
|
||||
# is restricted to the prompt area.
|
||||
#
|
||||
# Arguments:
|
||||
# w - The text window in which to insert the string
|
||||
# s - The string to insert (usually just a single character)
|
||||
|
||||
proc tixConsoleInsert {w s} {
|
||||
if ![winfo exists .console] tixConsoleInit
|
||||
|
||||
if {[.console dlineinfo insert] != {}} {
|
||||
set setend 1
|
||||
} else {
|
||||
set setend 0
|
||||
}
|
||||
if {$s == ""} {
|
||||
return
|
||||
}
|
||||
catch {
|
||||
if {[$w compare sel.first <= insert]
|
||||
&& [$w compare sel.last >= insert]} {
|
||||
$w tag remove sel sel.first promptEnd
|
||||
$w delete sel.first sel.last
|
||||
}
|
||||
}
|
||||
if {[$w compare insert < promptEnd]} {
|
||||
$w mark set insert end
|
||||
}
|
||||
$w insert insert $s {input stdin}
|
||||
if $setend {
|
||||
.console see insert
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
# tixConsoleOutput --
|
||||
#
|
||||
# This routine is called directly by ConsolePutsCmd to cause a string
|
||||
# to be displayed in the console.
|
||||
#
|
||||
# Arguments:
|
||||
# dest - The output tag to be used: either "stderr" or "stdout".
|
||||
# string - The string to be displayed.
|
||||
|
||||
proc tixConsoleOutput {dest string} {
|
||||
if ![winfo exists .console] tixConsoleInit
|
||||
|
||||
if {[.console dlineinfo insert] != {}} {
|
||||
set setend 1
|
||||
} else {
|
||||
set setend 0
|
||||
}
|
||||
.console insert output $string $dest
|
||||
if $setend {
|
||||
.console see insert
|
||||
}
|
||||
}
|
||||
|
||||
# tixConsoleExit --
|
||||
#
|
||||
# This routine is called by ConsoleEventProc when the main window of
|
||||
# the application is destroyed.
|
||||
#
|
||||
# Arguments:
|
||||
# None.
|
||||
|
||||
proc tixConsoleExit {} {
|
||||
if ![winfo exists .console] tixConsoleInit
|
||||
|
||||
exit
|
||||
}
|
||||
|
||||
# Configure the default Tk console
|
||||
proc tixConsoleEvalAppend {inter} {
|
||||
global tixOption
|
||||
# A slave like the console interp has no global variables set!
|
||||
|
||||
if {!$inter} {
|
||||
console hide
|
||||
|
||||
# Change the menubar to Close the console instead of exiting
|
||||
# Your code must provide a way for the user to do a "console show"
|
||||
console eval {
|
||||
if {[winfo exists .menubar.file]} {
|
||||
.menubar.file entryconfigure "Hide Console" \
|
||||
-underline 0 \
|
||||
-label Close \
|
||||
-command [list wm withdraw .]
|
||||
.menubar.file entryconfigure Exit -state disabled
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console eval ".option configure -font \{$tixOption(fixed_font)\}"
|
||||
|
||||
console eval {
|
||||
if {[winfo exists .menubar.edit]} {
|
||||
.menubar.edit add sep
|
||||
.menubar.edit add command \
|
||||
-accelerator 'Ctrl+l' \
|
||||
-underline 0 \
|
||||
-label Clear \
|
||||
-command [list .console delete 1.0 end]
|
||||
bind .console <Control-Key-l> [list .console delete 1.0 end]
|
||||
}
|
||||
if {![winfo exists .menubar.font]} {
|
||||
set m .menubar.font
|
||||
menu $m -tearoff 0
|
||||
.menubar add cascade -menu .menubar.font \
|
||||
-underline 0 -label Options
|
||||
|
||||
global _TixConsole
|
||||
set font [font actual [.console cget -font]]
|
||||
set pos [lsearch $font -family]
|
||||
set _TixConsole(font) [lindex $font [incr pos]]
|
||||
set pos [lsearch $font -size]
|
||||
set _TixConsole(size) [lindex $font [incr pos]]
|
||||
set pos [lsearch $font -weight]
|
||||
set _TixConsole(weight) [lindex $font [incr pos]]
|
||||
|
||||
set allowed {System Fixedsys Terminal {MS Serif}
|
||||
{MS Sans Serif} Courier {Lucida Console} Tahoma
|
||||
Arial {Courier New} {Times New Roman}
|
||||
{Arial Black} Verdana Garamond {Arial Narrow}}
|
||||
.menubar.font add cascade -label Font -menu $m.font
|
||||
menu $m.font -tearoff 0
|
||||
foreach font [lsort [font families]] {
|
||||
if {[lsearch $allowed $font] < 0} {continue}
|
||||
$m.font add radiobutton -label $font \
|
||||
-variable _TixConsole(font) \
|
||||
-value $font \
|
||||
-command \
|
||||
".console configure -font \"\{$font\} \$_TixConsole(size) \$_TixConsole(weight)\""
|
||||
}
|
||||
|
||||
.menubar.font add cascade -label Size -menu $m.size
|
||||
menu $m.size -tearoff 0
|
||||
foreach size {8 9 10 12 14 16 18} {
|
||||
$m.size add radiobutton -label $size \
|
||||
-variable _TixConsole(size) \
|
||||
-value $size \
|
||||
-command \
|
||||
".console configure -font \"\{\$_TixConsole(font)\} $size \$_TixConsole(weight)\""
|
||||
}
|
||||
|
||||
.menubar.font add cascade -label Weight -menu $m.weight
|
||||
menu $m.weight -tearoff 0
|
||||
foreach weight {normal bold} {
|
||||
$m.weight add radiobutton -label [string totit $weight] \
|
||||
-variable _TixConsole(weight) \
|
||||
-value $weight \
|
||||
-command \
|
||||
".console configure -font \"\{\$_TixConsole(font)\} \$_TixConsole(size) $weight\""
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
482
win32/lib/tix8.4.3/Control.tcl
Normal file
@@ -0,0 +1,482 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: Control.tcl,v 1.9 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# Control.tcl --
|
||||
#
|
||||
# Implements the TixControl Widget. It is called the "SpinBox"
|
||||
# in other toolkits.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
|
||||
tixWidgetClass tixControl {
|
||||
-classname TixControl
|
||||
-superclass tixLabelWidget
|
||||
-method {
|
||||
incr decr invoke update
|
||||
}
|
||||
-flag {
|
||||
-allowempty -autorepeat -command -decrcmd -disablecallback
|
||||
-disabledforeground -incrcmd -initwait -integer -llimit
|
||||
-repeatrate -max -min -selectmode -step -state -validatecmd
|
||||
-value -variable -ulimit
|
||||
}
|
||||
-forcecall {
|
||||
-variable -state
|
||||
}
|
||||
-configspec {
|
||||
{-allowempty allowEmpty AllowEmpty false}
|
||||
{-autorepeat autoRepeat AutoRepeat true}
|
||||
{-command command Command ""}
|
||||
{-decrcmd decrCmd DecrCmd ""}
|
||||
{-disablecallback disableCallback DisableCallback 0 tixVerifyBoolean}
|
||||
{-disabledforeground disabledForeground DisabledForeground #303030}
|
||||
{-incrcmd incrCmd IncrCmd ""}
|
||||
{-initwait initWait InitWait 500}
|
||||
{-integer integer Integer false}
|
||||
{-max max Max ""}
|
||||
{-min min Min ""}
|
||||
{-repeatrate repeatRate RepeatRate 50}
|
||||
{-step step Step 1}
|
||||
{-state state State normal}
|
||||
{-selectmode selectMode SelectMode normal}
|
||||
{-validatecmd validateCmd ValidateCmd ""}
|
||||
{-value value Value 0}
|
||||
{-variable variable Variable ""}
|
||||
}
|
||||
-alias {
|
||||
{-llimit -min}
|
||||
{-ulimit -max}
|
||||
}
|
||||
-default {
|
||||
{.borderWidth 0}
|
||||
{*entry.relief sunken}
|
||||
{*entry.width 5}
|
||||
{*label.anchor e}
|
||||
{*label.borderWidth 0}
|
||||
{*Button.anchor c}
|
||||
{*Button.borderWidth 2}
|
||||
{*Button.highlightThickness 1}
|
||||
{*Button.takeFocus 0}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixControl:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
|
||||
set data(varInited) 0
|
||||
set data(serial) 0
|
||||
}
|
||||
|
||||
proc tixControl:ConstructFramedWidget {w frame} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructFramedWidget $frame
|
||||
|
||||
set data(w:entry) [entry $frame.entry]
|
||||
|
||||
set data(w:incr) \
|
||||
[button $frame.incr -bitmap [tix getbitmap incr] -takefocus 0]
|
||||
set data(w:decr) \
|
||||
[button $frame.decr -bitmap [tix getbitmap decr] -takefocus 0]
|
||||
|
||||
# tixForm $data(w:entry) -left 0 -top 0 -bottom -1 -right $data(w:decr)
|
||||
# tixForm $data(w:incr) -right -1 -top 0 -bottom %50
|
||||
# tixForm $data(w:decr) -right -1 -top $data(w:incr) -bottom -1
|
||||
|
||||
pack $data(w:entry) -side left -expand yes -fill both
|
||||
pack $data(w:decr) -side bottom -fill both -expand yes
|
||||
pack $data(w:incr) -side top -fill both -expand yes
|
||||
|
||||
$data(w:entry) delete 0 end
|
||||
$data(w:entry) insert 0 $data(-value)
|
||||
|
||||
# This value is used to configure the disable/normal fg of the ebtry
|
||||
set data(entryfg) [$data(w:entry) cget -fg]
|
||||
set data(labelfg) [$data(w:label) cget -fg]
|
||||
}
|
||||
|
||||
proc tixControl:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
|
||||
bind $data(w:incr) <ButtonPress-1> \
|
||||
[list after idle tixControl:StartRepeat $w 1]
|
||||
bind $data(w:decr) <ButtonPress-1> \
|
||||
[list after idle tixControl:StartRepeat $w -1]
|
||||
|
||||
# These bindings will stop the button autorepeat when the
|
||||
# mouse button is up
|
||||
foreach btn [list $data(w:incr) $data(w:decr)] {
|
||||
bind $btn <ButtonRelease-1> [list tixControl:StopRepeat $w]
|
||||
}
|
||||
|
||||
tixSetMegaWidget $data(w:entry) $w
|
||||
|
||||
# If user press <return>, verify the value and call the -command
|
||||
#
|
||||
tixAddBindTag $data(w:entry) TixControl:Entry
|
||||
}
|
||||
|
||||
proc tixControlBind {} {
|
||||
tixBind TixControl:Entry <Return> {
|
||||
tixControl:Invoke [tixGetMegaWidget %W] 1
|
||||
}
|
||||
tixBind TixControl:Entry <Escape> {
|
||||
tixControl:Escape [tixGetMegaWidget %W]
|
||||
}
|
||||
tixBind TixControl:Entry <Up> {
|
||||
[tixGetMegaWidget %W] incr
|
||||
}
|
||||
tixBind TixControl:Entry <Down> {
|
||||
[tixGetMegaWidget %W] decr
|
||||
}
|
||||
tixBind TixControl:Entry <FocusOut> {
|
||||
if {"%d" eq "NotifyNonlinear" || "%d" eq "NotifyNonlinearVirtual"} {
|
||||
tixControl:Tab [tixGetMegaWidget %W] %d
|
||||
}
|
||||
}
|
||||
tixBind TixControl:Entry <Any-KeyPress> {
|
||||
tixControl:KeyPress [tixGetMegaWidget %W]
|
||||
}
|
||||
tixBind TixControl:Entry <Any-Tab> {
|
||||
# This has a higher priority than the <Any-KeyPress> binding
|
||||
# --> so that data(edited) is not set
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# CONFIG OPTIONS
|
||||
#----------------------------------------------------------------------
|
||||
proc tixControl:config-state {w arg} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$arg eq "normal"} {
|
||||
$data(w:incr) config -state $arg
|
||||
$data(w:decr) config -state $arg
|
||||
catch {
|
||||
$data(w:label) config -fg $data(labelfg)
|
||||
}
|
||||
$data(w:entry) config -state $arg -fg $data(entryfg)
|
||||
} else {
|
||||
$data(w:incr) config -state $arg
|
||||
$data(w:decr) config -state $arg
|
||||
catch {
|
||||
$data(w:label) config -fg $data(-disabledforeground)
|
||||
}
|
||||
$data(w:entry) config -state $arg -fg $data(-disabledforeground)
|
||||
}
|
||||
}
|
||||
|
||||
proc tixControl:config-value {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixControl:SetValue $w $value 0 1
|
||||
|
||||
# This will tell the Intrinsics: "Please use this value"
|
||||
# because "value" might be altered by SetValues
|
||||
#
|
||||
return $data(-value)
|
||||
}
|
||||
|
||||
proc tixControl:config-variable {w arg} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[tixVariable:ConfigVariable $w $arg]} {
|
||||
# The value of data(-value) is changed if tixVariable:ConfigVariable
|
||||
# returns true
|
||||
tixControl:SetValue $w $data(-value) 1 1
|
||||
}
|
||||
catch {
|
||||
unset data(varInited)
|
||||
}
|
||||
set data(-variable) $arg
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# User Commands
|
||||
#----------------------------------------------------------------------
|
||||
proc tixControl:incr {w {by 1}} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(-state) ne "disabled"} {
|
||||
if {![catch {$data(w:entry) index sel.first}]} {
|
||||
$data(w:entry) select from end
|
||||
$data(w:entry) select to end
|
||||
}
|
||||
# CYGNUS - why set value before changing it?
|
||||
#tixControl:SetValue $w [$data(w:entry) get] 0 1
|
||||
tixControl:AdjustValue $w $by
|
||||
}
|
||||
}
|
||||
|
||||
proc tixControl:decr {w {by 1}} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(-state) ne "disabled"} {
|
||||
if {![catch {$data(w:entry) index sel.first}]} {
|
||||
$data(w:entry) select from end
|
||||
$data(w:entry) select to end
|
||||
}
|
||||
# CYGNUS - why set value before changing it?
|
||||
#tixControl:SetValue $w [$data(w:entry) get] 0 1
|
||||
tixControl:AdjustValue $w [expr {0 - $by}]
|
||||
}
|
||||
}
|
||||
|
||||
proc tixControl:invoke {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixControl:Invoke $w 0
|
||||
}
|
||||
|
||||
proc tixControl:update {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[info exists data(edited)]} {
|
||||
tixControl:invoke $w
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Internal Commands
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
# Change the value by a multiple of the data(-step)
|
||||
#
|
||||
proc tixControl:AdjustValue {w amount} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$amount == 1 && [llength $data(-incrcmd)]} {
|
||||
set newValue [tixEvalCmdBinding $w $data(-incrcmd) "" $data(-value)]
|
||||
} elseif {$amount == -1 && [llength $data(-decrcmd)]} {
|
||||
set newValue [tixEvalCmdBinding $w $data(-decrcmd) "" $data(-value)]
|
||||
} else {
|
||||
set newValue [expr {$data(-value) + $amount * $data(-step)}]
|
||||
}
|
||||
|
||||
if {$data(-state) ne "disabled"} {
|
||||
tixControl:SetValue $w $newValue 0 1
|
||||
}
|
||||
}
|
||||
|
||||
proc tixControl:SetValue {w newvalue noUpdate forced} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[$data(w:entry) selection present]} {
|
||||
set oldSelection [list [$data(w:entry) index sel.first] \
|
||||
[$data(w:entry) index sel.last]]
|
||||
}
|
||||
|
||||
set oldvalue $data(-value)
|
||||
set oldCursor [$data(w:entry) index insert]
|
||||
set changed 0
|
||||
|
||||
|
||||
if {[llength $data(-validatecmd)]} {
|
||||
# Call the user supplied validation command
|
||||
#
|
||||
set data(-value) [tixEvalCmdBinding $w $data(-validatecmd) "" $newvalue]
|
||||
} else {
|
||||
# Here we only allow int or floating numbers
|
||||
#
|
||||
# If the new value is not a valid number, the old value will be
|
||||
# kept due to the "catch" statements
|
||||
#
|
||||
if {[catch {expr 0+$newvalue}]} {
|
||||
set newvalue 0
|
||||
set data(-value) 0
|
||||
set changed 1
|
||||
}
|
||||
|
||||
if {$newvalue == ""} {
|
||||
if {![string is true -strict $data(-allowempty)]} {
|
||||
set newvalue 0
|
||||
set changed 1
|
||||
} else {
|
||||
set data(-value) ""
|
||||
}
|
||||
}
|
||||
|
||||
if {$newvalue != ""} {
|
||||
# Change this to a valid decimal string (trim leading 0)
|
||||
#
|
||||
regsub -- {^[0]*} $newvalue "" newvalue
|
||||
if {[catch {expr 0+$newvalue}]} {
|
||||
set newvalue 0
|
||||
set data(-value) 0
|
||||
set changed 1
|
||||
}
|
||||
if {$newvalue == ""} {
|
||||
set newvalue 0
|
||||
}
|
||||
|
||||
if {[string is true -strict $data(-integer)]} {
|
||||
set data(-value) [tixGetInt -nocomplain $newvalue]
|
||||
} else {
|
||||
if {[catch {set data(-value) [format "%d" $newvalue]}]} {
|
||||
if {[catch {set data(-value) [expr $newvalue+0.0]}]} {
|
||||
set data(-value) $oldvalue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Now perform boundary checking
|
||||
#
|
||||
if {$data(-max) != "" && $data(-value) > $data(-max)} {
|
||||
set data(-value) $data(-max)
|
||||
}
|
||||
if {$data(-min) != "" && $data(-value) < $data(-min)} {
|
||||
set data(-value) $data(-min)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if {! $noUpdate} {
|
||||
tixVariable:UpdateVariable $w
|
||||
}
|
||||
|
||||
if {$forced || ($newvalue ne $data(-value)) || $changed} {
|
||||
$data(w:entry) delete 0 end
|
||||
$data(w:entry) insert 0 $data(-value)
|
||||
$data(w:entry) icursor $oldCursor
|
||||
if {[info exists oldSelection]} {
|
||||
eval [list $data(w:entry) selection range] $oldSelection
|
||||
}
|
||||
}
|
||||
|
||||
if {!$data(-disablecallback) && $data(-command) != ""} {
|
||||
if {![info exists data(varInited)]} {
|
||||
set bind(specs) ""
|
||||
tixEvalCmdBinding $w $data(-command) bind $data(-value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixControl:Invoke {w forced} {
|
||||
upvar #0 $w data
|
||||
|
||||
catch {
|
||||
unset data(edited)
|
||||
}
|
||||
|
||||
if {[catch {$data(w:entry) index sel.first}] == 0} {
|
||||
# THIS ENTRY OWNS SELECTION --> TURN IT OFF
|
||||
#
|
||||
$data(w:entry) select from end
|
||||
$data(w:entry) select to end
|
||||
}
|
||||
|
||||
tixControl:SetValue $w [$data(w:entry) get] 0 $forced
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# The three functions StartRepeat, Repeat and StopRepeat make use of the
|
||||
# data(serial) variable to discard spurious repeats: If a button is clicked
|
||||
# repeatedly but is not hold down, the serial counter will increase
|
||||
# successively and all "after" time event handlers will be discarded
|
||||
#----------------------------------------------------------------------
|
||||
proc tixControl:StartRepeat {w amount} {
|
||||
if {![winfo exists $w]} {
|
||||
return
|
||||
}
|
||||
|
||||
upvar #0 $w data
|
||||
|
||||
incr data(serial)
|
||||
# CYGNUS bug fix
|
||||
# Need to set a local variable because otherwise the buttonrelease
|
||||
# callback could change the value of data(serial) between now and
|
||||
# the time the repeat is scheduled.
|
||||
set serial $data(serial)
|
||||
|
||||
if {![catch {$data(w:entry) index sel.first}]} {
|
||||
$data(w:entry) select from end
|
||||
$data(w:entry) select to end
|
||||
}
|
||||
|
||||
if {[info exists data(edited)]} {
|
||||
unset data(edited)
|
||||
tixControl:SetValue $w [$data(w:entry) get] 0 1
|
||||
}
|
||||
|
||||
tixControl:AdjustValue $w $amount
|
||||
|
||||
if {$data(-autorepeat)} {
|
||||
after $data(-initwait) tixControl:Repeat $w $amount $serial
|
||||
}
|
||||
|
||||
focus $data(w:entry)
|
||||
}
|
||||
|
||||
proc tixControl:Repeat {w amount serial} {
|
||||
if {![winfo exists $w]} {
|
||||
return
|
||||
}
|
||||
upvar #0 $w data
|
||||
|
||||
if {$serial eq $data(serial)} {
|
||||
tixControl:AdjustValue $w $amount
|
||||
|
||||
if {$data(-autorepeat)} {
|
||||
after $data(-repeatrate) tixControl:Repeat $w $amount $serial
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixControl:StopRepeat {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
incr data(serial)
|
||||
}
|
||||
|
||||
proc tixControl:Destructor {w} {
|
||||
|
||||
tixVariable:DeleteVariable $w
|
||||
|
||||
# Chain this to the superclass
|
||||
#
|
||||
tixChainMethod $w Destructor
|
||||
}
|
||||
|
||||
# ToDo: maybe should return -code break if the value is not good ...
|
||||
#
|
||||
proc tixControl:Tab {w detail} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {![info exists data(edited)]} {
|
||||
return
|
||||
} else {
|
||||
unset data(edited)
|
||||
}
|
||||
|
||||
tixControl:invoke $w
|
||||
}
|
||||
|
||||
proc tixControl:Escape {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
$data(w:entry) delete 0 end
|
||||
$data(w:entry) insert 0 $data(-value)
|
||||
}
|
||||
|
||||
proc tixControl:KeyPress {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(-selectmode) eq "normal"} {
|
||||
set data(edited) 0
|
||||
return
|
||||
} else {
|
||||
# == "immediate"
|
||||
after 1 tixControl:invoke $w
|
||||
}
|
||||
}
|
||||
103
win32/lib/tix8.4.3/DefSchm.tcl
Normal file
@@ -0,0 +1,103 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: DefSchm.tcl,v 1.2 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# DefSchm.tcl --
|
||||
#
|
||||
# Implements the default color and font schemes for Tix.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
proc tixSetDefaultFontset {} {
|
||||
global tixOption tcl_platform
|
||||
|
||||
switch -- $tcl_platform(platform) "windows" {
|
||||
# This should be Tahoma for Win2000/XP
|
||||
set font "MS Sans Serif"
|
||||
set fixedfont "Courier New"
|
||||
set size 8
|
||||
} unix {
|
||||
set font "helvetica"
|
||||
set fixedfont "courier"
|
||||
set size -12
|
||||
}
|
||||
|
||||
set tixOption(font) [list $font $size]
|
||||
set tixOption(bold_font) [list $font $size bold]
|
||||
set tixOption(menu_font) [list $font $size]
|
||||
set tixOption(italic_font) [list $font $size bold italic]
|
||||
set tixOption(fixed_font) [list $fixedfont $size]
|
||||
set tixOption(border1) 1
|
||||
}
|
||||
|
||||
proc tixSetDefaultScheme-Color {} {
|
||||
global tixOption
|
||||
|
||||
set tixOption(bg) #d9d9d9
|
||||
set tixOption(fg) black
|
||||
|
||||
set tixOption(dark1_bg) #c3c3c3
|
||||
set tixOption(dark1_fg) black
|
||||
set tixOption(dark2_bg) #a3a3a3
|
||||
set tixOption(dark2_fg) black
|
||||
set tixOption(inactive_bg) #a3a3a3
|
||||
set tixOption(inactive_fg) black
|
||||
|
||||
set tixOption(light1_bg) #ececec
|
||||
set tixOption(light1_fg) white
|
||||
set tixOption(light2_bg) #fcfcfc
|
||||
set tixOption(light2_fg) white
|
||||
|
||||
set tixOption(active_bg) $tixOption(dark1_bg)
|
||||
set tixOption(active_fg) $tixOption(fg)
|
||||
set tixOption(disabled_fg) gray55
|
||||
|
||||
set tixOption(input1_bg) #d9d9d9
|
||||
set tixOption(input2_bg) #d9d9d9
|
||||
set tixOption(output1_bg) $tixOption(dark1_bg)
|
||||
set tixOption(output2_bg) $tixOption(bg)
|
||||
|
||||
set tixOption(select_fg) black
|
||||
set tixOption(select_bg) #c3c3c3
|
||||
|
||||
set tixOption(selector) #b03060
|
||||
}
|
||||
|
||||
proc tixSetDefaultScheme-Mono {} {
|
||||
|
||||
global tixOption
|
||||
|
||||
set tixOption(bg) lightgray
|
||||
set tixOption(fg) black
|
||||
|
||||
set tixOption(dark1_bg) gray70
|
||||
set tixOption(dark1_fg) black
|
||||
set tixOption(dark2_bg) gray60
|
||||
set tixOption(dark2_fg) white
|
||||
set tixOption(inactive_bg) lightgray
|
||||
set tixOption(inactive_fg) black
|
||||
|
||||
set tixOption(light1_bg) gray90
|
||||
set tixOption(light1_fg) white
|
||||
set tixOption(light2_bg) gray95
|
||||
set tixOption(light2_fg) white
|
||||
|
||||
set tixOption(active_bg) gray90
|
||||
set tixOption(active_fg) $tixOption(fg)
|
||||
set tixOption(disabled_fg) gray55
|
||||
|
||||
set tixOption(input1_bg) $tixOption(light1_bg)
|
||||
set tixOption(input2_bg) $tixOption(light1_bg)
|
||||
set tixOption(output1_bg) $tixOption(light1_bg)
|
||||
set tixOption(output2_bg) $tixOption(light1_bg)
|
||||
|
||||
set tixOption(select_fg) white
|
||||
set tixOption(select_bg) black
|
||||
|
||||
set tixOption(selector) black
|
||||
}
|
||||
175
win32/lib/tix8.4.3/DialogS.tcl
Normal file
@@ -0,0 +1,175 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: DialogS.tcl,v 1.5 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# DialogS.tcl --
|
||||
#
|
||||
#
|
||||
# Implements the DialogShell widget. It tells the window
|
||||
# manager that it is a dialog window and should be treated specially.
|
||||
# The exact treatment depends on the treatment of the window
|
||||
# manager
|
||||
#
|
||||
# Copyright (c) 1994-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.
|
||||
#
|
||||
|
||||
tixWidgetClass tixDialogShell {
|
||||
-superclass tixShell
|
||||
-classname TixDialogShell
|
||||
-method {
|
||||
popdown popup center
|
||||
}
|
||||
-flag {
|
||||
-mapped -minheight -minwidth -parent -transient
|
||||
}
|
||||
-static {}
|
||||
-configspec {
|
||||
{-mapped mapped Mapped 0}
|
||||
{-minwidth minWidth MinWidth 0}
|
||||
{-minheight minHeight MinHeight 0}
|
||||
{-transient transient Transient true}
|
||||
{-parent parent Parent ""}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Construct widget
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
proc tixDialogShell:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
# Set the title of this shell appropriately
|
||||
#
|
||||
if {$data(-title) == ""} {
|
||||
# dynamically sets the title
|
||||
#
|
||||
set data(-title) [winfo name $w]
|
||||
}
|
||||
wm title $w $data(-title)
|
||||
|
||||
# Set the parent of this dialog shell
|
||||
#
|
||||
if {$data(-parent) == ""} {
|
||||
set data(-parent) [winfo parent $w]
|
||||
}
|
||||
|
||||
# Set the minsize and maxsize of the thing
|
||||
#
|
||||
wm minsize $w $data(-minwidth) $data(-minheight)
|
||||
wm transient $w ""
|
||||
}
|
||||
|
||||
# The next procedures manage the dialog boxes
|
||||
#
|
||||
proc tixDialogShell:popup {w {parent ""}} {
|
||||
upvar #0 $w data
|
||||
|
||||
# First update to make sure the boxes are the right size
|
||||
#
|
||||
update idletask
|
||||
|
||||
# Then we set the position and update
|
||||
#
|
||||
# tixDialogShell:center $w $parent
|
||||
|
||||
# and now make it visible. Viola! Centered over parent.
|
||||
#
|
||||
wm deiconify $w
|
||||
after idle raise $w
|
||||
}
|
||||
|
||||
# This procedure centers a dialog box over a window making sure that the
|
||||
# dialog box doesn't appear off the screen
|
||||
#
|
||||
# However, if the parent is smaller than this dialog, make this dialog
|
||||
# appear at parent(x,y) + (20,20)
|
||||
#
|
||||
proc tixDialogShell:center {w {parent ""}} {
|
||||
upvar #0 $w data
|
||||
|
||||
# Tell the WM that we'll do this ourselves.
|
||||
wm sizefrom $w user
|
||||
wm positionfrom $w user
|
||||
|
||||
if {$parent == ""} {
|
||||
set parent $data(-parent)
|
||||
}
|
||||
if {$parent == "" || [catch {set parent [winfo toplevel $parent]}]} {
|
||||
set parent "."
|
||||
}
|
||||
|
||||
# Where is my parent and what are it's dimensions
|
||||
#
|
||||
if {$parent != ""} {
|
||||
set pargeo [split [wm geometry $parent] "+x"]
|
||||
set parentW [lindex $pargeo 0]
|
||||
set parentH [lindex $pargeo 1]
|
||||
set parx [lindex $pargeo 2]
|
||||
set pary [lindex $pargeo 3]
|
||||
|
||||
if {[string is true -strict $data(-transient)]} {
|
||||
wm transient $w $parent
|
||||
}
|
||||
} else {
|
||||
set parentW [winfo screenwidth $w]
|
||||
set parentH [winfo screenheight $w]
|
||||
set parx 0
|
||||
set pary 0
|
||||
set parent [winfo parent $w]
|
||||
}
|
||||
|
||||
# What are is the offset of the virtual window
|
||||
set vrootx [winfo vrootx $parent]
|
||||
set vrooty [winfo vrooty $parent]
|
||||
|
||||
# What are my dimensions ?
|
||||
set dialogW [winfo reqwidth $w]
|
||||
set dialogH [winfo reqheight $w]
|
||||
|
||||
if {$dialogW < $parentW-30 || $dialogW < $parentH-30} {
|
||||
set dialogx [expr {$parx+($parentW-$dialogW)/2+$vrootx}]
|
||||
set dialogy [expr {$pary+($parentH-$dialogH)/2+$vrooty}]
|
||||
} else {
|
||||
# This dialog is too big. Place it at (parentx, parenty) + (20,20)
|
||||
#
|
||||
set dialogx [expr {$parx+20+$vrootx}]
|
||||
set dialogy [expr {$pary+20+$vrooty}]
|
||||
}
|
||||
|
||||
set maxx [expr {[winfo screenwidth $parent] - $dialogW}]
|
||||
set maxy [expr {[winfo screenheight $parent] - $dialogH}]
|
||||
|
||||
# Make sure it doesn't go off screen
|
||||
#
|
||||
if {$dialogx < 0} {
|
||||
set dialogx 0
|
||||
} else {
|
||||
if {$dialogx > $maxx} {
|
||||
set dialogx $maxx
|
||||
}
|
||||
}
|
||||
if {$dialogy < 0} {
|
||||
set dialogy 0
|
||||
} else {
|
||||
if {$dialogy > $maxy} {
|
||||
set dialogy $maxy
|
||||
}
|
||||
}
|
||||
|
||||
# set my new position (and dimensions)
|
||||
#
|
||||
if {[wm geometry $w] == "1x1+0+0"} {
|
||||
wm geometry $w ${dialogW}x${dialogH}+${dialogx}+${dialogy}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixDialogShell:popdown {w args} {
|
||||
wm withdraw $w
|
||||
}
|
||||
|
||||
207
win32/lib/tix8.4.3/DirBox.tcl
Normal file
@@ -0,0 +1,207 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: DirBox.tcl,v 1.4 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# DirBox.tcl --
|
||||
#
|
||||
# Implements the tixDirSelectBox widget.
|
||||
#
|
||||
# - overrides the -browsecmd and -command options of the
|
||||
# HList subwidget
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
|
||||
tixWidgetClass tixDirSelectBox {
|
||||
-classname TixDirSelectBox
|
||||
-superclass tixPrimitive
|
||||
-method {
|
||||
}
|
||||
-flag {
|
||||
-command -disablecallback -value
|
||||
}
|
||||
-configspec {
|
||||
{-command command Command ""}
|
||||
{-disablecallback disableCallback DisableCallback 0 tixVerifyBoolean}
|
||||
{-label label Label "Directory:"}
|
||||
{-value value Value ""}
|
||||
}
|
||||
-forcecall {
|
||||
-value -label
|
||||
}
|
||||
-default {
|
||||
{*combo*listbox.height 5}
|
||||
{*combo.label.anchor w}
|
||||
{*combo.labelSide top}
|
||||
{*combo.history true}
|
||||
{*combo.historyLimit 20}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixDirSelectBox:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
tixChainMethod $w InitWidgetRec
|
||||
}
|
||||
|
||||
proc tixDirSelectBox:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
set data(w:dircbx) [tixFileComboBox $w.dircbx]
|
||||
set data(w:dirlist) [tixDirList $w.dirlist]
|
||||
|
||||
pack $data(w:dircbx) -side top -fill x -padx 4 -pady 2
|
||||
pack $data(w:dirlist) -side top -fill both -expand yes -padx 4 -pady 2
|
||||
|
||||
if {$data(-value) eq ""} {
|
||||
set data(-value) [pwd]
|
||||
}
|
||||
}
|
||||
|
||||
proc tixDirSelectBox:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
|
||||
$data(w:dircbx) config -command [list tixDirSelectBox:Cmd-DirCbx $w]
|
||||
$data(w:dirlist) config -command [list tixDirSelectBox:Cmd-DirList $w]\
|
||||
-browsecmd [list tixDirSelectBox:Browse-DirList $w]
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Incoming event: User
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
# User activates the FileComboBox
|
||||
#
|
||||
#
|
||||
proc tixDirSelectBox:Cmd-DirCbx {w args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set fInfo [tixEvent value]
|
||||
set path [lindex $fInfo 0]
|
||||
|
||||
if {![file exists $path]} {
|
||||
# 1.1 Check for validity. The pathname cannot contain invalid chars
|
||||
#
|
||||
if {![tixFSIsValid $path]} {
|
||||
tk_messageBox -title "Invalid Directory" \
|
||||
-type ok -icon error \
|
||||
-message "\"$path\" is not a valid directory name"
|
||||
$data(w:dircbx) config \
|
||||
-text [tixFSDisplayName [file normalize $data(-value)]] \
|
||||
-directory $data(-value)
|
||||
return
|
||||
}
|
||||
|
||||
# 1.2 Prompt for creation
|
||||
#
|
||||
set choice [tk_messageBox -title "Create Directory?" \
|
||||
-type yesno -icon question \
|
||||
-message "Directory \"$path\" does not exist.\
|
||||
\nDo you want to create it?"]
|
||||
if {$choice eq "yes"
|
||||
&& [catch {file mkdir [file dirname $path]} err]} {
|
||||
tk_messageBox -title "Error Creating Directory" \
|
||||
-icon error -type ok \
|
||||
-message "Cannot create directory \"$path\":\n$err"
|
||||
set choice "no"
|
||||
}
|
||||
if {$choice eq "no"} {
|
||||
$data(w:dircbx) config \
|
||||
-text [tixFSDisplayName [file normalize $data(-value)]] \
|
||||
-directory $data(-value)
|
||||
return
|
||||
}
|
||||
tixDirSelectBox:SetValue $w $path 1 1
|
||||
} elseif {![file isdirectory $path]} {
|
||||
# 2.1: Can't choose a non-directory file
|
||||
#
|
||||
tk_messageBox -title "Invalid Directory" \
|
||||
-type ok -icon error \
|
||||
-message "\"$path\" is not a directory"
|
||||
$data(w:dircbx) config \
|
||||
-text [tixFSDisplayName [file normalize $data(-value)]] \
|
||||
-directory $data(-value)
|
||||
return
|
||||
} else {
|
||||
# OK. It is an existing directory
|
||||
#
|
||||
tixDirSelectBox:SetValue $w $path 1 1
|
||||
}
|
||||
}
|
||||
|
||||
# User activates the dir list
|
||||
#
|
||||
#
|
||||
proc tixDirSelectBox:Cmd-DirList {w args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set dir $data(-value)
|
||||
catch {set dir [tixEvent flag V]}
|
||||
set dir [tixFSNormalize $dir]
|
||||
tixDirSelectBox:SetValue $w $dir 0 0
|
||||
}
|
||||
|
||||
# User browses the dir list
|
||||
#
|
||||
#
|
||||
proc tixDirSelectBox:Browse-DirList {w args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set dir $data(-value)
|
||||
catch {set dir [tixEvent flag V]}
|
||||
set dir [tixFSNormalize $dir]
|
||||
tixDirSelectBox:SetValue $w $dir 0 0
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Incoming event: Application
|
||||
#----------------------------------------------------------------------
|
||||
proc tixDirSelectBox:config-value {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
set value [tixFSNormalize $value]
|
||||
tixDirSelectBox:SetValue $w $value 1 1
|
||||
return $value
|
||||
}
|
||||
|
||||
proc tixDirSelectBox:config-label {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
$data(w:dircbx) subwidget combo config -label $value
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Internal functions
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
# Arguments:
|
||||
# callback:Bool Should we invoke the the -command.
|
||||
# setlist:Bool Should we set the -value of the DirList subwidget.
|
||||
#
|
||||
proc tixDirSelectBox:SetValue {w dir callback setlist} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(-value) $dir
|
||||
$data(w:dircbx) config -text [tixFSDisplayName $dir] -directory $dir
|
||||
if {$setlist && [file isdirectory $dir]} {
|
||||
tixSetSilent $data(w:dirlist) $dir
|
||||
}
|
||||
|
||||
if {$callback} {
|
||||
if {!$data(-disablecallback) && [llength $data(-command)]} {
|
||||
set bind(specs) {%V}
|
||||
set bind(%V) $data(-value)
|
||||
|
||||
tixEvalCmdBinding $w $data(-command) bind $data(-value)
|
||||
}
|
||||
}
|
||||
}
|
||||
95
win32/lib/tix8.4.3/DirDlg.tcl
Normal file
@@ -0,0 +1,95 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: DirDlg.tcl,v 1.3 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# DirDlg.tcl --
|
||||
#
|
||||
# Implements the Directory Selection Dialog widget.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
tixWidgetClass tixDirSelectDialog {
|
||||
-classname TixDirSelectDialog
|
||||
-superclass tixDialogShell
|
||||
-method {}
|
||||
-flag {
|
||||
-command
|
||||
}
|
||||
-configspec {
|
||||
{-command command Command ""}
|
||||
{-title title Title "Select A Directory"}
|
||||
}
|
||||
|
||||
-default {
|
||||
{*ok.text "OK"}
|
||||
{*ok.underline 0}
|
||||
{*ok.width 6}
|
||||
{*cancel.text "Cancel"}
|
||||
{*cancel.underline 0}
|
||||
{*cancel.width 6}
|
||||
{*dirbox.borderWidth 1}
|
||||
{*dirbox.relief raised}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixDirSelectDialog:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
# the buttons
|
||||
frame $w.f -relief raised -bd 1
|
||||
set data(w:ok) [button $w.f.ok -command \
|
||||
"tixDirSelectDialog:OK $w"]
|
||||
set data(w:cancel) [button $w.f.cancel -command \
|
||||
"tixDirSelectDialog:Cancel $w"]
|
||||
|
||||
pack $data(w:ok) $data(w:cancel) -side left -expand yes -padx 10 -pady 8
|
||||
pack $w.f -side bottom -fill x
|
||||
# the dir select box
|
||||
set data(w:dirbox) [tixDirSelectBox $w.dirbox \
|
||||
-command [list tixDirSelectDialog:DirBoxCmd $w]]
|
||||
pack $data(w:dirbox) -expand yes -fill both
|
||||
}
|
||||
|
||||
proc tixDirSelectDialog:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
|
||||
bind $w <Alt-Key-d> "focus [$data(w:dirbox) subwidget dircbx]"
|
||||
}
|
||||
|
||||
proc tixDirSelectDialog:OK {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
wm withdraw $w
|
||||
$data(w:dirbox) subwidget dircbx invoke
|
||||
}
|
||||
|
||||
proc tixDirSelectDialog:DirBoxCmd {w args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set value [tixEvent flag V]
|
||||
wm withdraw $w
|
||||
tixDirSelectDialog:CallCmd $w $value
|
||||
}
|
||||
|
||||
proc tixDirSelectDialog:CallCmd {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(-command) != ""} {
|
||||
set bind(specs) "%V"
|
||||
set bind(%V) $value
|
||||
tixEvalCmdBinding $w $data(-command) bind $value
|
||||
}
|
||||
}
|
||||
|
||||
proc tixDirSelectDialog:Cancel {w} {
|
||||
wm withdraw $w
|
||||
}
|
||||
272
win32/lib/tix8.4.3/DirList.tcl
Normal file
@@ -0,0 +1,272 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: DirList.tcl,v 1.5 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# DirList.tcl --
|
||||
#
|
||||
# Implements the tixDirList widget.
|
||||
#
|
||||
# - overrides the -browsecmd and -command options of the
|
||||
# HList subwidget
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
|
||||
tixWidgetClass tixDirList {
|
||||
-classname TixDirList
|
||||
-superclass tixScrolledHList
|
||||
-method {
|
||||
chdir
|
||||
}
|
||||
-flag {
|
||||
-browsecmd -command -dircmd -disablecallback
|
||||
-root -rootname -showhidden -value
|
||||
}
|
||||
-configspec {
|
||||
{-browsecmd browseCmd BrowseCmd ""}
|
||||
{-command command Command ""}
|
||||
{-dircmd dirCmd DirCmd ""}
|
||||
{-disablecallback disableCallback DisableCallback 0 tixVerifyBoolean}
|
||||
{-root root Root ""}
|
||||
{-rootname rootName RootName ""}
|
||||
{-showhidden showHidden ShowHidden 0 tixVerifyBoolean}
|
||||
{-value value Value ""}
|
||||
}
|
||||
-default {
|
||||
{.scrollbar auto}
|
||||
{*borderWidth 1}
|
||||
{*hlist.background #c3c3c3}
|
||||
{*hlist.indent 7}
|
||||
{*hlist.relief sunken}
|
||||
{*hlist.height 10}
|
||||
{*hlist.width 20}
|
||||
{*hlist.padX 2}
|
||||
{*hlist.padY 0}
|
||||
{*hlist.wideSelection 0}
|
||||
{*hlist.drawBranch 0}
|
||||
{*hlist.highlightBackground #d9d9d9}
|
||||
{*hlist.itemType imagetext}
|
||||
{*hlist.takeFocus 1}
|
||||
}
|
||||
-forcecall {
|
||||
-value
|
||||
}
|
||||
}
|
||||
|
||||
# Important data members:
|
||||
#
|
||||
# data(vpath)
|
||||
# The currently selected vpath. This internal variable is useful on
|
||||
# the Win95 platform, where an directory may correspond to more than
|
||||
# one node in the hierarchy. For example, C:\Windows\Desktop\Foo
|
||||
# can appead as "Desktop\Foo" and
|
||||
# "Desktop\My Computer\C:\Windows\Desktop\Foo". This variable tells us
|
||||
# which icon should we show given the same DOS pathname.
|
||||
#
|
||||
|
||||
proc tixDirList:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
}
|
||||
|
||||
proc tixDirList:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
$data(w:hlist) config -separator [tixFSSep] -selectmode "single"
|
||||
}
|
||||
|
||||
proc tixDirList:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
|
||||
$data(w:hlist) config \
|
||||
-browsecmd [list tixDirList:Browse $w] \
|
||||
-command [list tixDirList:Command $w]
|
||||
|
||||
if {$data(-value) eq ""
|
||||
|| [catch {set data(-value) [tixFSNormalize $data(-value)]}]} {
|
||||
set data(-value) [pwd]
|
||||
}
|
||||
set data(vpath) [tixFSInternal $data(-value)]
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Incoming-Events
|
||||
#----------------------------------------------------------------------
|
||||
proc tixDirList:Browse {w args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set vpath [tixEvent flag V]
|
||||
set value [$data(w:hlist) info data $vpath]
|
||||
|
||||
tixDirList:HighLight $w $vpath
|
||||
|
||||
set data(vpath) $vpath
|
||||
set data(-value) [tixFSExternal $value]
|
||||
|
||||
tixDirList:CallBrowseCmd $w $data(-value)
|
||||
}
|
||||
|
||||
proc tixDirList:Command {w args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set vpath [tixEvent value]
|
||||
set value [$data(w:hlist) info data $vpath]
|
||||
set data(-value) [tixFSExternal $value]
|
||||
|
||||
tixDirList:LoadDir $w [tixFSNativeNorm $value] $vpath
|
||||
tixDirList:HighLight $w $vpath
|
||||
|
||||
set data(vpath) $vpath
|
||||
tixDirList:CallCommand $w $data(-value)
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Outgoing-Events
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
proc tixDirList:CallBrowseCmd {w npath} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[llength $data(-browsecmd)]} {
|
||||
set bind(specs) "%V"
|
||||
set bind(%V) $npath
|
||||
tixEvalCmdBinding $w $data(-browsecmd) bind $npath
|
||||
}
|
||||
}
|
||||
|
||||
proc tixDirList:CallCommand {w npath} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[llength $data(-command)] && !$data(-disablecallback)} {
|
||||
set bind(specs) "%V"
|
||||
set bind(%V) $npath
|
||||
tixEvalCmdBinding $w $data(-command) bind $npath
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Directory loading
|
||||
#----------------------------------------------------------------------
|
||||
proc tixDirList:LoadDir {w {npath ""} {vpath ""}} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixBusy $w on $data(w:hlist)
|
||||
|
||||
$data(w:hlist) delete all
|
||||
|
||||
if {$npath eq ""} {
|
||||
set npath [tixFSNativeNorm $data(-value)]
|
||||
set vpath [tixFSInternal $npath]
|
||||
}
|
||||
|
||||
tixDirList:ListHierachy $w $npath $vpath
|
||||
tixDirList:ListSubDirs $w $npath $vpath
|
||||
|
||||
tixWidgetDoWhenIdle tixBusy $w off $data(w:hlist)
|
||||
}
|
||||
|
||||
proc tixDirList:ListHierachy {w npath vpath} {
|
||||
upvar #0 $w data
|
||||
|
||||
set img [tix getimage openfold]
|
||||
set curpath ""
|
||||
foreach part [tixFSAncestors $npath] {
|
||||
set curpath [file join $curpath $part]
|
||||
set text [tixFSDisplayFileName $curpath]
|
||||
set vpath [tixFSInternal $curpath]
|
||||
$data(w:hlist) add $vpath -text $text -data $curpath -image $img
|
||||
}
|
||||
}
|
||||
|
||||
proc tixDirList:ListSubDirs {w npath vpath} {
|
||||
upvar #0 $w data
|
||||
|
||||
$data(w:hlist) entryconfig $vpath -image [tix getimage act_fold]
|
||||
|
||||
set img [tix getimage folder]
|
||||
foreach ent [tixFSListDir $npath 1 0 0 $data(-showhidden)] {
|
||||
set curpath [file join $npath $ent]
|
||||
set vp [tixFSInternal $curpath]
|
||||
if {![$data(w:hlist) info exists $vp]} {
|
||||
$data(w:hlist) add $vp -text $ent -data $curpath -image $img
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixDirList:SetValue {w npath vpath {flag ""}} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$flag eq "reload" || ![$data(w:hlist) info exists $vpath]} {
|
||||
tixDirList:LoadDir $w $npath $vpath
|
||||
}
|
||||
|
||||
tixDirList:HighLight $w $vpath
|
||||
|
||||
set data(-value) [tixFSNativeNorm $npath]
|
||||
set data(vpath) $vpath
|
||||
tixDirList:CallCommand $w $data(-value)
|
||||
}
|
||||
|
||||
proc tixDirList:HighLight {w vpath} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(vpath) ne $vpath} {
|
||||
set old $data(vpath)
|
||||
|
||||
if {[$data(w:hlist) info exists $old]} {
|
||||
# Un-highlight the originally selected entry by changing its
|
||||
# folder image
|
||||
|
||||
if {[llength [$data(w:hlist) info children $old]]} {
|
||||
set img [tix getimage openfold]
|
||||
} else {
|
||||
set img [tix getimage folder]
|
||||
}
|
||||
$data(w:hlist) entryconfig $old -image $img
|
||||
}
|
||||
}
|
||||
|
||||
# Highlight the newly selected entry
|
||||
#
|
||||
$data(w:hlist) entryconfig $vpath -image [tix getimage act_fold]
|
||||
$data(w:hlist) anchor set $vpath
|
||||
$data(w:hlist) select clear
|
||||
$data(w:hlist) select set $vpath
|
||||
$data(w:hlist) see $vpath
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Config options
|
||||
#----------------------------------------------------------------------
|
||||
proc tixDirList:config-value {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixDirList:chdir $w $value
|
||||
return $data(-value)
|
||||
}
|
||||
|
||||
proc tixDirList:config-showhidden {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixWidgetDoWhenIdle tixDirList:LoadDir $w
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Public methods
|
||||
#----------------------------------------------------------------------
|
||||
proc tixDirList:chdir {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
set npath [tixFSNativeNorm $value]
|
||||
tixDirList:SetValue $w $npath [tixFSInternal $npath]
|
||||
}
|
||||
350
win32/lib/tix8.4.3/DirTree.tcl
Normal file
@@ -0,0 +1,350 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: DirTree.tcl,v 1.4 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# DirTree.tcl --
|
||||
#
|
||||
# Implements directory tree for Unix file systems
|
||||
#
|
||||
# What the indicators mean:
|
||||
#
|
||||
# (+): There are some subdirectories in this directory which are not
|
||||
# currently visible.
|
||||
# (-): This directory has some subdirectories and they are all visible
|
||||
#
|
||||
# none: The dir has no subdirectori(es).
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
|
||||
##
|
||||
## The tixDirTree require special FS handling due to it's limited
|
||||
## separator idea (instead of real tree).
|
||||
##
|
||||
|
||||
tixWidgetClass tixDirTree {
|
||||
-classname TixDirTree
|
||||
-superclass tixVTree
|
||||
-method {
|
||||
activate chdir refresh
|
||||
}
|
||||
-flag {
|
||||
-browsecmd -command -directory -disablecallback -showhidden -value
|
||||
}
|
||||
-configspec {
|
||||
{-browsecmd browseCmd BrowseCmd ""}
|
||||
{-command command Command ""}
|
||||
{-disablecallback disableCallback DisableCallback 0 tixVerifyBoolean}
|
||||
{-showhidden showHidden ShowHidden 0 tixVerifyBoolean}
|
||||
{-value value Value ""}
|
||||
}
|
||||
-alias {
|
||||
{-directory -value}
|
||||
}
|
||||
-default {
|
||||
{.scrollbar auto}
|
||||
{*Scrollbar.takeFocus 0}
|
||||
{*borderWidth 1}
|
||||
{*hlist.indicator 1}
|
||||
{*hlist.background #c3c3c3}
|
||||
{*hlist.drawBranch 1}
|
||||
{*hlist.height 10}
|
||||
{*hlist.highlightBackground #d9d9d9}
|
||||
{*hlist.indent 20}
|
||||
{*hlist.itemType imagetext}
|
||||
{*hlist.padX 3}
|
||||
{*hlist.padY 0}
|
||||
{*hlist.relief sunken}
|
||||
{*hlist.takeFocus 1}
|
||||
{*hlist.wideSelection 0}
|
||||
{*hlist.width 20}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixDirTree:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
|
||||
if {$data(-value) == ""} {
|
||||
set data(-value) [pwd]
|
||||
}
|
||||
|
||||
tixDirTree:SetDir $w [file normalize $data(-value)]
|
||||
}
|
||||
|
||||
proc tixDirTree:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
tixDoWhenMapped $w [list tixDirTree:StartUp $w]
|
||||
|
||||
$data(w:hlist) config -separator [tixFSSep] \
|
||||
-selectmode "single" -drawbranch 1
|
||||
|
||||
# We must creat an extra copy of these images to avoid flashes on
|
||||
# the screen when user changes directory
|
||||
#
|
||||
set data(images) [image create compound -window $data(w:hlist)]
|
||||
$data(images) add image -image [tix getimage act_fold]
|
||||
$data(images) add image -image [tix getimage folder]
|
||||
$data(images) add image -image [tix getimage openfold]
|
||||
}
|
||||
|
||||
proc tixDirTree:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
}
|
||||
|
||||
# Add one dir into the node (parent directory), sorted alphabetically
|
||||
#
|
||||
proc tixDirTree:AddToList {w fsdir image} {
|
||||
upvar #0 $w data
|
||||
|
||||
set dir [tixFSInternal $fsdir]
|
||||
|
||||
if {[$data(w:hlist) info exists $dir]} { return }
|
||||
|
||||
set parent [file dirname $fsdir]
|
||||
if {$fsdir eq $parent} {
|
||||
# root node
|
||||
set node ""
|
||||
} else {
|
||||
# regular node
|
||||
set node [tixFSInternal $parent]
|
||||
}
|
||||
set added 0
|
||||
set text [tixFSDisplayFileName $fsdir]
|
||||
foreach sib [$data(w:hlist) info children $node] {
|
||||
if {[string compare $dir $sib] < 0} {
|
||||
$data(w:hlist) add $dir -before $sib -text $text -image $image
|
||||
set added 1
|
||||
break
|
||||
}
|
||||
}
|
||||
if {!$added} {
|
||||
$data(w:hlist) add $dir -text $text -image $image
|
||||
}
|
||||
|
||||
# Check to see if we have children (%% optimize!)
|
||||
if {[llength [tixFSListDir $fsdir 1 0 0 $data(-showhidden)]]} {
|
||||
tixVTree:SetMode $w $dir open
|
||||
}
|
||||
}
|
||||
|
||||
proc tixDirTree:LoadDir {w fsdir {mode toggle}} {
|
||||
if {![winfo exists $w]} { return }
|
||||
upvar #0 $w data
|
||||
|
||||
# Add the directory and set it to the active directory
|
||||
#
|
||||
set fsdir [tixFSNormalize $fsdir]
|
||||
set dir [tixFSInternal $fsdir]
|
||||
if {![$data(w:hlist) info exists $dir]} {
|
||||
# Add $dir and all ancestors of $dir into the HList widget
|
||||
set fspath ""
|
||||
set imgopenfold [tix getimage openfold]
|
||||
foreach part [tixFSAncestors $fsdir] {
|
||||
set fspath [file join $fspath $part]
|
||||
tixDirTree:AddToList $w $fspath $imgopenfold
|
||||
}
|
||||
}
|
||||
$data(w:hlist) entryconfig $dir -image [tix getimage act_fold]
|
||||
|
||||
if {$mode eq "toggle"} {
|
||||
if {[llength [$data(w:hlist) info children $dir]]} {
|
||||
set mode flatten
|
||||
} else {
|
||||
set mode expand
|
||||
}
|
||||
}
|
||||
|
||||
if {$mode eq "expand"} {
|
||||
# Add all the sub directories of fsdir into the HList widget
|
||||
tixBusy $w on $data(w:hlist)
|
||||
set imgfolder [tix getimage folder]
|
||||
foreach part [tixFSListDir $fsdir 1 0 0 $data(-showhidden)] {
|
||||
tixDirTree:AddToList $w [file join $fsdir $part] $imgfolder
|
||||
}
|
||||
tixWidgetDoWhenIdle tixBusy $w off $data(w:hlist)
|
||||
# correct indicator to represent children status (added above)
|
||||
if {[llength [$data(w:hlist) info children $dir]]} {
|
||||
tixVTree:SetMode $w $dir close
|
||||
} else {
|
||||
tixVTree:SetMode $w $dir none
|
||||
}
|
||||
} else {
|
||||
$data(w:hlist) delete offsprings $dir
|
||||
tixVTree:SetMode $w $dir open
|
||||
}
|
||||
}
|
||||
|
||||
proc tixDirTree:ToggleDir {w value mode} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixDirTree:LoadDir $w $value $mode
|
||||
tixDirTree:CallCommand $w
|
||||
}
|
||||
|
||||
proc tixDirTree:CallCommand {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[llength $data(-command)] && !$data(-disablecallback)} {
|
||||
set bind(specs) {%V}
|
||||
set bind(%V) $data(-value)
|
||||
|
||||
tixEvalCmdBinding $w $data(-command) bind $data(-value)
|
||||
}
|
||||
}
|
||||
|
||||
proc tixDirTree:CallBrowseCmd {w ent} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[llength $data(-browsecmd)] && !$data(-disablecallback)} {
|
||||
set bind(specs) {%V}
|
||||
set bind(%V) $data(-value)
|
||||
|
||||
tixEvalCmdBinding $w $data(-browsecmd) bind [list $data(-value)]
|
||||
}
|
||||
}
|
||||
|
||||
proc tixDirTree:StartUp {w} {
|
||||
if {![winfo exists $w]} { return }
|
||||
|
||||
upvar #0 $w data
|
||||
|
||||
# make sure that all the basic volumes are listed
|
||||
set imgopenfold [tix getimage openfold]
|
||||
foreach fspath [tixFSVolumes] {
|
||||
tixDirTree:AddToList $w $fspath $imgopenfold
|
||||
}
|
||||
|
||||
tixDirTree:LoadDir $w [tixFSExternal $data(i-directory)]
|
||||
}
|
||||
|
||||
proc tixDirTree:ChangeDir {w fsdir {forced 0}} {
|
||||
upvar #0 $w data
|
||||
|
||||
set dir [tixFSInternal $fsdir]
|
||||
if {!$forced && $data(i-directory) eq $dir} {
|
||||
return
|
||||
}
|
||||
|
||||
if {!$forced && [$data(w:hlist) info exists $dir]} {
|
||||
# Set the old directory to "non active"
|
||||
#
|
||||
if {[$data(w:hlist) info exists $data(i-directory)]} {
|
||||
$data(w:hlist) entryconfig $data(i-directory) \
|
||||
-image [tix getimage folder]
|
||||
}
|
||||
|
||||
$data(w:hlist) entryconfig $dir -image [tix getimage act_fold]
|
||||
} else {
|
||||
if {$forced} {
|
||||
if {[llength [$data(w:hlist) info children $dir]]} {
|
||||
set mode expand
|
||||
} else {
|
||||
set mode flatten
|
||||
}
|
||||
} else {
|
||||
set mode toggle
|
||||
}
|
||||
tixDirTree:LoadDir $w $fsdir $mode
|
||||
tixDirTree:CallCommand $w
|
||||
}
|
||||
tixDirTree:SetDir $w $fsdir
|
||||
}
|
||||
|
||||
|
||||
proc tixDirTree:SetDir {w path} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(i-directory) [tixFSInternal $path]
|
||||
set data(-value) [tixFSNativeNorm $path]
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Virtual Methods
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
proc tixDirTree:OpenCmd {w ent} {
|
||||
set fsdir [tixFSExternal $ent]
|
||||
tixDirTree:ToggleDir $w $fsdir expand
|
||||
tixDirTree:ChangeDir $w $fsdir
|
||||
tixDirTree:CallBrowseCmd $w $fsdir
|
||||
}
|
||||
|
||||
proc tixDirTree:CloseCmd {w ent} {
|
||||
set fsdir [tixFSExternal $ent]
|
||||
tixDirTree:ToggleDir $w $fsdir flatten
|
||||
tixDirTree:ChangeDir $w $fsdir
|
||||
tixDirTree:CallBrowseCmd $w $fsdir
|
||||
}
|
||||
|
||||
proc tixDirTree:Command {w B} {
|
||||
upvar #0 $w data
|
||||
upvar $B bind
|
||||
|
||||
set ent [tixEvent flag V]
|
||||
tixChainMethod $w Command $B
|
||||
|
||||
if {[llength $data(-command)]} {
|
||||
set fsdir [tixFSExternal $ent]
|
||||
tixEvalCmdBinding $w $data(-command) bind $fsdir
|
||||
}
|
||||
}
|
||||
|
||||
# This is a virtual method
|
||||
#
|
||||
proc tixDirTree:BrowseCmd {w B} {
|
||||
upvar #0 $w data
|
||||
upvar 1 $B bind
|
||||
|
||||
set ent [tixEvent flag V]
|
||||
set fsdir [tixFSExternal $ent]
|
||||
|
||||
# This is a hack because %V may have been modified by callbrowsecmd
|
||||
set fsdir [file normalize $fsdir]
|
||||
|
||||
tixDirTree:ChangeDir $w $fsdir
|
||||
tixDirTree:CallBrowseCmd $w $fsdir
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Public Methods
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
proc tixDirTree:chdir {w value} {
|
||||
tixDirTree:ChangeDir $w [file normalize $value]
|
||||
}
|
||||
|
||||
proc tixDirTree:refresh {w {dir ""}} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$dir eq ""} {
|
||||
set dir $data(-value)
|
||||
}
|
||||
set dir [file normalize $dir]
|
||||
|
||||
tixDirTree:ChangeDir $w $dir 1
|
||||
|
||||
# Delete any stale directories that no longer exist
|
||||
#
|
||||
foreach child [$data(w:hlist) info children [tixFSInternal $dir]] {
|
||||
if {![file exists [tixFSExternal $child]]} {
|
||||
$data(w:hlist) delete entry $child
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixDirTree:config-directory {w value} {
|
||||
tixDirTree:ChangeDir $w [file normalize $value]
|
||||
}
|
||||
166
win32/lib/tix8.4.3/DragDrop.tcl
Normal file
@@ -0,0 +1,166 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: DragDrop.tcl,v 1.4 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# DragDrop.tcl ---
|
||||
#
|
||||
# Implements drag+drop for Tix widgets.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
tixClass tixDragDropContext {
|
||||
-superclass {}
|
||||
-classname TixDragDropContext
|
||||
-method {
|
||||
cget configure drag drop set startdrag
|
||||
}
|
||||
-flag {
|
||||
-command -source
|
||||
}
|
||||
-configspec {
|
||||
{-command ""}
|
||||
{-source ""}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixDragDropContext:Constructor {w} {
|
||||
upvar #0 $w data
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Private methods
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
proc tixDragDropContext:CallCommand {w target command X Y} {
|
||||
upvar #0 $w data
|
||||
|
||||
set x [expr $X-[winfo rootx $target]]
|
||||
set y [expr $Y-[winfo rooty $target]]
|
||||
|
||||
regsub %x $command $x command
|
||||
regsub %y $command $y command
|
||||
regsub %X $command $X command
|
||||
regsub %Y $command $Y command
|
||||
regsub %W $command $target command
|
||||
regsub %S $command [list $data(-command)] command
|
||||
|
||||
eval $command
|
||||
}
|
||||
|
||||
proc tixDragDropContext:Send {w target event X Y} {
|
||||
upvar #0 $w data
|
||||
global tixDrop
|
||||
|
||||
foreach tag [tixDropBindTags $target] {
|
||||
if {[info exists tixDrop($tag,$event)]} {
|
||||
tixDragDropContext:CallCommand $w $target \
|
||||
$tixDrop($tag,$event) $X $Y
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# set --
|
||||
#
|
||||
# Set the "small data" of the type supported by the source widget
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
proc tixDragDropContext:set {w type data} {
|
||||
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# startdrag --
|
||||
#
|
||||
# Start the dragging action
|
||||
#----------------------------------------------------------------------
|
||||
proc tixDragDropContext:startdrag {w x y} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(oldTarget) ""
|
||||
|
||||
$data(-source) config -cursor "[tix getbitmap drop] black"
|
||||
tixDragDropContext:drag $w $x $y
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# drag --
|
||||
#
|
||||
# Continue the dragging action
|
||||
#----------------------------------------------------------------------
|
||||
proc tixDragDropContext:drag {w X Y} {
|
||||
upvar #0 $w data
|
||||
global tixDrop
|
||||
|
||||
set target [winfo containing -displayof $w $X $Y]
|
||||
|
||||
if {$target != $data(oldTarget)} {
|
||||
if {$data(oldTarget) != ""} {
|
||||
tixDragDropContext:Send $w $data(oldTarget) <Out> $X $Y
|
||||
}
|
||||
if {$target != ""} {
|
||||
tixDragDropContext:Send $w $target <In> $X $Y
|
||||
}
|
||||
set data(oldTarget) $target
|
||||
}
|
||||
if {$target != ""} {
|
||||
tixDragDropContext:Send $w $target <Over> $X $Y
|
||||
}
|
||||
}
|
||||
|
||||
proc tixDragDropContext:drop {w X Y} {
|
||||
upvar #0 $w data
|
||||
global tixDrop
|
||||
|
||||
set target [winfo containing -displayof $w $X $Y]
|
||||
if {$target != ""} {
|
||||
tixDragDropContext:Send $w $target <Drop> $X $Y
|
||||
}
|
||||
|
||||
if {$data(-source) != ""} {
|
||||
$data(-source) config -cursor ""
|
||||
}
|
||||
set data(-source) ""
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Public Procedures -- This is NOT a member of the tixDragDropContext
|
||||
# class!
|
||||
#
|
||||
# parameters :
|
||||
# $w: who wants to start dragging? (currently ignored)
|
||||
#----------------------------------------------------------------------
|
||||
proc tixGetDragDropContext {w} {
|
||||
global tixDD
|
||||
if {[info exists tixDD]} {
|
||||
return tixDD
|
||||
}
|
||||
|
||||
return [tixDragDropContext tixDD]
|
||||
}
|
||||
|
||||
proc tixDropBind {w event command} {
|
||||
global tixDrop
|
||||
|
||||
set tixDrop($w) 1
|
||||
set tixDrop($w,$event) $command
|
||||
}
|
||||
|
||||
proc tixDropBindTags {w args} {
|
||||
global tixDropTags
|
||||
|
||||
if {$args == ""} {
|
||||
if {[info exists tixDropTags($w)]} {
|
||||
return $tixDropTags($w)
|
||||
} else {
|
||||
return [list [winfo class $w] $w]
|
||||
}
|
||||
} else {
|
||||
set tixDropTags($w) $args
|
||||
}
|
||||
}
|
||||
49
win32/lib/tix8.4.3/DtlList.tcl
Normal file
@@ -0,0 +1,49 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: DtlList.tcl,v 1.2 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# DtlList.tcl --
|
||||
#
|
||||
# This file implements DetailList widgets
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
tixWidgetClass tixDetailList {
|
||||
-classname TixDetailList
|
||||
-superclass tixScrolledGrid
|
||||
-method {
|
||||
}
|
||||
-flag {
|
||||
-hdrbackground
|
||||
}
|
||||
-configspec {
|
||||
{-hdrbackground hdrBackground HdrBackground #606060}
|
||||
}
|
||||
-alias {
|
||||
{-hdrbg -hdrbackground}
|
||||
}
|
||||
-default {
|
||||
{*grid.topMargin 1}
|
||||
{*grid.leftMargin 0}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
proc tixDetailList:FormatCmd {w area x1 y1 x2 y2} {
|
||||
upvar #0 $w data
|
||||
|
||||
case $area {
|
||||
main {
|
||||
}
|
||||
default {
|
||||
$data(w:grid) format border $x1 $y1 $x2 $y2 \
|
||||
-filled 1 \
|
||||
-relief raised -bd 1 -bg $data(-hdrbackground)
|
||||
}
|
||||
}
|
||||
}
|
||||
436
win32/lib/tix8.4.3/EFileBox.tcl
Normal file
@@ -0,0 +1,436 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: EFileBox.tcl,v 1.5 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# EFileBox.tcl --
|
||||
#
|
||||
# Implements the Extended File Selection Box widget.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# ToDo
|
||||
# (1) If user has entered an invalid directory, give an error dialog
|
||||
#
|
||||
|
||||
tixWidgetClass tixExFileSelectBox {
|
||||
-classname TixExFileSelectBox
|
||||
-superclass tixPrimitive
|
||||
-method {
|
||||
filter invoke
|
||||
}
|
||||
-flag {
|
||||
-browsecmd -command -dialog -dir -dircmd -directory
|
||||
-disablecallback -filetypes -pattern -selection -showhidden -value
|
||||
}
|
||||
-forcecall {
|
||||
-filetypes
|
||||
}
|
||||
-configspec {
|
||||
{-browsecmd browseCmd BrowseCmd ""}
|
||||
{-command command Command ""}
|
||||
{-dialog dialog Dialog ""}
|
||||
{-dircmd dirCmd DirCmd ""}
|
||||
{-directory directory Directory ""}
|
||||
{-disablecallback disableCallback DisableCallback 0 tixVerifyBoolean}
|
||||
{-filetypes fileTypes FileTypes ""}
|
||||
{-pattern pattern Pattern *}
|
||||
{-showhidden showHidden ShowHidden 0 tixVerifyBoolean}
|
||||
{-value value Value ""}
|
||||
}
|
||||
-alias {
|
||||
{-dir -directory}
|
||||
{-selection -value}
|
||||
}
|
||||
|
||||
-default {
|
||||
{*dir.label {Directories:}}
|
||||
{*dir.editable true}
|
||||
{*dir.history true}
|
||||
{*dir*listbox.height 5}
|
||||
{*file.label Files:}
|
||||
{*file.editable true}
|
||||
{*file.history false}
|
||||
{*file*listbox.height 5}
|
||||
{*types.label {List Files of Type:}}
|
||||
{*types*listbox.height 3}
|
||||
{*TixComboBox.labelSide top}
|
||||
{*TixComboBox*Label.anchor w}
|
||||
{*dir.label.underline 0}
|
||||
{*file.label.underline 0}
|
||||
{*types.label.underline 14}
|
||||
{*TixComboBox.anchor e}
|
||||
{*TixHList.height 7}
|
||||
{*filelist*listbox.height 7}
|
||||
{*hidden.wrapLength 3c}
|
||||
{*hidden.justify left}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixExFileSelectBox:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
global env
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
|
||||
if {$data(-directory) eq ""} {
|
||||
set data(-directory) [pwd]
|
||||
}
|
||||
set data(oldDir) ""
|
||||
set data(flag) 0
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Construct widget
|
||||
#----------------------------------------------------------------------
|
||||
proc tixExFileSelectBox:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
# listbox frame
|
||||
set lf [frame $w.lf]
|
||||
|
||||
# The pane that contains the two listboxes
|
||||
#
|
||||
set pane [tixPanedWindow $lf.pane -orientation horizontal]
|
||||
set dpane [$pane add 1 -size 160]
|
||||
set fpane [$pane add 2 -size 160]
|
||||
|
||||
$dpane config -relief flat
|
||||
$fpane config -relief flat
|
||||
|
||||
# The File List Pane
|
||||
#
|
||||
set data(w:file) [tixComboBox $fpane.file\
|
||||
-command [list tixExFileSelectBox:Cmd-FileCombo $w]\
|
||||
-prunehistory true \
|
||||
-options {
|
||||
label.anchor w
|
||||
}]
|
||||
set data(w:filelist) \
|
||||
[tixScrolledListBox $fpane.filelist \
|
||||
-command [list tixExFileSelectBox:Cmd-FileList $w 1] \
|
||||
-browsecmd [list tixExFileSelectBox:Cmd-FileList $w 0]]
|
||||
pack $data(w:file) -padx 8 -pady 4 -side top -fill x
|
||||
pack $data(w:filelist) -padx 8 -pady 4 -side top -fill both -expand yes
|
||||
|
||||
# The Directory Pane
|
||||
#
|
||||
set data(w:dir) [tixComboBox $dpane.dir \
|
||||
-command [list tixExFileSelectBox:Cmd-DirCombo $w]\
|
||||
-prunehistory true \
|
||||
-options {
|
||||
label.anchor w
|
||||
}]
|
||||
set data(w:dirlist) \
|
||||
[tixDirList $dpane.dirlist \
|
||||
-command [list tixExFileSelectBox:Cmd-DirList $w]\
|
||||
-browsecmd [list tixExFileSelectBox:Browse-DirList $w]]
|
||||
pack $data(w:dir) -padx 8 -pady 4 -side top -fill x
|
||||
pack $data(w:dirlist) -padx 8 -pady 4 -side top -fill both -expand yes
|
||||
|
||||
# The file types listbox
|
||||
#
|
||||
set data(w:types) [tixComboBox $lf.types\
|
||||
-command [list tixExFileSelectBox:Cmd-TypeCombo $w]\
|
||||
-options {
|
||||
label.anchor w
|
||||
}]
|
||||
|
||||
pack $data(w:types) -padx 12 -pady 4 -side bottom -fill x -anchor w
|
||||
pack $pane -side top -padx 4 -pady 4 -expand yes -fill both
|
||||
|
||||
# Buttons to the right
|
||||
#
|
||||
set bf [frame $w.bf]
|
||||
set data(w:ok) [button $bf.ok -text Ok -width 6 \
|
||||
-underline 0 -command [list tixExFileSelectBox:Ok $w]]
|
||||
set data(w:cancel) [button $bf.cancel -text Cancel -width 6 \
|
||||
-underline 0 -command [list tixExFileSelectBox:Cancel $w]]
|
||||
set data(w:hidden) [checkbutton $bf.hidden -text "Show Hidden Files"\
|
||||
-underline 0\
|
||||
-variable [format %s(-showhidden) $w] -onvalue 1 -offvalue 0\
|
||||
-command [list tixExFileSelectBox:SetShowHidden $w]]
|
||||
|
||||
pack $data(w:ok) $data(w:cancel) $data(w:hidden)\
|
||||
-side top -fill x -padx 6 -pady 3
|
||||
|
||||
pack $bf -side right -fill y -pady 6
|
||||
pack $lf -side left -expand yes -fill both
|
||||
|
||||
tixDoWhenMapped $w [list tixExFileSelectBox:Map $w]
|
||||
|
||||
if {$data(-filetypes) == ""} {
|
||||
$data(w:types) config -state disabled
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Configuration
|
||||
#----------------------------------------------------------------------
|
||||
proc tixExFileSelectBox:config-showhidden {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(-showhidden) $value
|
||||
tixExFileSelectBox:SetShowHidden $w
|
||||
}
|
||||
|
||||
# Update both DirList and {file list and dir combo}
|
||||
#
|
||||
proc tixExFileSelectBox:config-directory {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(-directory) [tixFSNormalize $value]
|
||||
tixSetSilent $data(w:dirlist) $data(-directory)
|
||||
tixSetSilent $data(w:dir) $data(-directory)
|
||||
tixWidgetDoWhenIdle tixExFileSelectBox:LoadFiles $w reload
|
||||
|
||||
return $data(-directory)
|
||||
}
|
||||
|
||||
proc tixExFileSelectBox:config-filetypes {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
$data(w:types) subwidget listbox delete 0 end
|
||||
|
||||
foreach name [array names data] {
|
||||
if {[string match type,* $name]} {
|
||||
catch {unset data($name)}
|
||||
}
|
||||
}
|
||||
|
||||
if {$value == ""} {
|
||||
$data(w:types) config -state disabled
|
||||
} else {
|
||||
$data(w:types) config -state normal
|
||||
|
||||
foreach type $value {
|
||||
$data(w:types) insert end [lindex $type 1]
|
||||
set data(type,[lindex $type 1]) [lindex $type 0]
|
||||
}
|
||||
tixSetSilent $data(w:types) ""
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# MISC Methods
|
||||
#----------------------------------------------------------------------
|
||||
proc tixExFileSelectBox:SetShowHidden {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
$data(w:dirlist) config -showhidden $data(-showhidden)
|
||||
|
||||
tixWidgetDoWhenIdle tixExFileSelectBox:LoadFiles $w reload
|
||||
}
|
||||
|
||||
# User activates the dir combobox
|
||||
#
|
||||
#
|
||||
proc tixExFileSelectBox:Cmd-DirCombo {w args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set dir [tixEvent flag V]
|
||||
set dir [tixFSExternal $dir]
|
||||
if {![file isdirectory $dir]} {
|
||||
return
|
||||
}
|
||||
set dir [tixFSNormalize $dir]
|
||||
|
||||
$data(w:dirlist) config -value $dir
|
||||
set data(-directory) $dir
|
||||
}
|
||||
|
||||
# User activates the dir list
|
||||
#
|
||||
#
|
||||
proc tixExFileSelectBox:Cmd-DirList {w args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set dir $data(-directory)
|
||||
catch {set dir [tixEvent flag V]}
|
||||
set dir [tixFSNormalize [tixFSExternal $dir]]
|
||||
|
||||
tixSetSilent $data(w:dir) $dir
|
||||
set data(-directory) $dir
|
||||
|
||||
tixWidgetDoWhenIdle tixExFileSelectBox:LoadFiles $w noreload
|
||||
}
|
||||
|
||||
# User activates the dir list
|
||||
#
|
||||
#
|
||||
proc tixExFileSelectBox:Browse-DirList {w args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set dir [tixEvent flag V]
|
||||
set dir [tixFSNormalize [tixFSExternal $dir]]
|
||||
tixExFileSelectBox:Cmd-DirList $w $dir
|
||||
}
|
||||
|
||||
proc tixExFileSelectBox:IsPattern {w string} {
|
||||
return [regexp "\[\[\\\{\\*\\?\]" $string]
|
||||
}
|
||||
|
||||
proc tixExFileSelectBox:Cmd-FileCombo {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[tixEvent type] eq "<Return>"} {
|
||||
tixExFileSelectBox:Ok $w
|
||||
}
|
||||
}
|
||||
|
||||
proc tixExFileSelectBox:Ok {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
set value [string trim [$data(w:file) subwidget entry get]]
|
||||
if {$value == ""} {
|
||||
set value $data(-pattern)
|
||||
}
|
||||
tixSetSilent $data(w:file) $value
|
||||
|
||||
if {[tixExFileSelectBox:IsPattern $w $value]} {
|
||||
set data(-pattern) $value
|
||||
tixWidgetDoWhenIdle tixExFileSelectBox:LoadFiles $w reload
|
||||
} else {
|
||||
# ensure absolute path
|
||||
set value [file join $data(-directory) $value]; # native
|
||||
set data(-value) [tixFSNativeNorm $value]
|
||||
tixExFileSelectBox:Invoke $w
|
||||
}
|
||||
}
|
||||
|
||||
proc tixExFileSelectBox:Cancel {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(-dialog) != ""} {
|
||||
eval $data(-dialog) popdown
|
||||
}
|
||||
}
|
||||
|
||||
proc tixExFileSelectBox:Invoke {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
# Save some old history
|
||||
#
|
||||
$data(w:dir) addhistory [$data(w:dir) cget -value]
|
||||
$data(w:file) addhistory $data(-pattern)
|
||||
$data(w:file) addhistory $data(-value)
|
||||
if {$data(-dialog) != ""} {
|
||||
eval $data(-dialog) popdown
|
||||
}
|
||||
if {$data(-command) != "" && !$data(-disablecallback)} {
|
||||
set bind(specs) "%V"
|
||||
set bind(%V) $data(-value)
|
||||
tixEvalCmdBinding $w $data(-command) bind $data(-value)
|
||||
}
|
||||
}
|
||||
|
||||
proc tixExFileSelectBox:Cmd-FileList {w invoke args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set index [lindex [$data(w:filelist) subwidget listbox curselection] 0]
|
||||
if {$index == ""} {
|
||||
set index 0
|
||||
}
|
||||
|
||||
set file [$data(w:filelist) subwidget listbox get $index]
|
||||
tixSetSilent $data(w:file) $file
|
||||
|
||||
set value [file join $data(-directory) $file]
|
||||
set data(-value) [tixFSNativeNorm $value]
|
||||
|
||||
if {$invoke == 1} {
|
||||
tixExFileSelectBox:Invoke $w
|
||||
} elseif {$data(-browsecmd) != ""} {
|
||||
tixEvalCmdBinding $w $data(-browsecmd) "" $data(-value)
|
||||
}
|
||||
}
|
||||
|
||||
proc tixExFileSelectBox:Cmd-TypeCombo {w args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set value [tixEvent flag V]
|
||||
|
||||
if {[info exists data(type,$value)]} {
|
||||
set data(-pattern) $data(type,$value)
|
||||
tixSetSilent $data(w:file) $data(-pattern)
|
||||
tixWidgetDoWhenIdle tixExFileSelectBox:LoadFiles $w reload
|
||||
}
|
||||
}
|
||||
|
||||
proc tixExFileSelectBox:LoadFiles {w flag} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$flag ne "reload" && $data(-directory) eq $data(oldDir)} {
|
||||
return
|
||||
}
|
||||
|
||||
if {![winfo ismapped [winfo toplevel $w]]} {
|
||||
tixDoWhenMapped [winfo toplevel $w] \
|
||||
[list tixExFileSelectBox:LoadFiles $w $flag]
|
||||
return
|
||||
}
|
||||
|
||||
set listbox [$data(w:filelist) subwidget listbox]
|
||||
$listbox delete 0 end
|
||||
|
||||
set data(-value) ""
|
||||
|
||||
tixBusy $w on [$data(w:dirlist) subwidget hlist]
|
||||
|
||||
# wrap in a catch so you can't get stuck in a Busy state
|
||||
if {[catch {
|
||||
foreach name [tixFSListDir $data(-directory) 0 1 0 \
|
||||
$data(-showhidden) $data(-pattern)] {
|
||||
$listbox insert end $name
|
||||
}
|
||||
|
||||
if {$data(oldDir) ne $data(-directory)} {
|
||||
# Otherwise if the user has already selected a file and then
|
||||
# presses "show hidden", the selection won't be wiped out.
|
||||
tixSetSilent $data(w:file) $data(-pattern)
|
||||
}
|
||||
} err]} {
|
||||
tixDebug "tixExFileSelectBox:LoadFiles error for $w\n$err"
|
||||
}
|
||||
set data(oldDir) $data(-directory)
|
||||
|
||||
tixWidgetDoWhenIdle tixBusy $w off [$data(w:dirlist) subwidget hlist]
|
||||
}
|
||||
|
||||
#
|
||||
# Called when thd listbox is first mapped
|
||||
proc tixExFileSelectBox:Map {w} {
|
||||
if {![winfo exists $w]} {
|
||||
return
|
||||
}
|
||||
upvar #0 $w data
|
||||
|
||||
set bind(specs) "%V"
|
||||
set bind(%V) $data(-value)
|
||||
tixEvalCmdBinding $w bind \
|
||||
[list tixExFileSelectBox:Cmd-DirList $w] $data(-directory)
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Public commands
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
proc tixExFileSelectBox:invoke {w} {
|
||||
tixExFileSelectBox:Invoke $w
|
||||
}
|
||||
|
||||
proc tixExFileSelectBox:filter {w} {
|
||||
tixExFileSelectBox:LoadFiles $w reload
|
||||
}
|
||||
|
||||
65
win32/lib/tix8.4.3/EFileDlg.tcl
Normal file
@@ -0,0 +1,65 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: EFileDlg.tcl,v 1.3 2002/01/24 09:13:58 idiscovery Exp $
|
||||
#
|
||||
# EFileDlg.tcl --
|
||||
#
|
||||
# Implements the Extended File Selection Dialog widget.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
foreach fun {tkButtonInvoke} {
|
||||
if {![llength [info commands $fun]]} {
|
||||
tk::unsupported::ExposePrivateCommand $fun
|
||||
}
|
||||
}
|
||||
unset fun
|
||||
|
||||
tixWidgetClass tixExFileSelectDialog {
|
||||
-classname TixExFileSelectDialog
|
||||
-superclass tixDialogShell
|
||||
-method {}
|
||||
-flag {
|
||||
-command
|
||||
}
|
||||
-configspec {
|
||||
{-command command Command ""}
|
||||
|
||||
{-title title Title "Select A File"}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixExFileSelectDialog:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
set data(w:fsbox) [tixExFileSelectBox $w.fsbox -dialog $w \
|
||||
-command $data(-command)]
|
||||
pack $data(w:fsbox) -expand yes -fill both
|
||||
|
||||
|
||||
}
|
||||
|
||||
proc tixExFileSelectDialog:config-command {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
$data(w:fsbox) config -command $value
|
||||
}
|
||||
|
||||
proc tixExFileSelectDialog:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
|
||||
bind $w <Alt-Key-f> "focus [$data(w:fsbox) subwidget file]"
|
||||
bind $w <Alt-Key-t> "focus [$data(w:fsbox) subwidget types]"
|
||||
bind $w <Alt-Key-d> "focus [$data(w:fsbox) subwidget dir]"
|
||||
bind $w <Alt-Key-o> "tkButtonInvoke [$data(w:fsbox) subwidget ok]"
|
||||
bind $w <Alt-Key-c> "tkButtonInvoke [$data(w:fsbox) subwidget cancel]"
|
||||
bind $w <Alt-Key-s> "tkButtonInvoke [$data(w:fsbox) subwidget hidden]"
|
||||
}
|
||||
217
win32/lib/tix8.4.3/Event.tcl
Normal file
@@ -0,0 +1,217 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: Event.tcl,v 1.6 2004/04/09 21:37:01 hobbs Exp $
|
||||
#
|
||||
# Event.tcl --
|
||||
#
|
||||
# Handles the event bindings of the -command and -browsecmd options
|
||||
# (and various of others such as -validatecmd).
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Evaluate high-level bindings (-command, -browsecmd, etc):
|
||||
# with % subsitution or without (compatibility mode)
|
||||
#
|
||||
#
|
||||
# BUG : if a -command is intercepted by a hook, the hook must use
|
||||
# the same record name as the issuer of the -command. For the time
|
||||
# being, you must use the name "bind" as the record name!!!!!
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
namespace eval ::tix {
|
||||
variable event_flags ""
|
||||
set evs [list % \# a b c d f h k m o p s t w x y A B E K N R S T W X Y]
|
||||
foreach ev $evs {
|
||||
lappend event_flags "%$ev"
|
||||
}
|
||||
|
||||
# This is a "name stack" for storing the "bind" structures
|
||||
#
|
||||
# The bottom of the event stack is usually a raw event (generated by
|
||||
# tixBind) but it may also be a programatically triggered (caused by
|
||||
# tixEvalCmdBinding)
|
||||
variable EVENT
|
||||
set EVENT(nameStack) ""
|
||||
set EVENT(stackLevel) 0
|
||||
}
|
||||
|
||||
proc tixBind {tag event action} {
|
||||
set cmd [linsert $::tix::event_flags 0 _tixRecordFlags $event]
|
||||
append cmd "; $action; _tixDeleteFlags;"
|
||||
|
||||
bind $tag $event $cmd
|
||||
}
|
||||
|
||||
proc tixPushEventStack {} {
|
||||
variable ::tix::EVENT
|
||||
|
||||
set lastEvent [lindex $EVENT(nameStack) 0]
|
||||
incr EVENT(stackLevel)
|
||||
set thisEvent ::tix::_event$EVENT(stackLevel)
|
||||
|
||||
set EVENT(nameStack) [list $thisEvent $EVENT(nameStack)]
|
||||
|
||||
if {$lastEvent == ""} {
|
||||
upvar #0 $thisEvent this
|
||||
set this(type) <Application>
|
||||
} else {
|
||||
upvar #0 $lastEvent last
|
||||
upvar #0 $thisEvent this
|
||||
|
||||
foreach name [array names last] {
|
||||
set this($name) $last($name)
|
||||
}
|
||||
}
|
||||
|
||||
return $thisEvent
|
||||
}
|
||||
|
||||
proc tixPopEventStack {varName} {
|
||||
variable ::tix::EVENT
|
||||
|
||||
if {$varName ne [lindex $EVENT(nameStack) 0]} {
|
||||
error "unmatched tixPushEventStack and tixPopEventStack calls"
|
||||
}
|
||||
incr EVENT(stackLevel) -1
|
||||
set EVENT(nameStack) [lindex $EVENT(nameStack) 1]
|
||||
global $varName
|
||||
unset $varName
|
||||
}
|
||||
|
||||
|
||||
# Events triggered by tixBind
|
||||
#
|
||||
proc _tixRecordFlags [concat event $::tix::event_flags] {
|
||||
set thisName [tixPushEventStack]; upvar #0 $thisName this
|
||||
|
||||
set this(type) $event
|
||||
foreach f $::tix::event_flags {
|
||||
set this($f) [set $f]
|
||||
}
|
||||
}
|
||||
|
||||
proc _tixDeleteFlags {} {
|
||||
variable ::tix::EVENT
|
||||
|
||||
tixPopEventStack [lindex $EVENT(nameStack) 0]
|
||||
}
|
||||
|
||||
# programatically trigged events
|
||||
#
|
||||
proc tixEvalCmdBinding {w cmd {subst ""} args} {
|
||||
global tixPriv tix
|
||||
variable ::tix::EVENT
|
||||
|
||||
set thisName [tixPushEventStack]; upvar #0 $thisName this
|
||||
|
||||
if {$subst != ""} {
|
||||
upvar $subst bind
|
||||
|
||||
if {[info exists bind(specs)]} {
|
||||
foreach spec $bind(specs) {
|
||||
set this($spec) $bind($spec)
|
||||
}
|
||||
}
|
||||
if {[info exists bind(type)]} {
|
||||
set this(type) $bind(type)
|
||||
}
|
||||
}
|
||||
|
||||
if {[catch {
|
||||
if {![info exists tix(-extracmdargs)]
|
||||
|| [string is true -strict $tix(-extracmdargs)]} {
|
||||
# Compatibility mode
|
||||
set ret [uplevel \#0 $cmd $args]
|
||||
} else {
|
||||
set ret [uplevel 1 $cmd]
|
||||
}
|
||||
} error]} {
|
||||
if {[catch {tixCmdErrorHandler $error} error]} {
|
||||
# double fault: just print out
|
||||
tixBuiltInCmdErrorHandler $error
|
||||
}
|
||||
tixPopEventStack $thisName
|
||||
return ""
|
||||
} else {
|
||||
tixPopEventStack $thisName
|
||||
|
||||
return $ret
|
||||
}
|
||||
}
|
||||
|
||||
proc tixEvent {option args} {
|
||||
global tixPriv
|
||||
variable ::tix::EVENT
|
||||
set varName [lindex $EVENT(nameStack) 0]
|
||||
|
||||
if {$varName == ""} {
|
||||
error "tixEvent called when no event is being processed"
|
||||
} else {
|
||||
upvar #0 $varName event
|
||||
}
|
||||
|
||||
switch -exact -- $option {
|
||||
type {
|
||||
return $event(type)
|
||||
}
|
||||
value {
|
||||
if {[info exists event(%V)]} {
|
||||
return $event(%V)
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
flag {
|
||||
set f %[lindex $args 0]
|
||||
if {[info exists event($f)]} {
|
||||
return $event($f)
|
||||
}
|
||||
error "The flag \"[lindex $args 0]\" does not exist"
|
||||
}
|
||||
match {
|
||||
return [string match [lindex $args 0] $event(type)]
|
||||
}
|
||||
default {
|
||||
error "unknown option \"$option\""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# tixBuiltInCmdErrorHandler --
|
||||
#
|
||||
# Default method to report command handler errors. This procedure is
|
||||
# also called if double-fault happens (command handler causes error,
|
||||
# then tixCmdErrorHandler causes error).
|
||||
#
|
||||
proc tixBuiltInCmdErrorHandler {errorMsg} {
|
||||
global errorInfo tcl_platform
|
||||
if {![info exists errorInfo]} {
|
||||
set errorInfo "???"
|
||||
}
|
||||
if {$tcl_platform(platform) eq "windows"} {
|
||||
bgerror "Tix Error: $errorMsg"
|
||||
} else {
|
||||
puts "Error:\n $errorMsg\n$errorInfo"
|
||||
}
|
||||
}
|
||||
|
||||
# tixCmdErrorHandler --
|
||||
#
|
||||
# You can redefine this command to handle the errors that occur
|
||||
# in the command handlers. See the programmer's documentation
|
||||
# for details
|
||||
#
|
||||
if {![llength [info commands tixCmdErrorHandler]]} {
|
||||
proc tixCmdErrorHandler {errorMsg} {
|
||||
tixBuiltInCmdErrorHandler $errorMsg
|
||||
}
|
||||
}
|
||||
|
||||
568
win32/lib/tix8.4.3/FileBox.tcl
Normal file
@@ -0,0 +1,568 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: FileBox.tcl,v 1.5 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# FileBox.tcl --
|
||||
#
|
||||
# Implements the File Selection Box widget.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
|
||||
|
||||
# ToDo
|
||||
# (1) If user has entered an invalid directory, give an error dialog
|
||||
#
|
||||
|
||||
tixWidgetClass tixFileSelectBox {
|
||||
-superclass tixPrimitive
|
||||
-classname TixFileSelectBox
|
||||
-method {
|
||||
filter invoke
|
||||
}
|
||||
-flag {
|
||||
-browsecmd -command -dir -directory -disablecallback
|
||||
-grab -pattern -selection -value
|
||||
}
|
||||
-configspec {
|
||||
{-browsecmd browseCmd BrowseCmd ""}
|
||||
{-command command Command ""}
|
||||
{-directory directory Directory ""}
|
||||
{-disablecallback disableCallback DisableCallback 0 tixVerifyBoolean}
|
||||
{-grab grab Grab global}
|
||||
{-pattern pattern Pattern *}
|
||||
{-value value Value ""}
|
||||
}
|
||||
-alias {
|
||||
{-selection -value}
|
||||
{-dir -directory}
|
||||
}
|
||||
-forcecall {
|
||||
-value
|
||||
}
|
||||
-default {
|
||||
{.relief raised}
|
||||
{*filelist*Listbox.takeFocus true}
|
||||
{.borderWidth 1}
|
||||
{*Label.anchor w}
|
||||
{*Label.borderWidth 0}
|
||||
{*TixComboBox*scrollbar auto}
|
||||
{*TixComboBox*Label.anchor w}
|
||||
{*TixScrolledListBox.scrollbar auto}
|
||||
{*Listbox.exportSelection false}
|
||||
{*directory*Label.text "Directories:"}
|
||||
{*directory*Label.underline 0}
|
||||
{*file*Label.text "Files:"}
|
||||
{*file*Label.underline 2}
|
||||
{*filter.label "Filter:"}
|
||||
{*filter*label.underline 3}
|
||||
{*filter.labelSide top}
|
||||
{*selection.label "Selection:"}
|
||||
{*selection*label.underline 0}
|
||||
{*selection.labelSide top}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
proc tixFileSelectBox:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
global env
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
|
||||
if {$data(-directory) eq ""} {
|
||||
set data(-directory) [pwd]
|
||||
}
|
||||
if {$data(-pattern) eq ""} {
|
||||
set data(-pattern) "*"
|
||||
}
|
||||
|
||||
tixFileSelectBox:SetPat $w $data(-pattern)
|
||||
tixFileSelectBox:SetDir $w [tixFSNormalize $data(-directory)]
|
||||
|
||||
set data(flag) 0
|
||||
set data(fakeDir) 0
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Construct widget
|
||||
#----------------------------------------------------------------------
|
||||
proc tixFileSelectBox:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
set frame1 [tixFileSelectBox:CreateFrame1 $w]
|
||||
set frame2 [tixFileSelectBox:CreateFrame2 $w]
|
||||
set frame3 [tixFileSelectBox:CreateFrame3 $w]
|
||||
|
||||
pack $frame1 -in $w -side top -fill x
|
||||
pack $frame3 -in $w -side bottom -fill x
|
||||
pack $frame2 -in $w -side top -fill both -expand yes
|
||||
}
|
||||
|
||||
proc tixFileSelectBox:CreateFrame1 {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
frame $w.f1 -border 10
|
||||
tixComboBox $w.f1.filter -editable 1\
|
||||
-command [list $w filter] -anchor e \
|
||||
-options {
|
||||
slistbox.scrollbar auto
|
||||
listbox.height 5
|
||||
label.anchor w
|
||||
}
|
||||
set data(w:filter) $w.f1.filter
|
||||
|
||||
pack $data(w:filter) -side top -expand yes -fill both
|
||||
return $w.f1
|
||||
}
|
||||
|
||||
proc tixFileSelectBox:CreateFrame2 {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixPanedWindow $w.f2 -orientation horizontal
|
||||
# THE LEFT FRAME
|
||||
#-----------------------
|
||||
set dir [$w.f2 add directory -size 120]
|
||||
$dir config -relief flat
|
||||
label $dir.lab
|
||||
set data(w:dirlist) [tixScrolledListBox $dir.dirlist\
|
||||
-scrollbar auto\
|
||||
-options {listbox.width 4 listbox.height 6}]
|
||||
|
||||
pack $dir.lab -side top -fill x -padx 10
|
||||
pack $data(w:dirlist) -side bottom -expand yes -fill both -padx 10
|
||||
|
||||
# THE RIGHT FRAME
|
||||
#-----------------------
|
||||
set file [$w.f2 add file -size 160]
|
||||
$file config -relief flat
|
||||
label $file.lab
|
||||
set data(w:filelist) [tixScrolledListBox $file.filelist \
|
||||
-scrollbar auto\
|
||||
-options {listbox.width 4 listbox.height 6}]
|
||||
|
||||
pack $file.lab -side top -fill x -padx 10
|
||||
pack $data(w:filelist) -side bottom -expand yes -fill both -padx 10
|
||||
|
||||
return $w.f2
|
||||
}
|
||||
|
||||
proc tixFileSelectBox:CreateFrame3 {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
frame $w.f3 -border 10
|
||||
tixComboBox $w.f3.selection -editable 1\
|
||||
-command [list tixFileSelectBox:SelInvoke $w] \
|
||||
-anchor e \
|
||||
-options {
|
||||
slistbox.scrollbar auto
|
||||
listbox.height 5
|
||||
label.anchor w
|
||||
}
|
||||
|
||||
set data(w:selection) $w.f3.selection
|
||||
|
||||
pack $data(w:selection) -side top -fill both
|
||||
|
||||
return $w.f3
|
||||
}
|
||||
|
||||
proc tixFileSelectBox:SelInvoke {w args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set event [tixEvent type]
|
||||
|
||||
if {$event ne "<FocusOut>" && $event ne "<Tab>"} {
|
||||
$w invoke
|
||||
}
|
||||
}
|
||||
|
||||
proc tixFileSelectBox:SetValue {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(i-value) $value
|
||||
set data(-value) [tixFSNative $value]
|
||||
}
|
||||
|
||||
proc tixFileSelectBox:SetDir {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(i-directory) $value
|
||||
set data(-directory) [tixFSNative $value]
|
||||
}
|
||||
|
||||
proc tixFileSelectBox:SetPat {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(i-pattern) $value
|
||||
set data(-pattern) [tixFSNative $value]
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# BINDINGS
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
proc tixFileSelectBox:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
|
||||
tixDoWhenMapped $w [list tixFileSelectBox:FirstMapped $w]
|
||||
|
||||
$data(w:dirlist) config \
|
||||
-browsecmd [list tixFileSelectBox:SelectDir $w] \
|
||||
-command [list tixFileSelectBox:InvokeDir $w]
|
||||
|
||||
$data(w:filelist) config \
|
||||
-browsecmd [list tixFileSelectBox:SelectFile $w] \
|
||||
-command [list tixFileSelectBox:InvokeFile $w]
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# CONFIG OPTIONS
|
||||
#----------------------------------------------------------------------
|
||||
proc tixFileSelectBox:config-directory {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$value eq ""} {
|
||||
set value [pwd]
|
||||
}
|
||||
tixFileSelectBox:SetDir $w [tixFSNormalize $value]
|
||||
tixFileSelectBox:SetFilter $w $data(i-directory) $data(i-pattern)
|
||||
$w filter
|
||||
|
||||
return $data(-directory)
|
||||
}
|
||||
|
||||
proc tixFileSelectBox:config-pattern {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$value eq ""} {
|
||||
set value "*"
|
||||
}
|
||||
|
||||
tixFileSelectBox:SetPat $w $value
|
||||
tixFileSelectBox:SetFilter $w $data(i-directory) $data(i-pattern)
|
||||
|
||||
# Returning a value means we have overridden the value and updated
|
||||
# the widget record ourselves.
|
||||
#
|
||||
return $data(-pattern)
|
||||
}
|
||||
|
||||
proc tixFileSelectBox:config-value {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixFileSelectBox:SetValue $w [tixFSNormalize $value]
|
||||
tixSetSilent $data(w:selection) $value
|
||||
|
||||
return $data(-value)
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# PUBLIC METHODS
|
||||
#----------------------------------------------------------------------
|
||||
proc tixFileSelectBox:filter {w args} {
|
||||
upvar #0 $w data
|
||||
|
||||
$data(w:filter) popdown
|
||||
tixFileSelectBox:InterpFilter $w
|
||||
tixFileSelectBox:LoadDir $w
|
||||
}
|
||||
|
||||
proc tixFileSelectBox:invoke {w args} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[$data(w:selection) cget -value] ne
|
||||
[$data(w:selection) cget -selection]} {
|
||||
# this will in turn call "invoke" again ...
|
||||
#
|
||||
$data(w:selection) invoke
|
||||
return
|
||||
}
|
||||
|
||||
# record the filter
|
||||
#
|
||||
set filter [tixFileSelectBox:InterpFilter $w]
|
||||
$data(w:filter) addhistory $filter
|
||||
|
||||
# record the selection
|
||||
#
|
||||
set userInput [string trim [$data(w:selection) cget -value]]
|
||||
tixFileSelectBox:SetValue $w \
|
||||
[tixFSNormalize [file join $data(i-directory) $userInput]]
|
||||
$data(w:selection) addhistory $data(-value)
|
||||
|
||||
$data(w:filter) align
|
||||
$data(w:selection) align
|
||||
|
||||
if {[llength $data(-command)] && !$data(-disablecallback)} {
|
||||
set bind(specs) "%V"
|
||||
set bind(%V) $data(-value)
|
||||
tixEvalCmdBinding $w $data(-command) bind $data(-value)
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# INTERNAL METHODS
|
||||
#----------------------------------------------------------------------
|
||||
# InterpFilter:
|
||||
# Interprets the value of the w:filter widget.
|
||||
#
|
||||
# Side effects:
|
||||
# Changes the fields data(-directory) and data(-pattenn)
|
||||
#
|
||||
proc tixFileSelectBox:InterpFilter {w {filter ""}} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$filter == ""} {
|
||||
set filter [$data(w:filter) cget -selection]
|
||||
if {$filter == ""} {
|
||||
set filter [$data(w:filter) cget -value]
|
||||
}
|
||||
}
|
||||
|
||||
set i_filter [tixFSNormalize $filter]
|
||||
|
||||
if {[file isdirectory $filter]} {
|
||||
tixFileSelectBox:SetDir $w $i_filter
|
||||
tixFileSelectBox:SetPat $w "*"
|
||||
} else {
|
||||
set nDir [file dirname $filter]
|
||||
if {$nDir eq "" || $nDir eq "."} {
|
||||
tixFileSelectBox:SetDir $w [tixFSNormalize $data(i-directory)]
|
||||
} else {
|
||||
tixFileSelectBox:SetDir $w [tixFSNormalize $nDir]
|
||||
}
|
||||
tixFileSelectBox:SetPat $w [file tail $filter]
|
||||
}
|
||||
|
||||
tixFileSelectBox:SetFilter $w $data(i-directory) $data(i-pattern)
|
||||
|
||||
return $data(filter)
|
||||
}
|
||||
|
||||
proc tixFileSelectBox:SetFilter {w dir pattern} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(filter) [file join $dir $pattern]
|
||||
tixSetSilent $data(w:filter) $data(filter)
|
||||
}
|
||||
|
||||
proc tixFileSelectBox:LoadDirIntoLists {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
$data(w:dirlist) subwidget listbox delete 0 end
|
||||
$data(w:filelist) subwidget listbox delete 0 end
|
||||
|
||||
set dir $data(i-directory)
|
||||
|
||||
# (1) List the directories
|
||||
#
|
||||
set isDrive [expr {[llength [file split $dir]] == 1}]
|
||||
foreach name [tixFSListDir $dir 1 0 1 1] {
|
||||
if {".." eq $name && $isDrive} { continue }
|
||||
$data(w:dirlist) subwidget listbox insert end $name
|
||||
}
|
||||
|
||||
# (2) List the files
|
||||
#
|
||||
# %% UNIX'ISM:
|
||||
# If the pattern is "*" force glob to list the .* files.
|
||||
# However, since the user might not
|
||||
# be interested in them, shift the listbox so that the "normal" files
|
||||
# are seen first
|
||||
#
|
||||
# NOTE: if we pass $pat == "" but with $showHidden set to true,
|
||||
# tixFSListDir will list "* .*" in Unix. See the comment on top of
|
||||
# the tixFSListDir code.
|
||||
#
|
||||
if {$data(i-pattern) eq "*"} {
|
||||
set pat ""
|
||||
} else {
|
||||
set pat $data(i-pattern)
|
||||
}
|
||||
|
||||
set top 0
|
||||
foreach name [tixFSListDir $dir 0 1 0 0 $pat] {
|
||||
$data(w:filelist) subwidget listbox insert end $name
|
||||
if {[string match .* $name]} {
|
||||
incr top
|
||||
}
|
||||
}
|
||||
|
||||
$data(w:filelist) subwidget listbox yview $top
|
||||
}
|
||||
|
||||
proc tixFileSelectBox:LoadDir {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixBusy $w on [$data(w:dirlist) subwidget listbox]
|
||||
|
||||
tixFileSelectBox:LoadDirIntoLists $w
|
||||
|
||||
if {[$data(w:dirlist) subwidget listbox size] == 0} {
|
||||
# fail safe, just in case the user has inputed an errnoeuos
|
||||
# directory
|
||||
$data(w:dirlist) subwidget listbox insert 0 ".."
|
||||
}
|
||||
|
||||
tixWidgetDoWhenIdle tixBusy $w off [$data(w:dirlist) subwidget listbox]
|
||||
}
|
||||
|
||||
# User single clicks on the directory listbox
|
||||
#
|
||||
proc tixFileSelectBox:SelectDir {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(fakeDir) > 0} {
|
||||
incr data(fakeDir) -1
|
||||
$data(w:dirlist) subwidget listbox select clear 0 end
|
||||
$data(w:dirlist) subwidget listbox activate -1
|
||||
return
|
||||
}
|
||||
|
||||
if {$data(flag)} {
|
||||
return
|
||||
}
|
||||
set data(flag) 1
|
||||
|
||||
set subdir [tixListboxGetCurrent [$data(w:dirlist) subwidget listbox]]
|
||||
if {$subdir == ""} {
|
||||
set subdir "."
|
||||
}
|
||||
|
||||
tixFileSelectBox:SetFilter $w \
|
||||
[tixFSNormalize [file join $data(i-directory) $subdir]] \
|
||||
$data(i-pattern)
|
||||
set data(flag) 0
|
||||
}
|
||||
|
||||
proc tixFileSelectBox:InvokeDir {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
set theDir [$data(w:dirlist) subwidget listbox get active]
|
||||
|
||||
tixFileSelectBox:SetDir $w \
|
||||
[tixFSNormalize [file join $data(i-directory) $theDir]]
|
||||
|
||||
$data(w:dirlist) subwidget listbox select clear 0 end
|
||||
|
||||
tixFileSelectBox:SetFilter $w $data(i-directory) $data(i-pattern)
|
||||
tixFileSelectBox:InterpFilter $w [tixFSNativeNorm $data(filter)]
|
||||
|
||||
tixFileSelectBox:LoadDir $w
|
||||
|
||||
if {![tixEvent match <Return>]} {
|
||||
incr data(fakeDir) 1
|
||||
}
|
||||
}
|
||||
|
||||
proc tixFileSelectBox:SelectFile {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(flag)} {
|
||||
return
|
||||
}
|
||||
set data(flag) 1
|
||||
|
||||
# Reset the "Filter:" box to the current directory:
|
||||
#
|
||||
$data(w:dirlist) subwidget listbox select clear 0 end
|
||||
tixFileSelectBox:SetFilter $w $data(i-directory) $data(i-pattern)
|
||||
|
||||
# Now select the file
|
||||
#
|
||||
set selected [tixListboxGetCurrent [$data(w:filelist) subwidget listbox]]
|
||||
if {$selected != ""} {
|
||||
# Make sure that the selection is not empty!
|
||||
#
|
||||
tixFileSelectBox:SetValue $w \
|
||||
[tixFSNormalize [file join $data(i-directory) $selected]]
|
||||
tixSetSilent $data(w:selection) $data(-value)
|
||||
|
||||
if {[llength $data(-browsecmd)]} {
|
||||
tixEvalCmdBinding $w $data(-browsecmd) "" $data(-value)
|
||||
}
|
||||
}
|
||||
set data(flag) 0
|
||||
}
|
||||
|
||||
proc tixFileSelectBox:InvokeFile {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
set selected [tixListboxGetCurrent [$data(w:filelist) subwidget listbox]]
|
||||
if {$selected != ""} {
|
||||
$w invoke
|
||||
}
|
||||
}
|
||||
|
||||
# This is only called the first this fileBox is mapped -- load the directory
|
||||
#
|
||||
proc tixFileSelectBox:FirstMapped {w} {
|
||||
if {![winfo exists $w]} {
|
||||
return
|
||||
}
|
||||
|
||||
upvar #0 $w data
|
||||
|
||||
tixFileSelectBox:SetFilter $w $data(i-directory) $data(i-pattern)
|
||||
tixFileSelectBox:LoadDir $w
|
||||
$data(w:filter) align
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# C O N V E N I E N C E R O U T I N E S
|
||||
#
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
# This is obsolete. Use the widget tixFileSelectDialog instead
|
||||
#
|
||||
#
|
||||
proc tixMkFileDialog {w args} {
|
||||
set option(-okcmd) ""
|
||||
set option(-helpcmd) ""
|
||||
|
||||
tixHandleOptions option {-okcmd -helpcmd} $args
|
||||
|
||||
toplevel $w
|
||||
wm minsize $w 10 10
|
||||
|
||||
tixStdDlgBtns $w.btns
|
||||
|
||||
if {$option(-okcmd) != ""} {
|
||||
tixFileSelectBox $w.fsb \
|
||||
-command "[list wm withdraw $w]; $option(-okcmd)"
|
||||
} else {
|
||||
tixFileSelectBox $w.fsb -command [list wm withdraw $w]
|
||||
}
|
||||
|
||||
$w.btns button ok config -command [list $w.fsb invoke]
|
||||
$w.btns button apply config -command [list $w.fsb filter] -text Filter
|
||||
$w.btns button cancel config -command [list wm withdraw $w]
|
||||
|
||||
if {$option(-helpcmd) == ""} {
|
||||
$w.btns button help config -state disabled
|
||||
} else {
|
||||
$w.btns button help config -command $option(-helpcmd)
|
||||
}
|
||||
wm protocol $w WM_DELETE_WINDOW [list wm withdraw $w]
|
||||
pack $w.btns -side bottom -fill both
|
||||
pack $w.fsb -fill both -expand yes
|
||||
|
||||
return $w.fsb
|
||||
}
|
||||
|
||||
|
||||
108
win32/lib/tix8.4.3/FileCbx.tcl
Normal file
@@ -0,0 +1,108 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: FileCbx.tcl,v 1.5 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# tixFileCombobox --
|
||||
#
|
||||
# A combobox widget for entering file names, directory names, file
|
||||
# patterns, etc.
|
||||
#
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
|
||||
# tixFileComboBox displays and accepts the DOS pathnames only. It doesn't
|
||||
# recognize UNC file names or Tix VPATHS.
|
||||
#
|
||||
tixWidgetClass tixFileComboBox {
|
||||
-classname TixFileComboBox
|
||||
-superclass tixPrimitive
|
||||
-method {
|
||||
invoke
|
||||
}
|
||||
-flag {
|
||||
-command -defaultfile -directory -text
|
||||
}
|
||||
-forcecall {
|
||||
-directory
|
||||
}
|
||||
-configspec {
|
||||
{-defaultfile defaultFile DefaultFile ""}
|
||||
{-directory directory Directory ""}
|
||||
{-command command Command ""}
|
||||
{-text text Text ""}
|
||||
}
|
||||
-default {
|
||||
}
|
||||
}
|
||||
|
||||
proc tixFileComboBox:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
|
||||
if {$data(-directory) eq ""} {
|
||||
set data(-directory) [pwd]
|
||||
}
|
||||
}
|
||||
|
||||
proc tixFileComboBox:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
set data(w:combo) [tixComboBox $w.combo -editable true -dropdown true]
|
||||
pack $data(w:combo) -expand yes -fill both
|
||||
}
|
||||
|
||||
proc tixFileComboBox:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
$data(w:combo) config -command [list tixFileComboBox:OnComboCmd $w]
|
||||
}
|
||||
|
||||
proc tixFileComboBox:OnComboCmd {w args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set text [string trim [tixEvent value]]
|
||||
|
||||
set path [tixFSJoin $data(-directory) $text]
|
||||
if {[file isdirectory $path]} {
|
||||
set path [tixFSJoin $path $data(-defaultfile)]
|
||||
set tail $data(-defaultfile)
|
||||
} else {
|
||||
set tail [file tail $path]
|
||||
}
|
||||
set norm [tixFSNormalize $path]
|
||||
tixSetSilent $data(w:combo) $norm
|
||||
if {[llength $data(-command)]} {
|
||||
set bind(specs) {%V}
|
||||
set bind(%V) [list $norm $path $tail ""]
|
||||
tixEvalCmdBinding $w $data(-command) bind $bind(%V)
|
||||
}
|
||||
}
|
||||
|
||||
proc tixFileComboBox:config-text {w val} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixSetSilent $data(w:combo) $val
|
||||
}
|
||||
|
||||
proc tixFileComboBox:config-directory {w val} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(-directory) [tixFSNormalize $val]
|
||||
return $data(-directory)
|
||||
}
|
||||
|
||||
proc tixFileComboBox:invoke {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
$data(w:combo) invoke
|
||||
}
|
||||
|
||||
|
||||
75
win32/lib/tix8.4.3/FileDlg.tcl
Normal file
@@ -0,0 +1,75 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: FileDlg.tcl,v 1.3 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# FileDlg.tcl --
|
||||
#
|
||||
# Implements the File Selection Dialog widget.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
tixWidgetClass tixFileSelectDialog {
|
||||
-classname TixFileSelectDialog
|
||||
-superclass tixStdDialogShell
|
||||
-method {
|
||||
}
|
||||
-flag {
|
||||
-command
|
||||
}
|
||||
-configspec {
|
||||
{-command command Command ""}
|
||||
|
||||
{-title title Title "Select A File"}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixFileSelectDialog:ConstructTopFrame {w frame} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructTopFrame $frame
|
||||
|
||||
set data(w:fsbox) [tixFileSelectBox $frame.fsbox \
|
||||
-command [list tixFileSelectDialog:Invoke $w]]
|
||||
pack $data(w:fsbox) -expand yes -fill both
|
||||
}
|
||||
|
||||
proc tixFileSelectDialog:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
|
||||
$data(w:btns) subwidget ok config -command "$data(w:fsbox) invoke" \
|
||||
-underline 0
|
||||
$data(w:btns) subwidget apply config -command "$data(w:fsbox) filter" \
|
||||
-text Filter -underline 0
|
||||
$data(w:btns) subwidget cancel config -command "wm withdraw $w" \
|
||||
-underline 0
|
||||
$data(w:btns) subwidget help config -underline 0
|
||||
|
||||
|
||||
bind $w <Alt-Key-l> "focus [$data(w:fsbox) subwidget filelist]"
|
||||
bind $w <Alt-Key-d> "focus [$data(w:fsbox) subwidget dirlist]"
|
||||
bind $w <Alt-Key-s> "focus [$data(w:fsbox) subwidget selection]"
|
||||
bind $w <Alt-Key-t> "focus [$data(w:fsbox) subwidget filter]"
|
||||
bind $w <Alt-Key-o> "tkButtonInvoke [$data(w:btns) subwidget ok]"
|
||||
bind $w <Alt-Key-f> "tkButtonInvoke [$data(w:btns) subwidget apply]"
|
||||
bind $w <Alt-Key-c> "tkButtonInvoke [$data(w:btns) subwidget cancel]"
|
||||
bind $w <Alt-Key-h> "tkButtonInvoke [$data(w:btns) subwidget help]"
|
||||
}
|
||||
|
||||
proc tixFileSelectDialog:Invoke {w filename} {
|
||||
upvar #0 $w data
|
||||
|
||||
wm withdraw $w
|
||||
|
||||
if {$data(-command) != ""} {
|
||||
set bind(specs) "%V"
|
||||
set bind(%V) $filename
|
||||
tixEvalCmdBinding $w $data(-command) bind $filename
|
||||
}
|
||||
}
|
||||
270
win32/lib/tix8.4.3/FileEnt.tcl
Normal file
@@ -0,0 +1,270 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: FileEnt.tcl,v 1.7 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# FileEnt.tcl --
|
||||
#
|
||||
# TixFileEntry Widget: an entry box for entering filenames.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
|
||||
tixWidgetClass tixFileEntry {
|
||||
-classname TixFileEntry
|
||||
-superclass tixLabelWidget
|
||||
-method {
|
||||
invoke filedialog update
|
||||
}
|
||||
-flag {
|
||||
-activatecmd -command -dialogtype -disablecallback -disabledforeground
|
||||
-filebitmap -selectmode -state -validatecmd -value -variable
|
||||
}
|
||||
-forcecall {
|
||||
-variable
|
||||
}
|
||||
-static {
|
||||
-filebitmap
|
||||
}
|
||||
-configspec {
|
||||
{-activatecmd activateCmd ActivateCmd ""}
|
||||
{-command command Command ""}
|
||||
{-dialogtype dialogType DialogType ""}
|
||||
{-disablecallback disableCallback DisableCallback 0 tixVerifyBoolean}
|
||||
{-disabledforeground disabledForeground DisabledForeground #303030}
|
||||
{-filebitmap fileBitmap FileBitmap ""}
|
||||
{-selectmode selectMode SelectMode normal}
|
||||
{-state state State normal}
|
||||
{-validatecmd validateCmd ValidateCmd ""}
|
||||
{-value value Value ""}
|
||||
{-variable variable Variable ""}
|
||||
}
|
||||
-default {
|
||||
{*frame.borderWidth 2}
|
||||
{*frame.relief sunken}
|
||||
{*Button.highlightThickness 0}
|
||||
{*Entry.highlightThickness 0}
|
||||
{*Entry.borderWidth 0}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixFileEntry:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
set data(varInited) 0
|
||||
|
||||
if {$data(-filebitmap) eq ""} {
|
||||
set data(-filebitmap) [tix getbitmap openfile]
|
||||
}
|
||||
}
|
||||
|
||||
proc tixFileEntry:ConstructFramedWidget {w frame} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructFramedWidget $frame
|
||||
|
||||
set data(w:entry) [entry $frame.entry]
|
||||
set data(w:button) [button $frame.button -bitmap $data(-filebitmap) \
|
||||
-takefocus 0]
|
||||
set data(entryfg) [$data(w:entry) cget -fg]
|
||||
|
||||
pack $data(w:button) -side right -fill both
|
||||
pack $data(w:entry) -side left -expand yes -fill both
|
||||
}
|
||||
|
||||
proc tixFileEntry:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
|
||||
$data(w:button) config -command [list tixFileEntry:OpenFile $w]
|
||||
tixSetMegaWidget $data(w:entry) $w
|
||||
|
||||
# If user press <return>, verify the value and call the -command
|
||||
#
|
||||
bind $data(w:entry) <Return> [list tixFileEntry:invoke $w]
|
||||
bind $data(w:entry) <KeyPress> {
|
||||
if {[set [tixGetMegaWidget %W](-selectmode)] eq "immediate"} {
|
||||
tixFileEntry:invoke [tixGetMegaWidget %W]
|
||||
}
|
||||
}
|
||||
bind $data(w:entry) <FocusOut> {
|
||||
if {"%d" eq "NotifyNonlinear" || "%d" eq "NotifyNonlinearVirtual"} {
|
||||
tixFileEntry:invoke [tixGetMegaWidget %W]
|
||||
}
|
||||
}
|
||||
bind $w <FocusIn> [list focus $data(w:entry)]
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# CONFIG OPTIONS
|
||||
#----------------------------------------------------------------------
|
||||
proc tixFileEntry:config-state {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$value eq "normal"} {
|
||||
$data(w:button) config -state $value
|
||||
$data(w:entry) config -state $value -fg $data(entryfg)
|
||||
catch {$data(w:label) config -fg $data(entryfg)}
|
||||
} else {
|
||||
$data(w:button) config -state $value
|
||||
$data(w:entry) config -state $value -fg $data(-disabledforeground)
|
||||
catch {$data(w:label) config -fg $data(-disabledforeground)}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
proc tixFileEntry:config-value {w value} {
|
||||
tixFileEntry:SetValue $w $value
|
||||
}
|
||||
|
||||
proc tixFileEntry:config-variable {w arg} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[tixVariable:ConfigVariable $w $arg]} {
|
||||
# The value of data(-value) is changed if tixVariable:ConfigVariable
|
||||
# returns true
|
||||
tixFileEntry:SetValue $w $data(-value)
|
||||
}
|
||||
catch {
|
||||
unset data(varInited)
|
||||
}
|
||||
set data(-variable) $arg
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# User Commands
|
||||
#----------------------------------------------------------------------
|
||||
proc tixFileEntry:invoke {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {![catch {$data(w:entry) index sel.first}]} {
|
||||
# THIS ENTRY OWNS SELECTION --> TURN IT OFF
|
||||
#
|
||||
$data(w:entry) select from end
|
||||
$data(w:entry) select to end
|
||||
}
|
||||
|
||||
tixFileEntry:SetValue $w [$data(w:entry) get]
|
||||
}
|
||||
|
||||
proc tixFileEntry:filedialog {w args} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[llength $args]} {
|
||||
return [eval [tix filedialog $data(-dialogtype)] $args]
|
||||
} else {
|
||||
return [tix filedialog $data(-dialogtype)]
|
||||
}
|
||||
}
|
||||
|
||||
proc tixFileEntry:update {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[$data(w:entry) get] ne $data(-value)} {
|
||||
tixFileEntry:invoke $w
|
||||
}
|
||||
}
|
||||
#----------------------------------------------------------------------
|
||||
# Internal Commands
|
||||
#----------------------------------------------------------------------
|
||||
proc tixFileEntry:OpenFile {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(-activatecmd) != ""} {
|
||||
uplevel #0 $data(-activatecmd)
|
||||
}
|
||||
|
||||
switch -- $data(-dialogtype) tk_chooseDirectory {
|
||||
set args [list -parent [winfo toplevel $w]]
|
||||
if {[set initial $data(-value)] != ""} {
|
||||
lappend args -initialdir $data(value)
|
||||
}
|
||||
set retval [eval [linsert $args 0 tk_chooseDirectory]]
|
||||
|
||||
if {$retval != ""} {tixFileEntry:SetValue $w [tixFSNative $retval]}
|
||||
} tk_getOpenFile - tk_getSaveFile {
|
||||
set args [list -parent [winfo toplevel $w]]
|
||||
|
||||
if {[set initial [$data(w:entry) get]] != ""} {
|
||||
switch -glob -- $initial *.py {
|
||||
set types [list {"Python Files" {.py .pyw}} {"All Files" *}]
|
||||
} *.txt {
|
||||
set types [list {"Text Files" .txt} {"All Files" *}]
|
||||
} *.tcl {
|
||||
set types [list {"Tcl Files" .tcl} {"All Files" *}]
|
||||
} * - default {
|
||||
set types [list {"All Files" *}]
|
||||
}
|
||||
if {[file isfile $initial]} {
|
||||
lappend args -initialdir [file dir $initial] \
|
||||
-initialfile $initial
|
||||
} elseif {[file isdir $initial]} {
|
||||
lappend args -initialdir $initial
|
||||
}
|
||||
} else {
|
||||
set types [list {"All Files" *}]
|
||||
}
|
||||
lappend args -filetypes $types
|
||||
|
||||
set retval [eval $data(-dialogtype) $args]
|
||||
if {$retval != ""} {tixFileEntry:SetValue $w [tixFSNative $retval]}
|
||||
} default {
|
||||
set filedlg [tix filedialog $data(-dialogtype)]
|
||||
|
||||
$filedlg config -parent [winfo toplevel $w] \
|
||||
-command [list tixFileEntry:FileDlgCallback $w]
|
||||
|
||||
focus $data(w:entry)
|
||||
|
||||
$filedlg popup
|
||||
}
|
||||
}
|
||||
|
||||
proc tixFileEntry:FileDlgCallback {w args} {
|
||||
set filename [tixEvent flag V]
|
||||
|
||||
tixFileEntry:SetValue $w $filename
|
||||
}
|
||||
|
||||
proc tixFileEntry:SetValue {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[llength $data(-validatecmd)]} {
|
||||
set value [tixEvalCmdBinding $w $data(-validatecmd) "" $value]
|
||||
}
|
||||
|
||||
if {$data(-state) eq "normal"} {
|
||||
$data(w:entry) delete 0 end
|
||||
$data(w:entry) insert 0 $value
|
||||
$data(w:entry) xview end
|
||||
}
|
||||
|
||||
set data(-value) $value
|
||||
|
||||
tixVariable:UpdateVariable $w
|
||||
|
||||
if {[llength $data(-command)] && !$data(-disablecallback)} {
|
||||
if {![info exists data(varInited)]} {
|
||||
set bind(specs) ""
|
||||
tixEvalCmdBinding $w $data(-command) bind $value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixFileEntry:Destructor {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixUnsetMegaWidget $data(w:entry)
|
||||
tixVariable:DeleteVariable $w
|
||||
|
||||
# Chain this to the superclass
|
||||
#
|
||||
tixChainMethod $w Destructor
|
||||
}
|
||||
132
win32/lib/tix8.4.3/FloatEnt.tcl
Normal file
@@ -0,0 +1,132 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: FloatEnt.tcl,v 1.4 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# FloatEnt.tcl --
|
||||
#
|
||||
# An entry widget that can be attached on top of any widget to
|
||||
# provide dynamic editing. It is used to provide dynamic editing
|
||||
# for the tixGrid widget, among other things.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
|
||||
tixWidgetClass tixFloatEntry {
|
||||
-classname TixFloatEntry
|
||||
-superclass tixPrimitive
|
||||
-method {
|
||||
invoke post unpost
|
||||
}
|
||||
-flag {
|
||||
-command -value
|
||||
}
|
||||
-configspec {
|
||||
{-value value Value ""}
|
||||
{-command command Command ""}
|
||||
}
|
||||
-default {
|
||||
{.entry.highlightThickness 0}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Initialization bindings
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
proc tixFloatEntry:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
}
|
||||
|
||||
proc tixFloatEntry:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
set data(w:entry) [entry $w.entry]
|
||||
pack $data(w:entry) -expand yes -fill both
|
||||
}
|
||||
|
||||
proc tixFloatEntry:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
tixBind $data(w:entry) <Return> [list tixFloatEntry:invoke $w]
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Class bindings
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
proc tixFloatEntryBind {} {
|
||||
tixBind TixFloatEntry <FocusIn> {
|
||||
if {[focus -displayof [set %W(w:entry)]] ne [set %W(w:entry)]} {
|
||||
focus [%W subwidget entry]
|
||||
[set %W(w:entry)] selection from 0
|
||||
[set %W(w:entry)] selection to end
|
||||
[set %W(w:entry)] icursor end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Public methods
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
proc tixFloatEntry:post {w x y {width ""} {height ""}} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$width == ""} {
|
||||
set width [winfo reqwidth $data(w:entry)]
|
||||
}
|
||||
if {$height == ""} {
|
||||
set height [winfo reqheight $data(w:entry)]
|
||||
}
|
||||
|
||||
place $w -x $x -y $y -width $width -height $height -bordermode ignore
|
||||
raise $w
|
||||
focus $data(w:entry)
|
||||
}
|
||||
|
||||
proc tixFloatEntry:unpost {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
place forget $w
|
||||
}
|
||||
|
||||
proc tixFloatEntry:config-value {w val} {
|
||||
upvar #0 $w data
|
||||
|
||||
$data(w:entry) delete 0 end
|
||||
$data(w:entry) insert 0 $val
|
||||
|
||||
$data(w:entry) selection from 0
|
||||
$data(w:entry) selection to end
|
||||
$data(w:entry) icursor end
|
||||
}
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Private methods
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
proc tixFloatEntry:invoke {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[llength $data(-command)]} {
|
||||
set bind(specs) {%V}
|
||||
set bind(%V) [$data(w:entry) get]
|
||||
|
||||
tixEvalCmdBinding $w $data(-command) bind $bind(%V)
|
||||
}
|
||||
}
|
||||
1122
win32/lib/tix8.4.3/Grid.tcl
Normal file
917
win32/lib/tix8.4.3/HList.tcl
Normal file
@@ -0,0 +1,917 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: HList.tcl,v 1.6 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# HList.tcl --
|
||||
#
|
||||
# This file defines the default bindings for Tix Hierarchical Listbox
|
||||
# widgets.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
|
||||
global tkPriv
|
||||
if {![llength [info globals tkPriv]]} {
|
||||
tk::unsupported::ExposePrivateVariable tkPriv
|
||||
}
|
||||
#--------------------------------------------------------------------------
|
||||
# tkPriv elements used in this file:
|
||||
#
|
||||
# afterId - Token returned by "after" for autoscanning.
|
||||
# fakeRelease - Cancel the ButtonRelease-1 after the user double click
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
foreach fun {tkCancelRepeat} {
|
||||
if {![llength [info commands $fun]]} {
|
||||
tk::unsupported::ExposePrivateCommand $fun
|
||||
}
|
||||
}
|
||||
unset fun
|
||||
|
||||
proc tixHListBind {} {
|
||||
tixBind TixHList <ButtonPress-1> {
|
||||
tixHList:Button-1 %W %x %y ""
|
||||
}
|
||||
tixBind TixHList <Shift-ButtonPress-1> {
|
||||
tixHList:Button-1 %W %x %y s
|
||||
}
|
||||
tixBind TixHList <Control-ButtonPress-1> {
|
||||
tixHList:Button-1 %W %x %y c
|
||||
}
|
||||
tixBind TixHList <ButtonRelease-1> {
|
||||
tixHList:ButtonRelease-1 %W %x %y
|
||||
}
|
||||
tixBind TixHList <Double-ButtonPress-1> {
|
||||
tixHList:Double-1 %W %x %y
|
||||
}
|
||||
tixBind TixHList <B1-Motion> {
|
||||
set tkPriv(x) %x
|
||||
set tkPriv(y) %y
|
||||
set tkPriv(X) %X
|
||||
set tkPriv(Y) %Y
|
||||
|
||||
tixHList:B1-Motion %W %x %y
|
||||
}
|
||||
tixBind TixHList <B1-Leave> {
|
||||
set tkPriv(x) %x
|
||||
set tkPriv(y) %y
|
||||
set tkPriv(X) %X
|
||||
set tkPriv(Y) %Y
|
||||
|
||||
tixHList:B1-Leave %W
|
||||
}
|
||||
tixBind TixHList <B1-Enter> {
|
||||
tixHList:B1-Enter %W %x %y
|
||||
}
|
||||
|
||||
# Keyboard bindings
|
||||
#
|
||||
tixBind TixHList <Up> {
|
||||
tixHList:UpDown %W prev ""
|
||||
}
|
||||
tixBind TixHList <Down> {
|
||||
tixHList:UpDown %W next ""
|
||||
}
|
||||
tixBind TixHList <Shift-Up> {
|
||||
tixHList:UpDown %W prev s
|
||||
}
|
||||
tixBind TixHList <Shift-Down> {
|
||||
tixHList:UpDown %W next s
|
||||
}
|
||||
tixBind TixHList <Left> {
|
||||
tixHList:LeftRight %W left
|
||||
}
|
||||
tixBind TixHList <Right> {
|
||||
tixHList:LeftRight %W right
|
||||
}
|
||||
tixBind TixHList <Prior> {
|
||||
%W yview scroll -1 pages
|
||||
}
|
||||
tixBind TixHList <Next> {
|
||||
%W yview scroll 1 pages
|
||||
}
|
||||
tixBind TixHList <Return> {
|
||||
tixHList:Keyboard-Activate %W
|
||||
}
|
||||
tixBind TixHList <space> {
|
||||
tixHList:Keyboard-Browse %W
|
||||
}
|
||||
|
||||
# Under Windows <Home> moves up, clears the sel and sets the selection
|
||||
# Under Windows <Control-Home> moves up, leaves the selection, and sets the anchor
|
||||
tixBind TixHList <Home> {
|
||||
set w %W
|
||||
$w yview moveto 0; # $w xview moveto 0
|
||||
set sel [lindex [$w info children] 0]
|
||||
# should be first not disabled
|
||||
$w anchor set $sel
|
||||
tixHList:Keyboard-Browse $w
|
||||
}
|
||||
tixBind TixHList <End> {
|
||||
set w %W
|
||||
$w yview moveto 1; # $w xview moveto 0
|
||||
$w select clear
|
||||
# should be last not disabled
|
||||
set sel [lindex [$w info children .] end]
|
||||
while {[set next [$w info next $sel]] ne "" && \
|
||||
![$w info hidden $next] && \
|
||||
[llength [set kids [$w info child $sel]]]} {
|
||||
set sel [lindex $kids end]
|
||||
}
|
||||
$w anchor set $sel
|
||||
tixHList:Keyboard-Browse $w
|
||||
}
|
||||
tixBind TixHList <Control-Home> {
|
||||
set w %W
|
||||
$w yview moveto 0; # $w xview moveto 0
|
||||
set sel [lindex [$w info children] 0]
|
||||
# should be first not disabled
|
||||
$w anchor set $sel
|
||||
}
|
||||
tixBind TixHList <Control-End> {
|
||||
set w %W
|
||||
$w yview moveto 1; # $w xview moveto 0
|
||||
# should be last not disabled
|
||||
set sel [lindex [$w info children .] end]
|
||||
while {[set next [$w info next $sel]] ne "" && \
|
||||
![$w info hidden $next] && \
|
||||
[llength [set kids [$w info child $sel]]]} {
|
||||
set sel [lindex $kids end]
|
||||
}
|
||||
$w anchor set $sel
|
||||
}
|
||||
#
|
||||
# Don't use tixBind because %A causes Tk 8.3.2 to crash
|
||||
#
|
||||
bind TixHList <MouseWheel> {
|
||||
%W yview scroll [expr {- (%D / 120) * 2}] units
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# Key bindings
|
||||
#
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
proc tixHList:Keyboard-Activate {w} {
|
||||
if {[tixHList:GetState $w] != 0} {
|
||||
return
|
||||
}
|
||||
set ent [$w info anchor]
|
||||
|
||||
if {$ent eq ""} {
|
||||
return
|
||||
}
|
||||
|
||||
if {[$w cget -selectmode] eq "single"} {
|
||||
$w select clear
|
||||
}
|
||||
$w select set $ent
|
||||
|
||||
set command [$w cget -command]
|
||||
if {$command ne ""} {
|
||||
set bind(specs) {%V}
|
||||
set bind(%V) $ent
|
||||
|
||||
tixEvalCmdBinding $w $command bind $ent
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHList:Keyboard-Browse {w} {
|
||||
if {[tixHList:GetState $w] != 0} {
|
||||
return
|
||||
}
|
||||
set ent [$w info anchor]
|
||||
|
||||
if {$ent eq ""} {
|
||||
return
|
||||
}
|
||||
|
||||
if {[$w cget -selectmode] eq "single"} {
|
||||
$w select clear
|
||||
}
|
||||
$w select set $ent
|
||||
|
||||
tixHList:Browse $w $ent
|
||||
}
|
||||
|
||||
proc tixHList:LeftRight {w spec} {
|
||||
catch {
|
||||
uplevel #0 unset $w:priv:shiftanchor
|
||||
}
|
||||
if {[tixHList:GetState $w] != 0} {
|
||||
return
|
||||
}
|
||||
|
||||
set anchor [$w info anchor]
|
||||
if {$anchor eq ""} {
|
||||
set anchor [lindex [$w info children] 0]
|
||||
}
|
||||
if {$anchor eq ""} {
|
||||
return
|
||||
}
|
||||
|
||||
set ent $anchor
|
||||
while {1} {
|
||||
set e $ent
|
||||
if {$spec eq "left"} {
|
||||
set ent [$w info parent $e]
|
||||
|
||||
if {$ent eq "" || [$w entrycget $ent -state] eq "disabled"} {
|
||||
set ent [$w info prev $e]
|
||||
}
|
||||
} else {
|
||||
set ent [lindex [$w info children $e] 0]
|
||||
|
||||
if {$ent eq "" || [$w entrycget $ent -state] eq "disabled"} {
|
||||
set ent [$w info next $e]
|
||||
}
|
||||
}
|
||||
|
||||
if {$ent eq ""} {
|
||||
break
|
||||
}
|
||||
if {[$w entrycget $ent -state] eq "disabled"} {
|
||||
continue
|
||||
}
|
||||
if {[$w info hidden $ent]} {
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
if {$ent eq ""} {
|
||||
return
|
||||
}
|
||||
|
||||
$w anchor set $ent
|
||||
$w see $ent
|
||||
|
||||
if {[$w cget -selectmode] ne "single"} {
|
||||
$w select clear
|
||||
$w selection set $ent
|
||||
|
||||
tixHList:Browse $w $ent
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHList:UpDown {w spec mod} {
|
||||
if {[tixHList:GetState $w] ne 0} {
|
||||
return
|
||||
}
|
||||
set anchor [$w info anchor]
|
||||
set done 0
|
||||
|
||||
if {$anchor eq ""} {
|
||||
set anchor [lindex [$w info children] 0]
|
||||
|
||||
if {$anchor eq ""} {
|
||||
return
|
||||
}
|
||||
|
||||
if {[$w entrycget $anchor -state] ne "disabled"} {
|
||||
# That's a good anchor
|
||||
set done 1
|
||||
} else {
|
||||
# We search for the first non-disabled entry (downward)
|
||||
set spec next
|
||||
}
|
||||
}
|
||||
|
||||
set ent $anchor
|
||||
# mike - bulletproofing
|
||||
if {![$w info exists $ent]} {return}
|
||||
# Find the prev/next non-disabled entry
|
||||
#
|
||||
while {!$done} {
|
||||
set ent [$w info $spec $ent]
|
||||
if {$ent eq ""} {
|
||||
break
|
||||
}
|
||||
if {[$w entrycget $ent -state] eq "disabled"} {
|
||||
continue
|
||||
}
|
||||
if {[$w info hidden $ent]} {
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
if {$ent eq ""} {
|
||||
return
|
||||
} else {
|
||||
$w see $ent
|
||||
$w anchor set $ent
|
||||
|
||||
set selMode [$w cget -selectmode]
|
||||
if {$mod eq "s" && ($selMode eq "extended" || $selMode eq "multiple")} {
|
||||
global $w:priv:shiftanchor
|
||||
|
||||
if {![info exists $w:priv:shiftanchor]} {
|
||||
set $w:priv:shiftanchor $anchor
|
||||
}
|
||||
|
||||
$w selection clear
|
||||
# mike - bulletproofing
|
||||
if {![catch {$w selection set $ent [set $w:priv:shiftanchor]}]} {
|
||||
tixHList:Browse $w $ent
|
||||
}
|
||||
} else {
|
||||
catch {
|
||||
uplevel #0 unset $w:priv:shiftanchor
|
||||
}
|
||||
|
||||
if {[$w cget -selectmode] ne "single"} {
|
||||
$w select clear
|
||||
$w selection set $ent
|
||||
|
||||
tixHList:Browse $w $ent
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# Mouse bindings
|
||||
#
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
proc tixHList:Button-1 {w x y mod} {
|
||||
# if {[$w cget -state] eq "disabled"} {
|
||||
# return
|
||||
# }
|
||||
|
||||
if {[$w cget -takefocus]} {
|
||||
focus $w
|
||||
}
|
||||
|
||||
set selMode [$w cget -selectmode]
|
||||
|
||||
case [tixHList:GetState $w] {
|
||||
{0} {
|
||||
if {$mod eq "s" && $selMode eq "multiple"} {
|
||||
tixHList:GoState 28 $w $x $y
|
||||
return
|
||||
}
|
||||
if {$mod eq "s" && $selMode eq "extended"} {
|
||||
tixHList:GoState 28 $w $x $y
|
||||
return
|
||||
}
|
||||
if {$mod eq "c" && $selMode eq "extended"} {
|
||||
tixHList:GoState 33 $w $x $y
|
||||
return
|
||||
}
|
||||
|
||||
tixHList:GoState 1 $w $x $y
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHList:ButtonRelease-1 {w x y} {
|
||||
case [tixHList:GetState $w] {
|
||||
{5 16} {
|
||||
tixHList:GoState 6 $w $x $y
|
||||
}
|
||||
{15} {
|
||||
tixHList:GoState 17 $w $x $y
|
||||
}
|
||||
{10 11} {
|
||||
tixHList:GoState 18 $w
|
||||
}
|
||||
{13 20} {
|
||||
tixHList:GoState 14 $w $x $y
|
||||
}
|
||||
{21} {
|
||||
tixHList:GoState 22 $w
|
||||
}
|
||||
{24} {
|
||||
tixHList:GoState 25 $w
|
||||
}
|
||||
{26 28 33} {
|
||||
tixHList:GoState 27 $w
|
||||
}
|
||||
{30} {
|
||||
tixHList:GoState 32 $w
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHList:Double-1 {w x y} {
|
||||
case [tixHList:GetState $w] {
|
||||
{0} {
|
||||
tixHList:GoState 23 $w $x $y
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHList:B1-Motion {w x y} {
|
||||
case [tixHList:GetState $w] {
|
||||
{1} {
|
||||
tixHList:GoState 5 $w $x $y
|
||||
}
|
||||
{5 16} {
|
||||
tixHList:GoState 5 $w $x $y
|
||||
}
|
||||
{13 20 21} {
|
||||
tixHList:GoState 20 $w $x $y
|
||||
}
|
||||
{24 26 28} {
|
||||
tixHList:GoState 26 $w $x $y
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHList:B1-Leave {w} {
|
||||
case [tixHList:GetState $w] {
|
||||
{5} {
|
||||
tixHList:GoState 10 $w
|
||||
}
|
||||
{26} {
|
||||
tixHList:GoState 29 $w
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHList:B1-Enter {w x y} {
|
||||
case [tixHList:GetState $w] {
|
||||
{10 11} {
|
||||
tixHList:GoState 12 $w $x $y
|
||||
}
|
||||
{29 30} {
|
||||
tixHList:GoState 31 $w $x $y
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHList:AutoScan {w} {
|
||||
case [tixHList:GetState $w] {
|
||||
{29 30} {
|
||||
tixHList:GoState 30 $w
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# STATE MANIPULATION
|
||||
#
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
proc tixHList:GetState {w} {
|
||||
global $w:priv:state
|
||||
|
||||
if {![info exists $w:priv:state]} {
|
||||
set $w:priv:state 0
|
||||
}
|
||||
return [set $w:priv:state]
|
||||
}
|
||||
|
||||
proc tixHList:SetState {w n} {
|
||||
global $w:priv:state
|
||||
|
||||
set $w:priv:state $n
|
||||
}
|
||||
|
||||
proc tixHList:GoState {n w args} {
|
||||
|
||||
# puts "going from [tixHList:GetState $w] --> $n"
|
||||
|
||||
tixHList:SetState $w $n
|
||||
eval tixHList:GoState-$n $w $args
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# States
|
||||
#----------------------------------------------------------------------
|
||||
proc tixHList:GoState-0 {w} {
|
||||
|
||||
}
|
||||
proc tixHList:GoState-1 {w x y} {
|
||||
set oldEnt [$w info anchor]
|
||||
set ent [tixHList:SetAnchor $w $x $y 1]
|
||||
|
||||
if {$ent eq ""} {
|
||||
tixHList:GoState 0 $w
|
||||
return
|
||||
}
|
||||
|
||||
set info [$w info item $x $y]
|
||||
if {[lindex $info 1] eq "indicator"} {
|
||||
tixHList:GoState 13 $w $ent $oldEnt
|
||||
} else {
|
||||
if {[$w entrycget $ent -state] eq "disabled"} {
|
||||
tixHList:GoState 0 $w
|
||||
} else {
|
||||
case [$w cget -selectmode] {
|
||||
{single browse} {
|
||||
tixHList:GoState 16 $w $ent
|
||||
}
|
||||
default {
|
||||
tixHList:GoState 24 $w $ent
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHList:GoState-5 {w x y} {
|
||||
set oldEnt [$w info anchor]
|
||||
|
||||
set ent [tixHList:SetAnchor $w $x $y]
|
||||
|
||||
if {$ent eq "" || $oldEnt eq $ent} {
|
||||
return
|
||||
}
|
||||
|
||||
if {[$w cget -selectmode] ne "single"} {
|
||||
tixHList:Select $w $ent
|
||||
tixHList:Browse $w $ent
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHList:GoState-6 {w x y} {
|
||||
set ent [tixHList:SetAnchor $w $x $y]
|
||||
|
||||
if {$ent eq ""} {
|
||||
tixHList:GoState 0 $w
|
||||
return
|
||||
}
|
||||
tixHList:Select $w $ent
|
||||
tixHList:Browse $w $ent
|
||||
|
||||
tixHList:GoState 0 $w
|
||||
}
|
||||
|
||||
proc tixHList:GoState-10 {w} {
|
||||
tixHList:StartScan $w
|
||||
}
|
||||
|
||||
proc tixHList:GoState-11 {w} {
|
||||
global tkPriv
|
||||
|
||||
tixHList:DoScan $w
|
||||
|
||||
set oldEnt [$w info anchor]
|
||||
set ent [tixHList:SetAnchor $w $tkPriv(x) $tkPriv(y)]
|
||||
|
||||
if {$ent eq "" || $oldEnt eq $ent} {
|
||||
return
|
||||
}
|
||||
|
||||
if {[$w cget -selectmode] ne "single"} {
|
||||
tixHList:Select $w $ent
|
||||
tixHList:Browse $w $ent
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHList:GoState-12 {w x y} {
|
||||
tkCancelRepeat
|
||||
tixHList:GoState 5 $w $x $y
|
||||
}
|
||||
|
||||
proc tixHList:GoState-13 {w ent oldEnt} {
|
||||
global tkPriv
|
||||
set tkPriv(tix,indicator) $ent
|
||||
set tkPriv(tix,oldEnt) $oldEnt
|
||||
tixHList:CallIndicatorCmd $w <Arm> $ent
|
||||
}
|
||||
|
||||
proc tixHList:GoState-14 {w x y} {
|
||||
global tkPriv
|
||||
|
||||
if {[tixHList:InsideArmedIndicator $w $x $y]} {
|
||||
$w anchor set $tkPriv(tix,indicator)
|
||||
$w select clear
|
||||
$w select set $tkPriv(tix,indicator)
|
||||
tixHList:CallIndicatorCmd $w <Activate> $tkPriv(tix,indicator)
|
||||
} else {
|
||||
tixHList:CallIndicatorCmd $w <Disarm> $tkPriv(tix,indicator)
|
||||
}
|
||||
|
||||
unset tkPriv(tix,indicator)
|
||||
tixHList:GoState 0 $w
|
||||
}
|
||||
|
||||
proc tixHList:GoState-16 {w ent} {
|
||||
if {$ent ne "" && [$w cget -selectmode] ne "single"} {
|
||||
tixHList:Select $w $ent
|
||||
tixHList:Browse $w $ent
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHList:GoState-18 {w} {
|
||||
global tkPriv
|
||||
tkCancelRepeat
|
||||
tixHList:GoState 6 $w $tkPriv(x) $tkPriv(y)
|
||||
}
|
||||
|
||||
proc tixHList:GoState-20 {w x y} {
|
||||
global tkPriv
|
||||
|
||||
if {![tixHList:InsideArmedIndicator $w $x $y]} {
|
||||
tixHList:GoState 21 $w $x $y
|
||||
} else {
|
||||
tixHList:CallIndicatorCmd $w <Arm> $tkPriv(tix,indicator)
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHList:GoState-21 {w x y} {
|
||||
global tkPriv
|
||||
|
||||
if {[tixHList:InsideArmedIndicator $w $x $y]} {
|
||||
tixHList:GoState 20 $w $x $y
|
||||
} else {
|
||||
tixHList:CallIndicatorCmd $w <Disarm> $tkPriv(tix,indicator)
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHList:GoState-22 {w} {
|
||||
global tkPriv
|
||||
|
||||
if {$tkPriv(tix,oldEnt) ne ""} {
|
||||
$w anchor set $tkPriv(tix,oldEnt)
|
||||
} else {
|
||||
$w anchor clear
|
||||
}
|
||||
tixHList:GoState 0 $w
|
||||
}
|
||||
|
||||
proc tixHList:GoState-23 {w x y} {
|
||||
set ent [tixHList:GetNearest $w $y]
|
||||
|
||||
if {$ent ne ""} {
|
||||
set info [$w info item $x $y]
|
||||
|
||||
if {[lindex $info 1] eq "indicator"} {
|
||||
tixHList:CallIndicatorCmd $w <Activate> $ent
|
||||
} else {
|
||||
$w select set $ent
|
||||
set command [$w cget -command]
|
||||
if {$command ne ""} {
|
||||
set bind(specs) {%V}
|
||||
set bind(%V) $ent
|
||||
|
||||
tixEvalCmdBinding $w $command bind $ent
|
||||
}
|
||||
}
|
||||
}
|
||||
tixHList:GoState 0 $w
|
||||
}
|
||||
|
||||
proc tixHList:GoState-24 {w ent} {
|
||||
if {$ent ne ""} {
|
||||
tixHList:Select $w $ent
|
||||
tixHList:Browse $w $ent
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHList:GoState-25 {w} {
|
||||
set ent [$w info anchor]
|
||||
|
||||
if {$ent ne ""} {
|
||||
tixHList:Select $w $ent
|
||||
tixHList:Browse $w $ent
|
||||
}
|
||||
|
||||
tixHList:GoState 0 $w
|
||||
}
|
||||
|
||||
|
||||
proc tixHList:GoState-26 {w x y} {
|
||||
set anchor [$w info anchor]
|
||||
if {$anchor eq ""} {
|
||||
set first [lindex [$w info children ""] 0]
|
||||
if {$first ne ""} {
|
||||
$w anchor set $first
|
||||
set anchor $first
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
set ent [tixHList:GetNearest $w $y 1]
|
||||
|
||||
if {$ent ne ""} {
|
||||
$w selection clear
|
||||
$w selection set $anchor $ent
|
||||
|
||||
tixHList:Browse $w $ent
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHList:GoState-27 {w} {
|
||||
set ent [$w info anchor]
|
||||
|
||||
if {$ent ne ""} {
|
||||
tixHList:Browse $w $ent
|
||||
}
|
||||
|
||||
tixHList:GoState 0 $w
|
||||
}
|
||||
|
||||
proc tixHList:GoState-28 {w x y} {
|
||||
set anchor [$w info anchor]
|
||||
if {$anchor eq ""} {
|
||||
set first [lindex [$w info children ""] 0]
|
||||
if {$first ne ""} {
|
||||
$w anchor set $first
|
||||
set anchor $first
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
set ent [tixHList:GetNearest $w $y 1]
|
||||
if {$ent ne ""} {
|
||||
$w selection clear
|
||||
$w selection set $anchor $ent
|
||||
|
||||
tixHList:Browse $w $ent
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHList:GoState-29 {w} {
|
||||
tixHList:StartScan $w
|
||||
}
|
||||
|
||||
proc tixHList:GoState-30 {w} {
|
||||
global tkPriv
|
||||
|
||||
tixHList:DoScan $w
|
||||
|
||||
set anchor [$w info anchor]
|
||||
if {$anchor eq ""} {
|
||||
set first [lindex [$w info children ""] 0]
|
||||
if {$first ne ""} {
|
||||
$w anchor set $first
|
||||
set anchor $first
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
set ent [tixHList:GetNearest $w $tkPriv(y) 1]
|
||||
if {$ent ne ""} {
|
||||
$w selection clear
|
||||
$w selection set $anchor $ent
|
||||
|
||||
tixHList:Browse $w $ent
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHList:GoState-31 {w x y} {
|
||||
tkCancelRepeat
|
||||
tixHList:GoState 26 $w $x $y
|
||||
}
|
||||
|
||||
proc tixHList:GoState-32 {w} {
|
||||
tkCancelRepeat
|
||||
tixHList:GoState 0 $w
|
||||
}
|
||||
|
||||
proc tixHList:GoState-33 {w x y} {
|
||||
set ent [tixHList:GetNearest $w $y]
|
||||
if {$ent ne ""} {
|
||||
$w anchor set $ent
|
||||
if {[lsearch [$w selection get] $ent] > -1} {
|
||||
# This was missing - mike
|
||||
$w selection clear $ent
|
||||
} else {
|
||||
$w selection set $ent
|
||||
}
|
||||
tixHList:Browse $w $ent
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Common actions
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
proc tixHList:GetNearest {w y {disableOK 0}} {
|
||||
set ent [$w nearest $y]
|
||||
|
||||
if {$ent ne ""} {
|
||||
if {!$disableOK && [$w entrycget $ent -state] eq "disabled"} {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
return $ent
|
||||
}
|
||||
|
||||
proc tixHList:SetAnchor {w x y {disableOK 0}} {
|
||||
set ent [tixHList:GetNearest $w $y $disableOK]
|
||||
|
||||
if {$ent ne ""} {
|
||||
if {[$w entrycget $ent -state] ne "disabled"} {
|
||||
$w anchor set $ent
|
||||
# mike This is non-standard and has a wierd effect: too much motion
|
||||
# $w see $ent
|
||||
return $ent
|
||||
} elseif $disableOK {
|
||||
return $ent
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
proc tixHList:Select {w ent} {
|
||||
if {[$w info selection] ne $ent} {
|
||||
$w selection clear
|
||||
$w select set $ent
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Auto scan
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
proc tixHList:StartScan {w} {
|
||||
global tkPriv
|
||||
set tkPriv(afterId) [after 50 tixHList:AutoScan $w]
|
||||
}
|
||||
|
||||
proc tixHList:DoScan {w} {
|
||||
global tkPriv
|
||||
set x $tkPriv(x)
|
||||
set y $tkPriv(y)
|
||||
set X $tkPriv(X)
|
||||
set Y $tkPriv(Y)
|
||||
|
||||
if {$y >= [winfo height $w]} {
|
||||
$w yview scroll 1 units
|
||||
} elseif {$y < 0} {
|
||||
$w yview scroll -1 units
|
||||
} elseif {$x >= [winfo width $w]} {
|
||||
$w xview scroll 2 units
|
||||
} elseif {$x < 0} {
|
||||
$w xview scroll -2 units
|
||||
} else {
|
||||
return
|
||||
}
|
||||
|
||||
set tkPriv(afterId) [after 50 tixHList:AutoScan $w]
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Indicator handling
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
proc tixHList:CallIndicatorCmd {w event ent} {
|
||||
set cmd [$w cget -indicatorcmd]
|
||||
|
||||
if {$cmd ne ""} {
|
||||
set bind(type) $event
|
||||
set bind(specs) {%V}
|
||||
set bind(%V) $ent
|
||||
|
||||
tixEvalCmdBinding $w $cmd bind $ent
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHList:InsideArmedIndicator {w x y} {
|
||||
global tkPriv
|
||||
|
||||
set ent [tixHList:GetNearest $w $y 1]
|
||||
if {$ent eq "" || $ent ne $tkPriv(tix,indicator)} {
|
||||
return 0
|
||||
}
|
||||
|
||||
set info [$w info item $x $y]
|
||||
if {[lindex $info 1] eq "indicator"} {
|
||||
return 1
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHList:Browse {w ent} {
|
||||
set browsecmd [$w cget -browsecmd]
|
||||
if {$browsecmd ne ""} {
|
||||
set bind(specs) {%V}
|
||||
set bind(%V) $ent
|
||||
|
||||
tixEvalCmdBinding $w $browsecmd bind $ent
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
204
win32/lib/tix8.4.3/HListDD.tcl
Normal file
@@ -0,0 +1,204 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: HListDD.tcl,v 1.3 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# HListDD.tcl --
|
||||
#
|
||||
# !!! PRE-ALPHA CODE, NOT USED, DON'T USE !!!
|
||||
#
|
||||
# This file implements drag+drop for HList.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
#
|
||||
# events
|
||||
#
|
||||
#
|
||||
|
||||
proc tixHListSingle:DragTimer {w ent} {
|
||||
case [tixHListSingle:GetState $w] {
|
||||
{1} {
|
||||
# fire up
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Drag + Drop Bindings
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
#----------------------------------------#
|
||||
# Sending Actions #
|
||||
#----------------------------------------#
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# tixHListSingle:Send:WaitDrag --
|
||||
#
|
||||
# Sender wait for dragging action
|
||||
#----------------------------------------------------------------------
|
||||
proc tixHListSingle:Send:WaitDrag {w x y} {
|
||||
global tixPriv
|
||||
|
||||
set ent [tixHListSingle:GetNearest $w $y]
|
||||
if {$ent != ""} {
|
||||
$w anchor set $ent
|
||||
$w select clear
|
||||
$w select set $ent
|
||||
|
||||
set tixPriv(dd,$w:moved) 0
|
||||
set tixPriv(dd,$w:entry) $ent
|
||||
|
||||
# set browsecmd [$w cget -browsecmd]
|
||||
# if {$browsecmd != "" && $ent != ""} {
|
||||
# eval $browsecmd $ent
|
||||
# }
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHListSingle:Send:StartDrag {w x y} {
|
||||
global tixPriv
|
||||
set dd [tixGetDragDropContext $w]
|
||||
|
||||
if {![info exists tixPriv(dd,$w:entry)]} {
|
||||
return
|
||||
}
|
||||
if {$tixPriv(dd,$w:entry) == ""} {
|
||||
return
|
||||
}
|
||||
|
||||
if {$tixPriv(dd,$w:moved) == 0} {
|
||||
$w dragsite set $tixPriv(dd,$w:entry)
|
||||
set tixPriv(dd,$w:moved) 1
|
||||
$dd config -source $w -command [list tixHListSingle:Send:Cmd $w]
|
||||
$dd startdrag $X $Y
|
||||
} else {
|
||||
$dd drag $X $Y
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHListSingle:Send:DoneDrag {w x y} {
|
||||
global tixPriv
|
||||
global moved
|
||||
|
||||
if {![info exists tixPriv(dd,$w:entry)]} {
|
||||
return
|
||||
}
|
||||
if {$tixPriv(dd,$w:entry) == ""} {
|
||||
return
|
||||
}
|
||||
|
||||
if {$tixPriv(dd,$w:moved) == 1} {
|
||||
set dd [tixGetDragDropContext $w]
|
||||
$dd drop $X $Y
|
||||
}
|
||||
$w dragsite clear
|
||||
catch {unset tixPriv(dd,$w:moved)}
|
||||
catch {unset tixPriv(dd,$w:entry)}
|
||||
}
|
||||
|
||||
proc tixHListSingle:Send:Cmd {w option args} {
|
||||
set dragCmd [$w cget -dragcmd]
|
||||
if {$dragCmd != ""} {
|
||||
return [eval $dragCmd $option $args]
|
||||
}
|
||||
|
||||
# Perform the default action
|
||||
#
|
||||
case "$option" {
|
||||
who {
|
||||
return $w
|
||||
}
|
||||
types {
|
||||
return {data text}
|
||||
}
|
||||
get {
|
||||
global tixPriv
|
||||
if {[lindex $args 0] == "text"} {
|
||||
if {$tixPriv(dd,$w:entry) != ""} {
|
||||
return [$w entrycget $tixPriv(dd,$w:entry) -text]
|
||||
}
|
||||
}
|
||||
if {[lindex $args 0] == "data"} {
|
||||
if {$tixPriv(dd,$w:entry) != ""} {
|
||||
return [$w entrycget $tixPriv(dd,$w:entry) -data]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------#
|
||||
# Receiving Actions #
|
||||
#----------------------------------------#
|
||||
proc tixHListSingle:Rec:DragOver {w sender x y} {
|
||||
if {[$w cget -selectmode] != "dragdrop"} {
|
||||
return
|
||||
}
|
||||
|
||||
set ent [tixHListSingle:GetNearest $w $y]
|
||||
if {$ent != ""} {
|
||||
$w dropsite set $ent
|
||||
} else {
|
||||
$w dropsite clear
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHListSingle:Rec:DragIn {w sender x y} {
|
||||
if {[$w cget -selectmode] != "dragdrop"} {
|
||||
return
|
||||
}
|
||||
set ent [tixHListSingle:GetNearest $w $y]
|
||||
if {$ent != ""} {
|
||||
$w dropsite set $ent
|
||||
} else {
|
||||
$w dropsite clear
|
||||
}
|
||||
}
|
||||
|
||||
proc tixHListSingle:Rec:DragOut {w sender x y} {
|
||||
if {[$w cget -selectmode] != "dragdrop"} {
|
||||
return
|
||||
}
|
||||
$w dropsite clear
|
||||
}
|
||||
|
||||
proc tixHListSingle:Rec:Drop {w sender x y} {
|
||||
if {[$w cget -selectmode] != "dragdrop"} {
|
||||
return
|
||||
}
|
||||
$w dropsite clear
|
||||
|
||||
set ent [tixHListSingle:GetNearest $w $y]
|
||||
if {$ent != ""} {
|
||||
$w anchor set $ent
|
||||
$w select clear
|
||||
$w select set $ent
|
||||
}
|
||||
|
||||
set dropCmd [$w cget -dropcmd]
|
||||
if {$dropCmd != ""} {
|
||||
eval $dropCmd $sender $x $y
|
||||
return
|
||||
}
|
||||
|
||||
# set browsecmd [$w cget -browsecmd]
|
||||
# if {$browsecmd != "" && $ent != ""} {
|
||||
# eval $browsecmd [list $ent]
|
||||
# }
|
||||
}
|
||||
|
||||
tixDropBind TixHListSingle <In> "tixHListSingle:Rec:DragIn %W %S %x %y"
|
||||
tixDropBind TixHListSingle <Over> "tixHListSingle:Rec:DragOver %W %S %x %y"
|
||||
tixDropBind TixHListSingle <Out> "tixHListSingle:Rec:DragOut %W %S %x %y"
|
||||
tixDropBind TixHListSingle <Drop> "tixHListSingle:Rec:Drop %W %S %x %y"
|
||||
272
win32/lib/tix8.4.3/IconView.tcl
Normal file
@@ -0,0 +1,272 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: IconView.tcl,v 1.2 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# IconView.tcl --
|
||||
#
|
||||
# This file implements the Icon View widget: the "icon" view mode of
|
||||
# the MultiView widget. It implements:
|
||||
#
|
||||
# (1) Creation of the icons in the canvas subwidget.
|
||||
# (2) Automatic arrangement of the objects
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
tixWidgetClass tixIconView {
|
||||
-classname TixIconView
|
||||
-superclass tixCObjView
|
||||
-method {
|
||||
add arrange
|
||||
}
|
||||
-flag {
|
||||
-autoarrange
|
||||
}
|
||||
-static {
|
||||
}
|
||||
-configspec {
|
||||
{-autoarrange autoArrange AutoArrange 0 tixVerifyBoolean}
|
||||
}
|
||||
-default {
|
||||
{.scrollbar auto}
|
||||
{*borderWidth 1}
|
||||
{*canvas.background #c3c3c3}
|
||||
{*canvas.highlightBackground #d9d9d9}
|
||||
{*canvas.relief sunken}
|
||||
{*canvas.takeFocus 1}
|
||||
{*Scrollbar.takeFocus 0}
|
||||
}
|
||||
-forcecall {
|
||||
}
|
||||
}
|
||||
|
||||
proc tixIconView:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
}
|
||||
|
||||
proc tixIconView:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
|
||||
set c $data(w:canvas)
|
||||
|
||||
bind $c <1> "tixIconView:StartDrag $w %x %y"
|
||||
bind $c <B1-Motion> "tixIconView:Drag $w %x %y"
|
||||
bind $c <ButtonRelease-1> "tixIconView:EndDrag $w"
|
||||
}
|
||||
|
||||
proc tixIconView:StartDrag {w x y} {
|
||||
upvar #0 $w data
|
||||
global lastX lastY
|
||||
|
||||
set c $data(w:canvas)
|
||||
$c raise current
|
||||
|
||||
set lastX [$c canvasx $x]
|
||||
set lastY [$c canvasy $y]
|
||||
}
|
||||
|
||||
|
||||
proc tixIconView:Drag {w x y} {
|
||||
upvar #0 $w data
|
||||
global lastX lastY
|
||||
|
||||
set c $data(w:canvas)
|
||||
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
|
||||
}
|
||||
|
||||
proc tixIconView:EndDrag {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixCallMethod $w adjustscrollregion
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# option configs
|
||||
#----------------------------------------------------------------------
|
||||
proc tixIconView:add {w tag image text} {
|
||||
upvar #0 $w data
|
||||
|
||||
set cmp [image create compound -window $data(w:canvas)]
|
||||
|
||||
$cmp add image -image $image
|
||||
$cmp add line
|
||||
$cmp add text -text $text
|
||||
|
||||
set id [$data(w:canvas) create image 0 0 -image $cmp -anchor nw]
|
||||
$data(w:canvas) addtag $tag withtag $id
|
||||
|
||||
if {$data(-autoarrange)} {
|
||||
tixWidgetDoWhenIdle tixIconView:Arrange $w 1
|
||||
}
|
||||
}
|
||||
|
||||
# Do it in an idle handler, so that Arrange is not called before the window
|
||||
# is properly mapped.
|
||||
#
|
||||
proc tixIconView:arrange {w} {
|
||||
tixWidgetDoWhenIdle tixIconView:Arrange $w 1
|
||||
}
|
||||
|
||||
|
||||
proc tixIconView:PackOneRow {w row y maxH bd padX padY} {
|
||||
upvar #0 $w data
|
||||
|
||||
set iX [expr $bd+$padX]
|
||||
foreach i $row {
|
||||
set box [$data(w:canvas) bbox $i]
|
||||
set W [expr [lindex $box 2]-[lindex $box 0]+1]
|
||||
set H [expr [lindex $box 3]-[lindex $box 1]+1]
|
||||
|
||||
set iY [expr $y + $maxH - $H]
|
||||
$data(w:canvas) coords $i $iX $iY
|
||||
incr iX [expr $W+$padX]
|
||||
}
|
||||
}
|
||||
|
||||
# virtual method
|
||||
#
|
||||
proc tixIconView:PlaceWindow {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(-autoarrange)} {
|
||||
tixWidgetDoWhenIdle tixIconView:Arrange $w 0
|
||||
}
|
||||
|
||||
tixChainMethod $w PlaceWindow
|
||||
}
|
||||
|
||||
proc tixIconView:Arrange {w adjust} {
|
||||
upvar #0 $w data
|
||||
|
||||
set padX 2
|
||||
set padY 2
|
||||
|
||||
tixIconView:ArrangeGrid $w $padX $padY
|
||||
if {$adjust} {
|
||||
tixCallMethod $w adjustscrollregion
|
||||
}
|
||||
}
|
||||
|
||||
# the items are not packed
|
||||
#
|
||||
proc tixIconView:ArrangeGrid {w padX padY} {
|
||||
upvar #0 $w data
|
||||
|
||||
set maxW 0
|
||||
set maxH 0
|
||||
foreach item [$data(w:canvas) find all] {
|
||||
set box [$data(w:canvas) bbox $item]
|
||||
set itemW [expr [lindex $box 2]-[lindex $box 0]+1]
|
||||
set itemH [expr [lindex $box 3]-[lindex $box 1]+1]
|
||||
if {$maxW < $itemW} {
|
||||
set maxW $itemW
|
||||
}
|
||||
if {$maxH < $itemH} {
|
||||
set maxH $itemH
|
||||
}
|
||||
}
|
||||
if {$maxW == 0 || $maxH == 0} {
|
||||
return
|
||||
}
|
||||
|
||||
set winW [tixWinWidth $data(w:canvas)]
|
||||
set bd [expr [$data(w:canvas) cget -bd]+\
|
||||
[$data(w:canvas) cget -highlightthickness]]
|
||||
set cols [expr $winW / ($maxW+$padX)]
|
||||
if {$cols < 1} {
|
||||
set cols 1
|
||||
}
|
||||
set y $bd
|
||||
|
||||
set c 0
|
||||
set x $bd
|
||||
foreach item [$data(w:canvas) find all] {
|
||||
set box [$data(w:canvas) bbox $item]
|
||||
set itemW [expr [lindex $box 2]-[lindex $box 0]+1]
|
||||
set itemH [expr [lindex $box 3]-[lindex $box 1]+1]
|
||||
|
||||
set iX [expr $x + $padX + ($maxW-$itemW)/2]
|
||||
set iY [expr $y + $padY + ($maxH-$itemH) ]
|
||||
|
||||
$data(w:canvas) coords $item $iX $iY
|
||||
incr c
|
||||
incr x [expr $maxW + $padY]
|
||||
if {$c == $cols} {
|
||||
set c 0
|
||||
incr y [expr $maxH + $padY]
|
||||
set x $bd
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# the items are packed
|
||||
#
|
||||
proc tixIconView:ArrangePack {w padX padY} {
|
||||
upvar #0 $w data
|
||||
|
||||
set winW [tixWinWidth $data(w:canvas)]
|
||||
set bd [expr [$data(w:canvas) cget -bd]+\
|
||||
[$data(w:canvas) cget -highlightthickness]]
|
||||
set y [expr $bd + $padY]
|
||||
|
||||
set maxH 0
|
||||
set usedW $padX
|
||||
set row ""
|
||||
foreach item [$data(w:canvas) find all] {
|
||||
set box [$data(w:canvas) bbox $item]
|
||||
set itemW [expr [lindex $box 2]-[lindex $box 0]+1]
|
||||
set itemH [expr [lindex $box 3]-[lindex $box 1]+1]
|
||||
|
||||
if {[expr $usedW + $itemW] > $winW} {
|
||||
if {$row == ""} {
|
||||
# only one item in this row
|
||||
#
|
||||
$data(w:canvas) coords $item [expr $bd + $padX] $y
|
||||
incr y [expr $itemH+$padY]
|
||||
continue
|
||||
} else {
|
||||
# this item is not in this row. Arrange the previous items
|
||||
# first
|
||||
#
|
||||
tixIconView:PackOneRow $w $row $y $maxH $bd $padX $padY
|
||||
|
||||
incr y $maxH
|
||||
set row ""
|
||||
set maxH 0
|
||||
set usedW $padX
|
||||
}
|
||||
}
|
||||
lappend row $item
|
||||
if {$maxH < $itemH} {
|
||||
set maxH $itemH
|
||||
}
|
||||
incr usedW [expr $padX+$itemW]
|
||||
}
|
||||
if {$row != ""} {
|
||||
tixIconView:PackOneRow $w $row $y $maxH $bd $padX $padY
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Widget commands
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Private Methods
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
232
win32/lib/tix8.4.3/Init.tcl
Normal file
@@ -0,0 +1,232 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: Init.tcl,v 1.18 2008/02/28 04:35:16 hobbs Exp $
|
||||
#
|
||||
# Init.tcl --
|
||||
#
|
||||
# Initializes the Tix library and performes version checking to ensure
|
||||
# the Tcl, Tk and Tix script libraries loaded matches with the binary
|
||||
# of the respective packages.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
namespace eval ::tix {
|
||||
}
|
||||
|
||||
proc tixScriptVersion {} { return $::tix_version }
|
||||
proc tixScriptPatchLevel {} { return $::tix_patchLevel }
|
||||
|
||||
proc ::tix::Init {dir} {
|
||||
global tix env tix_library tcl_platform auto_path
|
||||
|
||||
if {[info exists tix(initialized)]} {
|
||||
return
|
||||
}
|
||||
|
||||
if {![info exists tix_library]} {
|
||||
# we're running from stand-alone module.
|
||||
set tix_library ""
|
||||
} elseif {[file isdir $tix_library]} {
|
||||
if {![info exists auto_path] ||
|
||||
[lsearch $auto_path $tix_library] == -1} {
|
||||
lappend auto_path $tix_library
|
||||
}
|
||||
}
|
||||
|
||||
# STEP 1: Version checking
|
||||
#
|
||||
#
|
||||
package require Tcl 8.4
|
||||
package require -exact Tix 8.4.3
|
||||
|
||||
# STEP 2: Initialize file compatibility modules
|
||||
#
|
||||
|
||||
foreach file {
|
||||
fs.tcl
|
||||
Tix.tcl Event.tcl
|
||||
Balloon.tcl BtnBox.tcl
|
||||
CObjView.tcl ChkList.tcl
|
||||
ComboBox.tcl Compat.tcl
|
||||
Console.tcl Control.tcl
|
||||
DefSchm.tcl DialogS.tcl
|
||||
DirBox.tcl DirDlg.tcl
|
||||
DirList.tcl DirTree.tcl
|
||||
DragDrop.tcl DtlList.tcl
|
||||
EFileBox.tcl EFileDlg.tcl
|
||||
FileBox.tcl FileCbx.tcl
|
||||
FileDlg.tcl FileEnt.tcl
|
||||
FloatEnt.tcl
|
||||
Grid.tcl HList.tcl
|
||||
HListDD.tcl IconView.tcl
|
||||
LabEntry.tcl LabFrame.tcl
|
||||
LabWidg.tcl ListNBk.tcl
|
||||
Meter.tcl MultView.tcl
|
||||
NoteBook.tcl OldUtil.tcl
|
||||
OptMenu.tcl PanedWin.tcl
|
||||
PopMenu.tcl Primitiv.tcl
|
||||
ResizeH.tcl SGrid.tcl
|
||||
SHList.tcl SListBox.tcl
|
||||
STList.tcl SText.tcl
|
||||
SWidget.tcl SWindow.tcl
|
||||
Select.tcl Shell.tcl
|
||||
SimpDlg.tcl StackWin.tcl
|
||||
StatBar.tcl StdBBox.tcl
|
||||
StdShell.tcl TList.tcl
|
||||
Tree.tcl
|
||||
Utils.tcl VResize.tcl
|
||||
VStack.tcl VTree.tcl
|
||||
Variable.tcl WInfo.tcl
|
||||
} {
|
||||
uplevel \#0 [list source [file join $dir $file]]
|
||||
}
|
||||
|
||||
# STEP 3: Initialize the Tix application context
|
||||
#
|
||||
tixAppContext tix
|
||||
|
||||
# DO NOT DO THIS HERE !!
|
||||
# This causes the global defaults to be altered, which may not
|
||||
# be desirable. The user can call this after requiring Tix if
|
||||
# they wish to use different defaults.
|
||||
#
|
||||
#tix initstyle
|
||||
|
||||
# STEP 4: Initialize the bindings for widgets that are implemented in C
|
||||
#
|
||||
foreach w {
|
||||
HList TList Grid ComboBox Control FloatEntry
|
||||
LabelEntry ScrolledGrid ScrolledListBox
|
||||
} {
|
||||
tix${w}Bind
|
||||
}
|
||||
|
||||
rename ::tix::Init ""
|
||||
}
|
||||
|
||||
# tixWidgetClassEx --
|
||||
#
|
||||
# This procedure is similar to tixWidgetClass, except it
|
||||
# performs a [subst] on the class declaration before evaluating
|
||||
# it. This gives us a chance to specify platform-specific widget
|
||||
# default without using a lot of ugly double quotes.
|
||||
#
|
||||
# The use of subst'able entries in the class declaration should
|
||||
# be restrained to widget default values only to avoid producing
|
||||
# unreadable code.
|
||||
#
|
||||
# Arguments:
|
||||
# name - The name of the class to declare.
|
||||
# classDecl - Various declarations about the class. See documentation
|
||||
# of tixWidgetClass for details.
|
||||
|
||||
proc tixWidgetClassEx {name classDecl} {
|
||||
tixWidgetClass $name [uplevel [list subst $classDecl]]
|
||||
}
|
||||
|
||||
#
|
||||
# Deprecated tix* functions
|
||||
#
|
||||
interp alias {} tixFileJoin {} file join
|
||||
interp alias {} tixStrEq {} string equal
|
||||
proc tixTrue {args} { return 1 }
|
||||
proc tixFalse {args} { return 0 }
|
||||
proc tixStringSub {var fromStr toStr} {
|
||||
upvar 1 var var
|
||||
set var [string map $var [list $fromStr $toStr]]
|
||||
}
|
||||
proc tixGetBoolean {args} {
|
||||
set len [llength [info level 0]]
|
||||
set nocomplain 0
|
||||
if {$len == 3} {
|
||||
if {[lindex $args 0] ne "-nocomplain"} {
|
||||
return -code error "wrong \# args:\
|
||||
must be [lindex [info level 0] 0] ?-nocomplain? string"
|
||||
}
|
||||
set nocomplain 1
|
||||
set val [lindex $args 1]
|
||||
} elseif {$len != 2} {
|
||||
return -code error "wrong \# args:\
|
||||
must be [lindex [info level 0] 0] ?-nocomplain? string"
|
||||
} else {
|
||||
set val [lindex $args 0]
|
||||
}
|
||||
if {[string is boolean -strict $val] || $nocomplain} {
|
||||
return [string is true -strict $val]
|
||||
} elseif {$nocomplain} {
|
||||
return 0
|
||||
} else {
|
||||
return -code error "\"$val\" is not a valid boolean"
|
||||
}
|
||||
}
|
||||
interp alias {} tixVerifyBoolean {} tixGetBoolean
|
||||
proc tixGetInt {args} {
|
||||
set len [llength [info level 0]]
|
||||
set nocomplain 0
|
||||
set trunc 0
|
||||
for {set i 1} {$i < $len-1} {incr i} {
|
||||
set arg [lindex $args 0]
|
||||
if {$arg eq "-nocomplain"} {
|
||||
set nocomplain 1
|
||||
} elseif {$arg eq "-trunc"} {
|
||||
set trunc 1
|
||||
} else {
|
||||
return -code error "wrong \# args: must be\
|
||||
[lindex [info level 0] 0] ?-nocomplain? ?-trunc? string"
|
||||
}
|
||||
}
|
||||
if {$i != $len-1} {
|
||||
return -code error "wrong \# args: must be\
|
||||
[lindex [info level 0] 0] ?-nocomplain? ?-trunc? string"
|
||||
}
|
||||
set val [lindex $args end]
|
||||
set code [catch {expr {round($val)}} res]
|
||||
if {$code} {
|
||||
if {$nocomplain} {
|
||||
return 0
|
||||
} else {
|
||||
return -code error "\"$val\" cannot be converted to integer"
|
||||
}
|
||||
}
|
||||
if {$trunc} {
|
||||
return [expr {int($val)}]
|
||||
} else {
|
||||
return $res
|
||||
}
|
||||
}
|
||||
proc tixFile {option filename} {
|
||||
set len [string length $option]
|
||||
if {$len > 1 && [string equal -length $len $option "tildesubst"]} {
|
||||
set code [catch {file normalize $filename} res]
|
||||
if {$code == 0} {
|
||||
set filename $res
|
||||
}
|
||||
} elseif {$len > 1 && [string equal -length $len $option "trimslash"]} {
|
||||
# normalize extra slashes
|
||||
set filename [file join $filename]
|
||||
if {$filename ne "/"} {
|
||||
set filename [string trimright $filename "/"]
|
||||
}
|
||||
} else {
|
||||
return -code error "unknown option \"$option\",\
|
||||
must be tildesubst or trimslash"
|
||||
}
|
||||
return $filename
|
||||
}
|
||||
|
||||
interp alias {} tixRaiseWindow {} raise
|
||||
#proc tixUnmapWindow {w} { }
|
||||
|
||||
#
|
||||
# if tix_library is not defined, we're running in SAM mode. ::tix::Init
|
||||
# will be called later by the Tix_Init() C code.
|
||||
#
|
||||
|
||||
if {[info exists tix_library]} {
|
||||
::tix::Init [file dirname [info script]]
|
||||
}
|
||||
86
win32/lib/tix8.4.3/LabEntry.tcl
Normal file
@@ -0,0 +1,86 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: LabEntry.tcl,v 1.4 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# LabEntry.tcl --
|
||||
#
|
||||
# TixLabelEntry Widget: an entry box with a label
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
tixWidgetClass tixLabelEntry {
|
||||
-classname TixLabelEntry
|
||||
-superclass tixLabelWidget
|
||||
-method {
|
||||
}
|
||||
-flag {
|
||||
-disabledforeground -state
|
||||
}
|
||||
-forcecall {
|
||||
-state
|
||||
}
|
||||
-static {
|
||||
}
|
||||
-configspec {
|
||||
{-disabledforeground disabledForeground DisabledForeground #303030}
|
||||
{-state state State normal}
|
||||
}
|
||||
-default {
|
||||
{.borderWidth 0}
|
||||
{*entry.relief sunken}
|
||||
{*entry.width 7}
|
||||
{*label.anchor e}
|
||||
{*label.borderWidth 0}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixLabelEntry:ConstructFramedWidget {w frame} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructFramedWidget $frame
|
||||
|
||||
set data(w:entry) [entry $frame.entry]
|
||||
pack $data(w:entry) -side left -expand yes -fill both
|
||||
|
||||
# This value is used to configure the disable/normal fg of the ebtry
|
||||
#
|
||||
set data(entryfg) [$data(w:entry) cget -fg]
|
||||
set data(labelfg) [$data(w:label) cget -fg]
|
||||
}
|
||||
|
||||
proc tixLabelEntryBind {} {
|
||||
tixBind TixLabelEntry <FocusIn> {
|
||||
if {[focus -displayof [set %W(w:entry)]] ne [set %W(w:entry)]} {
|
||||
focus [%W subwidget entry]
|
||||
[set %W(w:entry)] selection from 0
|
||||
[set %W(w:entry)] selection to end
|
||||
[set %W(w:entry)] icursor end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# CONFIG OPTIONS
|
||||
#----------------------------------------------------------------------
|
||||
proc tixLabelEntry:config-state {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$value == "normal"} {
|
||||
catch {
|
||||
$data(w:label) config -fg $data(labelfg)
|
||||
}
|
||||
$data(w:entry) config -state $value -fg $data(entryfg)
|
||||
} else {
|
||||
catch {
|
||||
$data(w:label) config -fg $data(-disabledforeground)
|
||||
}
|
||||
$data(w:entry) config -state $value -fg $data(-disabledforeground)
|
||||
}
|
||||
}
|
||||
49
win32/lib/tix8.4.3/LabFrame.tcl
Normal file
@@ -0,0 +1,49 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: LabFrame.tcl,v 1.2 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# LabFrame.tcl --
|
||||
#
|
||||
# TixLabelFrame Widget: a frame box with a label
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
tixWidgetClass tixLabelFrame {
|
||||
-classname TixLabelFrame
|
||||
-superclass tixLabelWidget
|
||||
-method {
|
||||
frame
|
||||
}
|
||||
-flag {}
|
||||
-static {}
|
||||
-configspec {
|
||||
{-labelside labelSide LabelSide acrosstop}
|
||||
{-padx padX Pad 2}
|
||||
{-pady padY Pad 2}
|
||||
}
|
||||
-alias {}
|
||||
-default {
|
||||
{*Label.anchor c}
|
||||
{.frame.borderWidth 2}
|
||||
{.frame.relief groove}
|
||||
{.border.borderWidth 2}
|
||||
{.border.relief groove}
|
||||
{.borderWidth 2}
|
||||
{.padX 2}
|
||||
{.padY 2}
|
||||
{.anchor sw}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Public methods
|
||||
#----------------------------------------------------------------------
|
||||
proc tixLabelFrame:frame {w args} {
|
||||
|
||||
return [eval tixCallMethod $w subwidget frame $args]
|
||||
}
|
||||
157
win32/lib/tix8.4.3/LabWidg.tcl
Normal file
@@ -0,0 +1,157 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: LabWidg.tcl,v 1.3 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# LabWidg.tcl --
|
||||
#
|
||||
# TixLabelWidget: Virtual base class. Do not instantiate
|
||||
#
|
||||
# This widget class is the base class for all widgets that has a
|
||||
# label. Most Tix compound widgets will have a label so that
|
||||
# the app programmer doesn't need to add labels themselvel.
|
||||
#
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
# LabelSide : top, left, right, bottom, none, acrosstop
|
||||
#
|
||||
# public widgets:
|
||||
# frame, label
|
||||
#
|
||||
|
||||
tixWidgetClass tixLabelWidget {
|
||||
-superclass tixPrimitive
|
||||
-classname TixLabelWidget
|
||||
-flag {
|
||||
-label -labelside -padx -pady
|
||||
}
|
||||
-static {-labelside}
|
||||
-configspec {
|
||||
{-label label Label ""}
|
||||
{-labelside labelSide LabelSide left}
|
||||
{-padx padX Pad 0}
|
||||
{-pady padY Pad 0}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixLabelWidget:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
if {$data(-labelside) != "acrosstop"} {
|
||||
set data(w:frame) [frame $w.frame]
|
||||
} else {
|
||||
set data(pw:border) [frame $w.border]
|
||||
set data(pw:pad) [frame $w.border.pad]
|
||||
set data(w:frame) [frame $w.border.frame]
|
||||
}
|
||||
|
||||
if {$data(-labelside) != "none"} {
|
||||
set data(w:label) [label $w.label -text $data(-label)]
|
||||
}
|
||||
tixLabelWidget:Pack $w
|
||||
|
||||
tixCallMethod $w ConstructFramedWidget $data(w:frame)
|
||||
}
|
||||
|
||||
proc tixLabelWidget:ConstructFramedWidget {w frame} {
|
||||
# Do nothing
|
||||
}
|
||||
|
||||
proc tixLabelWidget:Pack {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[catch {tixLabelWidget:Pack-$data(-labelside) $w}]} {
|
||||
error "unknown -labelside option \"$data(-labelside)\""
|
||||
}
|
||||
}
|
||||
|
||||
proc tixLabelWidget:Pack-acrosstop {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
set labHalfHeight [expr [winfo reqheight $data(w:label)] / 2]
|
||||
set padHeight [expr $labHalfHeight - [$data(pw:border) cget -bd]]
|
||||
if {$padHeight < 0} {
|
||||
set padHeight 0
|
||||
}
|
||||
|
||||
tixForm $data(w:label) -top 0 -left 4\
|
||||
-padx [expr $data(-padx) +4] -pady $data(-pady)
|
||||
tixForm $data(pw:border) -top $labHalfHeight -bottom -1 \
|
||||
-left 0 -right -1 -padx $data(-padx) -pady $data(-pady)
|
||||
tixForm $data(pw:pad) -left 0 -right -1 \
|
||||
-top 0 -bottom $padHeight
|
||||
tixForm $data(w:frame) -top $data(pw:pad) -bottom -1 \
|
||||
-left 0 -right -1
|
||||
}
|
||||
|
||||
proc tixLabelWidget:Pack-top {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
pack $data(w:label) -side top \
|
||||
-padx $data(-padx) -pady $data(-pady) \
|
||||
-fill x
|
||||
pack $data(w:frame) -side top \
|
||||
-padx $data(-padx) -pady $data(-pady) \
|
||||
-expand yes -fill both
|
||||
}
|
||||
|
||||
proc tixLabelWidget:Pack-bottom {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
pack $data(w:label) -side bottom \
|
||||
-padx $data(-padx) -pady $data(-pady) \
|
||||
-fill x
|
||||
pack $data(w:frame) -side bottom \
|
||||
-padx $data(-padx) -pady $data(-pady) \
|
||||
-expand yes -fill both
|
||||
}
|
||||
|
||||
proc tixLabelWidget:Pack-left {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
pack $data(w:label) -side left \
|
||||
-padx $data(-padx) -pady $data(-pady) \
|
||||
-fill y
|
||||
pack $data(w:frame) -side left \
|
||||
-padx $data(-padx) -pady $data(-pady) \
|
||||
-expand yes -fill both
|
||||
}
|
||||
|
||||
proc tixLabelWidget:Pack-right {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
pack $data(w:label) -side right \
|
||||
-padx $data(-padx) -pady $data(-pady) \
|
||||
-fill x
|
||||
pack $data(w:frame) -side right \
|
||||
-padx $data(-padx) -pady $data(-pady) \
|
||||
-expand yes -fill both
|
||||
}
|
||||
|
||||
proc tixLabelWidget:Pack-none {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
pack $data(w:frame)\
|
||||
-padx $data(-padx) -pady $data(-pady) \
|
||||
-expand yes -fill both
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# CONFIG OPTIONS
|
||||
#----------------------------------------------------------------------
|
||||
proc tixLabelWidget:config-label {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
$data(w:label) config -text $value
|
||||
|
||||
if {$data(-labelside) == "acrosstop"} {
|
||||
tixLabelWidget:Pack-acrosstop $w
|
||||
}
|
||||
}
|
||||
153
win32/lib/tix8.4.3/ListNBk.tcl
Normal file
@@ -0,0 +1,153 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: ListNBk.tcl,v 1.5 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# ListNBk.tcl --
|
||||
#
|
||||
# "List NoteBook" widget. Acts similarly to the notebook but uses a
|
||||
# HList widget to represent the pages.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
|
||||
tixWidgetClass tixListNoteBook {
|
||||
-classname TixListNoteBook
|
||||
-superclass tixVStack
|
||||
-method {
|
||||
}
|
||||
-flag {
|
||||
-height -width
|
||||
}
|
||||
-configspec {
|
||||
{-width width Width 0}
|
||||
{-height height Height 0}
|
||||
}
|
||||
-forcecall {
|
||||
-dynamicgeometry -width -height
|
||||
}
|
||||
-default {
|
||||
{*Orientation horizontal}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixListNoteBook:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
set data(w_pane) [tixPanedWindow $w.pane -panerelief flat]
|
||||
set p1 [$data(w_pane) add p1 -expand 0]
|
||||
set p2 [$data(w_pane) add p2 -expand 1]
|
||||
set data(w_p2) $p2
|
||||
set data(w:shlist) [tixScrolledHList $p1.shlist]
|
||||
set data(w:hlist) [$data(w:shlist) subwidget hlist]
|
||||
|
||||
if {[$data(w_pane) cget -orientation] eq "vertical"} {
|
||||
pack $data(w:shlist) -expand yes -fill both -padx 2 -pady 3
|
||||
} else {
|
||||
pack $data(w:shlist) -expand yes -fill both -padx 3 -pady 2
|
||||
}
|
||||
|
||||
$data(w:hlist) config \
|
||||
-command [list tixListNoteBook:Choose $w] \
|
||||
-browsecmd [list tixListNoteBook:Choose $w] \
|
||||
-selectmode single
|
||||
|
||||
pack $data(w_pane) -expand yes -fill both
|
||||
}
|
||||
|
||||
proc tixListNoteBook:add {w child args} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[string match *.* $child]} {
|
||||
error "the name of the page cannot contain the \".\" character"
|
||||
}
|
||||
return [eval tixChainMethod $w add $child $args]
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Virtual Methods
|
||||
#----------------------------------------------------------------------
|
||||
proc tixListNoteBook:InitGeometryManager {w} {
|
||||
tixWidgetDoWhenIdle tixListNoteBook:InitialRaise $w
|
||||
}
|
||||
|
||||
proc tixListNoteBook:InitialRaise {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(topchild) eq ""} {
|
||||
set top [lindex $data(windows) 0]
|
||||
} else {
|
||||
set top $data(topchild)
|
||||
}
|
||||
|
||||
if {$top ne ""} {
|
||||
tixCallMethod $w raise $top
|
||||
}
|
||||
}
|
||||
|
||||
proc tixListNoteBook:CreateChildFrame {w child} {
|
||||
upvar #0 $w data
|
||||
return [frame $data(w_p2).$child]
|
||||
}
|
||||
|
||||
proc tixListNoteBook:RaiseChildFrame {w child} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(topchild) ne $child} {
|
||||
if {$data(topchild) ne ""} {
|
||||
pack forget $data(w:$data(topchild))
|
||||
}
|
||||
pack $data(w:$child) -expand yes -fill both
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
|
||||
proc tixListNoteBook:config-dynamicgeometry {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
$data(w_pane) config -dynamicgeometry $value
|
||||
}
|
||||
|
||||
proc tixListNoteBook:config-width {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$value != 0} {
|
||||
$data(w_pane) config -width $value
|
||||
}
|
||||
}
|
||||
|
||||
proc tixListNoteBook:config-height {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$value != 0} {
|
||||
$data(w_pane) config -height $value
|
||||
}
|
||||
}
|
||||
|
||||
proc tixListNoteBook:raise {w child} {
|
||||
upvar #0 $w data
|
||||
|
||||
$data(w:hlist) selection clear
|
||||
$data(w:hlist) selection set $child
|
||||
$data(w:hlist) anchor set $child
|
||||
|
||||
tixChainMethod $w raise $child
|
||||
}
|
||||
|
||||
proc tixListNoteBook:Choose {w args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set entry [tixEvent flag V]
|
||||
|
||||
if {[lsearch $data(windows) $entry] != -1} {
|
||||
tixCallMethod $w raise $entry
|
||||
}
|
||||
}
|
||||
5
win32/lib/tix8.4.3/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
tclIndex::
|
||||
../tools/tixindex *tcl
|
||||
|
||||
clean::
|
||||
-rm -f *.bak *~
|
||||
137
win32/lib/tix8.4.3/Meter.tcl
Normal file
@@ -0,0 +1,137 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: Meter.tcl,v 1.3 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# Meter.tcl --
|
||||
#
|
||||
# Implements the tixMeter widget
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
tixWidgetClass tixMeter {
|
||||
-classname TixMeter
|
||||
-superclass tixPrimitive
|
||||
-method {
|
||||
}
|
||||
-flag {
|
||||
-foreground -text -value
|
||||
}
|
||||
-configspec {
|
||||
{-fillcolor fillColor FillColor #8080ff}
|
||||
{-foreground foreground Foreground black}
|
||||
{-text text Text ""}
|
||||
{-value value Value 0}
|
||||
}
|
||||
-default {
|
||||
{.relief sunken}
|
||||
{.borderWidth 2}
|
||||
{.width 150}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixMeter:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
global env
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Construct widget
|
||||
#----------------------------------------------------------------------
|
||||
proc tixMeter:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
set data(w:canvas) [canvas $w.canvas]
|
||||
pack $data(w:canvas) -expand yes -fill both
|
||||
|
||||
tixMeter:Update $w
|
||||
}
|
||||
|
||||
proc tixMeter:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
}
|
||||
|
||||
proc tixMeter:Update {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
# set the width of the canvas
|
||||
set W [expr $data(-width)-\
|
||||
([$data(w:root) cget -bd]+[$data(w:root) cget -highlightthickness]*2)]
|
||||
$data(w:canvas) config -width $W
|
||||
|
||||
if {$data(-text) == ""} {
|
||||
set text [format "%d%%" [expr int($data(-value)*100)]]
|
||||
} else {
|
||||
set text $data(-text)
|
||||
}
|
||||
|
||||
# (Create/Modify) the text item.
|
||||
#
|
||||
if {![info exists data(text)]} {
|
||||
set data(text) [$data(w:canvas) create text 0 0 -text $text]
|
||||
} else {
|
||||
$data(w:canvas) itemconfig $data(text) -text $text
|
||||
}
|
||||
|
||||
set bbox [$data(w:canvas) bbox $data(text)]
|
||||
|
||||
set itemW [expr [lindex $bbox 2]-[lindex $bbox 0]]
|
||||
set itemH [expr [lindex $bbox 3]-[lindex $bbox 1]]
|
||||
|
||||
|
||||
$data(w:canvas) coord $data(text) [expr $W/2] [expr $itemH/2+4]
|
||||
|
||||
set H [expr $itemH + 4]
|
||||
$data(w:canvas) config -height [expr $H]
|
||||
|
||||
|
||||
set rectW [expr int($W*$data(-value))]
|
||||
|
||||
if {![info exists data(rect)]} {
|
||||
set data(rect) [$data(w:canvas) create rectangle 0 0 $rectW 1000]
|
||||
} else {
|
||||
$data(w:canvas) coord $data(rect) 0 0 $rectW 1000
|
||||
}
|
||||
|
||||
$data(w:canvas) itemconfig $data(rect) \
|
||||
-fill $data(-fillcolor) -outline $data(-fillcolor)
|
||||
|
||||
$data(w:canvas) raise $data(text)
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Configuration
|
||||
#----------------------------------------------------------------------
|
||||
proc tixMeter:config-value {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(-value) $value
|
||||
tixMeter:Update $w
|
||||
}
|
||||
|
||||
proc tixMeter:config-text {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(-text) $value
|
||||
tixMeter:Update $w
|
||||
}
|
||||
|
||||
proc tixMeter:config-fillcolor {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(-fillcolor) $value
|
||||
tixMeter:Update $w
|
||||
}
|
||||
|
||||
|
||||
157
win32/lib/tix8.4.3/MultView.tcl
Normal file
@@ -0,0 +1,157 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: MultView.tcl,v 1.3 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# MultView.tcl --
|
||||
#
|
||||
# Implements the multi-view widget
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
tixWidgetClass tixMultiView {
|
||||
-classname TixMultiView
|
||||
-superclass tixPrimitive
|
||||
-method {
|
||||
add
|
||||
}
|
||||
-flag {
|
||||
-browsecmd -command -view
|
||||
}
|
||||
-forcecall {
|
||||
-view
|
||||
}
|
||||
-configspec {
|
||||
{-browsecmd browseCmd BrowseCmd ""}
|
||||
{-command command Command ""}
|
||||
{-view view View icon tixMultiView:VerifyView}
|
||||
}
|
||||
-alias {
|
||||
}
|
||||
|
||||
-default {
|
||||
}
|
||||
}
|
||||
|
||||
proc tixMultiView:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
global env
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Construct widget
|
||||
#----------------------------------------------------------------------
|
||||
proc tixMultiView:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
set data(w:stlist) [tixScrolledTList $w.stlist]
|
||||
set data(w:sgrid) [tixScrolledGrid $w.sgrid]
|
||||
set data(w:icon) [tixIconView $w.icon]
|
||||
|
||||
set data(w:tlist) [$data(w:stlist) subwidget tlist]
|
||||
set data(w:grid) [$data(w:sgrid) subwidget grid]
|
||||
|
||||
$data(w:grid) config -formatcmd [list tixMultiView:GridFormat $w] \
|
||||
-leftmargin 0 -topmargin 1
|
||||
}
|
||||
|
||||
proc tixMultiView:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
}
|
||||
|
||||
proc tixMultiView:GetWid {w which} {
|
||||
upvar #0 $w data
|
||||
|
||||
case $which {
|
||||
list {
|
||||
return $data(w:stlist)
|
||||
}
|
||||
icon {
|
||||
return $data(w:icon)
|
||||
}
|
||||
detail {
|
||||
return $data(w:sgrid)
|
||||
}
|
||||
}
|
||||
}
|
||||
#----------------------------------------------------------------------
|
||||
# Configuration
|
||||
#----------------------------------------------------------------------
|
||||
proc tixMultiView:config-view {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(-view) != ""} {
|
||||
pack forget [tixMultiView:GetWid $w $data(-view)]
|
||||
}
|
||||
|
||||
pack [tixMultiView:GetWid $w $value] -expand yes -fill both
|
||||
}
|
||||
#----------------------------------------------------------------------
|
||||
# Private methods
|
||||
#----------------------------------------------------------------------
|
||||
proc tixMultiView:GridFormat {w area x1 y1 x2 y2} {
|
||||
upvar #0 $w data
|
||||
|
||||
case $area {
|
||||
main {
|
||||
}
|
||||
{x-margin y-margin s-margin} {
|
||||
# cborder specifies consecutive 3d borders
|
||||
#
|
||||
$data(w:grid) format cborder $x1 $y1 $x2 $y2 \
|
||||
-fill 1 -relief raised -bd 2 -bg gray60 \
|
||||
-selectbackground gray80
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Public methods
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
# Return value is the index of "$name" in the grid subwidget
|
||||
#
|
||||
#
|
||||
proc tixMultiView:add {w name args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set validOptions {-image -text}
|
||||
|
||||
set opt(-image) ""
|
||||
set opt(-text) ""
|
||||
|
||||
tixHandleOptions -nounknown opt $validOptions $args
|
||||
|
||||
$data(w:icon) add $name $opt(-image) $opt(-text)
|
||||
$data(w:tlist) insert end -itemtype imagetext \
|
||||
-image $opt(-image) -text $opt(-text)
|
||||
$data(w:grid) set 0 end -itemtype imagetext \
|
||||
-image $opt(-image) -text $opt(-text)
|
||||
|
||||
return max
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# checker
|
||||
#----------------------------------------------------------------------
|
||||
proc tixMultiView:VerifyView {value} {
|
||||
case $value {
|
||||
{icon list detail} {
|
||||
return $value
|
||||
}
|
||||
}
|
||||
error "bad view \"$value\", must be detail, icon or list"
|
||||
}
|
||||
|
||||
247
win32/lib/tix8.4.3/NoteBook.tcl
Normal file
@@ -0,0 +1,247 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: NoteBook.tcl,v 1.7 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# NoteBook.tcl --
|
||||
#
|
||||
# tixNoteBook: NoteBook type of window.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
|
||||
tixWidgetClass tixNoteBook {
|
||||
-classname TixNoteBook
|
||||
-superclass tixVStack
|
||||
-method {
|
||||
}
|
||||
-flag {
|
||||
}
|
||||
-configspec {
|
||||
{-takefocus takeFocus TakeFocus 0 tixVerifyBoolean}
|
||||
}
|
||||
-default {
|
||||
{.nbframe.tabPadX 8}
|
||||
{.nbframe.tabPadY 5}
|
||||
{.nbframe.borderWidth 2}
|
||||
{*nbframe.relief raised}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixNoteBook:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
|
||||
set data(pad-x1) 0
|
||||
set data(pad-x2) 0
|
||||
set data(pad-y1) 20
|
||||
set data(pad-y2) 0
|
||||
}
|
||||
|
||||
proc tixNoteBook:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
set data(w:top) [tixNoteBookFrame $w.nbframe -slave 1 -takefocus 1]
|
||||
set data(w:nbframe) $data(w:top)
|
||||
|
||||
bind $data(w:top) <ButtonPress-1> [list tixNoteBook:MouseDown $w %x %y]
|
||||
bind $data(w:top) <ButtonRelease-1> [list tixNoteBook:MouseUp $w %x %y]
|
||||
|
||||
bind $data(w:top) <B1-Motion> [list tixNoteBook:MouseDown $w %x %y]
|
||||
|
||||
bind $data(w:top) <Left> [list tixNoteBook:FocusNext $w prev]
|
||||
bind $data(w:top) <Right> [list tixNoteBook:FocusNext $w next]
|
||||
|
||||
bind $data(w:top) <Return> [list tixNoteBook:SetFocusByKey $w]
|
||||
bind $data(w:top) <space> [list tixNoteBook:SetFocusByKey $w]
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Public methods
|
||||
#----------------------------------------------------------------------
|
||||
proc tixNoteBook:add {w child args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set ret [eval tixChainMethod $w add $child $args]
|
||||
|
||||
set new_args ""
|
||||
foreach {flag value} $args {
|
||||
if {$flag ne "-createcmd" && $flag ne "-raisecmd"} {
|
||||
lappend new_args $flag
|
||||
lappend new_args $value
|
||||
}
|
||||
}
|
||||
|
||||
eval [linsert $new_args 0 $data(w:top) add $child]
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
proc tixNoteBook:raise {w child} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w raise $child
|
||||
|
||||
if {[$data(w:top) pagecget $child -state] eq "normal"} {
|
||||
$data(w:top) activate $child
|
||||
}
|
||||
}
|
||||
|
||||
proc tixNoteBook:delete {w child} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w delete $child
|
||||
$data(w:top) delete $child
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Private methods
|
||||
#----------------------------------------------------------------------
|
||||
proc tixNoteBook:Resize {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
# We have to take care of the size of the tabs so that
|
||||
#
|
||||
set rootReq [$data(w:top) geometryinfo]
|
||||
set tW [lindex $rootReq 0]
|
||||
set tH [lindex $rootReq 1]
|
||||
|
||||
set data(pad-x1) 2
|
||||
set data(pad-x2) 2
|
||||
set data(pad-y1) [expr {$tH + $data(-ipadx) + 1}]
|
||||
set data(pad-y2) 2
|
||||
set data(minW) [expr {$tW}]
|
||||
set data(minH) [expr {$tH}]
|
||||
|
||||
# Now that we know data(pad-y1), we can chain the call
|
||||
#
|
||||
tixChainMethod $w Resize
|
||||
}
|
||||
|
||||
proc tixNoteBook:MouseDown {w x y} {
|
||||
upvar #0 $w data
|
||||
|
||||
focus $data(w:top)
|
||||
|
||||
set name [$data(w:top) identify $x $y]
|
||||
$data(w:top) focus $name
|
||||
set data(w:down) $name
|
||||
}
|
||||
|
||||
proc tixNoteBook:MouseUp {w x y} {
|
||||
upvar #0 $w data
|
||||
|
||||
#it could happen (using the tk/menu) that a MouseUp
|
||||
#proceeds without a MouseDown event!!
|
||||
if {![info exists data(w:down)] || ![info exists data(w:top)]} {
|
||||
return
|
||||
}
|
||||
|
||||
set name [$data(w:top) identify $x $y]
|
||||
|
||||
if {$name ne "" && $name eq $data(w:down)
|
||||
&& [$data(w:top) pagecget $name -state] eq "normal"} {
|
||||
$data(w:top) activate $name
|
||||
tixCallMethod $w raise $name
|
||||
} else {
|
||||
$data(w:top) focus ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Section for keyboard bindings
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
proc tixNoteBook:FocusNext {w dir} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[$data(w:top) info focus] == ""} {
|
||||
set name [$data(w:top) info active]
|
||||
$data(w:top) focus $name
|
||||
|
||||
if {$name ne ""} {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
set name [$data(w:top) info focus$dir]
|
||||
$data(w:top) focus $name
|
||||
}
|
||||
}
|
||||
|
||||
proc tixNoteBook:SetFocusByKey {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
set name [$data(w:top) info focus]
|
||||
|
||||
if {$name ne "" && [$data(w:top) pagecget $name -state] eq "normal"} {
|
||||
tixCallMethod $w raise $name
|
||||
$data(w:top) activate $name
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Automatic bindings for alt keys
|
||||
#----------------------------------------------------------------------
|
||||
proc tixNoteBookFind {w char} {
|
||||
set char [string tolower $char]
|
||||
|
||||
foreach child [winfo child $w] {
|
||||
if {![winfo ismapped $w]} {
|
||||
continue
|
||||
}
|
||||
switch -exact -- [winfo class $child] {
|
||||
Toplevel { continue }
|
||||
TixNoteBook {
|
||||
set nbframe [$child subwidget nbframe]
|
||||
foreach page [$nbframe info pages] {
|
||||
set char2 [string index [$nbframe pagecget $page -label] \
|
||||
[$nbframe pagecget $page -underline]]
|
||||
if {($char eq [string tolower $char2] || $char eq "")
|
||||
&& [$nbframe pagecget $page -state] ne "disabled"} {
|
||||
return [list $child $page]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
# Well, this notebook doesn't match with the key, but maybe
|
||||
# it contains a "subnotebook" that will match ..
|
||||
set match [tixNoteBookFind $child $char]
|
||||
if {$match ne ""} {
|
||||
return $match
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
proc tixTraverseToNoteBook {w char} {
|
||||
if {$char eq ""} {
|
||||
return 0
|
||||
}
|
||||
if {![winfo exists $w]} {
|
||||
return 0
|
||||
}
|
||||
set list [tixNoteBookFind [winfo toplevel $w] $char]
|
||||
if {$list ne ""} {
|
||||
[lindex $list 0] raise [lindex $list 1]
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Set default class bindings
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
bind all <Alt-KeyPress> "+tixTraverseToNoteBook %W %A"
|
||||
bind all <Meta-KeyPress> "+tixTraverseToNoteBook %W %A"
|
||||
|
||||
108
win32/lib/tix8.4.3/OldUtil.tcl
Normal file
@@ -0,0 +1,108 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: OldUtil.tcl,v 1.5 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# OldUtil.tcl -
|
||||
#
|
||||
# This is an undocumented file.
|
||||
# Are these features used in Tix : NO.
|
||||
# Should I use these features : NO.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
|
||||
proc setenv {name args} {
|
||||
global env
|
||||
|
||||
if {[llength $args] == 1} {
|
||||
return [set env($name) [lindex $args 0]]
|
||||
} else {
|
||||
if {[info exists env($ename)] == 0} {
|
||||
bgerror "Error in setenv: "
|
||||
"environment variable \"$name\" does not exist"
|
||||
} else {
|
||||
return $env($name)
|
||||
}
|
||||
}
|
||||
}
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# U T I L I T Y F U N C T I O N S F O R T I X
|
||||
#
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
# RESET THE STRING IN THE ENTRY
|
||||
proc tixSetEntry {entry string} {
|
||||
set oldstate [lindex [$entry config -state] 4]
|
||||
$entry config -state normal
|
||||
$entry delete 0 end
|
||||
$entry insert 0 $string
|
||||
$entry config -state $oldstate
|
||||
}
|
||||
|
||||
# GET THE FIRST SELECTED ITEM IN A LIST
|
||||
proc tixListGetSingle {lst} {
|
||||
set indices [$lst curselection]
|
||||
if {$indices != ""} {
|
||||
return [$lst get [lindex $indices 0]]
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# RECORD A DIALOG'S POSITION AND RESTORE IT THE NEXT TIME IT IS OPENED
|
||||
#----------------------------------------------------------------------
|
||||
proc tixDialogRestore {w {flag -geometry}} {
|
||||
global tixDPos
|
||||
|
||||
if {[info exists tixDPos($w)]} {
|
||||
if {![winfo ismapped $w]} {
|
||||
wm geometry $w $tixDPos($w)
|
||||
wm deiconify $w
|
||||
}
|
||||
} elseif {$flag eq "-geometry"} {
|
||||
update
|
||||
set tixDPos($w) [winfo geometry $w]
|
||||
} else {
|
||||
update
|
||||
set tixDPos($w) +[winfo rootx $w]+[winfo rooty $w]
|
||||
}
|
||||
}
|
||||
#----------------------------------------------------------------------
|
||||
# RECORD A DIALOG'S POSITION AND RESTORE IT THE NEXT TIME IT IS OPENED
|
||||
#----------------------------------------------------------------------
|
||||
proc tixDialogWithdraw {w {flag -geometry}} {
|
||||
global tixDPos
|
||||
|
||||
if {[winfo ismapped $w]} {
|
||||
if {$flag eq "-geometry"} {
|
||||
set tixDPos($w) [winfo geometry $w]
|
||||
} else {
|
||||
set tixDPos($w) +[winfo rootx $w]+[winfo rooty $w]
|
||||
}
|
||||
wm withdraw $w
|
||||
}
|
||||
}
|
||||
#----------------------------------------------------------------------
|
||||
# RECORD A DIALOG'S POSITION AND RESTORE IT THE NEXT TIME IT IS OPENED
|
||||
#----------------------------------------------------------------------
|
||||
proc tixDialogDestroy {w {flag -geometry}} {
|
||||
global tixDPos
|
||||
|
||||
if {[winfo ismapped $w]} {
|
||||
if {$flag eq "-geometry"} {
|
||||
set tixDPos($w) [winfo geometry $w]
|
||||
} else {
|
||||
set tixDPos($w) +[winfo rootx $w]+[winfo rooty $w]
|
||||
}
|
||||
}
|
||||
destroy $w
|
||||
}
|
||||
394
win32/lib/tix8.4.3/OptMenu.tcl
Normal file
@@ -0,0 +1,394 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: OptMenu.tcl,v 1.3 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# OptMenu.tcl --
|
||||
#
|
||||
# This file implements the TixOptionMenu widget.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
tixWidgetClass tixOptionMenu {
|
||||
-classname TixOptionMenu
|
||||
-superclass tixLabelWidget
|
||||
-method {
|
||||
add delete disable enable entrycget entryconfigure entries
|
||||
}
|
||||
-flag {
|
||||
-command -disablecallback -dynamicgeometry -value -variable
|
||||
-validatecmd -state
|
||||
}
|
||||
-forcecall {
|
||||
-variable -state
|
||||
}
|
||||
-configspec {
|
||||
{-command command Command ""}
|
||||
{-disablecallback disableCallback DisableCallback 0 tixVerifyBoolean}
|
||||
{-dynamicgeometry dynamicGeometry DynamicGeometry 0 tixVerifyBoolean}
|
||||
{-state state State normal}
|
||||
{-value value Value ""}
|
||||
{-validatecmd validateCmd ValidateCmd ""}
|
||||
{-variable variable Variable ""}
|
||||
}
|
||||
-default {
|
||||
{.highlightThickness 0}
|
||||
{.takeFocus 0}
|
||||
{.frame.menubutton.relief raised}
|
||||
{.frame.menubutton.borderWidth 2}
|
||||
{.frame.menubutton.anchor w}
|
||||
{.frame.menubutton.highlightThickness 2}
|
||||
{.frame.menubutton.takeFocus 1}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixOptionMenu:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
|
||||
set data(nItems) 0
|
||||
set data(items) ""
|
||||
set data(posted) 0
|
||||
set data(varInited) 0
|
||||
set data(maxWidth) 0
|
||||
}
|
||||
|
||||
proc tixOptionMenu:ConstructFramedWidget {w frame} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructFramedWidget $frame
|
||||
|
||||
set data(w:menubutton) [menubutton $frame.menubutton -indicatoron 1]
|
||||
set data(w:menu) [menu $frame.menubutton.menu -tearoff 0]
|
||||
pack $data(w:menubutton) -side left -expand yes -fill both
|
||||
|
||||
$data(w:menubutton) config -menu $data(w:menu)
|
||||
|
||||
bind $data(w:menubutton) <Up> [bind Menubutton <space>]
|
||||
bind $data(w:menubutton) <Down> [bind Menubutton <space>]
|
||||
|
||||
tixSetMegaWidget $data(w:menubutton) $w
|
||||
}
|
||||
|
||||
proc tixOptionMenu:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Private methods
|
||||
#----------------------------------------------------------------------
|
||||
proc tixOptionMenu:Invoke {w name} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {"$data(-state)" == "normal"} {
|
||||
tixOptionMenu:SetValue $w $name
|
||||
}
|
||||
}
|
||||
|
||||
proc tixOptionMenu:SetValue {w value {noUpdate 0}} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(-validatecmd) != ""} {
|
||||
set value [tixEvalCmdBinding $w $data(-validatecmd) "" $value]
|
||||
}
|
||||
|
||||
set name $value
|
||||
|
||||
if {$name == "" || [info exists data(varInited)]} {
|
||||
# variable may contain a bogus value
|
||||
if {![info exists data($name,index)]} {
|
||||
set data(-value) ""
|
||||
tixVariable:UpdateVariable $w
|
||||
$data(w:menubutton) config -text ""
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if {[info exists data($name,index)]} {
|
||||
$data(w:menubutton) config -text $data($name,label)
|
||||
|
||||
set data(-value) $value
|
||||
|
||||
if {! $noUpdate} {
|
||||
tixVariable:UpdateVariable $w
|
||||
}
|
||||
|
||||
if {$data(-command) != "" && !$data(-disablecallback)} {
|
||||
if {![info exists data(varInited)]} {
|
||||
set bind(specs) ""
|
||||
tixEvalCmdBinding $w $data(-command) bind $value
|
||||
}
|
||||
}
|
||||
} else {
|
||||
error "item \"$value\" does not exist"
|
||||
}
|
||||
}
|
||||
|
||||
proc tixOptionMenu:SetMaxWidth {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
foreach name $data(items) {
|
||||
set len [string length $data($name,label)]
|
||||
if {$data(maxWidth) < $len} {
|
||||
set data(maxWidth) $len
|
||||
}
|
||||
}
|
||||
|
||||
if {$data(maxWidth) > 0} {
|
||||
$data(w:menubutton) config -width $data(maxWidth)
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Configuration
|
||||
#----------------------------------------------------------------------
|
||||
proc tixOptionMenu:config-state {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {![info exists data(w:label)]} {
|
||||
return
|
||||
}
|
||||
|
||||
if {$value == "normal"} {
|
||||
catch {
|
||||
$data(w:label) config -fg \
|
||||
[$data(w:menubutton) cget -foreground]
|
||||
}
|
||||
$data(w:menubutton) config -state $value
|
||||
} else {
|
||||
catch {
|
||||
$data(w:label) config -fg \
|
||||
[$data(w:menubutton) cget -disabledforeground]
|
||||
}
|
||||
$data(w:menubutton) config -state $value
|
||||
}
|
||||
}
|
||||
|
||||
proc tixOptionMenu:config-value {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixOptionMenu:SetValue $w $value
|
||||
|
||||
# This will tell the Intrinsics: "Please use this value"
|
||||
# because "value" might be altered by SetValues
|
||||
#
|
||||
return $data(-value)
|
||||
}
|
||||
|
||||
proc tixOptionMenu:config-variable {w arg} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[tixVariable:ConfigVariable $w $arg]} {
|
||||
# The value of data(-value) is changed if tixVariable:ConfigVariable
|
||||
# returns true
|
||||
tixOptionMenu:SetValue $w $data(-value) 1
|
||||
}
|
||||
catch {
|
||||
unset data(varInited)
|
||||
}
|
||||
set data(-variable) $arg
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Public Methdos
|
||||
#----------------------------------------------------------------------
|
||||
proc tixOptionMenu:add {w type name args} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[info exists data($name,index)]} {
|
||||
error "item $name already exists in the option menu $w"
|
||||
}
|
||||
|
||||
case $type {
|
||||
"command" {
|
||||
set validOptions {
|
||||
-command -label
|
||||
}
|
||||
set opt(-command) ""
|
||||
set opt(-label) $name
|
||||
|
||||
tixHandleOptions -nounknown opt $validOptions $args
|
||||
|
||||
if {$opt(-command) != ""} {
|
||||
error "option -command cannot be specified"
|
||||
}
|
||||
|
||||
# Create a new item inside the menu
|
||||
#
|
||||
eval $data(w:menu) add command $args \
|
||||
[list -label $opt(-label) \
|
||||
-command "tixOptionMenu:Invoke $w \{$name\}"]
|
||||
set index $data(nItems)
|
||||
|
||||
# Store info about this item
|
||||
#
|
||||
set data($index,name) $name
|
||||
set data($name,type) cmd
|
||||
set data($name,label) $opt(-label)
|
||||
set data($name,index) $index
|
||||
|
||||
if {$index == 0} {
|
||||
$data(w:menubutton) config -text $data($name,label)
|
||||
tixOptionMenu:SetValue $w $name
|
||||
}
|
||||
|
||||
incr data(nItems)
|
||||
lappend data(items) $name
|
||||
|
||||
if $data(-dynamicgeometry) {
|
||||
tixOptionMenu:SetMaxWidth $w
|
||||
}
|
||||
}
|
||||
"separator" {
|
||||
$data(w:menu) add separator
|
||||
|
||||
set index $data(nItems)
|
||||
# Store info about this item
|
||||
#
|
||||
set data($index,name) $name
|
||||
set data($name,type) sep
|
||||
set data($name,label) ""
|
||||
set data($name,index) $index
|
||||
|
||||
incr data(nItems)
|
||||
lappend data(items) $name
|
||||
}
|
||||
default {
|
||||
error "only types \"separator\" and \"command\" are allowed"
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
proc tixOptionMenu:delete {w item} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {![info exists data($item,index)]} {
|
||||
error "item $item does not exist in $w"
|
||||
}
|
||||
|
||||
# Rehash the item list
|
||||
set newItems ""
|
||||
set oldIndex 0
|
||||
set newIndex 0
|
||||
foreach name $data(items) {
|
||||
if {$item == $name} {
|
||||
unset data($name,label)
|
||||
unset data($name,index)
|
||||
unset data($name,type)
|
||||
$data(w:menu) delete $oldIndex
|
||||
} else {
|
||||
set data($name,index) $newIndex
|
||||
set data($newIndex,name) $name
|
||||
incr newIndex
|
||||
lappend newItems $name
|
||||
}
|
||||
incr oldIndex
|
||||
}
|
||||
incr oldIndex -1; unset data($oldIndex,name)
|
||||
set data(nItems) $newIndex
|
||||
set data(items) $newItems
|
||||
|
||||
if {$data(-value) == $item} {
|
||||
set newVal ""
|
||||
foreach item $data(items) {
|
||||
if {$data($item,type) == "cmd"} {
|
||||
set newVal $item
|
||||
}
|
||||
}
|
||||
tixOptionMenu:SetValue $w $newVal
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
proc tixOptionMenu:disable {w item} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {![info exists data($item,index)]} {
|
||||
error "item $item does not exist in $w"
|
||||
} else {
|
||||
catch {$data(w:menu) entryconfig $data($item,index) -state disabled}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixOptionMenu:enable {w item} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {![info exists data($item,index)]} {
|
||||
error "item $item does not exist in $w"
|
||||
} else {
|
||||
catch {$data(w:menu) entryconfig $data($item,index) -state normal}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixOptionMenu:entryconfigure {w item args} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {![info exists data($item,index)]} {
|
||||
error "item $item does not exist in $w"
|
||||
} else {
|
||||
return [eval $data(w:menu) entryconfig $data($item,index) $args]
|
||||
}
|
||||
}
|
||||
|
||||
proc tixOptionMenu:entrycget {w item arg} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {![info exists data($item,index)]} {
|
||||
error "item $item does not exist in $w"
|
||||
} else {
|
||||
return [$data(w:menu) entrycget $data($item,index) $arg]
|
||||
}
|
||||
}
|
||||
|
||||
proc tixOptionMenu:entries {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
return $data(items)
|
||||
}
|
||||
|
||||
|
||||
proc tixOptionMenu:Destructor {w} {
|
||||
|
||||
tixVariable:DeleteVariable $w
|
||||
|
||||
# Chain this to the superclass
|
||||
#
|
||||
tixChainMethod $w Destructor
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Obsolete
|
||||
# These have been replaced by new commands in Tk 4.0
|
||||
#
|
||||
proc tixOptionMenu:Post {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
set rootx [winfo rootx $data(w:frame)]
|
||||
set rooty [winfo rooty $data(w:frame)]
|
||||
|
||||
# adjust for the border of the menu and frame
|
||||
#
|
||||
incr rootx [lindex [$data(w:menu) config -border] 4]
|
||||
incr rooty [lindex [$data(w:frame) config -border] 4]
|
||||
incr rooty [lindex [$data(w:menu) config -border] 4]
|
||||
|
||||
set value $data(-value)
|
||||
set y [$data(w:menu) yposition $data($value,index)]
|
||||
|
||||
$data(w:menu) post $rootx [expr $rooty - $y]
|
||||
$data(w:menu) activate $data($value,index)
|
||||
grab -global $data(w:menubutton)
|
||||
set data(posted) 1
|
||||
}
|
||||
1215
win32/lib/tix8.4.3/PanedWin.tcl
Normal file
239
win32/lib/tix8.4.3/PopMenu.tcl
Normal file
@@ -0,0 +1,239 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: PopMenu.tcl,v 1.7 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# PopMenu.tcl --
|
||||
#
|
||||
# This file implements the TixPopupMenu widget
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
global tkPriv
|
||||
if {![llength [info globals tkPriv]]} {
|
||||
tk::unsupported::ExposePrivateVariable tkPriv
|
||||
}
|
||||
#--------------------------------------------------------------------------
|
||||
# tkPriv elements used in this file:
|
||||
#
|
||||
# inMenubutton -
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
foreach fun {tkMenuUnpost tkMbButtonUp tkMbEnter tkMbPost} {
|
||||
if {![llength [info commands $fun]]} {
|
||||
tk::unsupported::ExposePrivateCommand $fun
|
||||
}
|
||||
}
|
||||
unset fun
|
||||
|
||||
tixWidgetClass tixPopupMenu {
|
||||
-classname TixPopupMenu
|
||||
-superclass tixShell
|
||||
-method {
|
||||
bind post unbind
|
||||
}
|
||||
-flag {
|
||||
-buttons -installcolormap -postcmd -spring -state -title
|
||||
}
|
||||
-configspec {
|
||||
{-buttons buttons Buttons {{3 {Any}}}}
|
||||
{-installcolormap installColormap InstallColormap false}
|
||||
{-postcmd postCmd PostCmd ""}
|
||||
{-spring spring Spring 1 tixVerifyBoolean}
|
||||
{-state state State normal}
|
||||
{-cursor corsor Cursor arrow}
|
||||
}
|
||||
-static {
|
||||
-buttons
|
||||
}
|
||||
-default {
|
||||
{*Menu.tearOff 0}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixPopupMenu:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
|
||||
set data(g:clients) ""
|
||||
}
|
||||
|
||||
proc tixPopupMenu:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
wm overrideredirect $w 1
|
||||
wm withdraw $w
|
||||
|
||||
set data(w:menubutton) [menubutton $w.menubutton -text $data(-title) \
|
||||
-menu $w.menubutton.menu -anchor w]
|
||||
set data(w:menu) [menu $w.menubutton.menu]
|
||||
|
||||
pack $data(w:menubutton) -expand yes -fill both
|
||||
}
|
||||
|
||||
proc tixPopupMenu:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
|
||||
foreach elm $data(-buttons) {
|
||||
set btn [lindex $elm 0]
|
||||
foreach mod [lindex $elm 1] {
|
||||
tixBind TixPopupMenu:MB:$w <$mod-ButtonPress-$btn> \
|
||||
"tixPopupMenu:Unpost $w"
|
||||
|
||||
tixBind TixPopupMenu:$w <$mod-ButtonPress-$btn> \
|
||||
"tixPopupMenu:post $w %W %x %y"
|
||||
}
|
||||
|
||||
tixBind TixPopupMenu:MB:$w <ButtonRelease-$btn> \
|
||||
"tixPopupMenu:BtnRelease $w %X %Y"
|
||||
|
||||
tixBind TixPopupMenu:M:$w <Unmap> \
|
||||
"tixPopupMenu:Unmap $w"
|
||||
tixBind TixPopupMenu:$w <ButtonRelease-$btn> \
|
||||
"tixPopupMenu:BtnRelease $w %X %Y"
|
||||
|
||||
tixAddBindTag $data(w:menubutton) TixPopupMenu:MB:$w
|
||||
tixAddBindTag $data(w:menu) TixPopupMenu:M:$w
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# PrivateMethods:
|
||||
#----------------------------------------------------------------------
|
||||
proc tixPopupMenu:Unpost {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
catch {
|
||||
tkMenuUnpost ""
|
||||
}
|
||||
# tkMbButtonUp $data(w:menubutton)
|
||||
}
|
||||
|
||||
proc tixPopupMenu:BtnRelease {w rootX rootY} {
|
||||
upvar #0 $w data
|
||||
|
||||
set cW [winfo containing -displayof $w $rootX $rootY]
|
||||
|
||||
if {$data(-spring)} {
|
||||
tixPopupMenu:Unpost $w
|
||||
}
|
||||
}
|
||||
|
||||
proc tixPopupMenu:Unmap {w} {
|
||||
upvar #0 $w data
|
||||
wm withdraw $w
|
||||
}
|
||||
|
||||
proc tixPopupMenu:Destructor {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
foreach client $data(g:clients) {
|
||||
if {[winfo exists $client]} {
|
||||
tixDeleteBindTag $client TixPopupMenu:$w
|
||||
}
|
||||
}
|
||||
|
||||
# delete the extra bindings
|
||||
#
|
||||
foreach tag [list TixPopupMenu:MB:$w TixPopupMenu:M:$w] {
|
||||
foreach e [bind $tag] {
|
||||
bind $tag $e ""
|
||||
}
|
||||
}
|
||||
|
||||
tixChainMethod $w Destructor
|
||||
}
|
||||
|
||||
proc tixPopupMenu:config-title {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
$data(w:menubutton) config -text $value
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# PublicMethods:
|
||||
#----------------------------------------------------------------------
|
||||
proc tixPopupMenu:bind {w args} {
|
||||
upvar #0 $w data
|
||||
|
||||
foreach client $args {
|
||||
if {[lsearch $data(g:clients) $client] == -1} {
|
||||
lappend data(g:clients) $client
|
||||
tixAppendBindTag $client TixPopupMenu:$w
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixPopupMenu:unbind {w args} {
|
||||
upvar #0 $w data
|
||||
|
||||
foreach client $args {
|
||||
if {[winfo exists $client]} {
|
||||
set index [lsearch $data(g:clients) $client]
|
||||
if {$index != -1} {
|
||||
tixDeleteBindTag $client TixPopupMenu:$w
|
||||
set data(g:clients) [lreplace $data(g:clients) $index $index]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixPopupMenu:post {w client x y} {
|
||||
upvar #0 $w data
|
||||
global tkPriv
|
||||
|
||||
if {$data(-state) == "disabled"} {
|
||||
return
|
||||
}
|
||||
|
||||
set rootx [expr $x + [winfo rootx $client]]
|
||||
set rooty [expr $y + [winfo rooty $client]]
|
||||
|
||||
if {$data(-postcmd) != ""} {
|
||||
set ret [tixEvalCmdBinding $w $data(-postcmd) "" $rootx $rooty]
|
||||
if {![tixGetBoolean $ret]} {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if {[string is true -strict $data(-installcolormap)]} {
|
||||
wm colormapwindows . $w
|
||||
}
|
||||
|
||||
|
||||
set menuWidth [winfo reqwidth $data(w:menu)]
|
||||
set width [winfo reqwidth $w]
|
||||
set height [winfo reqheight $w]
|
||||
|
||||
if {$width < $menuWidth} {
|
||||
set width $menuWidth
|
||||
}
|
||||
|
||||
set wx $rootx
|
||||
set wy $rooty
|
||||
|
||||
# trick: the following lines allow the popup menu
|
||||
# acquire a stable width and height when it is finally
|
||||
# put on the visible screen. Advoid flashing
|
||||
#
|
||||
wm geometry $w +10000+10000
|
||||
wm deiconify $w
|
||||
raise $w
|
||||
|
||||
update
|
||||
wm geometry $w ${width}x${height}+${wx}+${wy}
|
||||
update
|
||||
|
||||
tkMbEnter $data(w:menubutton)
|
||||
tkMbPost $tkPriv(inMenubutton) $rootx $rooty
|
||||
}
|
||||
428
win32/lib/tix8.4.3/Primitiv.tcl
Normal file
@@ -0,0 +1,428 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: Primitiv.tcl,v 1.7 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# Primitiv.tcl --
|
||||
#
|
||||
# This is the primitive widget. It is just a frame with proper
|
||||
# inheritance wrapping. All new Tix widgets will be derived from
|
||||
# this widget
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
# No superclass, so the superclass switch is not used
|
||||
#
|
||||
#
|
||||
tixWidgetClass tixPrimitive {
|
||||
-virtual true
|
||||
-superclass {}
|
||||
-classname TixPrimitive
|
||||
-method {
|
||||
cget configure subwidget subwidgets
|
||||
}
|
||||
-flag {
|
||||
-background -borderwidth -cursor
|
||||
-height -highlightbackground -highlightcolor -highlightthickness
|
||||
-options -relief -takefocus -width -bd -bg
|
||||
}
|
||||
-static {
|
||||
-options
|
||||
}
|
||||
-configspec {
|
||||
{-background background Background #d9d9d9}
|
||||
{-borderwidth borderWidth BorderWidth 0}
|
||||
{-cursor cursor Cursor ""}
|
||||
{-height height Height 0}
|
||||
{-highlightbackground highlightBackground HighlightBackground #c3c3c3}
|
||||
{-highlightcolor highlightColor HighlightColor black}
|
||||
{-highlightthickness highlightThickness HighlightThickness 0}
|
||||
{-options options Options ""}
|
||||
{-relief relief Relief flat}
|
||||
{-takefocus takeFocus TakeFocus 0 tixVerifyBoolean}
|
||||
{-width width Width 0}
|
||||
}
|
||||
-alias {
|
||||
{-bd -borderwidth}
|
||||
{-bg -background}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# ClassInitialization:
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
# not used
|
||||
# Implemented in C
|
||||
#
|
||||
# Override: never
|
||||
proc tixPrimitive:Constructor {w args} {
|
||||
|
||||
upvar #0 $w data
|
||||
upvar #0 $data(className) classRec
|
||||
|
||||
# Set up some minimal items in the class record.
|
||||
#
|
||||
set data(w:root) $w
|
||||
set data(rootCmd) $w:root
|
||||
|
||||
# We need to create the root widget in order to parse the options
|
||||
# database
|
||||
tixCallMethod $w CreateRootWidget
|
||||
|
||||
# Parse the default options from the options database
|
||||
#
|
||||
tixPrimitive:ParseDefaultOptions $w
|
||||
|
||||
# Parse the options supplied by the user
|
||||
#
|
||||
tixPrimitive:ParseUserOptions $w $args
|
||||
|
||||
# Rename the widget command so that it can be use to access
|
||||
# the methods of this class
|
||||
|
||||
tixPrimitive:MkWidgetCmd $w
|
||||
|
||||
# Inistalize the Widget Record
|
||||
#
|
||||
tixCallMethod $w InitWidgetRec
|
||||
|
||||
# Construct the compound widget
|
||||
#
|
||||
tixCallMethod $w ConstructWidget
|
||||
|
||||
# Do the bindings
|
||||
#
|
||||
tixCallMethod $w SetBindings
|
||||
|
||||
# Call the configuration methods for all "force call" options
|
||||
#
|
||||
foreach option $classRec(forceCall) {
|
||||
tixInt_ChangeOptions $w $option $data($option)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Create only the root widget. We need the root widget to query the option
|
||||
# database.
|
||||
#
|
||||
# Override: seldom. (unless you want to use a toplevel as root widget)
|
||||
# Chain : never.
|
||||
|
||||
proc tixPrimitive:CreateRootWidget {w args} {
|
||||
upvar #0 $w data
|
||||
upvar #0 $data(className) classRec
|
||||
|
||||
frame $w -class $data(ClassName)
|
||||
}
|
||||
|
||||
proc tixPrimitive:ParseDefaultOptions {w} {
|
||||
upvar #0 $w data
|
||||
upvar #0 $data(className) classRec
|
||||
|
||||
# SET UP THE INSTANCE RECORD ACCORDING TO DEFAULT VALUES IN
|
||||
# THE OPTIONS DATABASE
|
||||
#
|
||||
foreach option $classRec(options) {
|
||||
set spec [tixInt_GetOptionSpec $data(className) $option]
|
||||
|
||||
if {[lindex $spec 0] eq "="} {
|
||||
continue
|
||||
}
|
||||
|
||||
set o_name [lindex $spec 1]
|
||||
set o_class [lindex $spec 2]
|
||||
set o_default [lindex $spec 3]
|
||||
|
||||
if {![catch {option get $w $o_name $o_class} db_default]} {
|
||||
if {$db_default ne ""} {
|
||||
set data($option) $db_default
|
||||
} else {
|
||||
set data($option) $o_default
|
||||
}
|
||||
} else {
|
||||
set data($option) $o_default
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixPrimitive:ParseUserOptions {w arglist} {
|
||||
upvar #0 $w data
|
||||
upvar #0 $data(className) classRec
|
||||
|
||||
# SET UP THE INSTANCE RECORD ACCORDING TO COMMAND ARGUMENTS FROM
|
||||
# THE USER OF THE TIX LIBRARY (i.e. Application programmer:)
|
||||
#
|
||||
foreach {option arg} $arglist {
|
||||
if {[lsearch $classRec(options) $option] != "-1"} {
|
||||
set spec [tixInt_GetOptionSpec $data(className) $option]
|
||||
|
||||
if {[lindex $spec 0] ne "="} {
|
||||
set data($option) $arg
|
||||
} else {
|
||||
set realOption [lindex $spec 1]
|
||||
set data($realOption) $arg
|
||||
}
|
||||
} else {
|
||||
error "unknown option $option. Should be: [tixInt_ListOptions $w]"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Initialize the widget record
|
||||
#
|
||||
#
|
||||
# Override: always
|
||||
# Chain : always, before
|
||||
proc tixPrimitive:InitWidgetRec {w} {
|
||||
# default: do nothing
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# SetBindings
|
||||
#
|
||||
#
|
||||
# Override: sometimes
|
||||
# Chain : sometimes, before
|
||||
#
|
||||
bind TixDestroyHandler <Destroy> {
|
||||
[tixGetMethod %W [set %W(className)] Destructor] %W
|
||||
}
|
||||
|
||||
proc tixPrimitive:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[winfo toplevel $w] eq $w} {
|
||||
bindtags $w [concat TixDestroyHandler [bindtags $w]]
|
||||
} else {
|
||||
bind $data(w:root) <Destroy> \
|
||||
"[tixGetMethod $w $data(className) Destructor] $w"
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# PrivateMethod: ConstructWidget
|
||||
#
|
||||
# Construct and set up the compound widget
|
||||
#
|
||||
# Override: sometimes
|
||||
# Chain : sometimes, before
|
||||
#
|
||||
proc tixPrimitive:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
$data(rootCmd) config \
|
||||
-background $data(-background) \
|
||||
-borderwidth $data(-borderwidth) \
|
||||
-cursor $data(-cursor) \
|
||||
-relief $data(-relief)
|
||||
|
||||
if {$data(-width) != 0} {
|
||||
$data(rootCmd) config -width $data(-width)
|
||||
}
|
||||
if {$data(-height) != 0} {
|
||||
$data(rootCmd) config -height $data(-height)
|
||||
}
|
||||
|
||||
set rootname *[string range $w 1 end]
|
||||
|
||||
foreach {spec value} $data(-options) {
|
||||
option add $rootname*$spec $value 100
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# PrivateMethod: MkWidgetCmd
|
||||
#
|
||||
# Construct and set up the compound widget
|
||||
#
|
||||
# Override: sometimes
|
||||
# Chain : sometimes, before
|
||||
#
|
||||
proc tixPrimitive:MkWidgetCmd {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
rename $w $data(rootCmd)
|
||||
tixInt_MkInstanceCmd $w
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# ConfigOptions:
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# ConfigMethod: config
|
||||
#
|
||||
# Configure one option.
|
||||
#
|
||||
# Override: always
|
||||
# Chain : automatic.
|
||||
#
|
||||
# Note the hack of [winfo width] in this procedure
|
||||
#
|
||||
# The hack is necessary because of the bad interaction between TK's geometry
|
||||
# manager (the packer) and the frame widget. The packer determines the size
|
||||
# of the root widget of the ComboBox (a frame widget) according to the
|
||||
# requirement of the slaves inside the frame widget, NOT the -width
|
||||
# option of the frame widget.
|
||||
#
|
||||
# However, everytime the frame widget is
|
||||
# configured, it sends a geometry request to the packer according to its
|
||||
# -width and -height options and the packer will temporarily resize
|
||||
# the frame widget according to the requested size! The packer then realizes
|
||||
# something is wrong and revert to the size determined by the slaves. This
|
||||
# cause a flash on the screen.
|
||||
#
|
||||
foreach opt {-height -width -background -borderwidth -cursor
|
||||
-highlightbackground -highlightcolor -relief -takefocus -bd -bg} {
|
||||
|
||||
set tixPrimOpt($opt) 1
|
||||
}
|
||||
|
||||
proc tixPrimitive:config {w option value} {
|
||||
global tixPrimOpt
|
||||
upvar #0 $w data
|
||||
|
||||
if {[info exists tixPrimOpt($option)]} {
|
||||
$data(rootCmd) config $option $value
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# PublicMethods:
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# This method is used to implement the "subwidgets" widget command.
|
||||
# Will be re-written in C. It can't be used as a public method because
|
||||
# of the lame substring comparison routines used in tixClass.c
|
||||
#
|
||||
#
|
||||
proc tixPrimitive:subwidgets {w type args} {
|
||||
upvar #0 $w data
|
||||
|
||||
case $type {
|
||||
-class {
|
||||
set name [lindex $args 0]
|
||||
set args [lrange $args 1 end]
|
||||
# access subwidgets of a particular class
|
||||
#
|
||||
# note: if $name=="Frame", will *not return the root widget as well
|
||||
#
|
||||
set sub ""
|
||||
foreach des [tixDescendants $w] {
|
||||
if {[winfo class $des] eq $name} {
|
||||
lappend sub $des
|
||||
}
|
||||
}
|
||||
|
||||
# Note: if the there is no subwidget of this class, does not
|
||||
# cause any error.
|
||||
#
|
||||
if {$args eq ""} {
|
||||
return $sub
|
||||
} else {
|
||||
foreach des $sub {
|
||||
eval [linsert $args 0 $des]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
}
|
||||
-group {
|
||||
set name [lindex $args 0]
|
||||
set args [lrange $args 1 end]
|
||||
# access subwidgets of a particular group
|
||||
#
|
||||
if {[info exists data(g:$name)]} {
|
||||
if {$args eq ""} {
|
||||
set ret ""
|
||||
foreach item $data(g:$name) {
|
||||
lappend ret $w.$item
|
||||
}
|
||||
return $ret
|
||||
} else {
|
||||
foreach item $data(g:$name) {
|
||||
eval [linsert $args 0 $w.$item]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
} else {
|
||||
error "no such subwidget group $name"
|
||||
}
|
||||
}
|
||||
-all {
|
||||
set sub [tixDescendants $w]
|
||||
|
||||
if {$args eq ""} {
|
||||
return $sub
|
||||
} else {
|
||||
foreach des $sub {
|
||||
eval [linsert $args 0 $des]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
}
|
||||
default {
|
||||
error "unknown flag $type, should be -all, -class or -group"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# PublicMethod: subwidget
|
||||
#
|
||||
# Access a subwidget withe a particular name
|
||||
#
|
||||
# Override: never
|
||||
# Chain : never
|
||||
#
|
||||
# This is implemented in native C code in tixClass.c
|
||||
#
|
||||
proc tixPrimitive:subwidget {w name args} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[info exists data(w:$name)]} {
|
||||
if {$args eq ""} {
|
||||
return $data(w:$name)
|
||||
} else {
|
||||
return [eval [linsert $args 0 $data(w:$name)]]
|
||||
}
|
||||
} else {
|
||||
error "no such subwidget $name"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# PrivateMethods:
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
# delete the widget record and remove the command
|
||||
#
|
||||
proc tixPrimitive:Destructor {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {![info exists data(w:root)]} {
|
||||
return
|
||||
}
|
||||
|
||||
if {[llength [info commands $w]]} {
|
||||
# remove the command
|
||||
rename $w ""
|
||||
}
|
||||
|
||||
if {[llength [info commands $data(rootCmd)]]} {
|
||||
# remove the command of the root widget
|
||||
rename $data(rootCmd) ""
|
||||
}
|
||||
|
||||
# delete the widget record
|
||||
catch {unset data}
|
||||
}
|
||||
505
win32/lib/tix8.4.3/ResizeH.tcl
Normal file
@@ -0,0 +1,505 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: ResizeH.tcl,v 1.3 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# ResizeH.tcl --
|
||||
#
|
||||
# tixResizeHandle: A general purpose "resizing handle"
|
||||
# widget. You can use it to resize pictures, widgets, etc. When
|
||||
# using it to resize a widget, you can use the "attachwidget"
|
||||
# command to attach it to a widget and it will handle all the
|
||||
# events for you.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
tixWidgetClass tixResizeHandle {
|
||||
-classname TixResizeHandle
|
||||
-superclass tixVResize
|
||||
|
||||
-method {
|
||||
attachwidget detachwidget hide show
|
||||
}
|
||||
-flag {
|
||||
-command -cursorfg -cursorbg -handlesize -hintcolor -hintwidth -x -y
|
||||
}
|
||||
-configspec {
|
||||
{-command command Command ""}
|
||||
{-cursorfg cursorFg CursorColor white}
|
||||
{-cursorbg cursorBg CursorColor red}
|
||||
{-handlesize handleSize HandleSize 6}
|
||||
{-hintcolor hintColor HintColor red}
|
||||
{-hintwidth hintWidth HintWidth 1}
|
||||
{-x x X 0}
|
||||
{-y y Y 0}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixResizeHandle:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
|
||||
set data(shown) 0
|
||||
set data(widget) ""
|
||||
}
|
||||
|
||||
proc tixResizeHandle:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
# Create the hints
|
||||
#
|
||||
set data(w_ht) $w:tix_priv_ht
|
||||
set data(w_hb) $w:tix_priv_hb
|
||||
set data(w_hl) $w:tix_priv_hl
|
||||
set data(w_hr) $w:tix_priv_hr
|
||||
|
||||
frame $data(w_ht) -height $data(-hintwidth) -bg $data(-background)
|
||||
frame $data(w_hb) -height $data(-hintwidth) -bg $data(-background)
|
||||
frame $data(w_hl) -width $data(-hintwidth) -bg $data(-background)
|
||||
frame $data(w_hr) -width $data(-hintwidth) -bg $data(-background)
|
||||
|
||||
# Create the corner resize handles
|
||||
#
|
||||
set data(w_r00) $w
|
||||
|
||||
# Windows don't like this
|
||||
# $data(rootCmd) config\
|
||||
# -cursor "top_left_corner $data(-cursorbg) $data(-cursorfg)"
|
||||
|
||||
$data(rootCmd) config -cursor top_left_corner
|
||||
|
||||
set data(w_r01) $w:tix_priv_01
|
||||
set data(w_r10) $w:tix_priv_10
|
||||
set data(w_r11) $w:tix_priv_11
|
||||
|
||||
frame $data(w_r01) -relief $data(-relief) -bd $data(-borderwidth) \
|
||||
-cursor "bottom_left_corner"\
|
||||
-bg $data(-background)
|
||||
frame $data(w_r10) -relief $data(-relief) -bd $data(-borderwidth) \
|
||||
-cursor "top_right_corner"\
|
||||
-bg $data(-background)
|
||||
frame $data(w_r11) -relief $data(-relief) -bd $data(-borderwidth) \
|
||||
-cursor "bottom_right_corner"\
|
||||
-bg $data(-background)
|
||||
|
||||
# Create the border resize handles
|
||||
#
|
||||
set data(w_bt) $w:tix_priv_bt
|
||||
set data(w_bb) $w:tix_priv_bb
|
||||
set data(w_bl) $w:tix_priv_bl
|
||||
set data(w_br) $w:tix_priv_br
|
||||
|
||||
frame $data(w_bt) -relief $data(-relief) -bd $data(-borderwidth) \
|
||||
-cursor "top_side"\
|
||||
-bg $data(-background)
|
||||
frame $data(w_bb) -relief $data(-relief) -bd $data(-borderwidth) \
|
||||
-cursor "bottom_side"\
|
||||
-bg $data(-background)
|
||||
frame $data(w_bl) -relief $data(-relief) -bd $data(-borderwidth) \
|
||||
-cursor "left_side"\
|
||||
-bg $data(-background)
|
||||
frame $data(w_br) -relief $data(-relief) -bd $data(-borderwidth) \
|
||||
-cursor "right_side"\
|
||||
-bg $data(-background)
|
||||
}
|
||||
|
||||
proc tixResizeHandle:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
|
||||
bind $data(w_r00) <1> \
|
||||
"tixResizeHandle:dragstart $w $data(w_r00) 1 %X %Y {1 1 -1 -1}"
|
||||
bind $data(w_r01) <1> \
|
||||
"tixResizeHandle:dragstart $w $data(w_r01) 1 %X %Y {1 0 -1 1}"
|
||||
bind $data(w_r10) <1> \
|
||||
"tixResizeHandle:dragstart $w $data(w_r10) 1 %X %Y {0 1 1 -1}"
|
||||
bind $data(w_r11) <1> \
|
||||
"tixResizeHandle:dragstart $w $data(w_r11) 1 %X %Y {0 0 1 1}"
|
||||
bind $data(w_bt) <1> \
|
||||
"tixResizeHandle:dragstart $w $data(w_bt) 1 %X %Y {0 1 0 -1}"
|
||||
bind $data(w_bb) <1> \
|
||||
"tixResizeHandle:dragstart $w $data(w_bb) 1 %X %Y {0 0 0 1}"
|
||||
bind $data(w_bl) <1> \
|
||||
"tixResizeHandle:dragstart $w $data(w_bl) 1 %X %Y {1 0 -1 0}"
|
||||
bind $data(w_br) <1> \
|
||||
"tixResizeHandle:dragstart $w $data(w_br) 1 %X %Y {0 0 1 0}"
|
||||
|
||||
foreach win [list \
|
||||
$data(w_r00)\
|
||||
$data(w_r01)\
|
||||
$data(w_r10)\
|
||||
$data(w_r11)\
|
||||
$data(w_bt)\
|
||||
$data(w_bb)\
|
||||
$data(w_bl)\
|
||||
$data(w_br)\
|
||||
] {
|
||||
bind $win <B1-Motion> "tixVResize:drag $w %X %Y"
|
||||
bind $win <ButtonRelease-1> "tixVResize:dragend $w $win 0 %X %Y"
|
||||
bind $win <Any-Escape> "tixVResize:dragend $w $win 1 0 0"
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Config Methods
|
||||
#----------------------------------------------------------------------
|
||||
proc tixResizeHandle:config-width {w value} {
|
||||
tixWidgetDoWhenIdle tixResizeHandle:ComposeWindow $w
|
||||
}
|
||||
|
||||
proc tixResizeHandle:config-height {w value} {
|
||||
tixWidgetDoWhenIdle tixResizeHandle:ComposeWindow $w
|
||||
}
|
||||
|
||||
proc tixResizeHandle:config-x {w value} {
|
||||
tixWidgetDoWhenIdle tixResizeHandle:ComposeWindow $w
|
||||
}
|
||||
|
||||
proc tixResizeHandle:config-y {w value} {
|
||||
tixWidgetDoWhenIdle tixResizeHandle:ComposeWindow $w
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Public Methods
|
||||
#----------------------------------------------------------------------
|
||||
proc tixResizeHandle:dragstart {w win depress rootx rooty mrect} {
|
||||
upvar #0 $w data
|
||||
|
||||
set wx $data(-x)
|
||||
set wy $data(-y)
|
||||
set ww $data(-width)
|
||||
set wh $data(-height)
|
||||
|
||||
tixVResize:dragstart $w $win $depress $rootx $rooty \
|
||||
[list $wx $wy $ww $wh] $mrect
|
||||
}
|
||||
|
||||
# tixDeleteBindTag --
|
||||
#
|
||||
# Delete the bindtag(s) in the args list from the bindtags of the widget
|
||||
#
|
||||
proc tixDeleteBindTag {w args} {
|
||||
if {![winfo exists $w]} {
|
||||
return
|
||||
}
|
||||
set newtags ""
|
||||
|
||||
foreach tag [bindtags $w] {
|
||||
if {[lsearch $args $tag] == -1} {
|
||||
lappend newtags $tag
|
||||
}
|
||||
}
|
||||
bindtags $w $newtags
|
||||
}
|
||||
|
||||
proc tixAddBindTag {w args} {
|
||||
bindtags $w [concat [bindtags $w] $args]
|
||||
}
|
||||
|
||||
proc tixResizeHandle:attachwidget {w widget args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set opt(-move) 0
|
||||
tixHandleOptions opt {-move} $args
|
||||
|
||||
if {$data(widget) != ""} {
|
||||
tixDeleteBindTag $data(widget) TixResizeHandleTag:$w
|
||||
}
|
||||
|
||||
set data(widget) $widget
|
||||
|
||||
if {$data(widget) != ""} {
|
||||
# Just in case TixResizeHandleTag was already there
|
||||
tixDeleteBindTag $data(widget) TixResizeHandleTag:$w
|
||||
tixAddBindTag $data(widget) TixResizeHandleTag:$w
|
||||
|
||||
|
||||
set data(-x) [winfo x $data(widget)]
|
||||
set data(-y) [winfo y $data(widget)]
|
||||
set data(-width) [winfo width $data(widget)]
|
||||
set data(-height) [winfo height $data(widget)]
|
||||
|
||||
tixResizeHandle:show $w
|
||||
tixResizeHandle:ComposeWindow $w
|
||||
|
||||
# Now set the bindings
|
||||
#
|
||||
if {$opt(-move)} {
|
||||
bind TixResizeHandleTag:$w <1> \
|
||||
"tixResizeHandle:Attach $w %X %Y"
|
||||
bind TixResizeHandleTag:$w <B1-Motion> \
|
||||
"tixResizeHandle:BMotion $w %X %Y"
|
||||
bind TixResizeHandleTag:$w <Any-Escape> \
|
||||
"tixResizeHandle:BRelease $w 1 %X %Y"
|
||||
bind TixResizeHandleTag:$w <ButtonRelease-1>\
|
||||
"tixResizeHandle:BRelease $w 0 %X %Y"
|
||||
} else {
|
||||
# if "move" is false, then the widget won't be moved as a whole --
|
||||
# ResizeHandle will only move its sides
|
||||
bind TixResizeHandleTag:$w <1> {;}
|
||||
bind TixResizeHandleTag:$w <B1-Motion> {;}
|
||||
bind TixResizeHandleTag:$w <Any-Escape> {;}
|
||||
bind TixResizeHandleTag:$w <ButtonRelease-1> {;}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixResizeHandle:detachwidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(widget) != ""} {
|
||||
tixDeleteBindTag $data(widget) TixResizeHandleTag:$w
|
||||
}
|
||||
tixResizeHandle:hide $w
|
||||
}
|
||||
|
||||
proc tixResizeHandle:show {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(shown) 1
|
||||
|
||||
raise $data(w_ht)
|
||||
raise $data(w_hb)
|
||||
raise $data(w_hl)
|
||||
raise $data(w_hr)
|
||||
|
||||
raise $data(w_r00)
|
||||
raise $data(w_r01)
|
||||
raise $data(w_r10)
|
||||
raise $data(w_r11)
|
||||
|
||||
raise $data(w_bt)
|
||||
raise $data(w_bb)
|
||||
raise $data(w_bl)
|
||||
raise $data(w_br)
|
||||
|
||||
# tixCancleIdleTask tixResizeHandle:ComposeWindow $w
|
||||
tixResizeHandle:ComposeWindow $w
|
||||
}
|
||||
|
||||
|
||||
proc tixResizeHandle:hide {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {!$data(shown)} {
|
||||
return
|
||||
}
|
||||
|
||||
set data(shown) 0
|
||||
|
||||
place forget $data(w_r00)
|
||||
place forget $data(w_r01)
|
||||
place forget $data(w_r10)
|
||||
place forget $data(w_r11)
|
||||
|
||||
place forget $data(w_bt)
|
||||
place forget $data(w_bb)
|
||||
place forget $data(w_bl)
|
||||
place forget $data(w_br)
|
||||
|
||||
place forget $data(w_ht)
|
||||
place forget $data(w_hb)
|
||||
place forget $data(w_hl)
|
||||
place forget $data(w_hr)
|
||||
}
|
||||
|
||||
proc tixResizeHandle:Destructor {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(widget) != ""} {
|
||||
tixDeleteBindTag $data(widget) TixResizeHandleTag:$w
|
||||
}
|
||||
|
||||
catch {destroy $data(w_r01)}
|
||||
catch {destroy $data(w_r10)}
|
||||
catch {destroy $data(w_r11)}
|
||||
|
||||
catch {destroy $data(w_bt)}
|
||||
catch {destroy $data(w_bb)}
|
||||
catch {destroy $data(w_bl)}
|
||||
catch {destroy $data(w_br)}
|
||||
|
||||
catch {destroy $data(w_ht)}
|
||||
catch {destroy $data(w_hb)}
|
||||
catch {destroy $data(w_hl)}
|
||||
catch {destroy $data(w_hr)}
|
||||
|
||||
tixChainMethod $w Destructor
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Private Methods Dealing With Attached Widgets
|
||||
#----------------------------------------------------------------------
|
||||
proc tixResizeHandle:Attach {w rx ry} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixResizeHandle:dragstart $w $data(widget) 0 $rx $ry {1 1 0 0}
|
||||
}
|
||||
|
||||
proc tixResizeHandle:BMotion {w rx ry} {
|
||||
tixVResize:drag $w $rx $ry
|
||||
}
|
||||
|
||||
|
||||
proc tixResizeHandle:BRelease {w isAbort rx ry} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixVResize:dragend $w $data(widget) $isAbort $rx $ry
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Private Methods
|
||||
#----------------------------------------------------------------------
|
||||
proc tixResizeHandle:DrawTmpLines {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
# I've seen this error - mike
|
||||
if {![info exists data(hf:x1)]} {return}
|
||||
set x1 $data(hf:x1)
|
||||
if {![info exists data(hf:y1)]} {return}
|
||||
set y1 $data(hf:y1)
|
||||
if {![info exists data(hf:x2)]} {return}
|
||||
set x2 $data(hf:x2)
|
||||
if {![info exists data(hf:y2)]} {return}
|
||||
set y2 $data(hf:y2)
|
||||
|
||||
tixTmpLine $x1 $y1 $x2 $y1 $w
|
||||
tixTmpLine $x1 $y2 $x2 $y2 $w
|
||||
tixTmpLine $x1 $y1 $x1 $y2 $w
|
||||
tixTmpLine $x2 $y1 $x2 $y2 $w
|
||||
}
|
||||
|
||||
# Place the hint frame to indicate the changes
|
||||
#
|
||||
proc tixResizeHandle:SetHintFrame {w x1 y1 width height} {
|
||||
upvar #0 $w data
|
||||
|
||||
# The four sides of the window
|
||||
#
|
||||
set x2 [expr "$x1+$width"]
|
||||
set y2 [expr "$y1+$height"]
|
||||
|
||||
set rx [winfo rootx [winfo parent $w]]
|
||||
set ry [winfo rooty [winfo parent $w]]
|
||||
|
||||
incr x1 $rx
|
||||
incr y1 $ry
|
||||
incr x2 $rx
|
||||
incr y2 $ry
|
||||
|
||||
if {[info exists data(hf:x1)]} {
|
||||
tixResizeHandle:DrawTmpLines $w
|
||||
}
|
||||
|
||||
set data(hf:x1) $x1
|
||||
set data(hf:y1) $y1
|
||||
set data(hf:x2) $x2
|
||||
set data(hf:y2) $y2
|
||||
|
||||
tixResizeHandle:DrawTmpLines $w
|
||||
}
|
||||
|
||||
proc tixResizeHandle:ShowHintFrame {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
place forget $data(w_ht)
|
||||
place forget $data(w_hb)
|
||||
place forget $data(w_hl)
|
||||
place forget $data(w_hr)
|
||||
|
||||
update
|
||||
}
|
||||
|
||||
proc tixResizeHandle:HideHintFrame {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixResizeHandle:DrawTmpLines $w
|
||||
unset data(hf:x1)
|
||||
unset data(hf:y1)
|
||||
unset data(hf:x2)
|
||||
unset data(hf:y2)
|
||||
}
|
||||
|
||||
proc tixResizeHandle:UpdateSize {w x y width height} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(-x) $x
|
||||
set data(-y) $y
|
||||
set data(-width) $width
|
||||
set data(-height) $height
|
||||
|
||||
tixResizeHandle:ComposeWindow $w
|
||||
|
||||
if {$data(widget) != ""} {
|
||||
place $data(widget) -x $x -y $y -width $width -height $height
|
||||
}
|
||||
|
||||
if {$data(-command) != ""} {
|
||||
eval $data(-command) $x $y $width $height
|
||||
}
|
||||
}
|
||||
|
||||
proc tixResizeHandle:ComposeWindow {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
set px $data(-x)
|
||||
set py $data(-y)
|
||||
set pw $data(-width)
|
||||
set ph $data(-height)
|
||||
|
||||
# Show the hint frames
|
||||
#
|
||||
set x1 $px
|
||||
set y1 $py
|
||||
set x2 [expr "$px+$pw"]
|
||||
set y2 [expr "$py+$ph"]
|
||||
|
||||
place $data(w_ht) -x $x1 -y $y1 -width $pw -bordermode outside
|
||||
place $data(w_hb) -x $x1 -y $y2 -width $pw -bordermode outside
|
||||
place $data(w_hl) -x $x1 -y $y1 -height $ph -bordermode outside
|
||||
place $data(w_hr) -x $x2 -y $y1 -height $ph -bordermode outside
|
||||
|
||||
# Set the four corner resize handles
|
||||
#
|
||||
set sz_2 [expr $data(-handlesize)/2]
|
||||
|
||||
set x1 [expr "$px - $sz_2"]
|
||||
set y1 [expr "$py - $sz_2"]
|
||||
set x2 [expr "$px - $sz_2" + $pw]
|
||||
set y2 [expr "$py - $sz_2" + $ph]
|
||||
|
||||
place $data(w_r00) -x $x1 -y $y1 \
|
||||
-width $data(-handlesize) -height $data(-handlesize)
|
||||
place $data(w_r01) -x $x1 -y $y2\
|
||||
-width $data(-handlesize) -height $data(-handlesize)
|
||||
place $data(w_r10) -x $x2 -y $y1\
|
||||
-width $data(-handlesize) -height $data(-handlesize)
|
||||
place $data(w_r11) -x $x2 -y $y2\
|
||||
-width $data(-handlesize) -height $data(-handlesize)
|
||||
|
||||
|
||||
# Set the four border resize handles
|
||||
#
|
||||
set mx [expr "$px + $pw/2 - $sz_2"]
|
||||
set my [expr "$py + $ph/2 - $sz_2"]
|
||||
|
||||
place $data(w_bt) -x $mx -y $y1 \
|
||||
-width $data(-handlesize) -height $data(-handlesize)
|
||||
place $data(w_bb) -x $mx -y $y2 \
|
||||
-width $data(-handlesize) -height $data(-handlesize)
|
||||
place $data(w_bl) -x $x1 -y $my \
|
||||
-width $data(-handlesize) -height $data(-handlesize)
|
||||
place $data(w_br) -x $x2 -y $my \
|
||||
-width $data(-handlesize) -height $data(-handlesize)
|
||||
}
|
||||
243
win32/lib/tix8.4.3/SGrid.tcl
Normal file
@@ -0,0 +1,243 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: SGrid.tcl,v 1.6 2002/01/24 09:13:58 idiscovery Exp $
|
||||
#
|
||||
# SGrid.tcl --
|
||||
#
|
||||
# This file implements Scrolled Grid widgets
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
global tkPriv
|
||||
if {![llength [info globals tkPriv]]} {
|
||||
tk::unsupported::ExposePrivateVariable tkPriv
|
||||
}
|
||||
#--------------------------------------------------------------------------
|
||||
# tkPriv elements used in this file:
|
||||
#
|
||||
# x -
|
||||
# y -
|
||||
# X -
|
||||
# Y -
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
tixWidgetClass tixScrolledGrid {
|
||||
-classname TixScrolledGrid
|
||||
-superclass tixScrolledWidget
|
||||
-method {
|
||||
}
|
||||
-flag {
|
||||
}
|
||||
-configspec {
|
||||
}
|
||||
-default {
|
||||
{.scrollbar auto}
|
||||
{*grid.borderWidth 1}
|
||||
{*grid.Background #c3c3c3}
|
||||
{*grid.highlightBackground #d9d9d9}
|
||||
{*grid.relief sunken}
|
||||
{*grid.takeFocus 1}
|
||||
{*Scrollbar.takeFocus 0}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixScrolledGrid:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
set data(w:grid) [tixGrid $w.grid]
|
||||
|
||||
set data(w:hsb) \
|
||||
[scrollbar $w.hsb -orient horizontal -takefocus 0]
|
||||
set data(w:vsb) \
|
||||
[scrollbar $w.vsb -orient vertical -takefocus 0]
|
||||
|
||||
set data(pw:client) $data(w:grid)
|
||||
|
||||
pack $data(w:grid) -expand yes -fill both -padx 0 -pady 0
|
||||
}
|
||||
|
||||
proc tixScrolledGrid:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
|
||||
$data(w:grid) config \
|
||||
-xscrollcommand "$data(w:hsb) set"\
|
||||
-yscrollcommand "$data(w:vsb) set"\
|
||||
-sizecmd [list tixScrolledWidget:Configure $w] \
|
||||
-formatcmd "tixCallMethod $w FormatCmd"
|
||||
|
||||
$data(w:hsb) config -command "$data(w:grid) xview"
|
||||
$data(w:vsb) config -command "$data(w:grid) yview"
|
||||
|
||||
bindtags $data(w:grid) \
|
||||
"$data(w:grid) TixSGrid TixGrid [winfo toplevel $data(w:grid)] all"
|
||||
|
||||
tixSetMegaWidget $data(w:grid) $w
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# RAW event bindings
|
||||
#----------------------------------------------------------------------
|
||||
proc tixScrolledGridBind {} {
|
||||
tixBind TixScrolledGrid <ButtonPress-1> {
|
||||
tixScrolledGrid:Button-1 [tixGetMegaWidget %W] %x %y
|
||||
}
|
||||
tixBind TixScrolledGrid <Shift-ButtonPress-1> {
|
||||
tixScrolledGrid:Shift-Button-1 %W %x %y
|
||||
}
|
||||
tixBind TixScrolledGrid <Control-ButtonPress-1> {
|
||||
tixScrolledGrid:Control-Button-1 %W %x %y
|
||||
}
|
||||
tixBind TixScrolledGrid <ButtonRelease-1> {
|
||||
tixScrolledGrid:ButtonRelease-1 %W %x %y
|
||||
}
|
||||
tixBind TixScrolledGrid <Double-ButtonPress-1> {
|
||||
tixScrolledGrid:Double-1 %W %x %y
|
||||
}
|
||||
tixBind TixScrolledGrid <B1-Motion> {
|
||||
set tkPriv(x) %x
|
||||
set tkPriv(y) %y
|
||||
set tkPriv(X) %X
|
||||
set tkPriv(Y) %Y
|
||||
|
||||
tixScrolledGrid:B1-Motion %W %x %y
|
||||
}
|
||||
tixBind TixScrolledGrid <Control-B1-Motion> {
|
||||
set tkPriv(x) %x
|
||||
set tkPriv(y) %y
|
||||
set tkPriv(X) %X
|
||||
set tkPriv(Y) %Y
|
||||
|
||||
tixScrolledGrid:Control-B1-Motion %W %x %y
|
||||
}
|
||||
tixBind TixScrolledGrid <B1-Leave> {
|
||||
set tkPriv(x) %x
|
||||
set tkPriv(y) %y
|
||||
set tkPriv(X) %X
|
||||
set tkPriv(Y) %Y
|
||||
|
||||
tixScrolledGrid:B1-Leave %W
|
||||
}
|
||||
tixBind TixScrolledGrid <B1-Enter> {
|
||||
tixScrolledGrid:B1-Enter %W %x %y
|
||||
}
|
||||
tixBind TixScrolledGrid <Control-B1-Leave> {
|
||||
set tkPriv(x) %x
|
||||
set tkPriv(y) %y
|
||||
set tkPriv(X) %X
|
||||
set tkPriv(Y) %Y
|
||||
|
||||
tixScrolledGrid:Control-B1-Leave %W
|
||||
}
|
||||
tixBind TixScrolledGrid <Control-B1-Enter> {
|
||||
tixScrolledGrid:Control-B1-Enter %W %x %y
|
||||
}
|
||||
|
||||
# Keyboard bindings
|
||||
#
|
||||
tixBind TixScrolledGrid <Up> {
|
||||
tixScrolledGrid:DirKey %W up
|
||||
}
|
||||
tixBind TixScrolledGrid <Down> {
|
||||
tixScrolledGrid:DirKey %W down
|
||||
}
|
||||
tixBind TixScrolledGrid <Left> {
|
||||
tixScrolledGrid:DirKey %W left
|
||||
}
|
||||
tixBind TixScrolledGrid <Right> {
|
||||
tixScrolledGrid:DirKey %W right
|
||||
}
|
||||
tixBind TixScrolledGrid <Prior> {
|
||||
%W yview scroll -1 pages
|
||||
}
|
||||
tixBind TixScrolledGrid <Next> {
|
||||
%W yview scroll 1 pages
|
||||
}
|
||||
tixBind TixScrolledGrid <Return> {
|
||||
tixScrolledGrid:Return %W
|
||||
}
|
||||
tixBind TixScrolledGrid <space> {
|
||||
tixScrolledGrid:Space %W
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# Mouse bindings
|
||||
#
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
proc tixScrolledGrid:Button-1 {w x y} {
|
||||
if {[$w cget -state] == "disabled"} {
|
||||
return
|
||||
}
|
||||
if {[$w cget -takefocus]} {
|
||||
focus $w
|
||||
}
|
||||
case [tixScrolled:GetState $w] {
|
||||
{0} {
|
||||
tixScrolledGrid:GoState s1 $w $x $y
|
||||
}
|
||||
{b0} {
|
||||
tixScrolledGrid:GoState b1 $w $x $y
|
||||
}
|
||||
{m0} {
|
||||
tixScrolledGrid:GoState m1 $w $x $y
|
||||
}
|
||||
{e0} {
|
||||
tixScrolledGrid:GoState e1 $w $x $y
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# option configs
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Widget commands
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Private Methods
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Virtual Methods
|
||||
#----------------------------------------------------------------------
|
||||
proc tixScrolledGrid:FormatCmd {w area x1 y1 x2 y2} {
|
||||
# do nothing
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# virtual functions to query the client window's scroll requirement
|
||||
#----------------------------------------------------------------------
|
||||
proc tixScrolledGrid:GeometryInfo {w mW mH} {
|
||||
upvar #0 $w data
|
||||
|
||||
|
||||
if {$mW < 1} {
|
||||
set mW 1
|
||||
}
|
||||
if {$mH < 1} {
|
||||
set mH 1
|
||||
}
|
||||
|
||||
return [$data(w:grid) geometryinfo $mW $mH]
|
||||
}
|
||||
140
win32/lib/tix8.4.3/SHList.tcl
Normal file
@@ -0,0 +1,140 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: SHList.tcl,v 1.7 2004/04/09 21:37:33 hobbs Exp $
|
||||
#
|
||||
# SHList.tcl --
|
||||
#
|
||||
# This file implements Scrolled HList widgets
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
|
||||
tixWidgetClass tixScrolledHList {
|
||||
-classname TixScrolledHList
|
||||
-superclass tixScrolledWidget
|
||||
-method {
|
||||
}
|
||||
-flag {
|
||||
-highlightbackground -highlightcolor -highlightthickness
|
||||
}
|
||||
-configspec {
|
||||
{-highlightbackground -highlightBackground HighlightBackground #d9d9d9}
|
||||
{-highlightcolor -highlightColor HighlightColor black}
|
||||
{-highlightthickness -highlightThickness HighlightThickness 2}
|
||||
}
|
||||
-default {
|
||||
{.scrollbar auto}
|
||||
{*f1.borderWidth 1}
|
||||
{*hlist.Background #c3c3c3}
|
||||
{*hlist.highlightBackground #d9d9d9}
|
||||
{*hlist.relief sunken}
|
||||
{*hlist.takeFocus 1}
|
||||
{*Scrollbar.takeFocus 0}
|
||||
}
|
||||
-forcecall {
|
||||
-highlightbackground -highlightcolor -highlightthickness
|
||||
}
|
||||
}
|
||||
|
||||
proc tixScrolledHList:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
set data(pw:f1) [frame $w.f1 -takefocus 0]
|
||||
set data(w:hlist) \
|
||||
[tixHList $w.f1.hlist -bd 0 -takefocus 1 -highlightthickness 0]
|
||||
|
||||
pack $data(w:hlist) -in $data(pw:f1) -expand yes -fill both -padx 0 -pady 0
|
||||
|
||||
set data(w:hsb) [scrollbar $w.hsb -orient horizontal -takefocus 0]
|
||||
set data(w:vsb) [scrollbar $w.vsb -orient vertical -takefocus 0]
|
||||
|
||||
set data(pw:client) $data(pw:f1)
|
||||
}
|
||||
|
||||
proc tixScrolledHList:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
|
||||
$data(w:hlist) config \
|
||||
-xscrollcommand [list $data(w:hsb) set] \
|
||||
-yscrollcommand [list $data(w:vsb) set] \
|
||||
-sizecmd [list tixScrolledWidget:Configure $w]
|
||||
|
||||
$data(w:hsb) config -command [list $data(w:hlist) xview]
|
||||
$data(w:vsb) config -command [list $data(w:hlist) yview]
|
||||
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# option configs
|
||||
#----------------------------------------------------------------------
|
||||
proc tixScrolledHList:config-takefocus {w value} {
|
||||
upvar #0 $w data
|
||||
$data(w:hlist) config -takefocus $value
|
||||
}
|
||||
|
||||
proc tixScrolledHList:config-highlightbackground {w value} {
|
||||
upvar #0 $w data
|
||||
$data(pw:f1) config -highlightbackground $value
|
||||
}
|
||||
|
||||
proc tixScrolledHList:config-highlightcolor {w value} {
|
||||
upvar #0 $w data
|
||||
$data(pw:f1) config -highlightcolor $value
|
||||
}
|
||||
|
||||
proc tixScrolledHList:config-highlightthickness {w value} {
|
||||
upvar #0 $w data
|
||||
$data(pw:f1) config -highlightthickness $value
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Widget commands
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Private Methods
|
||||
#----------------------------------------------------------------------
|
||||
# virtual
|
||||
#
|
||||
proc tixScrolledHList:RepackHook {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w RepackHook
|
||||
}
|
||||
#----------------------------------------------------------------------
|
||||
# virtual functions to query the client window's scroll requirement
|
||||
#----------------------------------------------------------------------
|
||||
proc tixScrolledHList:GeometryInfo {w mW mH} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[winfo class $w.f1] eq "Frame"} {
|
||||
set extra [expr {[$w.f1 cget -bd]+[$w.f1 cget -highlightthickness]}]
|
||||
} else {
|
||||
set extra 0
|
||||
}
|
||||
|
||||
set mW [expr {$mW - $extra*2}]
|
||||
set mH [expr {$mH - $extra*2}]
|
||||
|
||||
if {$mW < 1} {
|
||||
set mW 1
|
||||
}
|
||||
if {$mH < 1} {
|
||||
set mH 1
|
||||
}
|
||||
|
||||
return [$data(w:hlist) geometryinfo $mW $mH]
|
||||
}
|
||||
295
win32/lib/tix8.4.3/SListBox.tcl
Normal file
@@ -0,0 +1,295 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: SListBox.tcl,v 1.5 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# SListBox.tcl --
|
||||
#
|
||||
# This file implements Scrolled Listbox widgets
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
# ToDo:
|
||||
# -anchor (none)
|
||||
#
|
||||
|
||||
tixWidgetClass tixScrolledListBox {
|
||||
-classname TixScrolledListBox
|
||||
-superclass tixScrolledWidget
|
||||
-method {
|
||||
}
|
||||
-flag {
|
||||
-anchor -browsecmd -command -state
|
||||
}
|
||||
-static {
|
||||
-anchor
|
||||
}
|
||||
-configspec {
|
||||
{-anchor anchor Anchor w}
|
||||
{-browsecmd browseCmd BrowseCmd ""}
|
||||
{-command command Command ""}
|
||||
{-state state State normal}
|
||||
{-takefocus takeFocus TakeFocus 1 tixVerifyBoolean}
|
||||
}
|
||||
-default {
|
||||
{.scrollbar auto}
|
||||
{*borderWidth 1}
|
||||
{*listbox.highlightBackground #d9d9d9}
|
||||
{*listbox.relief sunken}
|
||||
{*listbox.background #c3c3c3}
|
||||
{*listbox.takeFocus 1}
|
||||
{*Scrollbar.takeFocus 0}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixScrolledListBox:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
|
||||
set data(x-first) 0
|
||||
set data(x-last) 1
|
||||
set data(y-first) 0
|
||||
set data(y-last) 1
|
||||
}
|
||||
|
||||
proc tixScrolledListBox:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
set data(w:listbox) \
|
||||
[listbox $w.listbox]
|
||||
set data(w:hsb) \
|
||||
[scrollbar $w.hsb -orient horizontal]
|
||||
set data(w:vsb) \
|
||||
[scrollbar $w.vsb -orient vertical ]
|
||||
|
||||
set data(pw:client) $data(w:listbox)
|
||||
}
|
||||
|
||||
proc tixScrolledListBox:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
|
||||
$data(w:listbox) config \
|
||||
-xscrollcommand "tixScrolledListBox:XView $w"\
|
||||
-yscrollcommand "tixScrolledListBox:YView $w"
|
||||
|
||||
$data(w:hsb) config -command "$data(w:listbox) xview"
|
||||
$data(w:vsb) config -command "$data(w:listbox) yview"
|
||||
|
||||
bind $w <Configure> "+tixScrolledListBox:Configure $w"
|
||||
bind $w <FocusIn> "focus $data(w:listbox)"
|
||||
|
||||
bindtags $data(w:listbox) \
|
||||
"$data(w:listbox) TixListboxState Listbox TixListbox [winfo toplevel $data(w:listbox)] all"
|
||||
tixSetMegaWidget $data(w:listbox) $w
|
||||
}
|
||||
|
||||
proc tixScrolledListBoxBind {} {
|
||||
tixBind TixListboxState <1> {
|
||||
if {[set [tixGetMegaWidget %W](-state)] eq "disabled"} {
|
||||
break
|
||||
}
|
||||
}
|
||||
tixBind TixListbox <1> {
|
||||
if {[string is true -strict [%W cget -takefocus]]} {
|
||||
focus %W
|
||||
}
|
||||
tixScrolledListBox:Browse [tixGetMegaWidget %W]
|
||||
}
|
||||
|
||||
tixBind TixListboxState <B1-Motion> {
|
||||
if {[set [tixGetMegaWidget %W](-state)] eq "disabled"} {
|
||||
break
|
||||
}
|
||||
}
|
||||
tixBind TixListbox <B1-Motion> {
|
||||
tixScrolledListBox:Browse [tixGetMegaWidget %W]
|
||||
}
|
||||
|
||||
tixBind TixListboxState <Up> {
|
||||
if {[set [tixGetMegaWidget %W](-state)] eq "disabled"} {
|
||||
break
|
||||
}
|
||||
}
|
||||
tixBind TixListbox <Up> {
|
||||
tixScrolledListBox:KeyBrowse [tixGetMegaWidget %W]
|
||||
}
|
||||
|
||||
tixBind TixListboxState <Down> {
|
||||
if {[set [tixGetMegaWidget %W](-state)] eq "disabled"} {
|
||||
break
|
||||
}
|
||||
}
|
||||
tixBind TixListbox <Down> {
|
||||
tixScrolledListBox:KeyBrowse [tixGetMegaWidget %W]
|
||||
}
|
||||
|
||||
tixBind TixListboxState <Return> {
|
||||
if {[set [tixGetMegaWidget %W](-state)] eq "disabled"} {
|
||||
break
|
||||
}
|
||||
}
|
||||
tixBind TixListbox <Return> {
|
||||
tixScrolledListBox:KeyInvoke [tixGetMegaWidget %W]
|
||||
}
|
||||
|
||||
|
||||
tixBind TixListboxState <Double-1> {
|
||||
if {[set [tixGetMegaWidget %W](-state)] eq "disabled"} {
|
||||
break
|
||||
}
|
||||
}
|
||||
tixBind TixListbox <Double-1> {
|
||||
tixScrolledListBox:Invoke [tixGetMegaWidget %W]
|
||||
}
|
||||
|
||||
tixBind TixListboxState <ButtonRelease-1> {
|
||||
if {[set [tixGetMegaWidget %W](-state)] eq "disabled"} {
|
||||
break
|
||||
}
|
||||
}
|
||||
tixBind TixListbox <ButtonRelease-1> {
|
||||
tixScrolledListBox:Browse [tixGetMegaWidget %W]
|
||||
}
|
||||
}
|
||||
|
||||
proc tixScrolledListBox:Browse {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(-browsecmd) != ""} {
|
||||
set bind(specs) {%V}
|
||||
set bind(%V) [$data(w:listbox) get \
|
||||
[$data(w:listbox) nearest [tixEvent flag y]]]
|
||||
tixEvalCmdBinding $w $data(-browsecmd) bind
|
||||
}
|
||||
}
|
||||
|
||||
proc tixScrolledListBox:KeyBrowse {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(-browsecmd) != ""} {
|
||||
set bind(specs) {%V}
|
||||
set bind(%V) [$data(w:listbox) get active]
|
||||
tixEvalCmdBinding $w $data(-browsecmd) bind
|
||||
}
|
||||
}
|
||||
|
||||
# tixScrolledListBox:Invoke --
|
||||
#
|
||||
# The user has invoked the listbox by pressing either the <Returh>
|
||||
# key or double-clicking. Call the user-supplied -command function.
|
||||
#
|
||||
# For both -browsecmd and -command, it is the responsibility of the
|
||||
# user-supplied function to determine the current selection of the listbox
|
||||
#
|
||||
proc tixScrolledListBox:Invoke {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(-command) != ""} {
|
||||
set bind(specs) {%V}
|
||||
set bind(%V) [$data(w:listbox) get \
|
||||
[$data(w:listbox) nearest [tixEvent flag y]]]
|
||||
tixEvalCmdBinding $w $data(-command) bind
|
||||
}
|
||||
}
|
||||
|
||||
proc tixScrolledListBox:KeyInvoke {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(-command) != ""} {
|
||||
set bind(specs) {%V}
|
||||
set bind(%V) [$data(w:listbox) get active]
|
||||
tixEvalCmdBinding $w $data(-command) bind
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# option configs
|
||||
#----------------------------------------------------------------------
|
||||
proc tixScrolledListBox:config-takefocus {w value} {
|
||||
upvar #0 $w data
|
||||
$data(w:listbox) config -takefocus $value
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Widget commands
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Private Methods
|
||||
#----------------------------------------------------------------------
|
||||
proc tixScrolledListBox:XView {w first last} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(x-first) $first
|
||||
set data(x-last) $last
|
||||
|
||||
$data(w:hsb) set $first $last
|
||||
tixWidgetDoWhenIdle tixScrolledWidget:Configure $w
|
||||
|
||||
|
||||
}
|
||||
|
||||
proc tixScrolledListBox:YView {w first last} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(y-first) $first
|
||||
set data(y-last) $last
|
||||
|
||||
$data(w:vsb) set $first $last
|
||||
tixWidgetDoWhenIdle tixScrolledWidget:Configure $w
|
||||
|
||||
# Somehow an update here must be used to advoid osscilation
|
||||
#
|
||||
update idletasks
|
||||
}
|
||||
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
# virtual functions to query the client window's scroll requirement
|
||||
#----------------------------------------------------------------------
|
||||
proc tixScrolledListBox:GeometryInfo {w mW mH} {
|
||||
upvar #0 $w data
|
||||
|
||||
return [list \
|
||||
[list $data(x-first) $data(x-last)]\
|
||||
[list $data(y-first) $data(y-last)]]
|
||||
}
|
||||
|
||||
proc tixScrolledListBox:Configure {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixWidgetDoWhenIdle tixScrolledListBox:TrickScrollbar $w
|
||||
|
||||
if {$data(-anchor) eq "e"} {
|
||||
$data(w:listbox) xview 100000
|
||||
}
|
||||
}
|
||||
|
||||
# This procedure is necessary because listbox does not call x,y scroll command
|
||||
# when its size is changed
|
||||
#
|
||||
proc tixScrolledListBox:TrickScrollbar {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
set inc [$data(w:listbox) select include 0]
|
||||
|
||||
$data(w:listbox) select set 0
|
||||
if {!$inc} {
|
||||
$data(w:listbox) select clear 0
|
||||
}
|
||||
}
|
||||
93
win32/lib/tix8.4.3/STList.tcl
Normal file
@@ -0,0 +1,93 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: STList.tcl,v 1.4 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# STList.tcl --
|
||||
#
|
||||
# This file implements Scrolled TList widgets
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
tixWidgetClass tixScrolledTList {
|
||||
-classname TixScrolledTList
|
||||
-superclass tixScrolledWidget
|
||||
-method {
|
||||
}
|
||||
-flag {
|
||||
}
|
||||
-configspec {
|
||||
}
|
||||
-default {
|
||||
{.scrollbar auto}
|
||||
{*borderWidth 1}
|
||||
{*tlist.background #c3c3c3}
|
||||
{*tlist.highlightBackground #d9d9d9}
|
||||
{*tlist.relief sunken}
|
||||
{*tlist.takeFocus 1}
|
||||
{*Scrollbar.takeFocus 0}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixScrolledTList:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
set data(w:tlist) \
|
||||
[tixTList $w.tlist]
|
||||
set data(w:hsb) \
|
||||
[scrollbar $w.hsb -orient horizontal]
|
||||
set data(w:vsb) \
|
||||
[scrollbar $w.vsb -orient vertical ]
|
||||
|
||||
set data(pw:client) $data(w:tlist)
|
||||
}
|
||||
|
||||
proc tixScrolledTList:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
|
||||
$data(w:tlist) config \
|
||||
-xscrollcommand "$data(w:hsb) set"\
|
||||
-yscrollcommand "$data(w:vsb) set"\
|
||||
-sizecmd [list tixScrolledWidget:Configure $w]
|
||||
|
||||
$data(w:hsb) config -command "$data(w:tlist) xview"
|
||||
$data(w:vsb) config -command "$data(w:tlist) yview"
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# option configs
|
||||
#----------------------------------------------------------------------
|
||||
proc tixScrolledTList:config-takefocus {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
$data(w:tlist) config -takefocus $value
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Widget commands
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Private Methods
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# virtual functions to query the client window's scroll requirement
|
||||
#----------------------------------------------------------------------
|
||||
proc tixScrolledTList:GeometryInfo {w mW mH} {
|
||||
upvar #0 $w data
|
||||
|
||||
return [$data(w:tlist) geometryinfo $mW $mH]
|
||||
}
|
||||
134
win32/lib/tix8.4.3/SText.tcl
Normal file
@@ -0,0 +1,134 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: SText.tcl,v 1.4 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# SText.tcl --
|
||||
#
|
||||
# This file implements Scrolled Text widgets
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
|
||||
tixWidgetClass tixScrolledText {
|
||||
-classname TixScrolledText
|
||||
-superclass tixScrolledWidget
|
||||
-method {
|
||||
}
|
||||
-flag {
|
||||
}
|
||||
-static {
|
||||
}
|
||||
-configspec {
|
||||
}
|
||||
-default {
|
||||
{.scrollbar both}
|
||||
{*Scrollbar.takeFocus 0}
|
||||
}
|
||||
-forcecall {
|
||||
-scrollbar
|
||||
}
|
||||
}
|
||||
|
||||
proc tixScrolledText:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
global tcl_platform
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
set data(w:text) \
|
||||
[text $w.text]
|
||||
set data(w:hsb) \
|
||||
[scrollbar $w.hsb -orient horizontal]
|
||||
set data(w:vsb) \
|
||||
[scrollbar $w.vsb -orient vertical]
|
||||
|
||||
if {$data(-sizebox) && $tcl_platform(platform) == "windows"} {
|
||||
# set data(w:sizebox) [ide_sizebox $w.sizebox]
|
||||
}
|
||||
|
||||
set data(pw:client) $data(w:text)
|
||||
}
|
||||
|
||||
proc tixScrolledText:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
|
||||
$data(w:text) config \
|
||||
-xscrollcommand "tixScrolledText:XScroll $w"\
|
||||
-yscrollcommand "tixScrolledText:YScroll $w"
|
||||
|
||||
$data(w:hsb) config -command "$data(w:text) xview"
|
||||
$data(w:vsb) config -command "$data(w:text) yview"
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# option configs
|
||||
#----------------------------------------------------------------------
|
||||
proc tixScrolledText:config-takefocus {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
$data(w:text) config -takefocus $value
|
||||
}
|
||||
|
||||
proc tixScrolledText:config-scrollbar {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[string match "auto*" $value]} {
|
||||
set value "both"
|
||||
}
|
||||
set data(-scrollbar) $value
|
||||
|
||||
tixChainMethod $w config-scrollbar $value
|
||||
|
||||
return $value
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Widget commands
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Private Methods
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# virtual functions to query the client window's scroll requirement
|
||||
#----------------------------------------------------------------------
|
||||
proc tixScrolledText:GeometryInfo {w mW mH} {
|
||||
upvar #0 $w data
|
||||
|
||||
return [list "$data(x,first) $data(x,last)" "$data(y,first) $data(y,last)"]
|
||||
}
|
||||
|
||||
proc tixScrolledText:XScroll {w first last} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(x,first) $first
|
||||
set data(x,last) $last
|
||||
|
||||
$data(w:hsb) set $first $last
|
||||
|
||||
tixWidgetDoWhenIdle tixScrolledWidget:Configure $w
|
||||
}
|
||||
|
||||
proc tixScrolledText:YScroll {w first last} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(y,first) $first
|
||||
set data(y,last) $last
|
||||
|
||||
$data(w:vsb) set $first $last
|
||||
|
||||
tixWidgetDoWhenIdle tixScrolledWidget:Configure $w
|
||||
}
|
||||
465
win32/lib/tix8.4.3/SWidget.tcl
Normal file
@@ -0,0 +1,465 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: SWidget.tcl,v 1.5 2002/01/24 09:13:58 idiscovery Exp $
|
||||
#
|
||||
# SWidget.tcl --
|
||||
#
|
||||
# tixScrolledWidget: virtual base class. Do not instantiate
|
||||
# This is the core class for all scrolled widgets.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
tixWidgetClass tixScrolledWidget {
|
||||
-virtual true
|
||||
-classname TixScrolledWidget
|
||||
-superclass tixPrimitive
|
||||
-method {
|
||||
}
|
||||
-flag {
|
||||
-scrollbar -scrollbarspace
|
||||
}
|
||||
-configspec {
|
||||
{-scrollbar scrollbar Scrollbar both}
|
||||
{-scrollbarspace scrollbarSpace ScrollbarSpace {both}}
|
||||
{-sizebox sizeBox SizeBox 0}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixScrolledWidget:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
|
||||
set data(x,first) 0
|
||||
set data(x,last) 0
|
||||
|
||||
set data(y,first) 0
|
||||
set data(y,last) 0
|
||||
|
||||
set data(lastSpec) ""
|
||||
set data(lastMW) ""
|
||||
set data(lastMH) ""
|
||||
set data(lastScbW) ""
|
||||
set data(lastScbH) ""
|
||||
|
||||
set data(repack) 0
|
||||
set data(counter) 0
|
||||
|
||||
set data(vsbPadY) 0
|
||||
set data(hsbPadX) 0
|
||||
}
|
||||
|
||||
proc tixScrolledWidget:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
|
||||
tixManageGeometry $data(pw:client) "tixScrolledWidget:ClientGeomProc $w"
|
||||
bind $data(pw:client) <Configure> \
|
||||
[list tixScrolledWidget:ClientGeomProc $w "" $data(pw:client)]
|
||||
|
||||
tixManageGeometry $data(w:hsb) "tixScrolledWidget:ClientGeomProc $w"
|
||||
bind $data(w:hsb) <Configure> \
|
||||
[list tixScrolledWidget:ClientGeomProc $w "" $data(w:hsb)]
|
||||
|
||||
tixManageGeometry $data(w:vsb) "tixScrolledWidget:ClientGeomProc $w"
|
||||
bind $data(w:vsb) <Configure> \
|
||||
[list tixScrolledWidget:ClientGeomProc $w "" $data(w:vsb)]
|
||||
|
||||
bind $w <Configure> "tixScrolledWidget:MasterGeomProc $w"
|
||||
|
||||
tixWidgetDoWhenIdle tixScrolledWidget:Repack $w
|
||||
set data(repack) 1
|
||||
}
|
||||
|
||||
proc tixScrolledWidget:config-scrollbar {w value} {
|
||||
upvar #0 $w data
|
||||
global tcl_platform
|
||||
|
||||
if {[lindex $value 0] == "auto"} {
|
||||
foreach xspec [lrange $value 1 end] {
|
||||
case $xspec {
|
||||
{+x -x +y -y} {}
|
||||
default {
|
||||
error "bad -scrollbar value \"$value\""
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
case $value in {
|
||||
{none x y both} {}
|
||||
default {
|
||||
error "bad -scrollbar value \"$value\""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if {$data(-sizebox) && $tcl_platform(platform) == "windows"} {
|
||||
set data(-scrollbar) both
|
||||
}
|
||||
|
||||
if {$data(repack) == 0} {
|
||||
set data(repack) 1
|
||||
tixWidgetDoWhenIdle tixScrolledWidget:Repack $w
|
||||
}
|
||||
}
|
||||
|
||||
proc tixScrolledWidget:config-scrollbarspace {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(repack) == 0} {
|
||||
set data(repack) 1
|
||||
tixWidgetDoWhenIdle tixScrolledWidget:Repack $w
|
||||
}
|
||||
}
|
||||
|
||||
proc tixScrolledWidget:config-sizebox {w value} {
|
||||
error "unimplemented"
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Scrollbar calculations
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
proc tixScrolledWidget:ClientGeomProc {w type client} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(repack) == 0} {
|
||||
set data(repack) 1
|
||||
tixWidgetDoWhenIdle tixScrolledWidget:Repack $w
|
||||
}
|
||||
}
|
||||
|
||||
proc tixScrolledWidget:MasterGeomProc {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(repack) == 0} {
|
||||
set data(repack) 1
|
||||
tixWidgetDoWhenIdle tixScrolledWidget:Repack $w
|
||||
}
|
||||
}
|
||||
|
||||
proc tixScrolledWidget:Configure {w} {
|
||||
if {![winfo exists $w]} {
|
||||
return
|
||||
}
|
||||
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(repack) == 0} {
|
||||
set data(repack) 1
|
||||
tixWidgetDoWhenIdle tixScrolledWidget:Repack $w
|
||||
}
|
||||
}
|
||||
|
||||
proc tixScrolledWidget:ScrollCmd {w scrollbar axis first last} {
|
||||
upvar #0 $w data
|
||||
|
||||
$scrollbar set $first $last
|
||||
}
|
||||
|
||||
# Show or hide the scrollbars as required.
|
||||
#
|
||||
# spec: 00 = need none
|
||||
# spec: 01 = need y
|
||||
# spec: 10 = need x
|
||||
# spec: 11 = need xy
|
||||
#
|
||||
proc tixScrolledWidget:Repack {w} {
|
||||
tixCallMethod $w RepackHook
|
||||
}
|
||||
|
||||
proc tixScrolledWidget:RepackHook {w} {
|
||||
upvar #0 $w data
|
||||
global tcl_platform
|
||||
|
||||
if {![winfo exists $w]} {
|
||||
# This was generated by the <Destroy> event
|
||||
#
|
||||
return
|
||||
}
|
||||
|
||||
set client $data(pw:client)
|
||||
|
||||
# Calculate the size of the master
|
||||
#
|
||||
set mreqw [winfo reqwidth $w]
|
||||
set mreqh [winfo reqheight $w]
|
||||
set creqw [winfo reqwidth $client]
|
||||
set creqh [winfo reqheight $client]
|
||||
|
||||
set scbW [winfo reqwidth $w.vsb]
|
||||
set scbH [winfo reqheight $w.hsb]
|
||||
|
||||
case $data(-scrollbarspace) {
|
||||
"x" {
|
||||
incr creqh $scbH
|
||||
}
|
||||
"y" {
|
||||
incr creqw $scbW
|
||||
}
|
||||
"both" {
|
||||
incr creqw $scbW
|
||||
incr creqh $scbH
|
||||
}
|
||||
}
|
||||
|
||||
if {$data(-width) != 0} {
|
||||
set creqw $data(-width)
|
||||
}
|
||||
if {$data(-height) != 0} {
|
||||
set creqh $data(-height)
|
||||
}
|
||||
|
||||
if {$mreqw != $creqw || $mreqh != $creqh } {
|
||||
if {![info exists data(counter)]} {
|
||||
set data(counter) 0
|
||||
}
|
||||
if {$data(counter) < 50} {
|
||||
incr data(counter)
|
||||
tixGeometryRequest $w $creqw $creqh
|
||||
tixWidgetDoWhenIdle tixScrolledWidget:Repack $w
|
||||
set data(repack) 1
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
set data(counter) 0
|
||||
set mw [winfo width $w]
|
||||
set mh [winfo height $w]
|
||||
|
||||
set cw [expr $mw - $scbW]
|
||||
set ch [expr $mh - $scbH]
|
||||
|
||||
set scbx [expr $mw - $scbW]
|
||||
set scby [expr $mh - $scbH]
|
||||
|
||||
# Check the validity of the sizes: if window was not mapped then
|
||||
# sizes will be below 1x1
|
||||
if {$cw < 1} {
|
||||
set cw 1
|
||||
}
|
||||
if {$ch < 1} {
|
||||
set ch 1
|
||||
}
|
||||
if {$scbx < 1} {
|
||||
set scbx 1
|
||||
}
|
||||
if {$scby < 1} {
|
||||
set scby 1
|
||||
}
|
||||
|
||||
if {[lindex $data(-scrollbar) 0] == "auto"} {
|
||||
# Find out how we are going to pack the scrollbars
|
||||
#
|
||||
set spec [tixScrolledWidget:CheckScrollbars $w $scbW $scbH]
|
||||
|
||||
foreach xspec [lrange $data(-scrollbar) 1 end] {
|
||||
case $xspec {
|
||||
+x {
|
||||
set spec [expr $spec | 10]
|
||||
}
|
||||
-x {
|
||||
set spec [expr $spec & 01]
|
||||
}
|
||||
+y {
|
||||
set spec [expr $spec | 01]
|
||||
}
|
||||
-y {
|
||||
set spec [expr $spec & 10]
|
||||
}
|
||||
}
|
||||
}
|
||||
if {$spec == 0} {
|
||||
set spec 00
|
||||
}
|
||||
if {$spec == 1} {
|
||||
set spec 01
|
||||
}
|
||||
} else {
|
||||
case $data(-scrollbar) in {
|
||||
none {
|
||||
set spec 00
|
||||
}
|
||||
x {
|
||||
set spec 10
|
||||
}
|
||||
y {
|
||||
set spec 01
|
||||
}
|
||||
both {
|
||||
set spec 11
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if {$data(lastSpec)==$spec && $data(lastMW)==$mw && $data(lastMH)==$mh} {
|
||||
if {$data(lastScbW) == $scbW && $data(lastScbH) == $scbH} {
|
||||
tixCallMethod $w PlaceWindow
|
||||
set data(repack) 0
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
set vsbH [expr $mh - $data(vsbPadY)]
|
||||
set hsbW [expr $mw - $data(hsbPadX)]
|
||||
|
||||
if {$vsbH < 1} {
|
||||
set vsbH 1
|
||||
}
|
||||
if {$hsbW < 1} {
|
||||
set hsbW 1
|
||||
}
|
||||
|
||||
case $spec in {
|
||||
"00" {
|
||||
tixMoveResizeWindow $client 0 0 $mw $mh
|
||||
|
||||
tixMapWindow $client
|
||||
tixUnmapWindow $data(w:hsb)
|
||||
tixUnmapWindow $data(w:vsb)
|
||||
}
|
||||
"01" {
|
||||
tixMoveResizeWindow $client 0 0 $cw $mh
|
||||
tixMoveResizeWindow $data(w:vsb) $scbx $data(vsbPadY) $scbW $vsbH
|
||||
|
||||
tixMapWindow $client
|
||||
tixUnmapWindow $data(w:hsb)
|
||||
tixMapWindow $data(w:vsb)
|
||||
}
|
||||
"10" {
|
||||
tixMoveResizeWindow $client 0 0 $mw $ch
|
||||
tixMoveResizeWindow $data(w:hsb) $data(hsbPadX) $scby $hsbW $scbH
|
||||
|
||||
tixMapWindow $client
|
||||
tixMapWindow $data(w:hsb)
|
||||
tixUnmapWindow $data(w:vsb)
|
||||
}
|
||||
"11" {
|
||||
set vsbH [expr $ch - $data(vsbPadY)]
|
||||
set hsbW [expr $cw - $data(hsbPadX)]
|
||||
if {$vsbH < 1} {
|
||||
set vsbH 1
|
||||
}
|
||||
if {$hsbW < 1} {
|
||||
set hsbW 1
|
||||
}
|
||||
|
||||
tixMoveResizeWindow $client 0 0 $cw $ch
|
||||
tixMoveResizeWindow $data(w:vsb) $scbx $data(vsbPadY) $scbW $vsbH
|
||||
tixMoveResizeWindow $data(w:hsb) $data(hsbPadX) $scby $hsbW $scbH
|
||||
if {$data(-sizebox) && $tcl_platform(platform) == "windows"} {
|
||||
tixMoveResizeWindow $data(w:sizebox) $scbx $scby $scbW $scbH
|
||||
}
|
||||
|
||||
tixMapWindow $client
|
||||
tixMapWindow $data(w:hsb)
|
||||
tixMapWindow $data(w:vsb)
|
||||
if {$data(-sizebox) && $tcl_platform(platform) == "windows"} {
|
||||
tixMapWindow $data(w:sizebox)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set data(lastSpec) $spec
|
||||
set data(lastMW) $mw
|
||||
set data(lastMH) $mh
|
||||
set data(lastScbW) $scbW
|
||||
set data(lastScbH) $scbH
|
||||
|
||||
tixCallMethod $w PlaceWindow
|
||||
set data(repack) 0
|
||||
}
|
||||
|
||||
proc tixScrolledWidget:PlaceWindow {w} {
|
||||
# virtual base function
|
||||
}
|
||||
|
||||
#
|
||||
# Helper function
|
||||
#
|
||||
proc tixScrolledWidget:NeedScrollbar {w axis} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data($axis,first) > 0.0} {
|
||||
return 1
|
||||
}
|
||||
|
||||
if {$data($axis,last) < 1.0} {
|
||||
return 1
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Return whether H and V needs scrollbars in a list of two booleans
|
||||
#
|
||||
#
|
||||
proc tixScrolledWidget:CheckScrollbars {w scbW scbH} {
|
||||
upvar #0 $w data
|
||||
|
||||
set mW [winfo width $w]
|
||||
set mH [winfo height $w]
|
||||
|
||||
set info [tixCallMethod $w GeometryInfo $mW $mH]
|
||||
|
||||
if {$info != ""} {
|
||||
set xSpec [lindex $info 0]
|
||||
set ySpec [lindex $info 1]
|
||||
|
||||
set data(x,first) [lindex $xSpec 0]
|
||||
set data(x,last) [lindex $xSpec 1]
|
||||
|
||||
set data(y,first) [lindex $ySpec 0]
|
||||
set data(y,last) [lindex $ySpec 1]
|
||||
}
|
||||
|
||||
set needX [tixScrolledWidget:NeedScrollbar $w x]
|
||||
set needY [tixScrolledWidget:NeedScrollbar $w y]
|
||||
|
||||
if {[winfo ismapped $w]==0} {
|
||||
return "$needX$needY"
|
||||
}
|
||||
|
||||
if {$needX && $needY} {
|
||||
return 11
|
||||
}
|
||||
|
||||
if {$needX == 0 && $needY == 0} {
|
||||
return 00
|
||||
}
|
||||
|
||||
if {$needX} {
|
||||
set mH [expr $mH - $scbH]
|
||||
}
|
||||
if {$needY} {
|
||||
set mW [expr $mW - $scbW]
|
||||
}
|
||||
|
||||
set info [tixCallMethod $w GeometryInfo $mW $mH]
|
||||
if {$info != ""} {
|
||||
set xSpec [lindex $info 0]
|
||||
set ySpec [lindex $info 1]
|
||||
|
||||
set data(x,first) [lindex $xSpec 0]
|
||||
set data(x,last) [lindex $xSpec 1]
|
||||
|
||||
set data(y,first) [lindex $ySpec 0]
|
||||
set data(y,last) [lindex $ySpec 1]
|
||||
}
|
||||
|
||||
set needX [tixScrolledWidget:NeedScrollbar $w x]
|
||||
set needY [tixScrolledWidget:NeedScrollbar $w y]
|
||||
|
||||
return "$needX$needY"
|
||||
}
|
||||
|
||||
274
win32/lib/tix8.4.3/SWindow.tcl
Normal file
@@ -0,0 +1,274 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: SWindow.tcl,v 1.4 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# SWindow.tcl --
|
||||
#
|
||||
# This file implements Scrolled Window widgets
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
#
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# tixScrolledWindow .w
|
||||
# set window [.w subwidget window]
|
||||
# # Now you can put a whole widget hierachy inside $window.
|
||||
# #
|
||||
# button $window.b
|
||||
# pack $window.b
|
||||
#
|
||||
# Author's note
|
||||
#
|
||||
# Note, the current implementation does not allow the child window
|
||||
# to be outside of the parent window when the parent's size is larger
|
||||
# than the child's size. This is fine for normal operations. However,
|
||||
# it is not suitable for an MDI master window. Therefore, you will notice
|
||||
# that the MDI master window is not a subclass of ScrolledWidget at all.
|
||||
#
|
||||
#
|
||||
|
||||
tixWidgetClass tixScrolledWindow {
|
||||
-classname TixScrolledWindow
|
||||
-superclass tixScrolledWidget
|
||||
-method {
|
||||
}
|
||||
-flag {
|
||||
-expandmode -shrink -xscrollincrement -yscrollincrement
|
||||
}
|
||||
-static {
|
||||
}
|
||||
-configspec {
|
||||
{-expandmode expandMode ExpandMode expand}
|
||||
{-shrink shrink Shrink ""}
|
||||
{-xscrollincrement xScrollIncrement ScrollIncrement ""}
|
||||
{-yscrollincrement yScrollIncrement ScrollIncrement ""}
|
||||
|
||||
{-scrollbarspace scrollbarSpace ScrollbarSpace {both}}
|
||||
}
|
||||
-default {
|
||||
{.scrollbar auto}
|
||||
{*window.borderWidth 1}
|
||||
{*f1.borderWidth 1}
|
||||
{*Scrollbar.borderWidth 1}
|
||||
{*Scrollbar.takeFocus 0}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixScrolledWindow:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
|
||||
set data(dx) 0
|
||||
set data(dy) 0
|
||||
}
|
||||
|
||||
proc tixScrolledWindow:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
global tcl_platform
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
set data(pw:f1) \
|
||||
[frame $w.f1 -relief sunken]
|
||||
set data(pw:f2) \
|
||||
[frame $w.f2 -bd 0]
|
||||
set data(w:window) \
|
||||
[frame $w.f2.window -bd 0]
|
||||
pack $data(pw:f2) -in $data(pw:f1) -expand yes -fill both
|
||||
|
||||
set data(w:hsb) \
|
||||
[scrollbar $w.hsb -orient horizontal -takefocus 0]
|
||||
set data(w:vsb) \
|
||||
[scrollbar $w.vsb -orient vertical -takefocus 0]
|
||||
# set data(w:pann) \
|
||||
# [frame $w.pann -bd 2 -relief groove]
|
||||
|
||||
$data(pw:f1) config -highlightthickness \
|
||||
[$data(w:hsb) cget -highlightthickness]
|
||||
|
||||
set data(pw:client) $data(pw:f1)
|
||||
}
|
||||
|
||||
proc tixScrolledWindow:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
|
||||
$data(w:hsb) config -command "tixScrolledWindow:ScrollBarCB $w x"
|
||||
$data(w:vsb) config -command "tixScrolledWindow:ScrollBarCB $w y"
|
||||
|
||||
tixManageGeometry $data(w:window) "tixScrolledWindow:WindowGeomProc $w"
|
||||
}
|
||||
|
||||
# This guy just keeps asking for a same size as the w:window
|
||||
#
|
||||
proc tixScrolledWindow:WindowGeomProc {w args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set rw [winfo reqwidth $data(w:window)]
|
||||
set rh [winfo reqheight $data(w:window)]
|
||||
|
||||
if {$rw != [winfo reqwidth $data(pw:f2)] ||
|
||||
$rh != [winfo reqheight $data(pw:f2)]} {
|
||||
tixGeometryRequest $data(pw:f2) $rw $rh
|
||||
}
|
||||
}
|
||||
|
||||
proc tixScrolledWindow:Scroll {w axis total window first args} {
|
||||
upvar #0 $w data
|
||||
|
||||
case [lindex $args 0] {
|
||||
"scroll" {
|
||||
set amt [lindex $args 1]
|
||||
set unit [lindex $args 2]
|
||||
|
||||
case $unit {
|
||||
"units" {
|
||||
set incr $axis\scrollincrement
|
||||
if {$data(-$incr) != ""} {
|
||||
set by $data(-$incr)
|
||||
} else {
|
||||
set by [expr $window / 16]
|
||||
}
|
||||
set first [expr $first + $amt * $by]
|
||||
}
|
||||
"pages" {
|
||||
set first [expr $first + $amt * $window]
|
||||
}
|
||||
}
|
||||
}
|
||||
"moveto" {
|
||||
set to [lindex $args 1]
|
||||
set first [expr int($to * $total)]
|
||||
}
|
||||
}
|
||||
|
||||
if {[expr $first + $window] > $total} {
|
||||
set first [expr $total - $window]
|
||||
}
|
||||
if {$first < 0} {
|
||||
set first 0
|
||||
}
|
||||
|
||||
return $first
|
||||
}
|
||||
|
||||
proc tixScrolledWindow:ScrollBarCB {w axis args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set bd \
|
||||
[expr [$data(pw:f1) cget -bd] + [$data(pw:f1) cget -highlightthickness]]
|
||||
set fw [expr [winfo width $data(pw:f1)] - 2*$bd]
|
||||
set fh [expr [winfo height $data(pw:f1)] - 2*$bd]
|
||||
set ww [winfo reqwidth $data(w:window)]
|
||||
set wh [winfo reqheight $data(w:window)]
|
||||
|
||||
if {$axis == "x"} {
|
||||
set data(dx) \
|
||||
[eval tixScrolledWindow:Scroll $w $axis $ww $fw $data(dx) $args]
|
||||
} else {
|
||||
set data(dy) \
|
||||
[eval tixScrolledWindow:Scroll $w $axis $wh $fh $data(dy) $args]
|
||||
}
|
||||
|
||||
tixWidgetDoWhenIdle tixScrolledWindow:PlaceWindow $w
|
||||
}
|
||||
|
||||
proc tixScrolledWindow:PlaceWindow {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
set bd \
|
||||
[expr [$data(pw:f1) cget -bd] + [$data(pw:f1) cget -highlightthickness]]
|
||||
set fw [expr [winfo width $data(pw:f1)] - 2*$bd]
|
||||
set fh [expr [winfo height $data(pw:f1)] - 2*$bd]
|
||||
set ww [winfo reqwidth $data(w:window)]
|
||||
set wh [winfo reqheight $data(w:window)]
|
||||
|
||||
tixMapWindow $data(w:window)
|
||||
|
||||
if {$data(-expandmode) == "expand"} {
|
||||
if {$ww < $fw} {
|
||||
set ww $fw
|
||||
}
|
||||
if {$wh < $fh} {
|
||||
set wh $fh
|
||||
}
|
||||
}
|
||||
if {$data(-shrink) == "x"} {
|
||||
if {$fw < $ww} {
|
||||
set ww $fw
|
||||
}
|
||||
}
|
||||
|
||||
tixMoveResizeWindow $data(w:window) -$data(dx) -$data(dy) $ww $wh
|
||||
|
||||
set first [expr $data(dx).0 / $ww.0]
|
||||
set last [expr $first + ($fw.0 / $ww.0)]
|
||||
$data(w:hsb) set $first $last
|
||||
|
||||
set first [expr $data(dy).0 / $wh.0]
|
||||
set last [expr $first + ($fh.0 / $wh.0)]
|
||||
$data(w:vsb) set $first $last
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# virtual functions to query the client window's scroll requirement
|
||||
#
|
||||
# When this function is called, the scrolled window is going to be
|
||||
# mapped, if it is still unmapped. Also, it is going to change its
|
||||
# size. Therefore, it is a good time to check whether the w:window needs
|
||||
# to be re-positioned due to the new parent window size.
|
||||
#----------------------------------------------------------------------
|
||||
proc tixScrolledWindow:GeometryInfo {w mW mH} {
|
||||
upvar #0 $w data
|
||||
|
||||
set bd \
|
||||
[expr [$data(pw:f1) cget -bd] + [$data(pw:f1) cget -highlightthickness]]
|
||||
set fw [expr $mW -2*$bd]
|
||||
set fh [expr $mH -2*$bd]
|
||||
set ww [winfo reqwidth $data(w:window)]
|
||||
set wh [winfo reqheight $data(w:window)]
|
||||
|
||||
# Calculate the X info
|
||||
#
|
||||
if {$fw >= $ww} {
|
||||
if {$data(dx) > 0} {
|
||||
set data(dx) 0
|
||||
}
|
||||
set xinfo [list 0.0 1.0]
|
||||
} else {
|
||||
set maxdx [expr $ww - $fw]
|
||||
if {$data(dx) > $maxdx} {
|
||||
set data(dx) $maxdx
|
||||
}
|
||||
set first [expr $data(dx).0 / $ww.0]
|
||||
set last [expr $first + ($fw.0 / $ww.0)]
|
||||
set xinfo [list $first $last]
|
||||
}
|
||||
# Calculate the Y info
|
||||
#
|
||||
if {$fh >= $wh} {
|
||||
if {$data(dy) > 0} {
|
||||
set data(dy) 0
|
||||
}
|
||||
set yinfo [list 0.0 1.0]
|
||||
} else {
|
||||
set maxdy [expr $wh - $fh]
|
||||
if {$data(dy) > $maxdy} {
|
||||
set data(dy) $maxdy
|
||||
}
|
||||
set first [expr $data(dy).0 / $wh.0]
|
||||
set last [expr $first + ($fh.0 / $wh.0)]
|
||||
set yinfo [list $first $last]
|
||||
}
|
||||
|
||||
return [list $xinfo $yinfo]
|
||||
}
|
||||
300
win32/lib/tix8.4.3/Select.tcl
Normal file
@@ -0,0 +1,300 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: Select.tcl,v 1.3 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# Select.tcl --
|
||||
#
|
||||
# Implement the tixSelect widget.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
tixWidgetClass tixSelect {
|
||||
-superclass tixLabelWidget
|
||||
-classname TixSelect
|
||||
-method {
|
||||
add button invoke
|
||||
}
|
||||
-flag {
|
||||
-allowzero -buttontype -command -disablecallback -orientation
|
||||
-orient -padx -pady -radio -selectedbg -state -validatecmd
|
||||
-value -variable
|
||||
}
|
||||
-forcecall {
|
||||
-variable -state
|
||||
}
|
||||
-static {
|
||||
-allowzero -orientation -padx -pady -radio
|
||||
}
|
||||
-configspec {
|
||||
{-allowzero allowZero AllowZero 0 tixVerifyBoolean}
|
||||
{-buttontype buttonType ButtonType button}
|
||||
{-command command Command ""}
|
||||
{-disablecallback disableCallback DisableCallback 0 tixVerifyBoolean}
|
||||
{-orientation orientation Orientation horizontal}
|
||||
{-padx padx Pad 0}
|
||||
{-pady pady Pad 0}
|
||||
{-radio radio Radio 0 tixVerifyBoolean}
|
||||
{-selectedbg selectedBg SelectedBg gray}
|
||||
{-state state State normal}
|
||||
{-validatecmd validateCmd ValidateCmd ""}
|
||||
{-value value Value ""}
|
||||
{-variable variable Variable ""}
|
||||
}
|
||||
-alias {
|
||||
{-orient -orientation}
|
||||
}
|
||||
-default {
|
||||
{*frame.borderWidth 1}
|
||||
{*frame.relief sunken}
|
||||
{*Button.borderWidth 2}
|
||||
{*Button.highlightThickness 0}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixSelect:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
set data(items) ""
|
||||
set data(buttonbg) ""
|
||||
set data(varInited) 0
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# CONFIG OPTIONS
|
||||
#----------------------------------------------------------------------
|
||||
proc tixSelect:config-state {w arg} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$arg == "disabled"} {
|
||||
foreach item $data(items) {
|
||||
$data(w:$item) config -state disabled -relief raised \
|
||||
-bg $data(buttonbg)
|
||||
}
|
||||
if {![info exists data(labelFg)]} {
|
||||
set data(labelFg) [$data(w:label) cget -foreground]
|
||||
catch {
|
||||
$data(w:label) config -fg [tix option get disabled_fg]
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach item $data(items) {
|
||||
if {[lsearch $data(-value) $item] != -1} {
|
||||
# This button is selected
|
||||
#
|
||||
$data(w:$item) config -relief sunken -bg $data(-selectedbg) \
|
||||
-state normal
|
||||
} else {
|
||||
$data(w:$item) config -relief raised -bg $data(buttonbg) \
|
||||
-command "$w invoke $item" -state normal
|
||||
}
|
||||
}
|
||||
if {[info exists data(labelFg)]} {
|
||||
catch {
|
||||
$data(w:label) config -fg $data(labelFg)
|
||||
}
|
||||
unset data(labelFg)
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
proc tixSelect:config-variable {w arg} {
|
||||
upvar #0 $w data
|
||||
|
||||
set oldValue $data(-value)
|
||||
|
||||
if {[tixVariable:ConfigVariable $w $arg]} {
|
||||
# The value of data(-value) is changed if tixVariable:ConfigVariable
|
||||
# returns true
|
||||
set newValue $data(-value)
|
||||
set data(-value) $oldValue
|
||||
tixSelect:config-value $w $newValue
|
||||
}
|
||||
catch {
|
||||
unset data(varInited)
|
||||
}
|
||||
set data(-variable) $arg
|
||||
}
|
||||
|
||||
proc tixSelect:config-value {w value} {
|
||||
upvar #0 $w data
|
||||
|
||||
# sanity checking
|
||||
#
|
||||
foreach item $value {
|
||||
if {[lsearch $data(items) $item] == "-1"} {
|
||||
error "subwidget \"$item\" does not exist"
|
||||
}
|
||||
}
|
||||
|
||||
tixSelect:SetValue $w $value
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# WIDGET COMMANDS
|
||||
#----------------------------------------------------------------------
|
||||
proc tixSelect:add {w name args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(w:$name) [eval $data(-buttontype) $data(w:frame).$name -command \
|
||||
[list "$w invoke $name"] -takefocus 0 $args]
|
||||
|
||||
if {$data(-orientation) == "horizontal"} {
|
||||
pack $data(w:$name) -side left -expand yes -fill y\
|
||||
-padx $data(-padx) -pady $data(-pady)
|
||||
} else {
|
||||
pack $data(w:$name) -side top -expand yes -fill x\
|
||||
-padx $data(-padx) -pady $data(-pady)
|
||||
}
|
||||
|
||||
if {$data(-state) == "disabled"} {
|
||||
$data(w:$name) config -relief raised -state disabled
|
||||
}
|
||||
|
||||
# find out the background of the buttons
|
||||
#
|
||||
if {$data(buttonbg) == ""} {
|
||||
set data(buttonbg) [lindex [$data(w:$name) config -background] 4]
|
||||
|
||||
}
|
||||
|
||||
lappend data(items) $name
|
||||
}
|
||||
|
||||
# Obsolete command
|
||||
#
|
||||
proc tixSelect:button {w name args} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$args != ""} {
|
||||
return [eval $data(w:$name) $args]
|
||||
} else {
|
||||
return $w.$name
|
||||
}
|
||||
}
|
||||
|
||||
# This is called when a button is invoked
|
||||
#
|
||||
proc tixSelect:invoke {w button} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(-state) != "normal"} {
|
||||
return
|
||||
}
|
||||
|
||||
set newValue $data(-value)
|
||||
|
||||
if {[lsearch $data(-value) $button] != -1} {
|
||||
# This button was selected
|
||||
#
|
||||
if {[llength $data(-value)] > 1 || [tixGetBoolean $data(-allowzero)]} {
|
||||
|
||||
# Take the button from the selected list
|
||||
#
|
||||
set newValue ""
|
||||
foreach item $data(-value) {
|
||||
if {$item != $button} {
|
||||
lappend newValue $item
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
# This button was not selected
|
||||
#
|
||||
if {[tixGetBoolean $data(-radio)]} {
|
||||
# The button become the sole item in the list
|
||||
#
|
||||
set newValue [list $button]
|
||||
} else {
|
||||
# Add this button into the list
|
||||
#
|
||||
lappend newValue $button
|
||||
}
|
||||
}
|
||||
|
||||
if {$newValue != $data(-value)} {
|
||||
tixSelect:SetValue $w $newValue
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Private functions
|
||||
#----------------------------------------------------------------------
|
||||
proc tixSelect:SetValue {w newValue {noUpdate 0}} {
|
||||
upvar #0 $w data
|
||||
|
||||
set oldValue $data(-value)
|
||||
|
||||
if {$data(-validatecmd) != ""} {
|
||||
set data(-value) [tixEvalCmdBinding $w $data(-validatecmd) "" $newValue]
|
||||
} else {
|
||||
if {[tixGetBoolean $data(-radio)] && [llength $newValue] > 1} {
|
||||
error "cannot choose more than one items in a radio box"
|
||||
}
|
||||
|
||||
if {![tixGetBoolean $data(-allowzero)] && [llength $newValue] == 0} {
|
||||
error "empty selection not allowed"
|
||||
}
|
||||
|
||||
set data(-value) $newValue
|
||||
}
|
||||
|
||||
if {! $noUpdate} {
|
||||
tixVariable:UpdateVariable $w
|
||||
}
|
||||
|
||||
# Reset all to be unselected
|
||||
#
|
||||
foreach item $data(items) {
|
||||
if {[lsearch $data(-value) $item] == -1} {
|
||||
# Is unselected
|
||||
#
|
||||
if {[lsearch $oldValue $item] != -1} {
|
||||
# was selected
|
||||
# -> popup the button, call command
|
||||
#
|
||||
$data(w:$item) config -relief raised -bg $data(buttonbg)
|
||||
tixSelect:CallCommand $w $item 0
|
||||
}
|
||||
} else {
|
||||
# Is selected
|
||||
#
|
||||
if {[lsearch $oldValue $item] == -1} {
|
||||
# was unselected
|
||||
# -> push down the button, call command
|
||||
#
|
||||
$data(w:$item) config -relief sunken -bg $data(-selectedbg)
|
||||
tixSelect:CallCommand $w $item 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixSelect:CallCommand {w name value} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {!$data(-disablecallback) && $data(-command) != ""} {
|
||||
if {![info exists data(varInited)]} {
|
||||
set bind(specs) "name value"
|
||||
set bind(name) $name
|
||||
set bind(value) $value
|
||||
tixEvalCmdBinding $w $data(-command) bind $name $value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixSelect:Destructor {w} {
|
||||
|
||||
tixVariable:DeleteVariable $w
|
||||
|
||||
# Chain this to the superclass
|
||||
#
|
||||
tixChainMethod $w Destructor
|
||||
}
|
||||
47
win32/lib/tix8.4.3/Shell.tcl
Normal file
@@ -0,0 +1,47 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: Shell.tcl,v 1.2 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# Shell.tcl --
|
||||
#
|
||||
# This is the base class to all shell widget
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
#
|
||||
# type : normal, transient, overrideredirect
|
||||
#
|
||||
tixWidgetClass tixShell {
|
||||
-superclass tixPrimitive
|
||||
-classname TixShell
|
||||
-flag {
|
||||
-title
|
||||
}
|
||||
-configspec {
|
||||
{-title title Title ""}
|
||||
}
|
||||
-forcecall {
|
||||
-title
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# ClassInitialization:
|
||||
#----------------------------------------------------------------------
|
||||
proc tixShell:CreateRootWidget {w args} {
|
||||
upvar #0 $w data
|
||||
upvar #0 $data(className) classRec
|
||||
|
||||
toplevel $w -class $data(ClassName)
|
||||
wm transient $w ""
|
||||
wm withdraw $w
|
||||
}
|
||||
|
||||
proc tixShell:config-title {w value} {
|
||||
wm title $w $value
|
||||
}
|
||||
47
win32/lib/tix8.4.3/SimpDlg.tcl
Normal file
@@ -0,0 +1,47 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: SimpDlg.tcl,v 1.2 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# SimpDlg.tcl --
|
||||
#
|
||||
# This file implements Simple Dialog widgets
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
tixWidgetClass tixSimpleDialog {
|
||||
-classname TixSimpleDialog
|
||||
-superclass tixDialogShell
|
||||
-method {}
|
||||
-flag {
|
||||
-buttons -message -type
|
||||
}
|
||||
-configspec {
|
||||
{-buttons buttons Buttons ""}
|
||||
{-message message Message ""}
|
||||
{-type type Type info}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixSimpleDialog:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
frame $w.top
|
||||
|
||||
label $w.top.icon -image [tix getimage $data(-type)]
|
||||
label $w.top.message -text $data(-message)
|
||||
|
||||
pack $w.top.icon -side left -padx 20 -pady 50 -anchor c
|
||||
pack $w.top.message -side left -padx 10 -pady 50 -anchor c
|
||||
|
||||
frame $w.bot
|
||||
|
||||
pack $w.bot -side bottom -fill x
|
||||
pack $w.top -side top -expand yes -fill both
|
||||
}
|
||||
84
win32/lib/tix8.4.3/StackWin.tcl
Normal file
@@ -0,0 +1,84 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: StackWin.tcl,v 1.3 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# StackWin.tcl --
|
||||
#
|
||||
# Similar to NoteBook but uses a Select widget to represent the pages.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
tixWidgetClass tixStackWindow {
|
||||
-classname TixStackWindow
|
||||
-superclass tixVStack
|
||||
-method {
|
||||
}
|
||||
-flag {
|
||||
}
|
||||
-configspec {
|
||||
}
|
||||
}
|
||||
|
||||
proc tixStackWindow:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
set data(w:tabs) [tixSelect $w.tabs]
|
||||
|
||||
# We can't use the packer because it will conflict with the
|
||||
# geometry management of the VStack widget.
|
||||
#
|
||||
tixManageGeometry $data(w:tabs) [list tixVStack:ClientGeomProc $w]
|
||||
}
|
||||
|
||||
proc tixStackWindow:add {w child args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set ret [eval [list tixChainMethod $w add $child] $args]
|
||||
|
||||
# Find out the -label option
|
||||
#
|
||||
foreach {flag value} $args {
|
||||
if {$flag eq "-label"} {
|
||||
set label $value
|
||||
}
|
||||
}
|
||||
|
||||
$data(w:tabs) add $child -command [list $w raise $child] -text $label
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
proc tixStackWindow:raise {w child} {
|
||||
upvar #0 $w data
|
||||
|
||||
$data(w:tabs) config -value $child
|
||||
|
||||
tixChainMethod $w raise $child
|
||||
}
|
||||
|
||||
proc tixStackWindow:Resize {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
# We have to take care of the size of the tabs so that
|
||||
#
|
||||
set tW [winfo reqwidth $data(w:tabs)]
|
||||
set tH [winfo reqheight $data(w:tabs)]
|
||||
|
||||
tixMoveResizeWindow $data(w:tabs) $data(-ipadx) $data(-ipady) $tW $tH
|
||||
tixMapWindow $data(w:tabs)
|
||||
|
||||
set data(pad-y1) [expr $tH + $data(-ipadx)]
|
||||
set data(minW) [expr $tW + 2 * $data(-ipadx)]
|
||||
set data(minH) [expr $tH + 2 * $data(-ipady)]
|
||||
|
||||
# Now that we know data(pad-y1), we can chain the call
|
||||
#
|
||||
tixChainMethod $w Resize
|
||||
}
|
||||
56
win32/lib/tix8.4.3/StatBar.tcl
Normal file
@@ -0,0 +1,56 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: StatBar.tcl,v 1.2 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# StatBar.tcl --
|
||||
#
|
||||
# The StatusBar of an application.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
tixWidgetClass tixStatusBar {
|
||||
-classname TixStatusBar
|
||||
-superclass tixPrimitive
|
||||
-method {
|
||||
}
|
||||
-flag {
|
||||
-fields
|
||||
}
|
||||
-static {
|
||||
-fields
|
||||
}
|
||||
-configspec {
|
||||
{-fields fields Fields ""}
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------------
|
||||
# Create Widget
|
||||
#--------------------------
|
||||
proc tixStatusBar:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
foreach field $data(-fields) {
|
||||
set name [lindex $field 0]
|
||||
set width [lindex $field 1]
|
||||
|
||||
set data(w:width) [label $w.$name -width $width]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Public methods
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Internal commands
|
||||
#----------------------------------------------------------------------
|
||||
71
win32/lib/tix8.4.3/StdBBox.tcl
Normal file
@@ -0,0 +1,71 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: StdBBox.tcl,v 1.2 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# StdBBox.tcl --
|
||||
#
|
||||
# Standard Button Box, used in standard dialog boxes
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
|
||||
tixWidgetClass tixStdButtonBox {
|
||||
-classname TixStdButtonBox
|
||||
-superclass tixButtonBox
|
||||
-flag {
|
||||
-applycmd -cancelcmd -helpcmd -okcmd
|
||||
}
|
||||
-configspec {
|
||||
{-applycmd applyCmd ApplyCmd ""}
|
||||
{-cancelcmd cancelCmd CancelCmd ""}
|
||||
{-helpcmd helpCmd HelpCmd ""}
|
||||
{-okcmd okCmd OkCmd ""}
|
||||
}
|
||||
-default {
|
||||
{.borderWidth 1}
|
||||
{.relief raised}
|
||||
{.padX 5}
|
||||
{.padY 10}
|
||||
{*Button.anchor c}
|
||||
{*Button.padX 5}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixStdButtonBox:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
$w add ok -text OK -under 0 -width 6 -command $data(-okcmd)
|
||||
$w add apply -text Apply -under 0 -width 6 -command $data(-applycmd)
|
||||
$w add cancel -text Cancel -under 0 -width 6 -command $data(-cancelcmd)
|
||||
$w add help -text Help -under 0 -width 6 -command $data(-helpcmd)
|
||||
}
|
||||
|
||||
proc tixStdButtonBox:config {w flag value} {
|
||||
upvar #0 $w data
|
||||
|
||||
case $flag {
|
||||
-okcmd {
|
||||
$data(w:ok) config -command $value
|
||||
}
|
||||
-applycmd {
|
||||
$data(w:apply) config -command $value
|
||||
}
|
||||
-cancelcmd {
|
||||
$data(w:cancel) config -command $value
|
||||
}
|
||||
-helpcmd {
|
||||
$data(w:help) config -command $value
|
||||
}
|
||||
default {
|
||||
tixChainMethod $w config $flag $value
|
||||
}
|
||||
}
|
||||
}
|
||||
49
win32/lib/tix8.4.3/StdShell.tcl
Normal file
@@ -0,0 +1,49 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: StdShell.tcl,v 1.2 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# StdShell.tcl --
|
||||
#
|
||||
# Standard Dialog Shell.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
tixWidgetClass tixStdDialogShell {
|
||||
-classname TixStdDialogShell
|
||||
-superclass tixDialogShell
|
||||
-method {}
|
||||
-flag {
|
||||
-cached
|
||||
}
|
||||
-configspec {
|
||||
{-cached cached Cached ""}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixStdDialogShell:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
set data(w:btns) [tixStdButtonBox $w.btns]
|
||||
set data(w_tframe) [frame $w.tframe]
|
||||
|
||||
pack $data(w_tframe) -side top -expand yes -fill both
|
||||
pack $data(w:btns) -side bottom -fill both
|
||||
|
||||
tixCallMethod $w ConstructTopFrame $data(w_tframe)
|
||||
}
|
||||
|
||||
|
||||
# Subclasses of StdDialogShell should override this method instead of
|
||||
# ConstructWidget.
|
||||
#
|
||||
# Override : always
|
||||
# chain : before
|
||||
proc tixStdDialogShell:ConstructTopFrame {w frame} {
|
||||
# Do nothing
|
||||
}
|
||||
953
win32/lib/tix8.4.3/TList.tcl
Normal file
@@ -0,0 +1,953 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: TList.tcl,v 1.6 2002/01/24 09:13:58 idiscovery Exp $
|
||||
#
|
||||
# TList.tcl --
|
||||
#
|
||||
# This file defines the default bindings for Tix Tabular Listbox
|
||||
# widgets.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
global tkPriv
|
||||
if {![llength [info globals tkPriv]]} {
|
||||
tk::unsupported::ExposePrivateVariable tkPriv
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# tkPriv elements used in this file:
|
||||
#
|
||||
# afterId - Token returned by "after" for autoscanning.
|
||||
# fakeRelease - Cancel the ButtonRelease-1 after the user double click
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
proc tixTListBind {} {
|
||||
tixBind TixTList <ButtonPress-1> {
|
||||
tixTList:Button-1 %W %x %y
|
||||
}
|
||||
tixBind TixTList <Shift-ButtonPress-1> {
|
||||
tixTList:Shift-Button-1 %W %x %y
|
||||
}
|
||||
tixBind TixTList <Control-ButtonPress-1> {
|
||||
tixTList:Control-Button-1 %W %x %y
|
||||
}
|
||||
tixBind TixTList <ButtonRelease-1> {
|
||||
tixTList:ButtonRelease-1 %W %x %y
|
||||
}
|
||||
tixBind TixTList <Double-ButtonPress-1> {
|
||||
tixTList:Double-1 %W %x %y
|
||||
}
|
||||
tixBind TixTList <B1-Motion> {
|
||||
set tkPriv(x) %x
|
||||
set tkPriv(y) %y
|
||||
set tkPriv(X) %X
|
||||
set tkPriv(Y) %Y
|
||||
|
||||
tixTList:B1-Motion %W %x %y
|
||||
}
|
||||
tixBind TixTList <Control-B1-Motion> {
|
||||
set tkPriv(x) %x
|
||||
set tkPriv(y) %y
|
||||
set tkPriv(X) %X
|
||||
set tkPriv(Y) %Y
|
||||
|
||||
tixTList:Control-B1-Motion %W %x %y
|
||||
}
|
||||
tixBind TixTList <B1-Leave> {
|
||||
set tkPriv(x) %x
|
||||
set tkPriv(y) %y
|
||||
set tkPriv(X) %X
|
||||
set tkPriv(Y) %Y
|
||||
|
||||
tixTList:B1-Leave %W
|
||||
}
|
||||
tixBind TixTList <B1-Enter> {
|
||||
tixTList:B1-Enter %W %x %y
|
||||
}
|
||||
tixBind TixTList <Control-B1-Leave> {
|
||||
set tkPriv(x) %x
|
||||
set tkPriv(y) %y
|
||||
set tkPriv(X) %X
|
||||
set tkPriv(Y) %Y
|
||||
|
||||
tixTList:Control-B1-Leave %W
|
||||
}
|
||||
tixBind TixTList <Control-B1-Enter> {
|
||||
tixTList:Control-B1-Enter %W %x %y
|
||||
}
|
||||
|
||||
# Keyboard bindings
|
||||
#
|
||||
tixBind TixTList <Up> {
|
||||
tixTList:DirKey %W up
|
||||
}
|
||||
tixBind TixTList <Down> {
|
||||
tixTList:DirKey %W down
|
||||
}
|
||||
tixBind TixTList <Left> {
|
||||
tixTList:DirKey %W left
|
||||
}
|
||||
tixBind TixTList <Right> {
|
||||
tixTList:DirKey %W right
|
||||
}
|
||||
tixBind TixTList <Prior> {
|
||||
%W yview scroll -1 pages
|
||||
}
|
||||
tixBind TixTList <Next> {
|
||||
%W yview scroll 1 pages
|
||||
}
|
||||
tixBind TixTList <Return> {
|
||||
tixTList:Return %W
|
||||
}
|
||||
tixBind TixTList <space> {
|
||||
tixTList:Space %W
|
||||
}
|
||||
#
|
||||
# Don't use tixBind because %A causes Tk 8.3.2 to crash
|
||||
#
|
||||
bind TixTList <MouseWheel> {
|
||||
if {"[%W cget -orient]" == "vertical"} {
|
||||
%W xview scroll [expr {- (%D / 120) * 4}] units
|
||||
} else {
|
||||
%W yview scroll [expr {- (%D / 120) * 2}] units
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# Mouse bindings
|
||||
#
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
proc tixTList:Button-1 {w x y} {
|
||||
if {[$w cget -state] == "disabled"} {
|
||||
return
|
||||
}
|
||||
if {[$w cget -takefocus]} {
|
||||
focus $w
|
||||
}
|
||||
case [tixTList:GetState $w] {
|
||||
{s0} {
|
||||
tixTList:GoState s1 $w $x $y
|
||||
}
|
||||
{b0} {
|
||||
tixTList:GoState b1 $w $x $y
|
||||
}
|
||||
{m0} {
|
||||
tixTList:GoState m1 $w $x $y
|
||||
}
|
||||
{e0} {
|
||||
tixTList:GoState e1 $w $x $y
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTList:Shift-Button-1 {w x y} {
|
||||
if {[$w cget -state] == "disabled"} {
|
||||
return
|
||||
}
|
||||
if {[$w cget -takefocus]} {
|
||||
focus $w
|
||||
}
|
||||
case [tixTList:GetState $w] {
|
||||
{s0} {
|
||||
tixTList:GoState s1 $w $x $y
|
||||
}
|
||||
{b0} {
|
||||
tixTList:GoState b1 $w $x $y
|
||||
}
|
||||
{m0} {
|
||||
tixTList:GoState m7 $w $x $y
|
||||
}
|
||||
{e0} {
|
||||
tixTList:GoState e7 $w $x $y
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTList:Control-Button-1 {w x y} {
|
||||
if {[$w cget -state] == "disabled"} {
|
||||
return
|
||||
}
|
||||
if {[$w cget -takefocus]} {
|
||||
focus $w
|
||||
}
|
||||
case [tixTList:GetState $w] {
|
||||
{s0} {
|
||||
tixTList:GoState s1 $w $x $y
|
||||
}
|
||||
{b0} {
|
||||
tixTList:GoState b1 $w $x $y
|
||||
}
|
||||
{m0} {
|
||||
tixTList:GoState m1 $w $x $y
|
||||
}
|
||||
{e0} {
|
||||
tixTList:GoState e10 $w $x $y
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTList:ButtonRelease-1 {w x y} {
|
||||
case [tixTList:GetState $w] {
|
||||
{s2 s4 s5 s6} {
|
||||
tixTList:GoState s3 $w
|
||||
}
|
||||
{b2 b4 b5 b6} {
|
||||
tixTList:GoState b3 $w
|
||||
}
|
||||
{m2} {
|
||||
tixTList:GoState m3 $w
|
||||
}
|
||||
{m5} {
|
||||
tixTList:GoState m6 $w $x $y
|
||||
}
|
||||
{m9} {
|
||||
tixTList:GoState m0 $w
|
||||
}
|
||||
{e2} {
|
||||
tixTList:GoState e3 $w
|
||||
}
|
||||
{e5} {
|
||||
tixTList:GoState e6 $w $x $y
|
||||
}
|
||||
{e9} {
|
||||
tixTList:GoState e0 $w
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTList:B1-Motion {w x y} {
|
||||
case [tixTList:GetState $w] {
|
||||
{s2 s4} {
|
||||
tixTList:GoState s4 $w $x $y
|
||||
}
|
||||
{b2 b4} {
|
||||
tixTList:GoState b4 $w $x $y
|
||||
}
|
||||
{m2 m5} {
|
||||
tixTList:GoState m4 $w $x $y
|
||||
}
|
||||
{e2 e5} {
|
||||
tixTList:GoState e4 $w $x $y
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTList:Control-B1-Motion {w x y} {
|
||||
case [tixTList:GetState $w] {
|
||||
{s2 s4} {
|
||||
tixTList:GoState s4 $w $x $y
|
||||
}
|
||||
{b2 b4} {
|
||||
tixTList:GoState b4 $w $x $y
|
||||
}
|
||||
{m2 m5} {
|
||||
tixTList:GoState m4 $w $x $y
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTList:Double-1 {w x y} {
|
||||
case [tixTList:GetState $w] {
|
||||
{s0} {
|
||||
tixTList:GoState s7 $w $x $y
|
||||
}
|
||||
{b0} {
|
||||
tixTList:GoState b7 $w $x $y
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTList:B1-Leave {w} {
|
||||
case [tixTList:GetState $w] {
|
||||
{s2 s4} {
|
||||
tixTList:GoState s5 $w
|
||||
}
|
||||
{b2 b4} {
|
||||
tixTList:GoState b5 $w
|
||||
}
|
||||
{m2 m5} {
|
||||
tixTList:GoState m8 $w
|
||||
}
|
||||
{e2 e5} {
|
||||
tixTList:GoState e8 $w
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTList:B1-Enter {w x y} {
|
||||
case [tixTList:GetState $w] {
|
||||
{s5 s6} {
|
||||
tixTList:GoState s4 $w $x $y
|
||||
}
|
||||
{b5 b6} {
|
||||
tixTList:GoState b4 $w $x $y
|
||||
}
|
||||
{m8 m9} {
|
||||
tixTList:GoState m4 $w $x $y
|
||||
}
|
||||
{e8 e9} {
|
||||
tixTList:GoState e4 $w $x $y
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTList:Control-B1-Leave {w} {
|
||||
case [tixTList:GetState $w] {
|
||||
{s2 s4} {
|
||||
tixTList:GoState s5 $w
|
||||
}
|
||||
{b2 b4} {
|
||||
tixTList:GoState b5 $w
|
||||
}
|
||||
{m2 m5} {
|
||||
tixTList:GoState m8 $w
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTList:Control-B1-Enter {w x y} {
|
||||
case [tixTList:GetState $w] {
|
||||
{s5 s6} {
|
||||
tixTList:GoState s4 $w $x $y
|
||||
}
|
||||
{b5 b6} {
|
||||
tixTList:GoState b4 $w $x $y
|
||||
}
|
||||
{m8 m9} {
|
||||
tixTList:GoState m4 $w $x $y
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTList:AutoScan {w} {
|
||||
case [tixTList:GetState $w] {
|
||||
{s5 s6} {
|
||||
tixTList:GoState s6 $w
|
||||
}
|
||||
{b5 b6} {
|
||||
tixTList:GoState b6 $w
|
||||
}
|
||||
{m8 m9} {
|
||||
tixTList:GoState m9 $w
|
||||
}
|
||||
{e8 e9} {
|
||||
tixTList:GoState e9 $w
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# Key bindings
|
||||
#
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
proc tixTList:DirKey {w key} {
|
||||
if {[$w cget -state] == "disabled"} {
|
||||
return
|
||||
}
|
||||
case [tixTList:GetState $w] {
|
||||
{s0} {
|
||||
tixTList:GoState s8 $w $key
|
||||
}
|
||||
{b0} {
|
||||
tixTList:GoState b8 $w $key
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTList:Return {w} {
|
||||
if {[$w cget -state] == "disabled"} {
|
||||
return
|
||||
}
|
||||
case [tixTList:GetState $w] {
|
||||
{s0} {
|
||||
tixTList:GoState s9 $w
|
||||
}
|
||||
{b0} {
|
||||
tixTList:GoState b9 $w
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTList:Space {w} {
|
||||
if {[$w cget -state] == "disabled"} {
|
||||
return
|
||||
}
|
||||
case [tixTList:GetState $w] {
|
||||
{s0} {
|
||||
tixTList:GoState s10 $w
|
||||
}
|
||||
{b0} {
|
||||
tixTList:GoState b10 $w
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# STATE MANIPULATION
|
||||
#
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
proc tixTList:GetState {w} {
|
||||
global $w:priv:state
|
||||
|
||||
if {[info exists $w:priv:state]} {
|
||||
#
|
||||
# If the app has changed the selectmode, reset the state to the
|
||||
# original state.
|
||||
#
|
||||
set type [string index [$w cget -selectmode] 0]
|
||||
if {"[string index [set $w:priv:state] 0]" != "$type"} {
|
||||
unset $w:priv:state
|
||||
}
|
||||
}
|
||||
|
||||
if {![info exists $w:priv:state]} {
|
||||
case [$w cget -selectmode] {
|
||||
single {
|
||||
set $w:priv:state s0
|
||||
}
|
||||
browse {
|
||||
set $w:priv:state b0
|
||||
}
|
||||
multiple {
|
||||
set $w:priv:state m0
|
||||
}
|
||||
extended {
|
||||
set $w:priv:state e0
|
||||
}
|
||||
default {
|
||||
set $w:priv:state unknown
|
||||
}
|
||||
}
|
||||
}
|
||||
return [set $w:priv:state]
|
||||
}
|
||||
|
||||
proc tixTList:SetState {w n} {
|
||||
global $w:priv:state
|
||||
|
||||
set $w:priv:state $n
|
||||
}
|
||||
|
||||
proc tixTList:GoState {n w args} {
|
||||
|
||||
# puts "going from [tixTList:GetState $w] --> $n"
|
||||
|
||||
tixTList:SetState $w $n
|
||||
eval tixTList:GoState-$n $w $args
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# States
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# SINGLE SELECTION
|
||||
#----------------------------------------------------------------------
|
||||
proc tixTList:GoState-s0 {w} {
|
||||
}
|
||||
|
||||
proc tixTList:GoState-s1 {w x y} {
|
||||
set ent [$w nearest $x $y]
|
||||
if {$ent != ""} {
|
||||
$w anchor set $ent
|
||||
$w see $ent
|
||||
}
|
||||
tixTList:GoState s2 $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-s2 {w} {
|
||||
}
|
||||
|
||||
proc tixTList:GoState-s3 {w} {
|
||||
set ent [$w info anchor]
|
||||
if {$ent != ""} {
|
||||
$w selection clear
|
||||
$w selection set $ent
|
||||
tixTList:CallBrowseCmd $w $ent
|
||||
}
|
||||
tixTList:GoState s0 $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-s4 {w x y} {
|
||||
set ent [$w nearest $x $y]
|
||||
if {$ent != ""} {
|
||||
$w anchor set $ent
|
||||
$w see $ent
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTList:GoState-s5 {w} {
|
||||
tixTList:StartScan $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-s6 {w} {
|
||||
global tkPriv
|
||||
|
||||
tixTList:DoScan $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-s7 {w x y} {
|
||||
set ent [$w nearest $x $y]
|
||||
|
||||
if {$ent != ""} {
|
||||
$w selection clear
|
||||
$w selection set $ent
|
||||
tixTList:CallCommand $w $ent
|
||||
}
|
||||
tixTList:GoState s0 $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-s8 {w key} {
|
||||
set anchor [$w info anchor]
|
||||
|
||||
if {$anchor == ""} {
|
||||
set anchor 0
|
||||
} else {
|
||||
set anchor [$w info $key $anchor]
|
||||
}
|
||||
|
||||
$w anchor set $anchor
|
||||
$w see $anchor
|
||||
tixTList:GoState s0 $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-s9 {w} {
|
||||
set anchor [$w info anchor]
|
||||
|
||||
if {$anchor == ""} {
|
||||
set anchor 0
|
||||
$w anchor set $anchor
|
||||
$w see $anchor
|
||||
}
|
||||
|
||||
if {[$w info anchor] != ""} {
|
||||
# ! may not have any elements
|
||||
#
|
||||
tixTList:CallCommand $w [$w info anchor]
|
||||
$w selection clear
|
||||
$w selection set $anchor
|
||||
}
|
||||
|
||||
tixTList:GoState s0 $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-s10 {w} {
|
||||
set anchor [$w info anchor]
|
||||
|
||||
if {$anchor == ""} {
|
||||
set anchor 0
|
||||
$w anchor set $anchor
|
||||
$w see $anchor
|
||||
}
|
||||
|
||||
if {[$w info anchor] != ""} {
|
||||
# ! may not have any elements
|
||||
#
|
||||
tixTList:CallBrowseCmd $w [$w info anchor]
|
||||
$w selection clear
|
||||
$w selection set $anchor
|
||||
}
|
||||
|
||||
tixTList:GoState s0 $w
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# BROWSE SELECTION
|
||||
#----------------------------------------------------------------------
|
||||
proc tixTList:GoState-b0 {w} {
|
||||
}
|
||||
|
||||
proc tixTList:GoState-b1 {w x y} {
|
||||
set ent [$w nearest $x $y]
|
||||
if {$ent != ""} {
|
||||
$w anchor set $ent
|
||||
$w see $ent
|
||||
$w selection clear
|
||||
$w selection set $ent
|
||||
tixTList:CallBrowseCmd $w $ent
|
||||
}
|
||||
tixTList:GoState b2 $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-b2 {w} {
|
||||
}
|
||||
|
||||
proc tixTList:GoState-b3 {w} {
|
||||
set ent [$w info anchor]
|
||||
if {$ent != ""} {
|
||||
$w selection clear
|
||||
$w selection set $ent
|
||||
tixTList:CallBrowseCmd $w $ent
|
||||
}
|
||||
tixTList:GoState b0 $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-b4 {w x y} {
|
||||
set ent [$w nearest $x $y]
|
||||
if {$ent != ""} {
|
||||
$w anchor set $ent
|
||||
$w see $ent
|
||||
$w selection clear
|
||||
$w selection set $ent
|
||||
tixTList:CallBrowseCmd $w $ent
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTList:GoState-b5 {w} {
|
||||
tixTList:StartScan $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-b6 {w} {
|
||||
global tkPriv
|
||||
|
||||
tixTList:DoScan $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-b7 {w x y} {
|
||||
set ent [$w nearest $x $y]
|
||||
|
||||
if {$ent != ""} {
|
||||
$w selection clear
|
||||
$w selection set $ent
|
||||
tixTList:CallCommand $w $ent
|
||||
}
|
||||
tixTList:GoState b0 $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-b8 {w key} {
|
||||
set anchor [$w info anchor]
|
||||
|
||||
if {$anchor == ""} {
|
||||
set anchor 0
|
||||
} else {
|
||||
set anchor [$w info $key $anchor]
|
||||
}
|
||||
|
||||
$w anchor set $anchor
|
||||
$w selection clear
|
||||
$w selection set $anchor
|
||||
$w see $anchor
|
||||
|
||||
tixTList:CallBrowseCmd $w $anchor
|
||||
tixTList:GoState b0 $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-b9 {w} {
|
||||
set anchor [$w info anchor]
|
||||
|
||||
if {$anchor == ""} {
|
||||
set anchor 0
|
||||
$w anchor set $anchor
|
||||
$w see $anchor
|
||||
}
|
||||
|
||||
if {[$w info anchor] != ""} {
|
||||
# ! may not have any elements
|
||||
#
|
||||
tixTList:CallCommand $w [$w info anchor]
|
||||
$w selection clear
|
||||
$w selection set $anchor
|
||||
}
|
||||
|
||||
tixTList:GoState b0 $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-b10 {w} {
|
||||
set anchor [$w info anchor]
|
||||
|
||||
if {$anchor == ""} {
|
||||
set anchor 0
|
||||
$w anchor set $anchor
|
||||
$w see $anchor
|
||||
}
|
||||
|
||||
if {[$w info anchor] != ""} {
|
||||
# ! may not have any elements
|
||||
#
|
||||
tixTList:CallBrowseCmd $w [$w info anchor]
|
||||
$w selection clear
|
||||
$w selection set $anchor
|
||||
}
|
||||
|
||||
tixTList:GoState b0 $w
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# MULTIPLE SELECTION
|
||||
#----------------------------------------------------------------------
|
||||
proc tixTList:GoState-m0 {w} {
|
||||
}
|
||||
|
||||
proc tixTList:GoState-m1 {w x y} {
|
||||
set ent [$w nearest $x $y]
|
||||
if {$ent != ""} {
|
||||
$w anchor set $ent
|
||||
$w see $ent
|
||||
$w selection clear
|
||||
$w selection set $ent
|
||||
tixTList:CallBrowseCmd $w $ent
|
||||
}
|
||||
tixTList:GoState m2 $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-m2 {w} {
|
||||
}
|
||||
|
||||
proc tixTList:GoState-m3 {w} {
|
||||
set ent [$w info anchor]
|
||||
if {$ent != ""} {
|
||||
tixTList:CallBrowseCmd $w $ent
|
||||
}
|
||||
tixTList:GoState m0 $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-m4 {w x y} {
|
||||
set from [$w info anchor]
|
||||
set to [$w nearest $x $y]
|
||||
if {$to != ""} {
|
||||
$w selection clear
|
||||
$w selection set $from $to
|
||||
tixTList:CallBrowseCmd $w $to
|
||||
}
|
||||
tixTList:GoState m5 $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-m5 {w} {
|
||||
}
|
||||
|
||||
proc tixTList:GoState-m6 {w x y} {
|
||||
set ent [$w nearest $x $y]
|
||||
if {$ent != ""} {
|
||||
tixTList:CallBrowseCmd $w $ent
|
||||
}
|
||||
tixTList:GoState m0 $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-m7 {w x y} {
|
||||
set from [$w info anchor]
|
||||
set to [$w nearest $x $y]
|
||||
if {$from == ""} {
|
||||
set from $to
|
||||
$w anchor set $from
|
||||
$w see $from
|
||||
}
|
||||
if {$to != ""} {
|
||||
$w selection clear
|
||||
$w selection set $from $to
|
||||
tixTList:CallBrowseCmd $w $to
|
||||
}
|
||||
tixTList:GoState m5 $w
|
||||
}
|
||||
|
||||
|
||||
proc tixTList:GoState-m8 {w} {
|
||||
tixTList:StartScan $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-m9 {w} {
|
||||
tixTList:DoScan $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-xm7 {w x y} {
|
||||
set ent [$w nearest $x $y]
|
||||
|
||||
if {$ent != ""} {
|
||||
$w selection clear
|
||||
$w selection set $ent
|
||||
tixTList:CallCommand $w $ent
|
||||
}
|
||||
tixTList:GoState m0 $w
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# EXTENDED SELECTION
|
||||
#----------------------------------------------------------------------
|
||||
proc tixTList:GoState-e0 {w} {
|
||||
}
|
||||
|
||||
proc tixTList:GoState-e1 {w x y} {
|
||||
set ent [$w nearest $x $y]
|
||||
if {$ent != ""} {
|
||||
$w anchor set $ent
|
||||
$w see $ent
|
||||
$w selection clear
|
||||
$w selection set $ent
|
||||
tixTList:CallBrowseCmd $w $ent
|
||||
}
|
||||
tixTList:GoState e2 $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-e2 {w} {
|
||||
}
|
||||
|
||||
proc tixTList:GoState-e3 {w} {
|
||||
set ent [$w info anchor]
|
||||
if {$ent != ""} {
|
||||
tixTList:CallBrowseCmd $w $ent
|
||||
}
|
||||
tixTList:GoState e0 $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-e4 {w x y} {
|
||||
set from [$w info anchor]
|
||||
set to [$w nearest $x $y]
|
||||
if {$to != ""} {
|
||||
$w selection clear
|
||||
$w selection set $from $to
|
||||
tixTList:CallBrowseCmd $w $to
|
||||
}
|
||||
tixTList:GoState e5 $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-e5 {w} {
|
||||
}
|
||||
|
||||
proc tixTList:GoState-e6 {w x y} {
|
||||
set ent [$w nearest $x $y]
|
||||
if {$ent != ""} {
|
||||
tixTList:CallBrowseCmd $w $ent
|
||||
}
|
||||
tixTList:GoState e0 $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-e7 {w x y} {
|
||||
set from [$w info anchor]
|
||||
set to [$w nearest $x $y]
|
||||
if {$from == ""} {
|
||||
set from $to
|
||||
$w anchor set $from
|
||||
$w see $from
|
||||
}
|
||||
if {$to != ""} {
|
||||
$w selection clear
|
||||
$w selection set $from $to
|
||||
tixTList:CallBrowseCmd $w $to
|
||||
}
|
||||
tixTList:GoState e5 $w
|
||||
}
|
||||
|
||||
|
||||
proc tixTList:GoState-e8 {w} {
|
||||
tixTList:StartScan $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-e9 {w} {
|
||||
tixTList:DoScan $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-e10 {w x y} {
|
||||
set ent [$w nearest $x $y]
|
||||
if {$ent != ""} {
|
||||
if {[$w info anchor] == ""} {
|
||||
$w anchor set $ent
|
||||
$w see $ent
|
||||
}
|
||||
if {[$w selection includes $ent]} {
|
||||
$w selection clear $ent
|
||||
} else {
|
||||
$w selection set $ent
|
||||
}
|
||||
tixTList:CallBrowseCmd $w $ent
|
||||
}
|
||||
tixTList:GoState e2 $w
|
||||
}
|
||||
|
||||
proc tixTList:GoState-xm7 {w x y} {
|
||||
set ent [$w nearest $x $y]
|
||||
|
||||
if {$ent != ""} {
|
||||
$w selection clear
|
||||
$w selection set $ent
|
||||
tixTList:CallCommand $w $ent
|
||||
}
|
||||
tixTList:GoState e0 $w
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# callback actions
|
||||
#----------------------------------------------------------------------
|
||||
proc tixTList:SetAnchor {w x y} {
|
||||
set ent [$w nearest $x $y]
|
||||
if {$ent != "" && [$w entrycget $ent -state] != "disabled"} {
|
||||
$w anchor set $ent
|
||||
$w see $ent
|
||||
return $ent
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
proc tixTList:Select {w ent} {
|
||||
$w selection clear
|
||||
$w select set $ent
|
||||
}
|
||||
|
||||
proc tixTList:StartScan {w} {
|
||||
global tkPriv
|
||||
set tkPriv(afterId) [after 50 tixTList:AutoScan $w]
|
||||
}
|
||||
|
||||
proc tixTList:DoScan {w} {
|
||||
global tkPriv
|
||||
set x $tkPriv(x)
|
||||
set y $tkPriv(y)
|
||||
set X $tkPriv(X)
|
||||
set Y $tkPriv(Y)
|
||||
|
||||
set out 0
|
||||
if {$y >= [winfo height $w]} {
|
||||
$w yview scroll 1 units
|
||||
set out 1
|
||||
}
|
||||
if {$y < 0} {
|
||||
$w yview scroll -1 units
|
||||
set out 1
|
||||
}
|
||||
if {$x >= [winfo width $w]} {
|
||||
$w xview scroll 2 units
|
||||
set out 1
|
||||
}
|
||||
if {$x < 0} {
|
||||
$w xview scroll -2 units
|
||||
set out 1
|
||||
}
|
||||
|
||||
if {$out} {
|
||||
set tkPriv(afterId) [after 50 tixTList:AutoScan $w]
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTList:CallBrowseCmd {w ent} {
|
||||
set browsecmd [$w cget -browsecmd]
|
||||
if {$browsecmd != ""} {
|
||||
set bind(specs) {%V}
|
||||
set bind(%V) $ent
|
||||
|
||||
tixEvalCmdBinding $w $browsecmd bind $ent
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTList:CallCommand {w ent} {
|
||||
set command [$w cget -command]
|
||||
if {$command != ""} {
|
||||
set bind(specs) {%V}
|
||||
set bind(%V) $ent
|
||||
|
||||
tixEvalCmdBinding $w $command bind $ent
|
||||
}
|
||||
}
|
||||
398
win32/lib/tix8.4.3/Tix.tcl
Normal file
@@ -0,0 +1,398 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: Tix.tcl,v 1.14 2008/03/17 23:01:10 hobbs Exp $
|
||||
#
|
||||
# Tix.tcl --
|
||||
#
|
||||
# This file implements the Tix application context class
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
|
||||
tixClass tixAppContext {
|
||||
-superclass {}
|
||||
-classname TixAppContext
|
||||
-method {
|
||||
cget configure addbitmapdir filedialog getbitmap getimage
|
||||
option platform resetoptions setbitmap initstyle
|
||||
}
|
||||
-flag {
|
||||
-binding -debug -extracmdargs -filedialog -fontset -grabmode
|
||||
-haspixmap -libdir -scheme -schemepriority -percentsubst
|
||||
}
|
||||
-readonly {
|
||||
-haspixmap
|
||||
}
|
||||
-configspec {
|
||||
{-binding TK}
|
||||
{-debug 0}
|
||||
{-extracmdargs 1}
|
||||
{-filedialog ""}
|
||||
{-fontset WmDefault}
|
||||
{-grabmode global}
|
||||
{-haspixmap 0}
|
||||
{-libdir ""}
|
||||
{-percentsubst 0}
|
||||
{-scheme WmDefault}
|
||||
{-schemepriority 21}
|
||||
}
|
||||
-alias {
|
||||
}
|
||||
}
|
||||
|
||||
proc tixAppContext:Constructor {w} {
|
||||
upvar #0 $w data
|
||||
global tix_priv tix_library tixOption
|
||||
|
||||
if {[info exists data(initialized)]} {
|
||||
error "tixAppContext has already be initialized"
|
||||
} else {
|
||||
set data(initialized) 1
|
||||
}
|
||||
|
||||
set data(et) [string equal $tix_library ""]
|
||||
set data(image) 0
|
||||
|
||||
# These options were set when Tix was loaded
|
||||
#
|
||||
set data(-binding) $tix_priv(-binding)
|
||||
set data(-debug) $tix_priv(-debug)
|
||||
set data(-fontset) $tix_priv(-fontset)
|
||||
set data(-scheme) $tix_priv(-scheme)
|
||||
set data(-schemepriority) $tix_priv(-schemepriority)
|
||||
|
||||
if {![info exists tix_priv(isSafe)]} {
|
||||
set data(-libdir) [file normalize $tix_library]
|
||||
}
|
||||
set tixOption(prioLevel) $tix_priv(-schemepriority)
|
||||
|
||||
# Compatibility stuff: the obsolete name courier_font has been changed to
|
||||
# fixed_font
|
||||
set tixOption(fixed_font) Courier
|
||||
set tixOption(courier_font) $tixOption(fixed_font)
|
||||
|
||||
# Enable/Disable Intrinsics debugging
|
||||
#
|
||||
set tix_priv(debug) [string is true -strict $data(-debug)]
|
||||
|
||||
tixAppContext:BitmapInit $w
|
||||
tixAppContext:FileDialogInit $w
|
||||
|
||||
# Clean up any error message generated by the above loop
|
||||
set ::errorInfo ""
|
||||
}
|
||||
|
||||
proc tixAppContext:initstyle {w} {
|
||||
# Do the init stuff here that affects styles
|
||||
|
||||
upvar #0 $w data
|
||||
global tix_priv
|
||||
|
||||
if {![info exists tix_priv(isSafe)]} {
|
||||
tixAppContext:config-fontset $w $data(-fontset)
|
||||
tixAppContext:config-scheme $w $data(-scheme)
|
||||
}
|
||||
|
||||
tixAppContext:BitmapInit $w
|
||||
tixAppContext:FileDialogInit $w
|
||||
|
||||
# Force the "." window to accept the new Tix options
|
||||
#
|
||||
set noconfig [list -class -colormap -container -menu -screen -use -visual]
|
||||
set noconfig [lsort $noconfig]
|
||||
foreach spec [. configure] {
|
||||
set flag [lindex $spec 0]
|
||||
if {[llength $spec] != 5
|
||||
|| [lsearch -exact -sorted $noconfig $flag] != -1} {
|
||||
continue
|
||||
}
|
||||
set name [lindex $spec 1]
|
||||
set class [lindex $spec 2]
|
||||
set value [option get . $name $class]
|
||||
catch {. configure $flag $value}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Configurations
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
proc tixAppContext:resetoptions {w scheme fontset {schemePrio ""}} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {! $data(et)} {
|
||||
global tixOption
|
||||
option clear
|
||||
|
||||
if {$schemePrio != ""} {
|
||||
set tixOption(prioLevel) $schemePrio
|
||||
}
|
||||
tixAppContext:config-scheme $w $scheme
|
||||
tixAppContext:config-fontset $w $fontset
|
||||
}
|
||||
}
|
||||
proc tixAppContext:StartupError {args} {
|
||||
bgerror [join $args "\n"]
|
||||
}
|
||||
|
||||
proc tixAppContext:config-fontset {w value} {
|
||||
upvar #0 $w data
|
||||
global tix_priv tixOption
|
||||
|
||||
set data(-fontset) $value
|
||||
|
||||
#-----------------------------------
|
||||
# Initialization of options database
|
||||
#-----------------------------------
|
||||
# Load the fontset
|
||||
#
|
||||
if {!$data(et)} {
|
||||
set prefDir [file join $data(-libdir) pref]
|
||||
set fontSetFile [file join $prefDir $data(-fontset).fsc]
|
||||
if {[file exists $fontSetFile]} {
|
||||
source $fontSetFile
|
||||
tixPref:InitFontSet:$data(-fontset)
|
||||
tixPref:SetFontSet:$data(-fontset)
|
||||
} else {
|
||||
tixAppContext:StartupError \
|
||||
" Error: cannot use fontset \"$data(-fontset)\"" \
|
||||
" Using default fontset "
|
||||
tixSetDefaultFontset
|
||||
}
|
||||
} else {
|
||||
if [catch {
|
||||
tixPref:InitFontSet:$data(-fontset)
|
||||
tixPref:SetFontSet:$data(-fontset)
|
||||
}] {
|
||||
# User chose non-existent fontset
|
||||
#
|
||||
tixAppContext:StartupError \
|
||||
" Error: cannot use fontset \"$data(-fontset)\"" \
|
||||
" Using default fontset "
|
||||
tixSetDefaultFontset
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixAppContext:config-scheme {w value} {
|
||||
upvar #0 $w data
|
||||
global tix_priv
|
||||
|
||||
set data(-scheme) $value
|
||||
|
||||
# Load the color scheme
|
||||
#
|
||||
if {!$data(et)} {
|
||||
set schemeName [file join [file join $data(-libdir) pref] \
|
||||
$data(-scheme).csc]
|
||||
if {[file exists $schemeName]} {
|
||||
source $schemeName
|
||||
tixPref:SetScheme-Color:$data(-scheme)
|
||||
} else {
|
||||
tixAppContext:StartupError \
|
||||
" Error: cannot use color scheme \"$data(-scheme)\"" \
|
||||
" Using default color scheme"
|
||||
tixSetDefaultScheme-Color
|
||||
}
|
||||
} else {
|
||||
if [catch {tixPref:SetScheme-Color:$data(-scheme)}] {
|
||||
# User chose non-existent color scheme
|
||||
#
|
||||
tixAppContext:StartupError \
|
||||
" Error: cannot use color scheme \"$data(-scheme)\"" \
|
||||
" Using default color scheme"
|
||||
tixSetDefaultScheme-Color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Private methods
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
proc tixAppContext:BitmapInit {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
# See whether we have pixmap extension
|
||||
#
|
||||
set data(-haspixmap) true
|
||||
|
||||
# Dynamically set the bitmap directory
|
||||
#
|
||||
if {! $data(et)} {
|
||||
set data(bitmapdirs) [list [file join $data(-libdir) bitmaps]]
|
||||
} else {
|
||||
set data(bitmapdirs) ""
|
||||
}
|
||||
}
|
||||
|
||||
proc tixAppContext:FileDialogInit {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(-filedialog) == ""} {
|
||||
set data(-filedialog) [option get . fileDialog FileDialog]
|
||||
}
|
||||
if {$data(-filedialog) == ""} {
|
||||
set data(-filedialog) tixFileSelectDialog
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Public methods
|
||||
#----------------------------------------------------------------------
|
||||
proc tixAppContext:addbitmapdir {w bmpdir} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[lsearch $data(bitmapdirs) $bmpdir] == -1} {
|
||||
lappend data(bitmapdirs) $bmpdir
|
||||
}
|
||||
}
|
||||
|
||||
proc tixAppContext:getimage {w name} {
|
||||
upvar #0 $w data
|
||||
global tix_priv
|
||||
|
||||
if {[info exists data(img:$name)]} {
|
||||
return $data(img:$name)
|
||||
}
|
||||
|
||||
if {![info exists tix_priv(isSafe)]} {
|
||||
foreach dir $data(bitmapdirs) {
|
||||
foreach {ext type} {
|
||||
.xpm pixmap
|
||||
.gif photo
|
||||
.ppm photo
|
||||
.xbm bitmap
|
||||
"" bitmap
|
||||
} {
|
||||
set file [file join $dir $name$ext]
|
||||
if {[file exists $file]
|
||||
&& ![catch {
|
||||
set img tiximage$data(image)
|
||||
set data(img:$name) \
|
||||
[image create $type $img -file $file]
|
||||
}]} {
|
||||
incr data(image)
|
||||
break
|
||||
}
|
||||
}
|
||||
if {[info exists data(img:$name)]} {
|
||||
return $data(img:$name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if {![info exists data(img:$name)]} {
|
||||
catch {
|
||||
set img tiximage$data(image)
|
||||
# This is for compiled-in images
|
||||
set data(img:$name) [image create pixmap $img -id $name]
|
||||
} err
|
||||
if {[string match internal* $err]} {
|
||||
error $err
|
||||
} else {
|
||||
incr data(image)
|
||||
}
|
||||
}
|
||||
|
||||
if {[info exists data(img:$name)]} {
|
||||
return $data(img:$name)
|
||||
} else {
|
||||
error "image file \"$name\" cannot be found"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
proc tixAppContext:getbitmap {w bitmapname} {
|
||||
upvar #0 $w data
|
||||
global tix_priv
|
||||
|
||||
if {[info exists data(bmp:$bitmapname)]} {
|
||||
return $data(bmp:$bitmapname)
|
||||
} else {
|
||||
set ext [file extension $bitmapname]
|
||||
if {$ext == ""} {
|
||||
set ext .xbm
|
||||
}
|
||||
|
||||
# This is the fallback value. If we can't find the bitmap in
|
||||
# the bitmap directories, then use the name of the bitmap
|
||||
# as the default value.
|
||||
#
|
||||
set data(bmp:$bitmapname) $bitmapname
|
||||
|
||||
if {[info exists tix_priv(isSafe)]} {
|
||||
return $data(bmp:$bitmapname)
|
||||
}
|
||||
|
||||
foreach dir $data(bitmapdirs) {
|
||||
if {$ext eq ".xbm" &&
|
||||
[file exists [file join $dir $bitmapname.xbm]]} {
|
||||
set data(bmp:$bitmapname) \
|
||||
@[file join $dir $bitmapname.xbm]
|
||||
break
|
||||
}
|
||||
if {[file exists [file join $dir $bitmapname]]} {
|
||||
set data(bmp:$bitmapname) @[file join $dir $bitmapname]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return $data(bmp:$bitmapname)
|
||||
}
|
||||
}
|
||||
|
||||
proc tixAppContext:filedialog {w {type tixFileSelectDialog}} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$type == ""} {
|
||||
set type $data(-filedialog)
|
||||
}
|
||||
if {![info exists data(filedialog,$type)]} {
|
||||
set data(filedialog,$type) ""
|
||||
}
|
||||
|
||||
if {$data(filedialog,$type) == "" || \
|
||||
![winfo exists $data(filedialog,$type)]} {
|
||||
set data(filedialog,$type) [$type .tixapp_filedialog_$type]
|
||||
}
|
||||
|
||||
return $data(filedialog,$type)
|
||||
}
|
||||
|
||||
proc tixAppContext:option {w action {option ""} {value ""}} {
|
||||
global tixOption
|
||||
|
||||
if {$action eq "get"} {
|
||||
if {$option == ""} {return [lsort [array names tixOption]]}
|
||||
return $tixOption($option)
|
||||
}
|
||||
}
|
||||
|
||||
proc tixAppContext:platform {w} {
|
||||
return $::tcl_platform(platform)
|
||||
}
|
||||
|
||||
proc tixDebug {message {level "1"}} {
|
||||
set debug [tix cget -debug]
|
||||
if {![string is true -strict $debug]} { return }
|
||||
|
||||
if {$debug > 0} {
|
||||
# use $level here
|
||||
if {[catch {fconfigure stderr}]} {
|
||||
# This will happen under PYTHONW.EXE or frozen Windows apps
|
||||
proc tixDebug args {}
|
||||
} else {
|
||||
puts stderr $message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if {![llength [info commands toplevel]]} {
|
||||
interp alias {} toplevel {} frame
|
||||
}
|
||||
211
win32/lib/tix8.4.3/Tree.tcl
Normal file
@@ -0,0 +1,211 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: Tree.tcl,v 1.7 2004/04/09 21:39:12 hobbs Exp $
|
||||
#
|
||||
# Tree.tcl --
|
||||
#
|
||||
# This file implements the TixTree widget.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
tixWidgetClass tixTree {
|
||||
-classname TixTree
|
||||
-superclass tixVTree
|
||||
-method {
|
||||
autosetmode close getmode open setmode
|
||||
|
||||
addchild anchor column delete entrycget
|
||||
entryconfigure header hide indicator info
|
||||
item nearest see selection show
|
||||
}
|
||||
-flag {
|
||||
-browsecmd -command -opencmd -closecmd
|
||||
}
|
||||
-configspec {
|
||||
{-browsecmd browseCmd BrowseCmd ""}
|
||||
{-command command Command ""}
|
||||
{-closecmd closeCmd CloseCmd ""}
|
||||
{-opencmd openCmd OpenCmd ""}
|
||||
}
|
||||
-default {
|
||||
{.scrollbar auto}
|
||||
{*Scrollbar.takeFocus 0}
|
||||
{*borderWidth 1}
|
||||
{*hlist.background #c3c3c3}
|
||||
{*hlist.drawBranch 1}
|
||||
{*hlist.height 10}
|
||||
{*hlist.highlightBackground #d9d9d9}
|
||||
{*hlist.indicator 1}
|
||||
{*hlist.indent 20}
|
||||
{*hlist.itemType imagetext}
|
||||
{*hlist.padX 2}
|
||||
{*hlist.padY 2}
|
||||
{*hlist.relief sunken}
|
||||
{*hlist.takeFocus 1}
|
||||
{*hlist.wideSelection 0}
|
||||
{*hlist.width 20}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTree:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
}
|
||||
|
||||
proc tixTree:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
}
|
||||
|
||||
proc tixTree:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Widget commands
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
proc tixTree:autosetmode {w} {
|
||||
tixTree:SetModes $w ""
|
||||
}
|
||||
|
||||
proc tixTree:close {w ent} {
|
||||
upvar #0 $w data
|
||||
|
||||
set type [tixVTree:GetType $w $ent]
|
||||
if {$type == "close"} {
|
||||
tixCallMethod $w Activate $ent $type
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTree:open {w ent} {
|
||||
upvar #0 $w data
|
||||
|
||||
set type [tixVTree:GetType $w $ent]
|
||||
if {$type == "open"} {
|
||||
tixCallMethod $w Activate $ent $type
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTree:getmode {w ent} {
|
||||
tixVTree:GetType $w $ent
|
||||
}
|
||||
|
||||
proc tixTree:setmode {w ent mode} {
|
||||
tixVTree:SetMode $w $ent $mode
|
||||
}
|
||||
|
||||
foreach cmd {
|
||||
addchild anchor column delete entrycget
|
||||
entryconfigure header hide indicator info
|
||||
item nearest see selection show
|
||||
} {
|
||||
proc tixTree:$cmd {w args} {
|
||||
# These are hlist passthrough methods to work around
|
||||
# Tix' ignorant inheritance model.
|
||||
upvar #0 $w data
|
||||
set cmd [lindex [split [lindex [info level 0] 0] :] end]
|
||||
uplevel 1 [linsert $args 0 $data(w:hlist) $cmd]
|
||||
}
|
||||
}
|
||||
unset cmd
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Private Methods
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
proc tixTree:SetModes {w ent} {
|
||||
upvar #0 $w data
|
||||
|
||||
set mode none
|
||||
|
||||
if {$ent == ""} {
|
||||
set children [$data(w:hlist) info children]
|
||||
} else {
|
||||
set children [$data(w:hlist) info children $ent]
|
||||
}
|
||||
|
||||
if {$children != ""} {
|
||||
set mode close
|
||||
|
||||
foreach c $children {
|
||||
if {[$data(w:hlist) info hidden $c]} {
|
||||
set mode open
|
||||
}
|
||||
tixTree:SetModes $w $c
|
||||
}
|
||||
}
|
||||
|
||||
if {$ent != ""} {
|
||||
tixVTree:SetMode $w $ent $mode
|
||||
}
|
||||
}
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Virtual Methods
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
proc tixTree:OpenCmd {w ent} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(-opencmd) != ""} {
|
||||
tixTree:CallSwitchCmd $w $data(-opencmd) $ent
|
||||
} else {
|
||||
tixChainMethod $w OpenCmd $ent
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTree:CloseCmd {w ent} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(-closecmd) != ""} {
|
||||
tixTree:CallSwitchCmd $w $data(-closecmd) $ent
|
||||
} else {
|
||||
tixChainMethod $w CloseCmd $ent
|
||||
}
|
||||
}
|
||||
|
||||
# Call the opencmd or closecmd, depending on the mode ($cmd argument)
|
||||
#
|
||||
proc tixTree:CallSwitchCmd {w cmd ent} {
|
||||
upvar #0 $w data
|
||||
|
||||
set bind(specs) {%V}
|
||||
set bind(%V) $ent
|
||||
|
||||
tixEvalCmdBinding $w $cmd bind $ent
|
||||
}
|
||||
|
||||
proc tixTree:Command {w B} {
|
||||
upvar #0 $w data
|
||||
upvar $B bind
|
||||
|
||||
tixChainMethod $w Command $B
|
||||
|
||||
set ent [tixEvent flag V]
|
||||
if {$data(-command) != ""} {
|
||||
tixEvalCmdBinding $w $data(-command) bind $ent
|
||||
}
|
||||
}
|
||||
|
||||
proc tixTree:BrowseCmd {w B} {
|
||||
upvar #0 $w data
|
||||
|
||||
set ent [tixEvent flag V]
|
||||
if {$data(-browsecmd) != ""} {
|
||||
tixEvalCmdBinding $w $data(-browsecmd) "" $ent
|
||||
}
|
||||
}
|
||||
442
win32/lib/tix8.4.3/Utils.tcl
Normal file
@@ -0,0 +1,442 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: Utils.tcl,v 1.4 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# Util.tcl --
|
||||
#
|
||||
# The Tix utility commands. Some of these commands are
|
||||
# replacement of or extensions to the existing TK
|
||||
# commands. Occasionaly, you have to use the commands inside
|
||||
# this file instead of thestandard TK commands to make your
|
||||
# applicatiion work better with Tix. Please read the
|
||||
# documentations (programmer's guide, man pages) for information
|
||||
# about these utility commands.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# kludge: should be able to handle all kinds of flags
|
||||
# now only handles "-flag value" pairs.
|
||||
#
|
||||
proc tixHandleArgv {p_argv p_options validFlags} {
|
||||
upvar $p_options opt
|
||||
upvar $p_argv argv
|
||||
|
||||
set old_argv $argv
|
||||
set argv ""
|
||||
|
||||
foreac {flag value} $old_argv {
|
||||
if {[lsearch $validFlags $flag] != -1} {
|
||||
# The caller will handle this option exclusively
|
||||
# It won't be added back to the original arglist
|
||||
#
|
||||
eval $opt($flag,action) $value
|
||||
} else {
|
||||
# The caller does not handle this option
|
||||
#
|
||||
lappend argv $flag
|
||||
lappend argv $value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# tixDisableAll -
|
||||
#
|
||||
# Disable all members in a sub widget tree
|
||||
#
|
||||
proc tixDisableAll {w} {
|
||||
foreach x [tixDescendants $w] {
|
||||
catch {$x config -state disabled}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# tixEnableAll -
|
||||
#
|
||||
# enable all members in a sub widget tree
|
||||
#
|
||||
proc tixEnableAll {w} {
|
||||
foreach x [tixDescendants $w] {
|
||||
catch {$x config -state normal}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# tixDescendants -
|
||||
#
|
||||
# Return a list of all the member of a widget subtree, including
|
||||
# the tree's root widget.
|
||||
#
|
||||
proc tixDescendants {parent} {
|
||||
set des ""
|
||||
lappend des $parent
|
||||
|
||||
foreach w [winfo children $parent] {
|
||||
foreach x [tixDescendants $w] {
|
||||
lappend des $x
|
||||
}
|
||||
}
|
||||
return $des
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# tixTopLevel -
|
||||
#
|
||||
# Create a toplevel widget and unmap it immediately. This will ensure
|
||||
# that this toplevel widgets will not be popped up prematurely when you
|
||||
# create Tix widgets inside it.
|
||||
#
|
||||
# "tixTopLevel" also provide options for you to specify the appearance
|
||||
# and behavior of this toplevel.
|
||||
#
|
||||
#
|
||||
#
|
||||
proc tixTopLevel {w args} {
|
||||
set opt (-geometry) ""
|
||||
set opt (-minsize) ""
|
||||
set opt (-maxsize) ""
|
||||
set opt (-width) ""
|
||||
set opt (-height) ""
|
||||
|
||||
eval [linsert $args 0 toplevel $w]
|
||||
wm withdraw $w
|
||||
}
|
||||
|
||||
# This is a big kludge
|
||||
#
|
||||
# Substitutes all [...] and $.. in the string in $args
|
||||
#
|
||||
proc tixInt_Expand {args} {
|
||||
return $args
|
||||
}
|
||||
|
||||
# Print out all the config options of a widget
|
||||
#
|
||||
proc tixPConfig {w} {
|
||||
puts [join [lsort [$w config]] \n]
|
||||
}
|
||||
|
||||
proc tixAppendBindTag {w tag} {
|
||||
bindtags $w [concat [bindtags $w] $tag]
|
||||
}
|
||||
|
||||
proc tixAddBindTag {w tag} {
|
||||
bindtags $w [concat $tag [bindtags $w] ]
|
||||
}
|
||||
|
||||
proc tixSubwidgetRef {sub} {
|
||||
return $::tixSRef($sub)
|
||||
}
|
||||
|
||||
proc tixSubwidgetRetCreate {sub ref} {
|
||||
set ::tixSRef($sub) $ref
|
||||
}
|
||||
|
||||
proc tixSubwidgetRetDelete {sub} {
|
||||
catch {unset ::tixSRef($sub)}
|
||||
}
|
||||
|
||||
proc tixListboxGetCurrent {listbox} {
|
||||
return [tixEvent flag V]
|
||||
}
|
||||
|
||||
|
||||
# tixSetMegaWidget --
|
||||
#
|
||||
# Associate a subwidget with its mega widget "owner". This is mainly
|
||||
# used when we add a new bindtag to a subwidget and we need to find out
|
||||
# the name of the mega widget inside the binding.
|
||||
#
|
||||
proc tixSetMegaWidget {w mega {type any}} {
|
||||
set ::tixMega($type,$w) $mega
|
||||
}
|
||||
|
||||
proc tixGetMegaWidget {w {type any}} {
|
||||
return $::tixMega($type,$w)
|
||||
}
|
||||
|
||||
proc tixUnsetMegaWidget {w} {
|
||||
if {[info exists ::tixMega($w)]} { unset ::tixMega($w) }
|
||||
}
|
||||
|
||||
# tixBusy : display busy cursors on a window
|
||||
#
|
||||
#
|
||||
# Should flush the event queue (but not do any idle tasks) before blocking
|
||||
# the target window (I am not sure if it is aready doing so )
|
||||
#
|
||||
# ToDo: should take some additional windows to raise
|
||||
#
|
||||
proc tixBusy {w flag {focuswin ""}} {
|
||||
|
||||
if {[info command tixInputOnly] == ""} {
|
||||
return
|
||||
}
|
||||
|
||||
global tixBusy
|
||||
set toplevel [winfo toplevel $w]
|
||||
|
||||
if {![info exists tixBusy(cursor)]} {
|
||||
set tixBusy(cursor) watch
|
||||
# set tixBusy(cursor) "[tix getbitmap hourglass] \
|
||||
# [string range [tix getbitmap hourglass.mask] 1 end]\
|
||||
# black white"
|
||||
}
|
||||
|
||||
if {$toplevel eq "."} {
|
||||
set inputonly0 .__tix__busy0
|
||||
set inputonly1 .__tix__busy1
|
||||
set inputonly2 .__tix__busy2
|
||||
set inputonly3 .__tix__busy3
|
||||
} else {
|
||||
set inputonly0 $toplevel.__tix__busy0
|
||||
set inputonly1 $toplevel.__tix__busy1
|
||||
set inputonly2 $toplevel.__tix__busy2
|
||||
set inputonly3 $toplevel.__tix__busy3
|
||||
}
|
||||
|
||||
if {![winfo exists $inputonly0]} {
|
||||
for {set i 0} {$i < 4} {incr i} {
|
||||
tixInputOnly [set inputonly$i] -cursor $tixBusy(cursor)
|
||||
}
|
||||
}
|
||||
|
||||
if {$flag eq "on"} {
|
||||
if {$focuswin != "" && [winfo id $focuswin] != 0} {
|
||||
if {[info exists tixBusy($focuswin,oldcursor)]} {
|
||||
return
|
||||
}
|
||||
set tixBusy($focuswin,oldcursor) [$focuswin cget -cursor]
|
||||
$focuswin config -cursor $tixBusy(cursor)
|
||||
|
||||
set x1 [expr {[winfo rootx $focuswin]-[winfo rootx $toplevel]}]
|
||||
set y1 [expr {[winfo rooty $focuswin]-[winfo rooty $toplevel]}]
|
||||
|
||||
set W [winfo width $focuswin]
|
||||
set H [winfo height $focuswin]
|
||||
set x2 [expr {$x1 + $W}]
|
||||
set y2 [expr {$y1 + $H}]
|
||||
|
||||
|
||||
if {$y1 > 0} {
|
||||
tixMoveResizeWindow $inputonly0 0 0 10000 $y1
|
||||
}
|
||||
if {$x1 > 0} {
|
||||
tixMoveResizeWindow $inputonly1 0 0 $x1 10000
|
||||
}
|
||||
tixMoveResizeWindow $inputonly2 0 $y2 10000 10000
|
||||
tixMoveResizeWindow $inputonly3 $x2 0 10000 10000
|
||||
|
||||
for {set i 0} {$i < 4} {incr i} {
|
||||
tixMapWindow [set inputonly$i]
|
||||
tixRaiseWindow [set inputonly$i]
|
||||
}
|
||||
tixFlushX $w
|
||||
} else {
|
||||
tixMoveResizeWindow $inputonly0 0 0 10000 10000
|
||||
tixMapWindow $inputonly0
|
||||
tixRaiseWindow $inputonly0
|
||||
}
|
||||
} else {
|
||||
tixUnmapWindow $inputonly0
|
||||
tixUnmapWindow $inputonly1
|
||||
tixUnmapWindow $inputonly2
|
||||
tixUnmapWindow $inputonly3
|
||||
|
||||
if {$focuswin != "" && [winfo id $focuswin] != 0} {
|
||||
if {[info exists tixBusy($focuswin,oldcursor)]} {
|
||||
$focuswin config -cursor $tixBusy($focuswin,oldcursor)
|
||||
if {[info exists tixBusy($focuswin,oldcursor)]} {
|
||||
unset tixBusy($focuswin,oldcursor)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixOptionName {w} {
|
||||
return [string range $w 1 end]
|
||||
}
|
||||
|
||||
proc tixSetSilent {chooser value} {
|
||||
$chooser config -disablecallback true
|
||||
$chooser config -value $value
|
||||
$chooser config -disablecallback false
|
||||
}
|
||||
|
||||
# This command is useful if you want to ingore the arguments
|
||||
# passed by the -command or -browsecmd options of the Tix widgets. E.g
|
||||
#
|
||||
# tixFileSelectDialog .c -command "puts foo; tixBreak"
|
||||
#
|
||||
#
|
||||
proc tixBreak {args} {}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# tixDestroy -- deletes a Tix class object (not widget classes)
|
||||
#----------------------------------------------------------------------
|
||||
proc tixDestroy {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
set destructor ""
|
||||
if {[info exists data(className)]} {
|
||||
catch {
|
||||
set destructor [tixGetMethod $w $data(className) Destructor]
|
||||
}
|
||||
}
|
||||
if {$destructor != ""} {
|
||||
$destructor $w
|
||||
}
|
||||
catch {rename $w ""}
|
||||
catch {unset data}
|
||||
return ""
|
||||
}
|
||||
|
||||
proc tixPushGrab {args} {
|
||||
global tix_priv
|
||||
|
||||
if {![info exists tix_priv(grab-list)]} {
|
||||
set tix_priv(grab-list) ""
|
||||
set tix_priv(grab-mode) ""
|
||||
set tix_priv(grab-nopush) ""
|
||||
}
|
||||
|
||||
set len [llength $args]
|
||||
if {$len == 1} {
|
||||
set opt ""
|
||||
set w [lindex $args 0]
|
||||
} elseif {$len == 2} {
|
||||
set opt [lindex $args 0]
|
||||
set w [lindex $args 1]
|
||||
} else {
|
||||
error "wrong # of arguments: tixPushGrab ?-global? window"
|
||||
}
|
||||
|
||||
# Not everyone will call tixPushGrab. If someone else has a grab already
|
||||
# save that one as well, so that we can restore that later
|
||||
#
|
||||
set last [lindex $tix_priv(grab-list) end]
|
||||
set current [grab current $w]
|
||||
|
||||
if {$current ne "" && $current ne $last} {
|
||||
# Someone called "grab" directly
|
||||
#
|
||||
lappend tix_priv(grab-list) $current
|
||||
lappend tix_priv(grab-mode) [grab status $current]
|
||||
lappend tix_priv(grab-nopush) 1
|
||||
}
|
||||
|
||||
# Now push myself into the stack
|
||||
#
|
||||
lappend tix_priv(grab-list) $w
|
||||
lappend tix_priv(grab-mode) $opt
|
||||
lappend tix_priv(grab-nopush) 0
|
||||
|
||||
if {$opt eq "-global"} {
|
||||
grab -global $w
|
||||
} else {
|
||||
grab $w
|
||||
}
|
||||
}
|
||||
|
||||
proc tixPopGrab {} {
|
||||
global tix_priv
|
||||
|
||||
if {![info exists tix_priv(grab-list)]} {
|
||||
set tix_priv(grab-list) ""
|
||||
set tix_priv(grab-mode) ""
|
||||
set tix_priv(grab-nopush) ""
|
||||
}
|
||||
|
||||
set len [llength $tix_priv(grab-list)]
|
||||
if {$len <= 0} {
|
||||
error "no window is grabbed by tixGrab"
|
||||
}
|
||||
|
||||
set w [lindex $tix_priv(grab-list) end]
|
||||
grab release $w
|
||||
|
||||
if {$len > 1} {
|
||||
set tix_priv(grab-list) [lrange $tix_priv(grab-list) 0 end-1]
|
||||
set tix_priv(grab-mode) [lrange $tix_priv(grab-mode) 0 end-1]
|
||||
set tix_priv(grab-nopush) [lrange $tix_priv(grab-nopush) 0 end-1]
|
||||
|
||||
set w [lindex $tix_priv(grab-list) end]
|
||||
set m [lindex $tix_priv(grab-list) end]
|
||||
set np [lindex $tix_priv(grab-nopush) end]
|
||||
|
||||
if {$np == 1} {
|
||||
# We have a grab set by "grab"
|
||||
#
|
||||
set len [llength $tix_priv(grab-list)]
|
||||
|
||||
if {$len > 1} {
|
||||
set tix_priv(grab-list) [lrange $tix_priv(grab-list) 0 end-1]
|
||||
set tix_priv(grab-mode) [lrange $tix_priv(grab-mode) 0 end-1]
|
||||
set tix_priv(grab-nopush) \
|
||||
[lrange $tix_priv(grab-nopush) 0 end-1]
|
||||
} else {
|
||||
set tix_priv(grab-list) ""
|
||||
set tix_priv(grab-mode) ""
|
||||
set tix_priv(grab-nopush) ""
|
||||
}
|
||||
}
|
||||
|
||||
if {$m == "-global"} {
|
||||
grab -global $w
|
||||
} else {
|
||||
grab $w
|
||||
}
|
||||
} else {
|
||||
set tix_priv(grab-list) ""
|
||||
set tix_priv(grab-mode) ""
|
||||
set tix_priv(grab-nopush) ""
|
||||
}
|
||||
}
|
||||
|
||||
proc tixWithinWindow {wid rootX rootY} {
|
||||
set wc [winfo containing $rootX $rootY]
|
||||
if {$wid eq $wc} { return 1 }
|
||||
|
||||
# no see if it is an enclosing parent
|
||||
set rx1 [winfo rootx $wid]
|
||||
set ry1 [winfo rooty $wid]
|
||||
set rw [winfo width $wid]
|
||||
set rh [winfo height $wid]
|
||||
set rx2 [expr {$rx1+$rw}]
|
||||
set ry2 [expr {$ry1+$rh}]
|
||||
|
||||
if {$rootX >= $rx1 && $rootX < $rx2 && $rootY >= $ry1 && $rootY < $ry2} {
|
||||
return 1
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
proc tixWinWidth {w} {
|
||||
set W [winfo width $w]
|
||||
set bd [expr {[$w cget -bd] + [$w cget -highlightthickness]}]
|
||||
|
||||
return [expr {$W - 2*$bd}]
|
||||
}
|
||||
|
||||
proc tixWinHeight {w} {
|
||||
set H [winfo height $w]
|
||||
set bd [expr {[$w cget -bd] + [$w cget -highlightthickness]}]
|
||||
|
||||
return [expr {$H - 2*$bd}]
|
||||
}
|
||||
|
||||
# junk?
|
||||
#
|
||||
proc tixWinCmd {w} {
|
||||
return [winfo command $w]
|
||||
}
|
||||
211
win32/lib/tix8.4.3/VResize.tcl
Normal file
@@ -0,0 +1,211 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: VResize.tcl,v 1.3 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# VResize.tcl --
|
||||
#
|
||||
# tixVResize:
|
||||
# Virtual base class for all classes that provide resize capability,
|
||||
# such as the resize handle and the MDI client window.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
|
||||
tixWidgetClass tixVResize {
|
||||
-virtual true
|
||||
-classname TixVResize
|
||||
-superclass tixPrimitive
|
||||
-method {
|
||||
drag dragend dragstart
|
||||
}
|
||||
-flag {
|
||||
-gridded -gridx -gridy -minwidth -minheight
|
||||
}
|
||||
-configspec {
|
||||
{-gridded gridded Gridded false}
|
||||
{-gridx gridX Grid 10}
|
||||
{-gridy gridY Grid 10}
|
||||
{-minwidth minWidth MinWidth 0}
|
||||
{-minheight minHeight MinHeight 0}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
proc tixVResize:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
|
||||
set data(movePending) 0
|
||||
set data(aborted) 0
|
||||
set data(depress) 0
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Public methods
|
||||
#----------------------------------------------------------------------
|
||||
# Start dragging a window
|
||||
#
|
||||
proc tixVResize:dragstart {w win depress rootx rooty wrect mrect} {
|
||||
upvar #0 $w data
|
||||
|
||||
set data(rootx) $rootx
|
||||
set data(rooty) $rooty
|
||||
|
||||
set data(mx) [lindex $mrect 0]
|
||||
set data(my) [lindex $mrect 1]
|
||||
set data(mw) [lindex $mrect 2]
|
||||
set data(mh) [lindex $mrect 3]
|
||||
|
||||
set data(fx) [lindex $wrect 0]
|
||||
set data(fy) [lindex $wrect 1]
|
||||
set data(fw) [lindex $wrect 2]
|
||||
set data(fh) [lindex $wrect 3]
|
||||
|
||||
set data(old_x) [lindex $wrect 0]
|
||||
set data(old_y) [lindex $wrect 1]
|
||||
set data(old_w) [lindex $wrect 2]
|
||||
set data(old_h) [lindex $wrect 3]
|
||||
|
||||
if {$data(mw) < 0} {
|
||||
set data(maxx) [expr {$data(fx) + $data(old_w) - $data(-minwidth)}]
|
||||
} else {
|
||||
set data(maxx) 32000
|
||||
}
|
||||
if {$data(mh) < 0} {
|
||||
set data(maxy) [expr {$data(fy) + $data(old_h) - $data(-minheight)}]
|
||||
} else {
|
||||
set data(maxy) 32000
|
||||
}
|
||||
|
||||
set data(aborted) 0
|
||||
|
||||
tixCallMethod $w ShowHintFrame
|
||||
tixCallMethod $w SetHintFrame $data(fx) $data(fy) $data(fw) $data(fh)
|
||||
|
||||
# Grab so that all button events are captured
|
||||
#
|
||||
grab $win
|
||||
focus $win
|
||||
|
||||
set data(depress) $depress
|
||||
if {$depress} {
|
||||
set data(oldRelief) [$win cget -relief]
|
||||
$win config -relief sunken
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
proc tixVResize:drag {w rootx rooty} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(aborted) == 0} {
|
||||
set data(newrootx) $rootx
|
||||
set data(newrooty) $rooty
|
||||
|
||||
if {$data(movePending) == 0} {
|
||||
set data(movePending) 1
|
||||
after 2 tixVResize:DragCompressed $w
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixVResize:dragend {w win isAbort rootx rooty} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(aborted)} {
|
||||
if {$isAbort == 0} {
|
||||
grab release $win
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
# Just in case some draggings are not applied.
|
||||
#
|
||||
update
|
||||
|
||||
tixCallMethod $w HideHintFrame
|
||||
|
||||
if {$isAbort} {
|
||||
set data(aborted) 1
|
||||
} else {
|
||||
# Apply the changes
|
||||
#
|
||||
tixCallMethod $w UpdateSize $data(fx) $data(fy) $data(fw) $data(fh)
|
||||
|
||||
# Release the grab
|
||||
#
|
||||
grab release $win
|
||||
}
|
||||
|
||||
if {$data(depress)} {
|
||||
$win config -relief $data(oldRelief)
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Internal methods
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
proc tixVResize:DragCompressed {w} {
|
||||
if {![winfo exists $w]} {
|
||||
return
|
||||
}
|
||||
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(aborted) == 1 || $data(movePending) == 0} {
|
||||
return
|
||||
}
|
||||
|
||||
set dx [expr {$data(newrootx) - $data(rootx)}]
|
||||
set dy [expr {$data(newrooty) - $data(rooty)}]
|
||||
|
||||
set data(fx) [expr {$data(old_x) + ($dx * $data(mx))}]
|
||||
set data(fy) [expr {$data(old_y) + ($dy * $data(my))}]
|
||||
set data(fw) [expr {$data(old_w) + ($dx * $data(mw))}]
|
||||
set data(fh) [expr {$data(old_h) + ($dy * $data(mh))}]
|
||||
|
||||
if {$data(fw) < $data(-minwidth)} {
|
||||
set data(fw) $data(-minwidth)
|
||||
}
|
||||
if {$data(fh) < $data(-minheight)} {
|
||||
set data(fh) $data(-minheight)
|
||||
}
|
||||
|
||||
if {$data(fx) > $data(maxx)} {
|
||||
set data(fx) $data(maxx)
|
||||
}
|
||||
if {$data(fy) > $data(maxy)} {
|
||||
set data(fy) $data(maxy)
|
||||
}
|
||||
|
||||
# If we need grid, set x,y,w,h to fit the grid
|
||||
#
|
||||
# *note* grid overrides minwidth and maxwidth ...
|
||||
#
|
||||
if {$data(-gridded)} {
|
||||
set data(fx) [expr {round(double($data(fx))/$data(-gridx)) * $data(-gridx)}]
|
||||
set data(fy) [expr {round(double($data(fy))/$data(-gridy)) * $data(-gridy)}]
|
||||
|
||||
set fx2 [expr {$data(fx) + $data(fw) - 2}]
|
||||
set fy2 [expr {$data(fy) + $data(fh) - 2}]
|
||||
|
||||
set fx2 [expr {round(double($fx2)/$data(-gridx)) * $data(-gridx)}]
|
||||
set fy2 [expr {round(double($fy2)/$data(-gridy)) * $data(-gridy)}]
|
||||
|
||||
set data(fw) [expr {$fx2 - $data(fx) + 1}]
|
||||
set data(fh) [expr {$fy2 - $data(fy) + 1}]
|
||||
}
|
||||
|
||||
tixCallMethod $w SetHintFrame $data(fx) $data(fy) $data(fw) $data(fh)
|
||||
|
||||
update idletasks
|
||||
|
||||
set data(movePending) 0
|
||||
}
|
||||
430
win32/lib/tix8.4.3/VStack.tcl
Normal file
@@ -0,0 +1,430 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: VStack.tcl,v 1.4 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# VStack.tcl --
|
||||
#
|
||||
# Virtual base class, do not instantiate! This is the core
|
||||
# class for all NoteBook style widgets. Stack maintains a list
|
||||
# of windows. It provides methods to create, delete windows as
|
||||
# well as stepping through them.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
tixWidgetClass tixVStack {
|
||||
-virtual true
|
||||
-classname TixVStack
|
||||
-superclass tixPrimitive
|
||||
-method {
|
||||
add delete pageconfigure pagecget pages raise raised
|
||||
}
|
||||
-flag {
|
||||
-dynamicgeometry -ipadx -ipady
|
||||
}
|
||||
-configspec {
|
||||
{-dynamicgeometry dynamicGeometry DynamicGeometry 0 tixVerifyBoolean}
|
||||
{-ipadx ipadX Pad 0}
|
||||
{-ipady ipadY Pad 0}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixVStack:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
|
||||
set data(pad-x1) 0
|
||||
set data(pad-x2) 0
|
||||
set data(pad-y1) 0
|
||||
set data(pad-y2) 0
|
||||
|
||||
set data(windows) ""
|
||||
set data(nWindows) 0
|
||||
set data(topchild) ""
|
||||
|
||||
set data(minW) 1
|
||||
set data(minH) 1
|
||||
|
||||
set data(w:top) $w
|
||||
set data(counter) 0
|
||||
set data(repack) 0
|
||||
}
|
||||
|
||||
proc tixVStack:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
tixCallMethod $w InitGeometryManager
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Public methods
|
||||
#----------------------------------------------------------------------
|
||||
proc tixVStack:add {w child args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set validOptions {-createcmd -raisecmd}
|
||||
|
||||
set opt(-createcmd) ""
|
||||
set opt(-raisecmd) ""
|
||||
|
||||
tixHandleOptions -nounknown opt $validOptions $args
|
||||
|
||||
set data($child,raisecmd) $opt(-raisecmd)
|
||||
set data($child,createcmd) $opt(-createcmd)
|
||||
|
||||
set data(w:$child) [tixCallMethod $w CreateChildFrame $child]
|
||||
|
||||
lappend data(windows) $child
|
||||
incr data(nWindows) 1
|
||||
|
||||
return $data(w:$child)
|
||||
}
|
||||
|
||||
proc tixVStack:delete {w child} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {[info exists data($child,createcmd)]} {
|
||||
if {[winfo exists $data(w:$child)]} {
|
||||
bind $data(w:$child) <Destroy> {;}
|
||||
destroy $data(w:$child)
|
||||
}
|
||||
catch {unset data($child,createcmd)}
|
||||
catch {unset data($child,raisecmd)}
|
||||
catch {unset data(w:$child)}
|
||||
|
||||
set index [lsearch $data(windows) $child]
|
||||
if {$index >= 0} {
|
||||
set data(windows) [lreplace $data(windows) $index $index]
|
||||
incr data(nWindows) -1
|
||||
}
|
||||
|
||||
if {[string equal $data(topchild) $child]} {
|
||||
set data(topchild) ""
|
||||
foreach page $data(windows) {
|
||||
if {$page ne $child} {
|
||||
$w raise $page
|
||||
set data(topchild) $page
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
error "page $child does not exist"
|
||||
}
|
||||
}
|
||||
|
||||
proc tixVStack:pagecget {w child option} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {![info exists data($child,createcmd)]} {
|
||||
error "page \"$child\" does not exist in $w"
|
||||
}
|
||||
|
||||
case $option {
|
||||
-createcmd {
|
||||
return "$data($child,createcmd)"
|
||||
}
|
||||
-raisecmd {
|
||||
return "$data($child,raisecmd)"
|
||||
}
|
||||
default {
|
||||
if {$data(w:top) ne $w} {
|
||||
return [$data(w:top) pagecget $child $option]
|
||||
} else {
|
||||
error "unknown option \"$option\""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixVStack:pageconfigure {w child args} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {![info exists data($child,createcmd)]} {
|
||||
error "page \"$child\" does not exist in $w"
|
||||
}
|
||||
|
||||
set len [llength $args]
|
||||
|
||||
if {$len == 0} {
|
||||
set value [$data(w:top) pageconfigure $child]
|
||||
lappend value [list -createcmd "" "" "" $data($child,createcmd)]
|
||||
lappend value [list -raisecmd "" "" "" $data($child,raisecmd)]
|
||||
return $value
|
||||
}
|
||||
|
||||
if {$len == 1} {
|
||||
case [lindex $args 0] {
|
||||
-createcmd {
|
||||
return [list -createcmd "" "" "" $data($child,createcmd)]
|
||||
}
|
||||
-raisecmd {
|
||||
return [list -raisecmd "" "" "" $data($child,raisecmd)]
|
||||
}
|
||||
default {
|
||||
return [$data(w:top) pageconfigure $child [lindex $args 0]]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# By default handle each of the options
|
||||
#
|
||||
set opt(-createcmd) $data($child,createcmd)
|
||||
set opt(-raisecmd) $data($child,raisecmd)
|
||||
|
||||
tixHandleOptions -nounknown opt {-createcmd -raisecmd} $args
|
||||
|
||||
#
|
||||
# the widget options
|
||||
set new_args ""
|
||||
foreach {flag value} $args {
|
||||
if {$flag ne "-createcmd" && $flag ne "-raisecmd"} {
|
||||
lappend new_args $flag
|
||||
lappend new_args $value
|
||||
}
|
||||
}
|
||||
|
||||
if {[llength $new_args] >= 2} {
|
||||
eval $data(w:top) pageconfig $child $new_args
|
||||
}
|
||||
|
||||
#
|
||||
# The add-on options
|
||||
set data($child,raisecmd) $opt(-raisecmd)
|
||||
set data($child,createcmd) $opt(-createcmd)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
proc tixVStack:pages {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
return $data(windows)
|
||||
}
|
||||
|
||||
proc tixVStack:raise {w child} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {![info exists data($child,createcmd)]} {
|
||||
error "page $child does not exist"
|
||||
}
|
||||
|
||||
if {[llength $data($child,createcmd)]} {
|
||||
uplevel #0 $data($child,createcmd)
|
||||
set data($child,createcmd) ""
|
||||
}
|
||||
|
||||
tixCallMethod $w RaiseChildFrame $child
|
||||
|
||||
set oldTopChild $data(topchild)
|
||||
set data(topchild) $child
|
||||
|
||||
if {$oldTopChild ne $child} {
|
||||
if {[llength $data($child,raisecmd)]} {
|
||||
uplevel #0 $data($child,raisecmd)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixVStack:raised {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
return $data(topchild)
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Virtual Methods
|
||||
#----------------------------------------------------------------------
|
||||
proc tixVStack:InitGeometryManager {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
bind $w <Configure> "tixVStack:MasterGeomProc $w"
|
||||
bind $data(w:top) <Destroy> "+tixVStack:DestroyTop $w"
|
||||
|
||||
if {$data(repack) == 0} {
|
||||
set data(repack) 1
|
||||
tixWidgetDoWhenIdle tixCallMethod $w Resize
|
||||
}
|
||||
}
|
||||
|
||||
proc tixVStack:CreateChildFrame {w child} {
|
||||
upvar #0 $w data
|
||||
|
||||
set f [frame $data(w:top).$child]
|
||||
|
||||
tixManageGeometry $f "tixVStack:ClientGeomProc $w"
|
||||
bind $f <Configure> "tixVStack:ClientGeomProc $w -configure $f"
|
||||
bind $f <Destroy> "$w delete $child"
|
||||
|
||||
return $f
|
||||
}
|
||||
|
||||
proc tixVStack:RaiseChildFrame {w child} {
|
||||
upvar #0 $w data
|
||||
|
||||
# Hide the original visible window
|
||||
if {$data(topchild) ne "" && $data(topchild) ne $child} {
|
||||
tixUnmapWindow $data(w:$data(topchild))
|
||||
}
|
||||
|
||||
set myW [winfo width $w]
|
||||
set myH [winfo height $w]
|
||||
|
||||
set cW [expr {$myW - $data(pad-x1) - $data(pad-x2) - 2*$data(-ipadx)}]
|
||||
set cH [expr {$myH - $data(pad-y1) - $data(pad-y2) - 2*$data(-ipady)}]
|
||||
set cX [expr {$data(pad-x1) + $data(-ipadx)}]
|
||||
set cY [expr {$data(pad-y1) + $data(-ipady)}]
|
||||
|
||||
if {$cW > 0 && $cH > 0} {
|
||||
tixMoveResizeWindow $data(w:$child) $cX $cY $cW $cH
|
||||
tixMapWindow $data(w:$child)
|
||||
raise $data(w:$child)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# G E O M E T R Y M A N A G E M E N T
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
proc tixVStack:DestroyTop {w} {
|
||||
catch {
|
||||
destroy $w
|
||||
}
|
||||
}
|
||||
|
||||
proc tixVStack:MasterGeomProc {w args} {
|
||||
if {![winfo exists $w]} {
|
||||
return
|
||||
}
|
||||
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(repack) == 0} {
|
||||
set data(repack) 1
|
||||
tixWidgetDoWhenIdle tixCallMethod $w Resize
|
||||
}
|
||||
}
|
||||
|
||||
proc tixVStack:ClientGeomProc {w flag client} {
|
||||
if {![winfo exists $w]} {
|
||||
return
|
||||
}
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(repack) == 0} {
|
||||
set data(repack) 1
|
||||
tixWidgetDoWhenIdle tixCallMethod $w Resize
|
||||
}
|
||||
|
||||
if {$flag eq "-lostslave"} {
|
||||
error "Geometry Management Error: \
|
||||
Another geometry manager has taken control of $client.\
|
||||
This error is usually caused because a widget has been created\
|
||||
in the wrong frame: it should have been created inside $client instead\
|
||||
of $w"
|
||||
}
|
||||
}
|
||||
|
||||
proc tixVStack:Resize {w} {
|
||||
if {![winfo exists $w]} {
|
||||
return
|
||||
}
|
||||
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(nWindows) == 0} {
|
||||
set data(repack) 0
|
||||
return
|
||||
}
|
||||
|
||||
if {$data(-width) == 0 || $data(-height) == 0} {
|
||||
if {!$data(-dynamicgeometry)} {
|
||||
# Calculate my required width and height
|
||||
#
|
||||
set maxW 1
|
||||
set maxH 1
|
||||
|
||||
foreach child $data(windows) {
|
||||
set cW [winfo reqwidth $data(w:$child)]
|
||||
set cH [winfo reqheight $data(w:$child)]
|
||||
|
||||
if {$maxW < $cW} {
|
||||
set maxW $cW
|
||||
}
|
||||
if {$maxH < $cH} {
|
||||
set maxH $cH
|
||||
}
|
||||
}
|
||||
set reqW $maxW
|
||||
set reqH $maxH
|
||||
} else {
|
||||
if {$data(topchild) ne ""} {
|
||||
set reqW [winfo reqwidth $data(w:$data(topchild))]
|
||||
set reqH [winfo reqheight $data(w:$data(topchild))]
|
||||
} else {
|
||||
set reqW 1
|
||||
set reqH 1
|
||||
}
|
||||
}
|
||||
|
||||
incr reqW [expr {$data(pad-x1) + $data(pad-x2) + 2*$data(-ipadx)}]
|
||||
incr reqH [expr {$data(pad-y1) + $data(pad-y2) + 2*$data(-ipady)}]
|
||||
|
||||
if {$reqW < $data(minW)} {
|
||||
set reqW $data(minW)
|
||||
}
|
||||
if {$reqH < $data(minH)} {
|
||||
set reqH $data(minH)
|
||||
}
|
||||
}
|
||||
# These take higher precedence
|
||||
#
|
||||
if {$data(-width) != 0} {
|
||||
set reqW $data(-width)
|
||||
}
|
||||
if {$data(-height) != 0} {
|
||||
set reqH $data(-height)
|
||||
}
|
||||
|
||||
if {[winfo reqwidth $w] != $reqW || [winfo reqheight $w] != $reqH} {
|
||||
if {![info exists data(counter)]} {
|
||||
set data(counter) 0
|
||||
}
|
||||
if {$data(counter) < 50} {
|
||||
incr data(counter)
|
||||
tixGeometryRequest $w $reqW $reqH
|
||||
tixWidgetDoWhenIdle tixCallMethod $w Resize
|
||||
set data(repack) 1
|
||||
return
|
||||
}
|
||||
}
|
||||
set data(counter) 0
|
||||
|
||||
if {$data(w:top) ne $w} {
|
||||
tixMoveResizeWindow $data(w:top) 0 0 [winfo width $w] [winfo height $w]
|
||||
tixMapWindow $data(w:top)
|
||||
}
|
||||
|
||||
if {[string equal $data(topchild) ""]} {
|
||||
set top [lindex $data(windows) 0]
|
||||
} else {
|
||||
set top $data(topchild)
|
||||
}
|
||||
|
||||
if {$top ne ""} {
|
||||
tixCallMethod $w raise $top
|
||||
}
|
||||
|
||||
set data(repack) 0
|
||||
}
|
||||
195
win32/lib/tix8.4.3/VTree.tcl
Normal file
@@ -0,0 +1,195 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: VTree.tcl,v 1.6 2004/03/28 02:44:57 hobbs Exp $
|
||||
#
|
||||
# VTree.tcl --
|
||||
#
|
||||
# Virtual base class for Tree widgets.
|
||||
#
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# Copyright (c) 2000-2001 Tix Project Group.
|
||||
# Copyright (c) 2004 ActiveState
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
|
||||
tixWidgetClass tixVTree {
|
||||
-virtual true
|
||||
-classname TixVTree
|
||||
-superclass tixScrolledHList
|
||||
-method {
|
||||
}
|
||||
-flag {
|
||||
-ignoreinvoke
|
||||
}
|
||||
-configspec {
|
||||
{-ignoreinvoke ignoreInvoke IgnoreInvoke false tixVerifyBoolean}
|
||||
}
|
||||
-default {
|
||||
}
|
||||
}
|
||||
|
||||
proc tixVTree:InitWidgetRec {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w InitWidgetRec
|
||||
}
|
||||
|
||||
proc tixVTree:ConstructWidget {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w ConstructWidget
|
||||
|
||||
set data(indStyle) \
|
||||
[tixDisplayStyle image -refwindow $data(w:hlist) -padx 0 -pady 0]
|
||||
}
|
||||
|
||||
proc tixVTree:SetBindings {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
tixChainMethod $w SetBindings
|
||||
|
||||
$data(w:hlist) config \
|
||||
-indicatorcmd [list tixVTree:IndicatorCmd $w] \
|
||||
-browsecmd [list tixVTree:BrowseCmdHook $w] \
|
||||
-command [list tixVTree:CommandHook $w]
|
||||
}
|
||||
|
||||
proc tixVTree:IndicatorCmd {w args} {
|
||||
upvar #0 $w data
|
||||
|
||||
set event [tixEvent type]
|
||||
set ent [tixEvent flag V]
|
||||
|
||||
set type [tixVTree:GetType $w $ent]
|
||||
set plus [tix getimage plus]
|
||||
set plusarm [tix getimage plusarm]
|
||||
set minus [tix getimage minus]
|
||||
set minusarm [tix getimage minusarm]
|
||||
|
||||
if {![$data(w:hlist) info exists $ent]} {return}
|
||||
switch -exact -- $event {
|
||||
<Arm> {
|
||||
if {![$data(w:hlist) indicator exists $ent]} {return}
|
||||
$data(w:hlist) indicator config $ent \
|
||||
-image [expr {$type eq "open" ? $plusarm : $minusarm}]
|
||||
}
|
||||
<Disarm> {
|
||||
if {![$data(w:hlist) indicator exists $ent]} {return}
|
||||
$data(w:hlist) indicator config $ent \
|
||||
-image [expr {$type eq "open" ? $plus : $minus}]
|
||||
}
|
||||
<Activate> {
|
||||
upvar bind bind
|
||||
tixCallMethod $w Activate $ent $type
|
||||
set bind(%V) $ent
|
||||
tixVTree:BrowseCmdHook $w
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc tixVTree:GetType {w ent} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {![$data(w:hlist) indicator exists $ent]} {
|
||||
return none
|
||||
}
|
||||
|
||||
set img [$data(w:hlist) indicator cget $ent -image]
|
||||
if {$img eq [tix getimage plus] || $img eq [tix getimage plusarm]} {
|
||||
return open
|
||||
}
|
||||
return close
|
||||
}
|
||||
|
||||
proc tixVTree:Activate {w ent type} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$type eq "open"} {
|
||||
tixCallMethod $w OpenCmd $ent
|
||||
$data(w:hlist) indicator config $ent -image [tix getimage minus]
|
||||
} else {
|
||||
tixCallMethod $w CloseCmd $ent
|
||||
$data(w:hlist) indicator config $ent -image [tix getimage plus]
|
||||
}
|
||||
}
|
||||
|
||||
proc tixVTree:CommandHook {w args} {
|
||||
upvar #0 $w data
|
||||
upvar bind bind
|
||||
|
||||
tixCallMethod $w Command bind
|
||||
}
|
||||
|
||||
proc tixVTree:BrowseCmdHook {w args} {
|
||||
upvar #0 $w data
|
||||
upvar bind bind
|
||||
|
||||
tixCallMethod $w BrowseCmd bind
|
||||
}
|
||||
|
||||
proc tixVTree:SetMode {w ent mode} {
|
||||
upvar #0 $w data
|
||||
|
||||
switch -exact -- $mode {
|
||||
open {
|
||||
$data(w:hlist) indicator create $ent -itemtype image \
|
||||
-image [tix getimage plus] -style $data(indStyle)
|
||||
}
|
||||
close {
|
||||
$data(w:hlist) indicator create $ent -itemtype image \
|
||||
-image [tix getimage minus] -style $data(indStyle)
|
||||
}
|
||||
none {
|
||||
if {[$data(w:hlist) indicator exist $ent]} {
|
||||
$data(w:hlist) indicator delete $ent
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Virtual Methods
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
proc tixVTree:OpenCmd {w ent} {
|
||||
upvar #0 $w data
|
||||
|
||||
# The default action
|
||||
foreach kid [$data(w:hlist) info children $ent] {
|
||||
$data(w:hlist) show entry $kid
|
||||
}
|
||||
}
|
||||
|
||||
proc tixVTree:CloseCmd {w ent} {
|
||||
upvar #0 $w data
|
||||
|
||||
# The default action
|
||||
foreach kid [$data(w:hlist) info children $ent] {
|
||||
$data(w:hlist) hide entry $kid
|
||||
}
|
||||
}
|
||||
|
||||
proc tixVTree:Command {w B} {
|
||||
upvar #0 $w data
|
||||
upvar $B bind
|
||||
|
||||
if {$data(-ignoreinvoke)} {
|
||||
return
|
||||
}
|
||||
set ent [tixEvent flag V]
|
||||
if {[$data(w:hlist) indicator exist $ent]} {
|
||||
tixVTree:Activate $w $ent [tixVTree:GetType $w $ent]
|
||||
}
|
||||
}
|
||||
|
||||
proc tixVTree:BrowseCmd {w B} {
|
||||
}
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Widget commands
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
101
win32/lib/tix8.4.3/Variable.tcl
Normal file
@@ -0,0 +1,101 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: Variable.tcl,v 1.4 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# Variable.tcl --
|
||||
#
|
||||
# Routines in this file are used to set up and operate variables
|
||||
# for classes that support the -variable option
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
|
||||
# tixVariable:ConfigVariable --
|
||||
#
|
||||
# Set up the -variable option for the object $w
|
||||
#
|
||||
# Side effects:
|
||||
#
|
||||
# data(-variable) is changed to the name of the global variable
|
||||
# if the global variable exists, data(-value) takes the value of this
|
||||
# variable.
|
||||
# if the global variable does not exist, it is created with the
|
||||
# current data(-value)
|
||||
#
|
||||
# Return value:
|
||||
#
|
||||
# true is data(-value) is changed, indicating that data(-command)
|
||||
# should be invoked.
|
||||
#
|
||||
proc tixVariable:ConfigVariable {w arg} {
|
||||
upvar #0 $w data
|
||||
|
||||
set changed 0
|
||||
|
||||
if {$data(-variable) != ""} {
|
||||
uplevel #0 \
|
||||
[list trace vdelete $data(-variable) w "tixVariable:TraceProc $w"]
|
||||
}
|
||||
|
||||
if {$arg != ""} {
|
||||
if {[uplevel #0 info exists [list $arg]]} {
|
||||
# This global variable exists, we use its value
|
||||
#
|
||||
set data(-value) [uplevel #0 set [list $arg]]
|
||||
set changed 1
|
||||
} else {
|
||||
# This global variable does not exist; let's set it
|
||||
#
|
||||
uplevel #0 [list set $arg $data(-value)]
|
||||
}
|
||||
uplevel #0 \
|
||||
[list trace variable $arg w "tixVariable:TraceProc $w"]
|
||||
}
|
||||
|
||||
return $changed
|
||||
}
|
||||
|
||||
proc tixVariable:UpdateVariable {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
if {$data(-variable) != ""} {
|
||||
uplevel #0 \
|
||||
[list trace vdelete $data(-variable) w "tixVariable:TraceProc $w"]
|
||||
uplevel #0 \
|
||||
[list set $data(-variable) $data(-value)]
|
||||
uplevel #0 \
|
||||
[list trace variable $data(-variable) w "tixVariable:TraceProc $w"]
|
||||
|
||||
# just in case someone has another trace and restricted my change
|
||||
#
|
||||
set data(-value) [uplevel #0 set [list $data(-variable)]]
|
||||
}
|
||||
}
|
||||
|
||||
proc tixVariable:TraceProc {w name1 name2 op} {
|
||||
upvar #0 $w data
|
||||
set varname $data(-variable)
|
||||
|
||||
if {[catch {$w config -value [uplevel #0 [list set $varname]]} err]} {
|
||||
uplevel #0 [list set $varname [list [$w cget -value]]]
|
||||
error $err
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
proc tixVariable:DeleteVariable {w} {
|
||||
upvar #0 $w data
|
||||
|
||||
# Must delete the trace command of the -variable
|
||||
#
|
||||
if {$data(-variable) != ""} {
|
||||
uplevel #0 \
|
||||
[list trace vdelete $data(-variable) w "tixVariable:TraceProc $w"]
|
||||
}
|
||||
}
|
||||
40
win32/lib/tix8.4.3/WInfo.tcl
Normal file
@@ -0,0 +1,40 @@
|
||||
# -*- mode: TCL; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
|
||||
#
|
||||
# $Id: WInfo.tcl,v 1.2 2001/12/09 05:04:02 idiscovery Exp $
|
||||
#
|
||||
# WInfo.tcl --
|
||||
#
|
||||
# This file implements the command tixWInfo, which return various
|
||||
# information about a Tix widget.
|
||||
#
|
||||
# Copyright (c) 1993-1999 Ioi Kim Lam.
|
||||
# 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.
|
||||
#
|
||||
|
||||
proc tixWInfo {option w} {
|
||||
upvar #0 $w data
|
||||
|
||||
case $option {
|
||||
tix {
|
||||
# Is this a Tix widget?
|
||||
#
|
||||
return [info exists data(className)]
|
||||
}
|
||||
compound {
|
||||
# Is this a compound widget?
|
||||
# Currently this is the same as "tixWinfo tix" because only
|
||||
# Tix compilant compound widgets are supported
|
||||
return [info exists data(className)]
|
||||
}
|
||||
class {
|
||||
if {[info exists data(className)]} {
|
||||
return $data(className)
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
win32/lib/tix8.4.3/bitmaps/act_fold.gif
Normal file
|
After Width: | Height: | Size: 90 B |
5
win32/lib/tix8.4.3/bitmaps/act_fold.xbm
Normal file
@@ -0,0 +1,5 @@
|
||||
#define act_fold_width 16
|
||||
#define act_fold_height 10
|
||||
static unsigned char act_fold_bits[] = {
|
||||
0xfc, 0x00, 0xaa, 0x0f, 0x55, 0x15, 0xeb, 0xff, 0x15, 0x80, 0x0b, 0x40,
|
||||
0x05, 0x20, 0x03, 0x10, 0x01, 0x08, 0xff, 0x07};
|
||||
22
win32/lib/tix8.4.3/bitmaps/act_fold.xpm
Normal file
@@ -0,0 +1,22 @@
|
||||
/* XPM */
|
||||
static char * act_fold_xpm[] = {
|
||||
/* width height num_colors chars_per_pixel */
|
||||
"16 12 4 1",
|
||||
/* colors */
|
||||
" s None c None",
|
||||
". c black",
|
||||
"X c yellow",
|
||||
"o c #5B5B57574646",
|
||||
/* pixels */
|
||||
" .... ",
|
||||
" .XXXX. ",
|
||||
" .XXXXXX. ",
|
||||
"............. ",
|
||||
".oXoXoXoXoXo. ",
|
||||
".XoX............",
|
||||
".oX.XXXXXXXXXXX.",
|
||||
".Xo.XXXXXXXXXX. ",
|
||||
".o.XXXXXXXXXXX. ",
|
||||
".X.XXXXXXXXXXX. ",
|
||||
"..XXXXXXXXXX.. ",
|
||||
"............. "};
|
||||
4
win32/lib/tix8.4.3/bitmaps/balarrow.xbm
Normal file
@@ -0,0 +1,4 @@
|
||||
#define balarrow_width 6
|
||||
#define balarrow_height 6
|
||||
static char balarrow_bits[] = {
|
||||
0x1f, 0x07, 0x07, 0x09, 0x11, 0x20};
|
||||
6
win32/lib/tix8.4.3/bitmaps/cbxarrow.xbm
Normal file
@@ -0,0 +1,6 @@
|
||||
#define cbxarrow_width 11
|
||||
#define cbxarrow_height 14
|
||||
static char cbxarrow_bits[] = {
|
||||
0x00, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00, 0x70, 0x00,
|
||||
0xfe, 0x03, 0xfc, 0x01, 0xf8, 0x00, 0x70, 0x00, 0x20, 0x00, 0x00, 0x00,
|
||||
0xfe, 0x03, 0xfe, 0x03};
|
||||
6
win32/lib/tix8.4.3/bitmaps/ck_def.xbm
Normal file
@@ -0,0 +1,6 @@
|
||||
#define ck_def_width 13
|
||||
#define ck_def_height 13
|
||||
static unsigned char ck_def_bits[] = {
|
||||
0xff, 0x1f, 0x01, 0x10, 0x55, 0x15, 0x01, 0x10, 0x55, 0x15, 0x01, 0x10,
|
||||
0x55, 0x15, 0x01, 0x10, 0x55, 0x15, 0x01, 0x10, 0x55, 0x15, 0x01, 0x10,
|
||||
0xff, 0x1f};
|
||||
6
win32/lib/tix8.4.3/bitmaps/ck_off.xbm
Normal file
@@ -0,0 +1,6 @@
|
||||
#define ck_off_width 13
|
||||
#define ck_off_height 13
|
||||
static unsigned char ck_off_bits[] = {
|
||||
0xff, 0x1f, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10,
|
||||
0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10,
|
||||
0xff, 0x1f};
|
||||
6
win32/lib/tix8.4.3/bitmaps/ck_on.xbm
Normal file
@@ -0,0 +1,6 @@
|
||||
#define ck_on_width 13
|
||||
#define ck_on_height 13
|
||||
static unsigned char ck_on_bits[] = {
|
||||
0xff, 0x1f, 0x01, 0x10, 0x01, 0x10, 0x01, 0x14, 0x01, 0x16, 0x01, 0x17,
|
||||
0x89, 0x13, 0xdd, 0x11, 0xf9, 0x10, 0x71, 0x10, 0x21, 0x10, 0x01, 0x10,
|
||||
0xff, 0x1f};
|
||||
6
win32/lib/tix8.4.3/bitmaps/cross.xbm
Normal file
@@ -0,0 +1,6 @@
|
||||
#define cross_width 14
|
||||
#define cross_height 14
|
||||
static char cross_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x06, 0x18, 0x0e, 0x1c, 0x1c, 0x0e, 0x38, 0x07,
|
||||
0xf0, 0x03, 0xe0, 0x01, 0xe0, 0x01, 0xf0, 0x03, 0x38, 0x07, 0x1c, 0x0e,
|
||||
0x0e, 0x1c, 0x06, 0x18};
|
||||
4
win32/lib/tix8.4.3/bitmaps/decr.xbm
Normal file
@@ -0,0 +1,4 @@
|
||||
#define decr_width 7
|
||||
#define decr_height 4
|
||||
static char decr_bits[] = {
|
||||
0x7f, 0x3e, 0x1c, 0x08};
|
||||
8
win32/lib/tix8.4.3/bitmaps/drop.xbm
Normal file
@@ -0,0 +1,8 @@
|
||||
#define drop_width 16
|
||||
#define drop_height 16
|
||||
#define drop_x_hot 6
|
||||
#define drop_y_hot 4
|
||||
static unsigned char drop_bits[] = {
|
||||
0x00, 0x00, 0xfe, 0x07, 0x02, 0x04, 0x02, 0x04, 0x42, 0x04, 0xc2, 0x04,
|
||||
0xc2, 0x05, 0xc2, 0x07, 0xc2, 0x07, 0xc2, 0x0f, 0xfe, 0x1f, 0xc0, 0x07,
|
||||
0xc0, 0x06, 0x00, 0x0c, 0x00, 0x1c, 0x00, 0x08};
|
||||
BIN
win32/lib/tix8.4.3/bitmaps/file.gif
Normal file
|
After Width: | Height: | Size: 76 B |
5
win32/lib/tix8.4.3/bitmaps/file.xbm
Normal file
@@ -0,0 +1,5 @@
|
||||
#define file_width 12
|
||||
#define file_height 12
|
||||
static unsigned char file_bits[] = {
|
||||
0xfe, 0x00, 0x02, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
|
||||
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0xfe, 0x03};
|
||||
18
win32/lib/tix8.4.3/bitmaps/file.xpm
Normal file
@@ -0,0 +1,18 @@
|
||||
/* XPM */
|
||||
static char * file_xpm[] = {
|
||||
"12 12 3 1",
|
||||
" s None c None",
|
||||
". c black",
|
||||
"X c #FFFFFFFFF3CE",
|
||||
" ........ ",
|
||||
" .XXXXXX. ",
|
||||
" .XXXXXX... ",
|
||||
" .XXXXXXXX. ",
|
||||
" .XXXXXXXX. ",
|
||||
" .XXXXXXXX. ",
|
||||
" .XXXXXXXX. ",
|
||||
" .XXXXXXXX. ",
|
||||
" .XXXXXXXX. ",
|
||||
" .XXXXXXXX. ",
|
||||
" .XXXXXXXX. ",
|
||||
" .......... "};
|
||||
BIN
win32/lib/tix8.4.3/bitmaps/folder.gif
Normal file
|
After Width: | Height: | Size: 79 B |
5
win32/lib/tix8.4.3/bitmaps/folder.xbm
Normal file
@@ -0,0 +1,5 @@
|
||||
#define folder_width 16
|
||||
#define folder_height 10
|
||||
static unsigned char folder_bits[] = {
|
||||
0xfc, 0x00, 0x02, 0x07, 0x01, 0x08, 0x01, 0x08, 0x01, 0x08, 0x01, 0x08,
|
||||
0x01, 0x08, 0x01, 0x08, 0x01, 0x08, 0xff, 0x07};
|
||||
21
win32/lib/tix8.4.3/bitmaps/folder.xpm
Normal file
@@ -0,0 +1,21 @@
|
||||
/* XPM */
|
||||
static char * folder_foo_xpm[] = {
|
||||
/* width height num_colors chars_per_pixel */
|
||||
"16 12 3 1",
|
||||
/* colors */
|
||||
" s None c None",
|
||||
". c black",
|
||||
"X c #f0ff80",
|
||||
/* pixels */
|
||||
" .... ",
|
||||
" .XXXX. ",
|
||||
" .XXXXXX. ",
|
||||
"............. ",
|
||||
".XXXXXXXXXXX. ",
|
||||
".XXXXXXXXXXX. ",
|
||||
".XXXXXXXXXXX. ",
|
||||
".XXXXXXXXXXX. ",
|
||||
".XXXXXXXXXXX. ",
|
||||
".XXXXXXXXXXX. ",
|
||||
".XXXXXXXXXXX. ",
|
||||
"............. "};
|
||||
14
win32/lib/tix8.4.3/bitmaps/harddisk.xbm
Normal file
@@ -0,0 +1,14 @@
|
||||
#define harddisk_width 32
|
||||
#define harddisk_height 32
|
||||
static unsigned char harddisk_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};
|
||||
16
win32/lib/tix8.4.3/bitmaps/hourglas.mask
Normal file
@@ -0,0 +1,16 @@
|
||||
#define hourglass_mask_width 32
|
||||
#define hourglass_mask_height 32
|
||||
#define hourglass_mask_x_hot 16
|
||||
#define hourglass_mask_y_hot 15
|
||||
static char hourglass_mask_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0x7f,
|
||||
0x58, 0x00, 0x00, 0x34, 0x58, 0x00, 0x00, 0x34, 0x58, 0x00, 0x00, 0x34,
|
||||
0x98, 0x00, 0x00, 0x32, 0x98, 0x00, 0x00, 0x32, 0x98, 0x00, 0x00, 0x32,
|
||||
0x18, 0x01, 0x00, 0x31, 0x18, 0xfd, 0x7e, 0x31, 0x18, 0xfa, 0xbf, 0x30,
|
||||
0x18, 0xe4, 0x4f, 0x30, 0x18, 0xd8, 0x37, 0x30, 0x18, 0x20, 0x09, 0x30,
|
||||
0x18, 0x40, 0x05, 0x30, 0x18, 0x20, 0x08, 0x30, 0x18, 0x18, 0x31, 0x30,
|
||||
0x18, 0x04, 0x41, 0x30, 0x18, 0x02, 0x80, 0x30, 0x18, 0x01, 0x00, 0x31,
|
||||
0x18, 0x01, 0x00, 0x31, 0x98, 0x00, 0x01, 0x32, 0x98, 0x00, 0x01, 0x32,
|
||||
0x98, 0x80, 0x03, 0x32, 0x58, 0xc0, 0x07, 0x34, 0x58, 0xf0, 0x1f, 0x34,
|
||||
0x58, 0xfe, 0xff, 0x34, 0xf8, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x7f,
|
||||
0xfc, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00};
|
||||
16
win32/lib/tix8.4.3/bitmaps/hourglas.xbm
Normal file
@@ -0,0 +1,16 @@
|
||||
#define hourglass_width 32
|
||||
#define hourglas_height 32
|
||||
#define hourglas_x_hot 16
|
||||
#define hourglas_y_hot 15
|
||||
static char hourglas_bits[] = {
|
||||
0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff,
|
||||
0x7c, 0x00, 0x00, 0x7c, 0x7c, 0x00, 0x00, 0x7c, 0x7c, 0x00, 0x00, 0x7c,
|
||||
0xfc, 0x00, 0x00, 0x7e, 0xfc, 0x00, 0x00, 0x7e, 0xfc, 0x00, 0x00, 0x7e,
|
||||
0xbc, 0x01, 0x00, 0x7b, 0xbc, 0xfd, 0x7e, 0x7b, 0x3c, 0xfb, 0xbf, 0x79,
|
||||
0x3c, 0xe6, 0xcf, 0x78, 0x3c, 0xdc, 0x77, 0x78, 0x3c, 0x38, 0x39, 0x78,
|
||||
0x3c, 0x60, 0x0d, 0x78, 0x3c, 0x38, 0x38, 0x78, 0x3c, 0x1c, 0x71, 0x78,
|
||||
0x3c, 0x06, 0xc1, 0x78, 0x3c, 0x03, 0x80, 0x79, 0xbc, 0x01, 0x00, 0x7b,
|
||||
0xbc, 0x01, 0x00, 0x7b, 0xfc, 0x00, 0x01, 0x7e, 0xfc, 0x00, 0x01, 0x7e,
|
||||
0xfc, 0x80, 0x03, 0x7e, 0x7c, 0xc0, 0x07, 0x7c, 0x7c, 0xf0, 0x1f, 0x7c,
|
||||
0x7c, 0xfe, 0xff, 0x7c, 0xfe, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0xff,
|
||||
0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff};
|
||||
4
win32/lib/tix8.4.3/bitmaps/incr.xbm
Normal file
@@ -0,0 +1,4 @@
|
||||
#define incr_width 7
|
||||
#define incr_height 4
|
||||
static char incr_bits[] = {
|
||||
0x08, 0x1c, 0x3e, 0x7f};
|
||||
BIN
win32/lib/tix8.4.3/bitmaps/info.gif
Normal file
|
After Width: | Height: | Size: 159 B |
38
win32/lib/tix8.4.3/bitmaps/info.xpm
Normal file
@@ -0,0 +1,38 @@
|
||||
/* XPM */
|
||||
static char * info_xpm[] = {
|
||||
"32 32 3 1",
|
||||
" s None c None",
|
||||
". c #000000000000",
|
||||
"X c white",
|
||||
" ",
|
||||
" ......... ",
|
||||
" ...XXXXXXXXX... ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" ..XXXXXXXXXXXXXXXXX.. ",
|
||||
" .XXXXXXXXXXXXXXXXXXXXX. ",
|
||||
" .XXXXXXXXXX...XXXXXXXXXX. ",
|
||||
" .XXXXXXXXX.....XXXXXXXXX. ",
|
||||
" .XXXXXXXXX.......XXXXXXXXX. ",
|
||||
" .XXXXXXXXXX.......XXXXXXXXXX. ",
|
||||
" .XXXXXXXXXX.......XXXXXXXXXX. ",
|
||||
" .XXXXXXXXXXX.....XXXXXXXXXXX. ",
|
||||
".XXXXXXXXXXXXX...XXXXXXXXXXXXX. ",
|
||||
".XXXXXXXXXXXXXXXXXXXXXXXXXXXXX. ",
|
||||
".XXXXXXXXXXXXXXXXXXXXXXXXXXXXX. ",
|
||||
".XXXXXXXXXXX.......XXXXXXXXXXX. ",
|
||||
".XXXXXXXXXXX.......XXXXXXXXXXX. ",
|
||||
".XXXXXXXXXXX.......XXXXXXXXXXX. ",
|
||||
".XXXXXXXXXXX.......XXXXXXXXXXX. ",
|
||||
".XXXXXXXXXXX.......XXXXXXXXXXX. ",
|
||||
".XXXXXXXXXXX.......XXXXXXXXXXX. ",
|
||||
" .XXXXXXXXXX.......XXXXXXXXXX. ",
|
||||
" .XXXXXXXXXX.......XXXXXXXXXX. ",
|
||||
" .XXXXXXXXXX.......XXXXXXXXXX. ",
|
||||
" .XXXXXXXXX.......XXXXXXXXX. ",
|
||||
" .XXXXXXXX.......XXXXXXXX. ",
|
||||
" .XXXXXXXX.......XXXXXXXX. ",
|
||||
" .XXXXXXXXXXXXXXXXXXXXX. ",
|
||||
" ..XXXXXXXXXXXXXXXXX.. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" ...XXXXXXXXX... ",
|
||||
" ......... "};
|
||||
6
win32/lib/tix8.4.3/bitmaps/maximize.xbm
Normal file
@@ -0,0 +1,6 @@
|
||||
#define maximize_width 15
|
||||
#define maximize_height 15
|
||||
static unsigned char maximize_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0xfc, 0x1f, 0x04, 0x10, 0x04, 0x70, 0x04, 0x70,
|
||||
0x04, 0x70, 0x04, 0x70, 0x04, 0x70, 0x04, 0x70, 0x04, 0x70, 0x04, 0x70,
|
||||
0xfc, 0x7f, 0xf0, 0x7f, 0xf0, 0x7f};
|
||||
6
win32/lib/tix8.4.3/bitmaps/minimize.xbm
Normal file
@@ -0,0 +1,6 @@
|
||||
#define minimize_width 15
|
||||
#define minimize_height 15
|
||||
static unsigned char minimize_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01,
|
||||
0x20, 0x03, 0x20, 0x03, 0xe0, 0x03, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
BIN
win32/lib/tix8.4.3/bitmaps/minus.gif
Normal file
|
After Width: | Height: | Size: 57 B |
5
win32/lib/tix8.4.3/bitmaps/minus.xbm
Normal file
@@ -0,0 +1,5 @@
|
||||
#define minus_width 9
|
||||
#define minus_height 9
|
||||
static unsigned char minus_bits[] = {
|
||||
0xff, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x7d, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0xff, 0x01};
|
||||
14
win32/lib/tix8.4.3/bitmaps/minus.xpm
Normal file
@@ -0,0 +1,14 @@
|
||||
/* XPM */
|
||||
static char * minus_xpm[] = {
|
||||
"9 9 2 1",
|
||||
". s None c None",
|
||||
" c black",
|
||||
" ",
|
||||
" ....... ",
|
||||
" ....... ",
|
||||
" ....... ",
|
||||
" . . ",
|
||||
" ....... ",
|
||||
" ....... ",
|
||||
" ....... ",
|
||||
" "};
|
||||
BIN
win32/lib/tix8.4.3/bitmaps/minusarm.gif
Normal file
|
After Width: | Height: | Size: 59 B |
5
win32/lib/tix8.4.3/bitmaps/minusarm.xbm
Normal file
@@ -0,0 +1,5 @@
|
||||
#define minusarm_width 9
|
||||
#define minusarm_height 9
|
||||
static unsigned char minusarm_bits[] = {
|
||||
0xff, 0x01, 0x01, 0x01, 0x7d, 0x01, 0x7d, 0x01, 0x01, 0x01, 0x7d, 0x01,
|
||||
0x7d, 0x01, 0x01, 0x01, 0xff, 0x01};
|
||||
15
win32/lib/tix8.4.3/bitmaps/minusarm.xpm
Normal file
@@ -0,0 +1,15 @@
|
||||
/* XPM */
|
||||
static char * minusarm_xpm[] = {
|
||||
"9 9 3 1",
|
||||
" c black",
|
||||
". c yellow",
|
||||
"X c #808080808080",
|
||||
" ",
|
||||
" ....... ",
|
||||
" ....... ",
|
||||
" .XXXXX. ",
|
||||
" .X X. ",
|
||||
" .XXXXX. ",
|
||||
" ....... ",
|
||||
" ....... ",
|
||||
" "};
|
||||
14
win32/lib/tix8.4.3/bitmaps/mktransgif.tcl
Normal file
@@ -0,0 +1,14 @@
|
||||
#
|
||||
# $Id: mktransgif.tcl,v 1.1.1.1 2000/05/17 11:08:46 idiscovery Exp $
|
||||
#
|
||||
#!/usr/local/bin/tclsh
|
||||
|
||||
set dont(plusarm.gif) 1
|
||||
set dont(minusarm.gif) 1
|
||||
|
||||
foreach file [glob *.gif] {
|
||||
if ![info exists dont($file)] {
|
||||
puts "giftool -1 -B $file"
|
||||
}
|
||||
}
|
||||
|
||||
14
win32/lib/tix8.4.3/bitmaps/network.xbm
Normal file
@@ -0,0 +1,14 @@
|
||||
#define network_width 32
|
||||
#define network_height 32
|
||||
static unsigned char network_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};
|
||||
BIN
win32/lib/tix8.4.3/bitmaps/no_entry.gif
Normal file
|
After Width: | Height: | Size: 176 B |