home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CyberMycha 2006 April
/
SGP.iso
/
dema
/
Keepsake-Demo-en-li-v1.0.exe
/
res
/
bin
/
prime
/
oz'event.tcl
< prev
next >
Wrap
Text File
|
2005-10-29
|
2KB
|
78 lines
proc oz'event {flag {code ""}} {
if {$code == ""} {set code $flag}
if {$flag == "-all"} {
chainEvent [uplevel 1 subst \{$code\}]
return
}
chainEvent [uplevel 1 subst -nocommands \{$code\}]
}
proc oz'thread {id code} {
setThreadID $id
$code
setThreadID 0
}
proc oz'delay {time} {
delay [expr floor($time * 1000)]
}
namespace eval wq'widget {
proc new {name args} {
set optstring {{depth "0"} foreground background interface}
array set v [cmdline::getopt $args $optstring]
set sprite [::new oz'sprite $name]
eval "oz'widget::property $sprite $args"
oz'event {
if [oz'widget::valid? $sprite] {
if $v(background?) {
oz'widget::child [BACKGROUNDWIDGET] $sprite $v(depth)
} elseif $v(interface?) {
oz'widget::child [INTERFACEWIDGET] $sprite $v(depth)
} else {
oz'widget::child [FOREGROUNDWIDGET] $sprite $v(depth)
}
}
}
return $sprite
}
proc fadeto {this alpha args} {
if !$this return
set optstring {wait {time 0.5}}
array set v [cmdline::getopt $args $optstring]
oz'event {oz'widget::fadeto $this $alpha $v(time)}
if $v(wait?) {waitfor $this -transit}
}
proc waitfor {this args} {
if !$this return
set optstring {transit animate}
array set v [cmdline::getopt $args $optstring]
if $v(transit?) {oz'event {if [oz'widget::transit? $this] {oz'return wait}}}
if $v(animate?) {oz'event {if [oz'widget::animate? $this] {oz'return wait}}}
}
proc delete {this} {
if !$this return
oz'event {::delete $this}
}
proc delete& {var} {
upvar 1 $var this
if !$this return
oz'event {::delete $this}
set this 0
}
}