home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / propifcomb.tcl < prev    next >
Text File  |  1996-12-17  |  3KB  |  85 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Westmount Technology    1994
  4. #
  5. #      File:           @(#)propifcomb.tcl    /main/hindenburg/2
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)propifcomb.tcl    /main/hindenburg/2   17 Dec 1996 Copyright 1994 Westmount Technology
  10.  
  11. # Start user added include file section
  12.  
  13. require "propifelem.tcl"
  14.  
  15. # End user added include file section
  16.  
  17. require "propinterf.tcl"
  18.  
  19. Class PropIfCombo : {PropInterface} {
  20.     method destructor
  21.     constructor
  22.     method getProperties
  23.     method setProperties
  24.     attribute extraValue
  25.     attribute textDef
  26.     attribute selectIf
  27. }
  28.  
  29. method PropIfCombo::destructor {this} {
  30.     # Start destructor user section
  31.     # End destructor user section
  32.     $this PropInterface::destructor
  33. }
  34.  
  35. constructor PropIfCombo {class this guiParent propDef} {
  36.     set this [PropInterface::constructor $class $this]
  37.     set box [PropIfElement new $guiParent [lindex [$propDef memberSet] 0]]
  38.     eval $this config -definition $propDef \
  39.               -ifElement [$box ifElement] \
  40.               -textDef [lindex [$propDef memberSet] 1] \
  41.               -selectIf $box [$propDef ifOptions]
  42.     return $this
  43. }
  44.  
  45. method PropIfCombo::getProperties {this propContainer} {
  46.     global valueMethod
  47.     set def [[$this selectIf] definition]
  48.     set key [$def name]
  49.     set class [$def ifClass]
  50.     set elem [$this ifElement]
  51.     set key2 [[$this textDef] name]
  52.     set value [$propContainer getPropertyValue $key]
  53.     if {$value == ""} {
  54.         set value [PropIfElement::defaultValue $class $elem]
  55.     } elseif {$value == [$this extraValue]} {
  56.         set value [$propContainer getPropertyValue $key2]
  57.     }
  58.     $elem $valueMethod($class) $value
  59.     $elem sensitive [expr [$propContainer isPropertyEditable $key] && \
  60.                   [$propContainer isPropertyEditable $key2]]
  61. }
  62.  
  63. method PropIfCombo::setProperties {this propContainer} {
  64.     global valueMethod
  65.     set def [[$this selectIf] definition]
  66.     set elem [$this ifElement]
  67.     set class [$def ifClass]
  68.     set value [$elem $valueMethod($class)]
  69.     set defVal [PropIfElement::defaultValue $class $elem]
  70.     set prop [$def name]
  71.     set textDef [$this textDef]
  72.     foreach entry [$elem entrySet] {
  73.         if {$entry == $value} {
  74.             $propContainer changeProperty $prop $value $defVal
  75.             $propContainer removeProperty $textDef
  76.             return
  77.         }
  78.     }
  79.     $propContainer changeProperty $prop [$this extraValue] $defVal
  80.     $propContainer changeProperty [$textDef name] $value ""
  81. }
  82.  
  83. # Do not delete this line -- regeneration end marker
  84.  
  85.