MenuEditor.st
changeset 1778 32befdc61270
parent 1775 695f10f213d1
child 1780 5f831e1fc839
equal deleted inserted replaced
1777:fbf082828db6 1778:32befdc61270
   213         hideMenuOnActivated
   213         hideMenuOnActivated
   214         auxValue
   214         auxValue
   215         activeHelpKey
   215         activeHelpKey
   216         resourceRetriever
   216         resourceRetriever
   217         sendToOriginator
   217         sendToOriginator
       
   218         ignoreMnemonicKeys
       
   219         ignoreShortcutKeys
   218      )
   220      )
   219 ! !
   221 ! !
   220 
   222 
   221 !MenuEditor class methodsFor:'defaults'!
   223 !MenuEditor class methodsFor:'defaults'!
   222 
   224 
   317 #browseResource
   319 #browseResource
   318 'Search for methods with image resource.'
   320 'Search for methods with image resource.'
   319 
   321 
   320 #detailsAccelerator
   322 #detailsAccelerator
   321 'Accelerator key to select the menu item from the keyboard (Cmdx or Ctrlx).'
   323 'Accelerator key to select the menu item from the keyboard (Cmdx or Ctrlx).'
       
   324 
       
   325 #detailsIgnoreAcceleratorKeys
       
   326 'Ignore accelerator keys in submenu(s).'
       
   327 
       
   328 #detailsIgnoreMnemonicKeys
       
   329 'Ignore mnemonic keys (access characters) in submenu(s).'
   322 
   330 
   323 #detailsAccessCharaterPosition
   331 #detailsAccessCharaterPosition
   324 'Index of the access character position of the textual label (obsolete, VW compatibility).'
   332 'Index of the access character position of the textual label (obsolete, VW compatibility).'
   325 
   333 
   326 #detailsAuxValue
   334 #detailsAuxValue
  2906         window: 
  2914         window: 
  2907        (WindowSpec
  2915        (WindowSpec
  2908           label: 'Details Edit'
  2916           label: 'Details Edit'
  2909           name: 'Details Edit'
  2917           name: 'Details Edit'
  2910           min: (Point 10 10)
  2918           min: (Point 10 10)
  2911           bounds: (Rectangle 14 46 274 291)
  2919           bounds: (Rectangle 12 22 419 313)
  2912         )
  2920         )
  2913         component: 
  2921         component: 
  2914        (SpecCollection
  2922        (SpecCollection
  2915           collection: (
  2923           collection: (
  2916            (LabelSpec
  2924            (LabelSpec
  3028             )
  3036             )
  3029            (LabelSpec
  3037            (LabelSpec
  3030               label: 'Access Character Position:'
  3038               label: 'Access Character Position:'
  3031               name: 'accessCharLabel'
  3039               name: 'accessCharLabel'
  3032               layout: (AlignmentOrigin 217 0 170 0 1 0.5)
  3040               layout: (AlignmentOrigin 217 0 170 0 1 0.5)
  3033               activeHelpKey: detailsAccessCharaterPosition
       
  3034               resizeForLabel: true
  3041               resizeForLabel: true
  3035               adjust: right
  3042               adjust: right
  3036             )
  3043             )
  3037            (InputFieldSpec
  3044            (InputFieldSpec
  3038               name: 'accessCharField'
  3045               name: 'accessCharField'
  3047               acceptOnTab: true
  3054               acceptOnTab: true
  3048               acceptChannel: acceptChannel
  3055               acceptChannel: acceptChannel
  3049               modifiedChannel: modifiedChannel
  3056               modifiedChannel: modifiedChannel
  3050               acceptOnPointerLeave: false
  3057               acceptOnPointerLeave: false
  3051             )
  3058             )
       
  3059            (CheckBoxSpec
       
  3060               label: 'Ignore Accelerators in Submenu'
       
  3061               name: 'ignoreShortcutKeys'
       
  3062               layout: (AlignmentOrigin 42 0 204 0 0 0.5)
       
  3063               activeHelpKey: detailsIgnoreAcceleratorKeys
       
  3064               visibilityChannel: hasSubmenu
       
  3065               model: ignoreShortcutKeys
       
  3066               translateLabel: true
       
  3067               resizeForLabel: true
       
  3068             )
       
  3069            (CheckBoxSpec
       
  3070               label: 'Ignore Mnemonics in Submenu'
       
  3071               name: 'ignoreMnemonicKeys'
       
  3072               layout: (AlignmentOrigin 42 0 232 0 0 0.5)
       
  3073               activeHelpKey: detailsIgnoreMnemonicKeys
       
  3074               visibilityChannel: hasSubmenu
       
  3075               model: ignoreMnemonicKeys
       
  3076               translateLabel: true
       
  3077               resizeForLabel: true
       
  3078             )
  3052            (LabelSpec
  3079            (LabelSpec
  3053               label: 'Font:'
  3080               label: 'Font:'
  3054               name: 'fontLabel'
  3081               name: 'fontLabel'
  3055               layout: (AlignmentOrigin 75 0 219 0 1 0.5)
  3082               layout: (AlignmentOrigin 75 0 271 0 1 0.5)
  3056               resizeForLabel: true
  3083               resizeForLabel: true
  3057               adjust: right
  3084               adjust: right
  3058             )
  3085             )
  3059            (FontMenuSpec
  3086            (FontMenuSpec
  3060               attributes: 
  3087               attributes: 
  3061              (tabable
  3088              (tabable
  3062                 true
  3089                 true
  3063               )
  3090               )
  3064               name: 'fontMenu'
  3091               name: 'fontMenu'
  3065               layout: (LayoutFrame 78 0 208 0 -5 1.0 230 0)
  3092               layout: (LayoutFrame 78 0 260 0 -5 1.0 282 0)
  3066               activeHelpKey: fontMenu
  3093               activeHelpKey: fontMenu
  3067               model: font
  3094               model: font
  3068             )
  3095             )
  3069            )
  3096            )
  3070          
  3097          
  3077 addBindingsTo:aspects for:aMenuEditor
  3104 addBindingsTo:aspects for:aMenuEditor
  3078     "add additional bindings to the aspects
  3105     "add additional bindings to the aspects
  3079     "
  3106     "
  3080     aspects at:#notDelayedMenu ifAbsentPut:[
  3107     aspects at:#notDelayedMenu ifAbsentPut:[
  3081         true asValue
  3108         true asValue
       
  3109     ].
       
  3110     aspects at:#hasSubmenu ifAbsentPut:[
       
  3111         false asValue
  3082     ].
  3112     ].
  3083 ! !
  3113 ! !
  3084 
  3114 
  3085 !MenuEditor::Item class methodsFor:'testing'!
  3115 !MenuEditor::Item class methodsFor:'testing'!
  3086 
  3116 
  3190     "
  3220     "
  3191     MenuEditor aspects do:[:aKey|
  3221     MenuEditor aspects do:[:aKey|
  3192         (aspects at:aKey) value:(menuItem perform:aKey)
  3222         (aspects at:aKey) value:(menuItem perform:aKey)
  3193     ].
  3223     ].
  3194     (aspects at:#notDelayedMenu) value:(self isDelayedMenu not).
  3224     (aspects at:#notDelayedMenu) value:(self isDelayedMenu not).
       
  3225     (aspects at:#hasSubmenu)     value:(self isKindOfMenu or:[self children size ~~ 0]).
  3195 ! !
  3226 ! !
  3196 
  3227 
  3197 !MenuEditor::Item methodsFor:'displaying'!
  3228 !MenuEditor::Item methodsFor:'displaying'!
  3198 
  3229 
  3199 displayLabel
  3230 displayLabel
  3736             children first argument:aValue
  3767             children first argument:aValue
  3737         ].
  3768         ].
  3738         menuItem argument:aValue.
  3769         menuItem argument:aValue.
  3739       ^ self
  3770       ^ self
  3740     ].
  3771     ].
       
  3772 
  3741     aKey == #triggerOnDown ifTrue:[
  3773     aKey == #triggerOnDown ifTrue:[
  3742         self hasDelayedMenu ifTrue:[
  3774         self hasDelayedMenu ifTrue:[
  3743             menuItem triggerOnDown:false
  3775             menuItem triggerOnDown:false
  3744         ] ifFalse:[
  3776         ] ifFalse:[
  3745             menuItem triggerOnDown:aValue
  3777             menuItem triggerOnDown:aValue