MenuEditor.st
changeset 1623 3fac80dbb0b3
parent 1618 9c9b649ce251
child 1629 a79dce7e7045
equal deleted inserted replaced
1622:766547778a34 1623:3fac80dbb0b3
  3354            #(#LabelSpec
  3354            #(#LabelSpec
  3355               #label: 'Indication:'
  3355               #label: 'Indication:'
  3356               #name: 'indicationLabel'
  3356               #name: 'indicationLabel'
  3357               #layout: #(#AlignmentOrigin 107 0 138 0 1 0.5)
  3357               #layout: #(#AlignmentOrigin 107 0 138 0 1 0.5)
  3358               #activeHelpKey: #basicsIndication
  3358               #activeHelpKey: #basicsIndication
  3359               #visibilityChannel: #hasNoDelayedMenuValue
       
  3360               #resizeForLabel: true
  3359               #resizeForLabel: true
  3361               #adjust: #right
  3360               #adjust: #right
  3362             )
  3361             )
  3363            #(#InputFieldSpec
  3362            #(#InputFieldSpec
  3364               #name: 'indicationField'
  3363               #name: 'indicationField'
  3365               #layout: #(#LayoutFrame 110 0 127 0 -5 1.0 149 0)
  3364               #layout: #(#LayoutFrame 110 0 127 0 -5 1.0 149 0)
  3366               #activeHelpKey: #basicsIndication
  3365               #activeHelpKey: #basicsIndication
  3367               #visibilityChannel: #hasNoDelayedMenuValue
       
  3368               #enableChannel: #indicationEnabled
  3366               #enableChannel: #indicationEnabled
  3369               #tabable: true
  3367               #tabable: true
  3370               #model: #indication
  3368               #model: #indication
  3371               #group: #inputGroup
  3369               #group: #inputGroup
  3372               #type: #symbolOrNil
  3370               #type: #symbolOrNil
  3380            #(#LabelSpec
  3378            #(#LabelSpec
  3381               #label: 'Choice:'
  3379               #label: 'Choice:'
  3382               #name: 'choiceLabel'
  3380               #name: 'choiceLabel'
  3383               #layout: #(#AlignmentOrigin 107 0 163 0 1 0.5)
  3381               #layout: #(#AlignmentOrigin 107 0 163 0 1 0.5)
  3384               #activeHelpKey: #basicsChoice
  3382               #activeHelpKey: #basicsChoice
  3385               #visibilityChannel: #hasNoDelayedMenuValue
       
  3386               #translateLabel: true
  3383               #translateLabel: true
  3387               #resizeForLabel: true
  3384               #resizeForLabel: true
  3388               #adjust: #right
  3385               #adjust: #right
  3389             )
  3386             )
  3390            #(#InputFieldSpec
  3387            #(#InputFieldSpec
  3391               #name: 'choiceField'
  3388               #name: 'choiceField'
  3392               #layout: #(#LayoutFrame 110 0 152 0 -5 1.0 174 0)
  3389               #layout: #(#LayoutFrame 110 0 152 0 -5 1.0 174 0)
  3393               #activeHelpKey: #basicsChoice
  3390               #activeHelpKey: #basicsChoice
  3394               #visibilityChannel: #hasNoDelayedMenuValue
       
  3395               #enableChannel: #choiceEnabled
  3391               #enableChannel: #choiceEnabled
  3396               #tabable: true
  3392               #tabable: true
  3397               #model: #choice
  3393               #model: #choice
  3398               #group: #inputGroup
  3394               #group: #inputGroup
  3399               #type: #symbolOrNil
  3395               #type: #symbolOrNil
  3407            #(#LabelSpec
  3403            #(#LabelSpec
  3408               #label: 'Value:'
  3404               #label: 'Value:'
  3409               #name: 'choiceValueLabel'
  3405               #name: 'choiceValueLabel'
  3410               #layout: #(#AlignmentOrigin 107 0 188 0 1 0.5)
  3406               #layout: #(#AlignmentOrigin 107 0 188 0 1 0.5)
  3411               #activeHelpKey: #basicsChoiceValue
  3407               #activeHelpKey: #basicsChoiceValue
  3412               #visibilityChannel: #hasNoDelayedMenuValue
       
  3413               #translateLabel: true
  3408               #translateLabel: true
  3414               #resizeForLabel: true
  3409               #resizeForLabel: true
  3415               #adjust: #right
  3410               #adjust: #right
  3416             )
  3411             )
  3417            #(#InputFieldSpec
  3412            #(#InputFieldSpec
  3418               #name: 'choiceValueField'
  3413               #name: 'choiceValueField'
  3419               #layout: #(#LayoutFrame 110 0 177 0 -5 1.0 199 0)
  3414               #layout: #(#LayoutFrame 110 0 177 0 -5 1.0 199 0)
  3420               #activeHelpKey: #basicsChoiceValue
  3415               #activeHelpKey: #basicsChoiceValue
  3421               #visibilityChannel: #hasNoDelayedMenuValue
       
  3422               #enableChannel: #choiceValueEnabled
  3416               #enableChannel: #choiceValueEnabled
  3423               #tabable: true
  3417               #tabable: true
  3424               #model: #choiceValue
  3418               #model: #choiceValue
  3425               #group: #inputGroup
  3419               #group: #inputGroup
  3426               #type: #smalltalkObject
  3420               #type: #smalltalkObject
  3469            #(#CheckBoxSpec
  3463            #(#CheckBoxSpec
  3470               #label: 'Trigger On Down'
  3464               #label: 'Trigger On Down'
  3471               #name: 'triggerOnDown'
  3465               #name: 'triggerOnDown'
  3472               #layout: #(#Point 20 313)
  3466               #layout: #(#Point 20 313)
  3473               #activeHelpKey: #triggerOnDown
  3467               #activeHelpKey: #triggerOnDown
  3474               #visibilityChannel: #hasNoDelayedMenuValue
  3468               #enableChannel: #hasNoDelayedMenuValue
  3475               #tabable: true
  3469               #tabable: true
  3476               #model: #triggerOnDown
  3470               #model: #triggerOnDown
  3477               #translateLabel: true
  3471               #translateLabel: true
  3478             )
  3472             )
  3479            )
  3473            )
  3534     "
  3528     "
  3535     (anItem isKindOfMenu and:[self canAddDelayedMenu]) ifFalse:[
  3529     (anItem isKindOfMenu and:[self canAddDelayedMenu]) ifFalse:[
  3536         ^ nil
  3530         ^ nil
  3537     ].
  3531     ].
  3538     "/ reset values not setable if a delayed menu is configured
  3532     "/ reset values not setable if a delayed menu is configured
  3539 
       
  3540     menuItem        choice:nil.
       
  3541     menuItem    indication:nil.
       
  3542     menuItem   choiceValue:nil.
       
  3543     menuItem triggerOnDown:false.
  3533     menuItem triggerOnDown:false.
  3544 
  3534     anItem        argument:(menuItem argument).
  3545     anItem argument:(menuItem argument).
       
  3546 
  3535 
  3547     isExpanded := false.
  3536     isExpanded := false.
  3548     anItem parent:self.
  3537     anItem parent:self.
  3549     children := Array with:anItem.
  3538     children := Array with:anItem.
  3550     self expand.
  3539     self expand.
  3561             children first argument:aValue
  3550             children first argument:aValue
  3562         ].
  3551         ].
  3563         menuItem argument:aValue.
  3552         menuItem argument:aValue.
  3564       ^ self
  3553       ^ self
  3565     ].
  3554     ].
       
  3555     aKey == #triggerOnDown ifTrue:[
       
  3556         self hasDelayedMenu ifTrue:[
       
  3557             menuItem triggerOnDown:false
       
  3558         ] ifFalse:[
       
  3559             menuItem triggerOnDown:aValue
       
  3560         ].
       
  3561         ^ self.
       
  3562     ].
  3566     super aspectAt:aKey put:aValue.
  3563     super aspectAt:aKey put:aValue.
  3567 !
  3564 !
  3568 
  3565 
  3569 toAspects:aspects
  3566 toAspects:aspects
  3570     "write values to aspects
  3567     "write values to aspects
  3571     "
  3568     "
       
  3569     |hasDelayedMenu|
       
  3570 
  3572     super toAspects:aspects.
  3571     super toAspects:aspects.
  3573 
  3572 
  3574     (aspects at:#hasNoDelayedMenuValue) value:(self hasDelayedMenu not).
  3573     hasDelayedMenu := self hasDelayedMenu.
       
  3574     (aspects at:#hasNoDelayedMenuValue) value:(hasDelayedMenu not).
       
  3575 
       
  3576     hasDelayedMenu ifTrue:[
       
  3577         (aspects at:#triggerOnDown) value:false
       
  3578     ].
  3575 ! !
  3579 ! !
  3576 
  3580 
  3577 !MenuEditor::ItemAction methodsFor:'displaying'!
  3581 !MenuEditor::ItemAction methodsFor:'displaying'!
  3578 
  3582 
  3579 icon
  3583 icon
  3608 ! !
  3612 ! !
  3609 
  3613 
  3610 !MenuEditor::ItemAction methodsFor:'queries - operation'!
  3614 !MenuEditor::ItemAction methodsFor:'queries - operation'!
  3611 
  3615 
  3612 canAddDelayedMenu
  3616 canAddDelayedMenu
  3613     "returns true if a delayed menu can be added;
  3617     "returns true if a delayed menu can be added
  3614      no delayed menu exists and the indication or choice is unspecified
  3618     "
  3615     "
  3619     ^ self hasDelayedMenu not
  3616     self hasDelayedMenu ifTrue:[ ^ false ].
       
  3617   ^ (menuItem indication isNil and:[menuItem choice isNil])
       
  3618 ! !
  3620 ! !
  3619 
  3621 
  3620 !MenuEditor::ItemLinkedMenu class methodsFor:'defaults'!
  3622 !MenuEditor::ItemLinkedMenu class methodsFor:'defaults'!
  3621 
  3623 
  3622 defaultLabel
  3624 defaultLabel