home *** CD-ROM | disk | FTP | other *** search
-
- class xuiStructure {
- inherit xuiObject
-
- variable children {}
- variable nameMap
- variable align horizontal
-
- variable style none
-
- constructor {} {
- array set nameMap {}
- setXuiClass structure
-
- }
- destructor {
- eval delete object $children
- }
- method getComponentByName { name }
- method addComponent { xuiObject }
- method getText {}
- method getComponents {}
- method clear {}
- method forgetComponents {}
- method insertComponent {xuiObject name}
- method clone
- method copyClone { clone }
- method setAlign { newAlign } { set align $newAlign }
- method getAlign {} { return $align }
- method setStyle { newStyle } { set style $newStyle }
- method getStyle {} { return $style }
- method reset {}
- }
-
- body xuiStructure::reset {} {
- foreach child $children {
- $child reset
- }
- }
-
- body xuiStructure::clone {{parentName {::#auto}}} {
- #puts "********************Cloning $this with parentname $parentName"
- set clone [xuiStructure $parentName.$name]
- copyClone $clone
- $clone setXuiClass $xuiClass
- return $clone
- }
-
- body xuiStructure::copyClone { clone } {
- #puts "going to copy clone $this to $clone which has children [$clone getComponents]"
- xuiObject::copyClone $clone
- $clone clear
- foreach component $children {
- $clone addComponent [$component clone $clone]
- }
- $clone setAlign $align
- $clone setStyle $style
-
-
- }
-
-
- body xuiStructure::forgetComponents {} {
- set children {}
- catch {unset nameMap}
- variable nameMap
- }
-
- body xuiStructure::clear {} {
- #puts "clearing $this"
- #puts "--[$this getComponents]"
- #puts "children $children"
- foreach child $children {
- #puts "Deleting $child"
- delete object $child
- }
- set children {}
- catch {unset nameMap}
- variable nameMap
- }
-
- body xuiStructure::getComponentByName { name } {
- if [info exists nameMap($name)] {
- return $nameMap($name)
- } else {
- return {}
- }
- }
-
- body xuiStructure::addComponent { xuiObject } {
- #puts "adding $xuiObject"
- lappend children $xuiObject
- #puts "$children"
- array set nameMap [list [$xuiObject getName] $xuiObject]
- }
-
- body xuiStructure::getText {} {
- set result {}
- foreach object $children {
- append result "[$object getText] "
- }
-
- return [string trimleft $result ]
- }
-
- body xuiStructure::getComponents {} {
- return $children
- }
-
- body xuiStructure::insertComponent { xuiObject name} {
- set children [linsert $children \
- [lsearch -exact $nameMap($name)] $xuiObject]
- array set nameMap [list [$xuiObject getName] $xuiObject]
- }
-
-
-
-