home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / menuparent.tcl < prev    next >
Text File  |  1996-10-24  |  8KB  |  274 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Westmount Technology    1994
  4. #
  5. #      File:           @(#)menuparent.tcl    /main/hindenburg/2
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)menuparent.tcl    /main/hindenburg/2   24 Oct 1996 Copyright 1994 Westmount Technology
  10.  
  11. # Start user added include file section
  12. require mnemonicbu.tcl
  13. # End user added include file section
  14.  
  15. require "menudefine.tcl"
  16.  
  17. Class MenuParentDialog : {MenuDefineDialog} {
  18.     constructor
  19.     method destructor
  20.     method createInterface
  21.     method clearInterface
  22.     method fromInterface
  23.     method toInterface
  24.     method load
  25.     method objName
  26.     attribute iPage
  27.     attribute aPage
  28. }
  29.  
  30. constructor MenuParentDialog {class this name} {
  31.     set this [MenuDefineDialog::constructor $class $this $name]
  32.     # Start constructor user section
  33.     # End constructor user section
  34.     return $this
  35. }
  36.  
  37. method MenuParentDialog::destructor {this} {
  38.     # Start destructor user section
  39.     # End destructor user section
  40.     $this MenuDefineDialog::destructor
  41. }
  42.  
  43. method MenuParentDialog::createInterface {this} {
  44.  
  45.     #indentation of this function is 4 spaces to make it easier to read
  46.     $this MenuDefineDialog::createInterface
  47.  
  48.     # create "interface" page
  49.     interface NoteBkPage $this.InterfaceNBP {
  50.         label Interface
  51.         DlgRow NG { 
  52.             DlgColumn DC {
  53.                 DlgRow DR {
  54.                     verStretchFactor 0
  55.                     sizeEqual 1
  56.                     NamedGroup NG {
  57.                         label Name 
  58.                         DlgColumn DC {
  59.                             SingleLineText nameSLT {}
  60.                             }
  61.                     }
  62.                     NamedGroup NG {
  63.                         label Mnemonic 
  64.                         DlgRow DR {
  65.                             spaceType EVEN
  66.                             MnemonicButton  mnemonicDDL { 
  67.                                 verStretchFactor 0
  68.                                 horStretchFactor 0
  69.                 entrySet " "
  70.                 
  71.                             }
  72.                         }
  73.                     }
  74.                 }
  75.                 DlgRow DR {
  76.                     verStretchFactor 0
  77.                     sizeEqual 1
  78.                     NamedGroup NG {
  79.                         label "Hint text" 
  80.                         DlgColumn DC {
  81.                             SingleLineText hintSLT {}
  82.                             }
  83.                     }
  84.                 }
  85.                 DlgRow DR {
  86.                     verStretchFactor 0
  87.                     NamedGroup NG {
  88.                         DlgRow DR {
  89.                             CheckButton  pinnableCB { 
  90.                 label Pinnable
  91.                                 state 0
  92.                             }
  93.                         }
  94.                     }
  95.                 }
  96.             } 
  97.         }
  98.     }
  99.  
  100.     $this iPage $this.InterfaceNBP.NG.DC.DR.NG
  101.     [$this iPage].DC.nameSLT textModified "[$this iPage].DR.mnemonicDDL \
  102.                                                 entrySet \[%this text\]"
  103.  
  104.     # create "arbiter" page
  105.     interface NoteBkPage $this.ArbiterNBP {
  106.         label Arbiters
  107.         DlgRow NG { 
  108.             DlgColumn DC {
  109.                 NamedGroup NG {
  110.                     label "Arbiter 1"
  111.                     DlgColumn DC {
  112.             Label L { 
  113.                             text Name
  114.                         }
  115.                         SingleLineText nameSLT1 {}
  116.             Label L { 
  117.                             text CurrentButtonChanged
  118.                         }
  119.                         MultiLineText buttonChangedMLT1 {
  120.                             rowCount 2
  121.                         }
  122.                     }
  123.                 }
  124.                 NamedGroup NG {
  125.                     label "Arbiter 2"
  126.                     DlgColumn DC {
  127.             Label L { 
  128.                             text Name
  129.                         }
  130.                         SingleLineText nameSLT2 {}
  131.             Label L { 
  132.                             text CurrentButtonChanged
  133.                         }
  134.                         MultiLineText buttonChangedMLT2 {
  135.                             rowCount 2
  136.                         }
  137.                     }
  138.                 }
  139.                 NamedGroup NG {
  140.                     label "Arbiter 3"
  141.                     DlgColumn DC {
  142.             Label L { 
  143.                             text Name
  144.                         }
  145.                         SingleLineText nameSLT3 {}
  146.             Label L { 
  147.                             text CurrentButtonChanged
  148.                         }
  149.                         MultiLineText buttonChangedMLT3 {
  150.                             rowCount 2
  151.                         }
  152.                     }
  153.                 }
  154.             } 
  155.         }
  156.     }
  157.  
  158.     $this aPage $this.ArbiterNBP.NG.DC.NG.DC
  159.  
  160. }
  161.  
  162. method MenuParentDialog::clearInterface {this} {
  163.  
  164.     $this MenuDefineDialog::clearInterface
  165.  
  166.     # clean page "Interface"
  167.     [$this iPage].DC.nameSLT text ""
  168.     [$this iPage].DR.mnemonicDDL entrySet {}
  169.     [$this iPage].DR.pinnableCB state 0
  170.     [$this iPage].DC.hintSLT text ""
  171.     [$this aPage].nameSLT1 text ""
  172.     [$this aPage].buttonChangedMLT1 text ""
  173.     [$this aPage].nameSLT2 text ""
  174.     [$this aPage].buttonChangedMLT2 text ""
  175.     [$this aPage].nameSLT3 text ""
  176.     [$this aPage].buttonChangedMLT3 text ""
  177. }
  178.  
  179. method MenuParentDialog::fromInterface {this} {
  180.  
  181.     # save page "Interface"
  182.     set spec ""
  183.     set spec "$spec label \"[[$this iPage].DC.nameSLT text]\""
  184.     if {[string trim [[$this iPage].DR.mnemonicDDL selected]] != ""} {
  185.         set spec "$spec mnemonic [[$this iPage].DR.mnemonicDDL selected]"
  186.     }
  187.  
  188.     if { [[$this curObject] type] != "CustMenuBarButton" } {
  189.         set hint [string trim [[$this iPage].DC.hintSLT text]]
  190.         if ![lempty $hint] {
  191.             set spec "$spec hintText \"$hint\""
  192.         }
  193.     }
  194.  
  195.     [$this curObject] pinnable [[$this iPage].DR.pinnableCB state]
  196.  
  197.     set arbiters ""
  198.     if ![lempty [[$this aPage].nameSLT1 text]] {
  199.         lappend arbiters "\{[[$this aPage].nameSLT1 text]\} \
  200.                   \{[[$this aPage].buttonChangedMLT1 text]\}"
  201.     }
  202.     if ![lempty [[$this aPage].nameSLT2 text]] {
  203.         lappend arbiters "\{[[$this aPage].nameSLT2 text]\} \
  204.                   \{[[$this aPage].buttonChangedMLT2 text]\}"
  205.     }
  206.     if ![lempty [[$this aPage].nameSLT3 text]] {
  207.         lappend arbiters "\{[[$this aPage].nameSLT3 text]\} \
  208.                   \{[[$this aPage].buttonChangedMLT3 text]\}"
  209.     }
  210.  
  211.     [$this curObject] arbiters $arbiters
  212.  
  213.     return $spec
  214. }
  215.  
  216. method MenuParentDialog::toInterface {this key value} {
  217.  
  218.     # page "Interface"
  219.     if {$key == "label"} {
  220.  
  221.         [$this iPage].DC.nameSLT text $value
  222.         [$this iPage].DR.mnemonicDDL entrySet $value
  223.         return
  224.     }
  225.  
  226.     if {$key == "mnemonic"} { 
  227.         [$this iPage].DR.mnemonicDDL selected $value
  228.         return
  229.     }
  230.  
  231.     if { [[$this curObject] type] != "CustMenuBarButton" } {
  232.         if {$key == "hintText"} {
  233.             [$this iPage].DC.hintSLT text $value
  234.         }
  235.     }
  236. }
  237.  
  238. method MenuParentDialog::load {this object} {
  239.  
  240.     $this MenuDefineDialog::load $object
  241.     [$this iPage].DR.pinnableCB state [$object pinnable]
  242.  
  243.     # disable the hintText for MenuBarButtons, 
  244.     # A MenuBarButton has no hintText YET (next release?)
  245.     if { [[$this curObject] type] != "CustMenuBarButton" } {
  246.         [$this iPage].DC.hintSLT sensitive 1
  247.     } else {
  248.         [$this iPage].DC.hintSLT sensitive 0
  249.     }
  250.  
  251.     set count 1
  252.     foreach i [$object arbiters] {
  253.         [$this aPage].nameSLT$count text [lindex $i 0]
  254.         [$this aPage].buttonChangedMLT$count text [lindex $i 1]
  255.         if {$count == 3} {
  256.             break;
  257.         } else {
  258.             incr count
  259.         }
  260.     }
  261. }
  262.  
  263. method MenuParentDialog::objName {this args} {
  264.  
  265.     if {$args == ""} {
  266.         return [[$this iPage].DC.nameSLT text]
  267.     } else {
  268.         [$this iPage].DC.nameSLT text [join $args]
  269.     }
  270. }
  271.  
  272. # Do not delete this line -- regeneration end marker
  273.  
  274.