home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1997
- #
- # File: @(#)propifelem.tcl /main/titanic/7
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)propifelem.tcl /main/titanic/7 31 Oct 1997 Copyright 1997 Cayenne Software Inc.
-
- # Start user added include file section
-
- global valueMethod labelMethod
- global hasEntrySet defIndex
-
- set valueMethod(CheckButton) state
- set labelMethod(CheckButton) label
- set defIndex(CheckButton) 0
-
- set valueMethod(ComboBox) text
- set hasEntrySet(ComboBox) true
- set defIndex(ComboBox) 0
-
- set valueMethod(DropDwnComboBox) text
- set hasEntrySet(DropDwnComboBox) true
- set defIndex(DropDwnComboBox) 0
-
- set valueMethod(DropDwnList) selected
- set valueMethod(FloatField) text
- set valueMethod(HorControlPanel) selected
- set valueMethod(HorRadioGroup) selected
- set valueMethod(Image) pixmap
- set valueMethod(IntField) text
- set valueMethod(Label) text
- set valueMethod(MultiLineText) text
- set valueMethod(PropIfClassLib) selected
-
- set valueMethod(OptionMenu) selected
- set hasEntrySet(OptionMenu) true
- set defIndex(OptionMenu) 0
-
- set valueMethod(SingleLineText) text
- set valueMethod(TextList) selectedSet
- set valueMethod(VerControlPanel) selected
- set valueMethod(VerRadioGroup) selected
-
- # End user added include file section
-
- require "propinterf.tcl"
-
- Class PropIfElement : {PropInterface} {
- method destructor
- constructor
- method getProperties
- method setProperties
- }
-
- method PropIfElement::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this PropInterface::destructor
- }
-
- constructor PropIfElement {class this guiParent propDef} {
- set this [PropInterface::constructor $class $this]
- $this definition $propDef
- set name [$propDef name]
- set class [$propDef ifClass]
- global valueMethod labelMethod
- if {![PropIfElement::canHandle $class]} {
- error "Invalid interface class '$class'"
- }
- if [info exists labelMethod($class)] {
- $this ifElement [eval $class new [list $guiParent.$name] \
- [$propDef ifOptions]]
- [$this ifElement] $labelMethod($class) [$propDef longName]
- } else {
- Label new $guiParent.${name}l -text [$propDef longName]
- $this ifElement [eval $class new [list $guiParent.$name] \
- [$propDef ifOptions]]
- }
- return $this
- }
-
- proc PropIfElement::defaultValue {className ifOptions} {
- set defIdx -1
- global valueMethod
- set optList [concat $ifOptions]
- if [info exists valueMethod($className)] {
- set defIdx [lsearch -exact $optList -$valueMethod($className)]
- }
- if {$defIdx != -1} {
- return [lindex $optList [incr defIdx]]
- }
-
- global hasEntrySet defIndex
- if [info exists defIndex($className)] {
- if [info exists hasEntrySet($className)] {
- set entSetIdx [lsearch -exact $optList -entrySet]
- if {$entSetIdx != -1} {
- set entrySet [lindex $optList [incr entSetIdx]]
- return [lindex $entrySet $defIndex($className)]
- }
- }
- return $defIndex($className)
- }
-
- return ""
- }
-
- proc PropIfElement::canHandle {className} {
- global valueMethod
- return [info exists valueMethod($className)]
- }
-
- method PropIfElement::getProperties {this propContainer} {
- global valueMethod
- set def [$this definition]
- set key [$def name]
- set class [$def ifClass]
- set ifOpts [$def ifOptions]
- set elem [$this ifElement]
- set value [$propContainer getPropertyValue $key]
- if {[string length $value] == 0} {
- set value [PropIfElement::defaultValue $class $ifOpts]
- }
- $elem $valueMethod($class) $value
- $elem sensitive [$propContainer isPropertyEditable $key]
- }
-
- method PropIfElement::setProperties {this propContainer} {
- global valueMethod
- set def [$this definition]
- set elem [$this ifElement]
- set class [$def ifClass]
- set ifOpts [$def ifOptions]
- set value [$elem $valueMethod($class)]
- set defVal [PropIfElement::defaultValue $class $ifOpts]
- $propContainer changeProperty [$def name] $value $defVal
- }
-
- # Do not delete this line -- regeneration end marker
-
-