MenuEditor.st
changeset 1321 7894e542c64b
parent 1301 dc5c4a8e6e6e
child 1322 fbc9a32078b5
equal deleted inserted replaced
1320:9c9600432a09 1321:7894e542c64b
    22 
    22 
    23 Object subclass:#Item
    23 Object subclass:#Item
    24 	instanceVariableNames:'activeHelpKey enabled label value nameKey indication shortcutKey
    24 	instanceVariableNames:'activeHelpKey enabled label value nameKey indication shortcutKey
    25 		accessCharacterPos retriever icon iconAndLabel submenuChannel
    25 		accessCharacterPos retriever icon iconAndLabel submenuChannel
    26 		startGroup argument translateLabel isButton isVisible choice
    26 		startGroup argument translateLabel isButton isVisible choice
    27 		choiceValue auxValue'
    27 		choiceValue auxValue hideMenuOnActivated'
    28 	classVariableNames:''
    28 	classVariableNames:''
    29 	poolDictionaries:''
    29 	poolDictionaries:''
    30 	privateIn:MenuEditor
    30 	privateIn:MenuEditor
    31 !
    31 !
    32 
    32 
   129         startGroup
   129         startGroup
   130         retriever
   130         retriever
   131         iconAndLabel
   131         iconAndLabel
   132         icon
   132         icon
   133         isVisible
   133         isVisible
       
   134         hideMenuOnActivated
   134         auxValue
   135         auxValue
   135      )
   136      )
   136 
   137 
   137     "Modified: / 14.8.1998 / 14:46:36 / cg"
   138     "Modified: / 14.8.1998 / 14:46:36 / cg"
   138 ! !
   139 ! !
   249 #fileSave
   250 #fileSave
   250 'Saves the menu spec (and the help spec, if modified).'
   251 'Saves the menu spec (and the help spec, if modified).'
   251 
   252 
   252 #fileSaveAs
   253 #fileSaveAs
   253 'Opens a dialog to save the menu spec (and the help spec, if modified).'
   254 'Opens a dialog to save the menu spec (and the help spec, if modified).'
       
   255 
       
   256 #hideMenuOnActivated
       
   257 'Switch on/off hide of the submenu after activation'
   254 
   258 
   255 #imageImageAndLabel
   259 #imageImageAndLabel
   256 'Toggles display of both image and textual label.'
   260 'Toggles display of both image and textual label.'
   257 
   261 
   258 #imageImageEditor
   262 #imageImageEditor
   363        #(#WindowSpec
   367        #(#WindowSpec
   364           #label: 'Basics Item'
   368           #label: 'Basics Item'
   365           #name: 'Basics Item'
   369           #name: 'Basics Item'
   366           #min: #(#Point 10 10)
   370           #min: #(#Point 10 10)
   367           #max: #(#Point 1160 870)
   371           #max: #(#Point 1160 870)
   368           #bounds: #(#Rectangle 273 266 540 585)
   372           #bounds: #(#Rectangle 12 22 279 341)
   369         )
   373         )
   370         #component: 
   374         #component: 
   371        #(#SpecCollection
   375        #(#SpecCollection
   372           #collection: #(
   376           #collection: #(
   373            #(#LabelSpec
   377            #(#LabelSpec
   377               #activeHelpKey: #basicsKey
   381               #activeHelpKey: #basicsKey
   378               #resizeForLabel: true
   382               #resizeForLabel: true
   379               #adjust: #right
   383               #adjust: #right
   380             )
   384             )
   381            #(#InputFieldSpec
   385            #(#InputFieldSpec
       
   386               #attributes: 
       
   387              #(#tabable
       
   388                 true
       
   389               )
   382               #name: 'nameKeyField'
   390               #name: 'nameKeyField'
   383               #layout: #(#LayoutFrame 110 0 16 0 -5 1.0 38 0)
   391               #layout: #(#LayoutFrame 110 0 16 0 -5 1.0 38 0)
   384               #activeHelpKey: #basicsKey
   392               #activeHelpKey: #basicsKey
   385               #tabable: true
   393               #tabable: true
   386               #model: #nameKey
   394               #model: #nameKey
   401               #activeHelpKey: #basicsLabel
   409               #activeHelpKey: #basicsLabel
   402               #resizeForLabel: true
   410               #resizeForLabel: true
   403               #adjust: #right
   411               #adjust: #right
   404             )
   412             )
   405            #(#InputFieldSpec
   413            #(#InputFieldSpec
       
   414               #attributes: 
       
   415              #(#tabable
       
   416                 true
       
   417               )
   406               #name: 'labelField'
   418               #name: 'labelField'
   407               #layout: #(#LayoutFrame 110 0 40 0 -5 1.0 62 0)
   419               #layout: #(#LayoutFrame 110 0 40 0 -5 1.0 62 0)
   408               #activeHelpKey: #basicsLabel
   420               #activeHelpKey: #basicsLabel
   409               #tabable: true
   421               #tabable: true
   410               #model: #label
   422               #model: #label
   423               #activeHelpKey: #basicsAction
   435               #activeHelpKey: #basicsAction
   424               #resizeForLabel: true
   436               #resizeForLabel: true
   425               #adjust: #right
   437               #adjust: #right
   426             )
   438             )
   427            #(#InputFieldSpec
   439            #(#InputFieldSpec
       
   440               #attributes: 
       
   441              #(#tabable
       
   442                 true
       
   443               )
   428               #name: 'valueField'
   444               #name: 'valueField'
   429               #layout: #(#LayoutFrame 110 0 79 0 -5 1.0 101 0)
   445               #layout: #(#LayoutFrame 110 0 79 0 -5 1.0 101 0)
   430               #activeHelpKey: #basicsAction
   446               #activeHelpKey: #basicsAction
   431               #tabable: true
   447               #tabable: true
   432               #model: #value
   448               #model: #value
   446               #activeHelpKey: #basicsArgument
   462               #activeHelpKey: #basicsArgument
   447               #resizeForLabel: true
   463               #resizeForLabel: true
   448               #adjust: #right
   464               #adjust: #right
   449             )
   465             )
   450            #(#InputFieldSpec
   466            #(#InputFieldSpec
       
   467               #attributes: 
       
   468              #(#tabable
       
   469                 true
       
   470               )
   451               #name: 'argumentField'
   471               #name: 'argumentField'
   452               #layout: #(#LayoutFrame 110 0 104 0 -5 1.0 126 0)
   472               #layout: #(#LayoutFrame 110 0 104 0 -5 1.0 126 0)
   453               #activeHelpKey: #basicsArgument
   473               #activeHelpKey: #basicsArgument
   454               #tabable: true
   474               #tabable: true
   455               #model: #argument
   475               #model: #argument
   469               #activeHelpKey: #basicsIndication
   489               #activeHelpKey: #basicsIndication
   470               #resizeForLabel: true
   490               #resizeForLabel: true
   471               #adjust: #right
   491               #adjust: #right
   472             )
   492             )
   473            #(#InputFieldSpec
   493            #(#InputFieldSpec
       
   494               #attributes: 
       
   495              #(#tabable
       
   496                 true
       
   497               )
   474               #name: 'indicationField'
   498               #name: 'indicationField'
   475               #layout: #(#LayoutFrame 110 0 144 0 -5 1.0 166 0)
   499               #layout: #(#LayoutFrame 110 0 144 0 -5 1.0 166 0)
   476               #activeHelpKey: #basicsIndication
   500               #activeHelpKey: #basicsIndication
   477               #enableChannel: #indicationEnabled
   501               #enableChannel: #indicationEnabled
   478               #tabable: true
   502               #tabable: true
   495               #translateLabel: true
   519               #translateLabel: true
   496               #resizeForLabel: true
   520               #resizeForLabel: true
   497               #adjust: #right
   521               #adjust: #right
   498             )
   522             )
   499            #(#InputFieldSpec
   523            #(#InputFieldSpec
       
   524               #attributes: 
       
   525              #(#tabable
       
   526                 true
       
   527               )
   500               #name: 'choiceField'
   528               #name: 'choiceField'
   501               #layout: #(#LayoutFrame 110 0 169 0 -5 1.0 191 0)
   529               #layout: #(#LayoutFrame 110 0 169 0 -5 1.0 191 0)
   502               #activeHelpKey: #basicsChoice
   530               #activeHelpKey: #basicsChoice
   503               #enableChannel: #choiceEnabled
   531               #enableChannel: #choiceEnabled
   504               #tabable: true
   532               #tabable: true
   521               #translateLabel: true
   549               #translateLabel: true
   522               #resizeForLabel: true
   550               #resizeForLabel: true
   523               #adjust: #right
   551               #adjust: #right
   524             )
   552             )
   525            #(#InputFieldSpec
   553            #(#InputFieldSpec
       
   554               #attributes: 
       
   555              #(#tabable
       
   556                 true
       
   557               )
   526               #name: 'choiceValueField'
   558               #name: 'choiceValueField'
   527               #layout: #(#LayoutFrame 110 0 194 0 -5 1.0 216 0)
   559               #layout: #(#LayoutFrame 110 0 194 0 -5 1.0 216 0)
   528               #activeHelpKey: #basicsChoiceValue
   560               #activeHelpKey: #basicsChoiceValue
   529               #enableChannel: #choiceValueEnabled
   561               #enableChannel: #choiceValueEnabled
   530               #tabable: true
   562               #tabable: true
   538               #acceptChannel: #acceptChannel
   570               #acceptChannel: #acceptChannel
   539               #modifiedChannel: #modifiedChannel
   571               #modifiedChannel: #modifiedChannel
   540               #acceptOnPointerLeave: false
   572               #acceptOnPointerLeave: false
   541             )
   573             )
   542            #(#CheckBoxSpec
   574            #(#CheckBoxSpec
       
   575               #attributes: 
       
   576              #(#tabable
       
   577                 true
       
   578               )
   543               #label: 'Translate Label'
   579               #label: 'Translate Label'
   544               #name: 'translateLabelCheckBox'
   580               #name: 'translateLabelCheckBox'
   545               #layout: #(#Point 20 230)
   581               #layout: #(#Point 20 230)
   546               #activeHelpKey: #basicsTranslateLabel
   582               #activeHelpKey: #basicsTranslateLabel
   547               #tabable: true
   583               #tabable: true
   548               #model: #translateLabel
   584               #model: #translateLabel
   549             )
   585             )
   550            #(#CheckBoxSpec
   586            #(#CheckBoxSpec
       
   587               #attributes: 
       
   588              #(#tabable
       
   589                 true
       
   590               )
   551               #label: 'Is Button'
   591               #label: 'Is Button'
   552               #name: 'isButtonCheckBox'
   592               #name: 'isButtonCheckBox'
   553               #layout: #(#Point 20 259)
   593               #layout: #(#Point 20 256)
   554               #activeHelpKey: #basicsIsButton
   594               #activeHelpKey: #basicsIsButton
   555               #tabable: true
   595               #tabable: true
   556               #model: #isButton
   596               #model: #isButton
       
   597             )
       
   598            #(#CheckBoxSpec
       
   599               #attributes: 
       
   600              #(#tabable
       
   601                 true
       
   602               )
       
   603               #label: 'Hide Menu after Activation'
       
   604               #name: 'hideMenuOnActivated'
       
   605               #layout: #(#Point 20 281)
       
   606               #activeHelpKey: #hideMenuOnActivated
       
   607               #tabable: true
       
   608               #model: #hideMenuOnActivated
   557             )
   609             )
   558            )
   610            )
   559          
   611          
   560         )
   612         )
   561       )
   613       )
  2800     [
  2852     [
  2801         name  := (aspects at:#seperatorSelection) selectionIndex.
  2853         name  := (aspects at:#seperatorSelection) selectionIndex.
  2802         label := (self class separatorSlices at:name) last.
  2854         label := (self class separatorSlices at:name) last.
  2803     ].
  2855     ].
  2804     isVisible := (aspects at:#isVisible) value.
  2856     isVisible := (aspects at:#isVisible) value.
       
  2857     hideMenuOnActivated := (aspects at:#hideMenuOnActivated) value.
  2805 
  2858 
  2806     "Modified: / 14.8.1998 / 15:36:38 / cg"
  2859     "Modified: / 14.8.1998 / 15:36:38 / cg"
  2807 !
  2860 !
  2808 
  2861 
  2809 buildFromMenuItem:anItem
  2862 buildFromMenuItem:anItem
  2824         indication := nil
  2877         indication := nil
  2825     ].
  2878     ].
  2826     (choice := anItem choice) isSymbol ifFalse:[
  2879     (choice := anItem choice) isSymbol ifFalse:[
  2827         choice := nil
  2880         choice := nil
  2828     ].
  2881     ].
  2829     choiceValue := anItem choiceValue.
  2882     choiceValue         := anItem choiceValue.
  2830 
  2883     nameKey             := anItem nameKey.
  2831     nameKey            := anItem nameKey.
  2884     shortcutKey         := anItem shortcutKeyCharacter.
  2832     shortcutKey        := anItem shortcutKeyCharacter.
  2885     startGroup          := anItem startGroup.
  2833     startGroup         := anItem startGroup.
  2886     accessCharacterPos  := anItem accessCharacterPosition.
  2834     accessCharacterPos := anItem accessCharacterPosition.
  2887     argument            := anItem argument.
  2835     argument           := anItem argument.
  2888 
  2836 
  2889     submenuChannel      := anItem submenuChannel.
  2837     submenuChannel     := anItem submenuChannel.
  2890     translateLabel      := anItem translateLabel.
  2838     translateLabel     := anItem translateLabel.
  2891     isButton            := anItem isButton.
  2839     isButton           := anItem isButton.
  2892     isVisible           := anItem isVisible.
  2840     isVisible          := anItem isVisible.
  2893     hideMenuOnActivated := anItem hideMenuOnActivated.
  2841     auxValue           := anItem auxValue.
  2894     auxValue            := anItem auxValue.
  2842 
  2895 
  2843     (((rtv := anItem adornment) notNil)
  2896     (((rtv := anItem adornment) notNil)
  2844     and:[(rtv := rtv labelImage) isKindOf:ResourceRetriever])
  2897     and:[(rtv := rtv labelImage) isKindOf:ResourceRetriever])
  2845     ifTrue:
  2898     ifTrue:
  2846     [
  2899     [
  2861 
  2914 
  2862     |item rcv|
  2915     |item rcv|
  2863 
  2916 
  2864     item := MenuItem labeled:label.
  2917     item := MenuItem labeled:label.
  2865     item isVisible:isVisible.
  2918     item isVisible:isVisible.
       
  2919     item hideMenuOnActivated:hideMenuOnActivated.
  2866 
  2920 
  2867     self isSeparator ifFalse:[    
  2921     self isSeparator ifFalse:[    
  2868         item activeHelpKey:activeHelpKey.
  2922         item activeHelpKey:activeHelpKey.
  2869         item enabled:enabled.
  2923         item enabled:enabled.
  2870         item accessCharacterPosition:accessCharacterPos.
  2924         item accessCharacterPosition:accessCharacterPos.
  2926             value:(argument isSymbol
  2980             value:(argument isSymbol
  2927                         ifTrue: ['#', argument] 
  2981                         ifTrue: ['#', argument] 
  2928                         ifFalse:[argument]).
  2982                         ifFalse:[argument]).
  2929     ].
  2983     ].
  2930     (aspects at:#isVisible) value:isVisible.
  2984     (aspects at:#isVisible) value:isVisible.
       
  2985     (aspects at:#hideMenuOnActivated) value:hideMenuOnActivated.
  2931 
  2986 
  2932     "Modified: / 14.8.1998 / 15:37:29 / cg"
  2987     "Modified: / 14.8.1998 / 15:37:29 / cg"
  2933 ! !
  2988 ! !
  2934 
  2989 
  2935 !MenuEditor::Item methodsFor:'queries'!
  2990 !MenuEditor::Item methodsFor:'queries'!