home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CyberMycha 2006 April
/
SGP.iso
/
dema
/
Keepsake-Demo-en-li-v1.0.exe
/
res
/
interface
/
common
/
itf.sidebar.tcl
< prev
next >
Wrap
Text File
|
2005-10-31
|
5KB
|
167 lines
proc create_itf {this itf class prop} {
upvar $itf i
if {$i == 0} {
set $itf [new $class]
eval "oz'widget::property $i $prop"
oz'widget::child [FOREGROUNDWIDGET] $i 0.5
oz'event {oz'delay 0.001}
oz'event {itf'sidebar::unselect_all $this}
oz'event {oz'widget::fadeto $i 1}
} else {
if {![oz'widget::usable? $i]} {
itf'sidebar::unselect_all $this
oz'widget::fadeto $i 1
}
}
}
proc hide_widget {w} {
if {$w != 0} {
if [oz'widget::usable? $w] {
oz'widget::fadeto $w 0
}
}
}
proc delete_widget {object} {
upvar $object o
if {$o != 0} {
oz'event {
if [oz'widget::usable? $o] {oz'return remove}
if [oz'widget::visible? $o] {oz'return queue}
delete $o
set $object 0
}
}
}
class itf'sidebar {
proc itf'sidebar {this} oz'widget {itf'sidebar} {
set dirname "interface/[MODE]/sidebar"
set ($this,bg) [new oz'sprite "$dirname/sidebar.bg"]
set ($this,inv) [new oz'button "$dirname/sidebar.inv"]
set ($this,notebook) [new oz'button "$dirname/sidebar.notebook"]
set ($this,vision) [new oz'button "$dirname/sidebar.vision"]
set ($this,option) [new oz'button "$dirname/sidebar.option"]
set ($this,quit) [new oz'button "$dirname/sidebar.quit"]
oz'widget::bind $this enter itf'sidebar::enter $this
oz'widget::bind $this leave itf'sidebar::leave $this
oz'widget::property $this -isize [oz'widget::width $($this,bg)] [oz'widget::height $($this,bg)]
oz'button::property $($this,inv) -click itf'sidebar::inv $this
oz'button::property $($this,notebook) -click itf'sidebar::notebook $this
oz'button::property $($this,vision) -click itf'sidebar::vision $this
oz'button::property $($this,option) -click itf'sidebar::option $this
oz'button::property $($this,quit) -click itf'sidebar::quit $this
oz'widget::property $($this,inv) -pos 0.005859 0.131510
oz'widget::property $($this,notebook) -pos 0.005859 0.235677
oz'widget::property $($this,vision) -pos 0.005859 0.339844
oz'widget::property $($this,option) -pos 0.005859 0.444010
oz'widget::property $($this,quit) -pos 0.005859 0.549479
oz'widget::child $this $($this,bg) 1
oz'widget::child $this $($this,inv) 0
oz'widget::child $this $($this,notebook) 0
oz'widget::child $this $($this,vision) 0
oz'widget::child $this $($this,option) 0
oz'widget::child $this $($this,quit) 0
}
proc ~itf'sidebar {this} {
delete $($this,bg)
delete $($this,inv)
delete $($this,notebook)
delete $($this,visiov)
delete $($this,option)
delete $($this,quit)
}
proc show {this} {
oz'widget::fadeto $this 1
}
proc hide {this} {
unselect_all $this
oz'widget::fadeto $this 0
}
proc unselect_all {this} {
oz'button::unselect $($this,inv)
oz'button::unselect $($this,notebook)
oz'button::unselect $($this,vision)
oz'button::unselect $($this,option)
oz'button::unselect $($this,quit)
unselect_inv $this
unselect_notebook $this
unselect_vision $this
unselect_option $this
unselect_quit $this
}
proc notebook {this} {
itf'sidebar::unselect_all $this
oz'button::select $($this,notebook)
itf'inventory::show $::itf::inventory 2
}
proc unselect_notebook {this} {
itf'inventory::hide $::itf::inventory
}
proc vision {this} {
itf'sidebar::unselect_all $this
oz'button::select $($this,vision)
itf'vision::show $::itf::vision
}
proc unselect_vision {this} {
itf'vision::hide $::itf::vision
}
proc option {this} {
itf'sidebar::unselect_all $this
oz'button::select $($this,option)
oz'widget::fadeto $::itf::option 1
}
proc unselect_option {this} {
oz'widget::fadeto $::itf::option 0
}
proc inv {this} {
itf'sidebar::unselect_all $this
oz'button::select $($this,inv)
itf'inventory::show $::itf::inventory 1
}
proc unselect_inv {this} {
itf'inventory::hide $::itf::inventory
}
proc quit {this} {
itf'sidebar::unselect_all $this
oz'button::select $($this,quit)
oz'widget::fadeto $::itf::quit 1
}
proc unselect_quit {this} {
oz'widget::fadeto $::itf::quit 0
}
proc enter {this} {
oz'mouse::cursor +100
}
proc leave {this} {
oz'mouse::cursor -100
}
}