MenuEditor.st
changeset 1564 0833cfacf787
parent 1547 c770276e8001
child 1566 852d3060ce0a
equal deleted inserted replaced
1563:bf3439f7e277 1564:0833cfacf787
    24 
    24 
    25 Object subclass:#Item
    25 Object subclass:#Item
    26 	instanceVariableNames:'activeHelpKey enabled label value nameKey indication shortcutKey
    26 	instanceVariableNames:'activeHelpKey enabled label value nameKey indication shortcutKey
    27 		accessCharacterPos retriever icon iconAndLabel submenuChannel
    27 		accessCharacterPos retriever icon iconAndLabel submenuChannel
    28 		startGroup argument translateLabel isButton isVisible choice
    28 		startGroup argument translateLabel isButton isVisible choice
    29 		choiceValue auxValue hideMenuOnActivated font
    29 		choiceValue auxValue hideMenuOnActivated font horizontalLayout
    30 		showBusyCursorWhilePerforming keepLinkedMenu triggerOnDown'
    30 		showBusyCursorWhilePerforming keepLinkedMenu triggerOnDown'
    31 	classVariableNames:''
    31 	classVariableNames:''
    32 	poolDictionaries:''
    32 	poolDictionaries:''
    33 	privateIn:MenuEditor
    33 	privateIn:MenuEditor
    34 !
    34 !
   158 
   158 
   159     ^#(
   159     ^#(
   160         label
   160         label
   161         accessCharacterPos
   161         accessCharacterPos
   162         showBusyCursorWhilePerforming
   162         showBusyCursorWhilePerforming
       
   163         horizontalLayout
   163         triggerOnDown
   164         triggerOnDown
   164         font
   165         font
   165         argument
   166         argument
   166         submenuChannel
   167         submenuChannel
   167         keepLinkedMenu
   168         keepLinkedMenu
   353 'If on, a busy cursor is shown while the items action is performing.'
   354 'If on, a busy cursor is shown while the items action is performing.'
   354 
   355 
   355 #triggerOnDown
   356 #triggerOnDown
   356 'If on, the items action is performed on mouse-button press (default is on button-release).'
   357 'If on, the items action is performed on mouse-button press (default is on button-release).'
   357 
   358 
       
   359 #horizontalLayout
       
   360 'If on, the submenu organizes its items horizontal insteat of vertical (default).'
       
   361 
   358 )
   362 )
   359 ! !
   363 ! !
   360 
   364 
   361 !MenuEditor class methodsFor:'image specs'!
   365 !MenuEditor class methodsFor:'image specs'!
   362 
   366 
   794               #activeHelpKey: #basicsTranslateLabel
   798               #activeHelpKey: #basicsTranslateLabel
   795               #tabable: true
   799               #tabable: true
   796               #model: #translateLabel
   800               #model: #translateLabel
   797             )
   801             )
   798            #(#CheckBoxSpec
   802            #(#CheckBoxSpec
       
   803               #label: 'Has Horizontal Layout'
       
   804               #name: 'horizontalLayout'
       
   805               #layout: #(#Point 20 217)
       
   806               #activeHelpKey: #horizontalLayout
       
   807               #tabable: true
       
   808               #model: #horizontalLayout
       
   809             )
       
   810            #(#CheckBoxSpec
   799               #label: 'Do not destroy linked Menu'
   811               #label: 'Do not destroy linked Menu'
   800               #name: 'keepLinkedMenu'
   812               #name: 'keepLinkedMenu'
   801               #layout: #(#Point 20 217)
   813               #layout: #(#Point 20 244)
   802               #tabable: true
   814               #tabable: true
   803               #activeHelpKey: #keepLinkedMenu
   815               #activeHelpKey: #keepLinkedMenu
   804               #model: #keepLinkedMenu
   816               #model: #keepLinkedMenu
   805               #translateLabel: true
   817               #translateLabel: true
   806             )
   818             )
   885               #layout: #(#Point 20 190)
   897               #layout: #(#Point 20 190)
   886               #activeHelpKey: #basicsTranslateLabel
   898               #activeHelpKey: #basicsTranslateLabel
   887               #tabable: true
   899               #tabable: true
   888               #model: #translateLabel
   900               #model: #translateLabel
   889             )
   901             )
       
   902            #(#CheckBoxSpec
       
   903               #label: 'Has Horizontal Orientation'
       
   904               #name: 'horizontalLayout'
       
   905               #layout: #(#Point 20 217)
       
   906               #activeHelpKey: #horizontalLayout
       
   907               #tabable: true
       
   908               #model: #horizontalLayout
       
   909             )
       
   910 
   890            )
   911            )
   891          
   912          
   892         )
   913         )
   893       )
   914       )
   894 !
   915 !
  2954         font               := (aspects at:#font) value.
  2975         font               := (aspects at:#font) value.
  2955         argument           := (aspects at:#argument) value.
  2976         argument           := (aspects at:#argument) value.
  2956         translateLabel     := (aspects at:#translateLabel) value.
  2977         translateLabel     := (aspects at:#translateLabel) value.
  2957         isButton           := (aspects at:#isButton) value.
  2978         isButton           := (aspects at:#isButton) value.
  2958         auxValue           := (aspects at:#auxValue) value.
  2979         auxValue           := (aspects at:#auxValue) value.
       
  2980         horizontalLayout   := (aspects at:#horizontalLayout) value.
  2959 
  2981 
  2960         argument isString ifTrue:[
  2982         argument isString ifTrue:[
  2961             argument size > 1 ifTrue:[
  2983             argument size > 1 ifTrue:[
  2962                 (argument at:1) == $# ifTrue:[
  2984                 (argument at:1) == $# ifTrue:[
  2963                     argument := (argument copyFrom:2) asSymbol
  2985                     argument := (argument copyFrom:2) asSymbol
  3015     translateLabel      := anItem translateLabel.
  3037     translateLabel      := anItem translateLabel.
  3016     isButton            := anItem isButton.
  3038     isButton            := anItem isButton.
  3017     isVisible           := anItem isVisible.
  3039     isVisible           := anItem isVisible.
  3018     hideMenuOnActivated := anItem hideMenuOnActivated.
  3040     hideMenuOnActivated := anItem hideMenuOnActivated.
  3019     auxValue            := anItem auxValue.
  3041     auxValue            := anItem auxValue.
       
  3042     horizontalLayout    := anItem horizontalLayout.
  3020 
  3043 
  3021     (((rtv := anItem adornment) notNil)
  3044     (((rtv := anItem adornment) notNil)
  3022     and:[(rtv := rtv labelImage) isKindOf:ResourceRetriever])
  3045     and:[(rtv := rtv labelImage) isKindOf:ResourceRetriever])
  3023     ifTrue:
  3046     ifTrue:
  3024     [
  3047     [
  3061         item choice:choice.
  3084         item choice:choice.
  3062         item choiceValue:choiceValue.
  3085         item choiceValue:choiceValue.
  3063         item translateLabel: translateLabel.
  3086         item translateLabel: translateLabel.
  3064         item isButton: isButton.
  3087         item isButton: isButton.
  3065         item auxValue: auxValue.
  3088         item auxValue: auxValue.
       
  3089 
       
  3090         horizontalLayout == true ifTrue:[
       
  3091             item horizontalLayout:true.
       
  3092         ].
  3066 
  3093 
  3067         icon notNil ifTrue:[
  3094         icon notNil ifTrue:[
  3068             rcv := ResourceRetriever new.
  3095             rcv := ResourceRetriever new.
  3069             rcv className:retriever.
  3096             rcv className:retriever.
  3070             rcv selector:icon.
  3097             rcv selector:icon.
  3106         (aspects at:#retriever)            value:retriever.
  3133         (aspects at:#retriever)            value:retriever.
  3107         (aspects at:#icon)                 value:icon.
  3134         (aspects at:#icon)                 value:icon.
  3108         (aspects at:#iconAndLabel)         value:iconAndLabel.
  3135         (aspects at:#iconAndLabel)         value:iconAndLabel.
  3109         (aspects at:#isButton)             value:isButton.
  3136         (aspects at:#isButton)             value:isButton.
  3110         (aspects at:#auxValue)             value:auxValue.
  3137         (aspects at:#auxValue)             value:auxValue.
       
  3138         (aspects at:#horizontalLayout)     value:(horizontalLayout ? false).
  3111 
  3139 
  3112         (aspects at:#argument)
  3140         (aspects at:#argument)
  3113             value:(argument isSymbol
  3141             value:(argument isSymbol
  3114                         ifTrue: ['#', argument] 
  3142                         ifTrue: ['#', argument] 
  3115                         ifFalse:[argument]).
  3143                         ifFalse:[argument]).