MenuEditor.st
changeset 1249 bb12f148aa96
parent 1246 c5425b3c8f3e
child 1250 644ed357b524
equal deleted inserted replaced
1248:fc64935b7ff9 1249:bb12f148aa96
    18 	classVariableNames:''
    18 	classVariableNames:''
    19 	poolDictionaries:''
    19 	poolDictionaries:''
    20 	category:'Interface-UIPainter'
    20 	category:'Interface-UIPainter'
    21 !
    21 !
    22 
    22 
    23 SelectionInTreeView subclass:#TreeView
       
    24 	instanceVariableNames:''
       
    25 	classVariableNames:''
       
    26 	poolDictionaries:''
       
    27 	privateIn:MenuEditor
       
    28 !
       
    29 
       
    30 Object subclass:#Item
    23 Object subclass:#Item
    31 	instanceVariableNames:'activeHelpKey enabled label value nameKey indication shortcutKey
    24 	instanceVariableNames:'activeHelpKey enabled label value nameKey indication shortcutKey
    32 		accessCharacterPos retriever icon iconAndLabel submenuChannel
    25 		accessCharacterPos retriever icon iconAndLabel submenuChannel
    33 		startGroup argument translateLabel isButton isVisible choice
    26 		startGroup argument translateLabel isButton isVisible choice
    34 		choiceValue auxValue'
    27 		choiceValue auxValue'
       
    28 	classVariableNames:''
       
    29 	poolDictionaries:''
       
    30 	privateIn:MenuEditor
       
    31 !
       
    32 
       
    33 SelectionInTreeView subclass:#TreeView
       
    34 	instanceVariableNames:''
    35 	classVariableNames:''
    35 	classVariableNames:''
    36 	poolDictionaries:''
    36 	poolDictionaries:''
    37 	privateIn:MenuEditor
    37 	privateIn:MenuEditor
    38 !
    38 !
    39 
    39 
  1204        #(#WindowSpec
  1204        #(#WindowSpec
  1205           #label: 'Menu Editor'
  1205           #label: 'Menu Editor'
  1206           #name: 'Menu Editor'
  1206           #name: 'Menu Editor'
  1207           #min: #(#Point 550 440)
  1207           #min: #(#Point 550 440)
  1208           #max: #(#Point 1152 900)
  1208           #max: #(#Point 1152 900)
  1209           #bounds: #(#Rectangle 162 299 719 739)
  1209           #bounds: #(#Rectangle 37 413 594 853)
  1210           #menu: #menu
  1210           #menu: #menu
       
  1211           #returnIsOKInDialog: false
       
  1212           #escapeIsCancelInDialog: false
  1211         )
  1213         )
  1212         #component: 
  1214         #component: 
  1213        #(#SpecCollection
  1215        #(#SpecCollection
  1214           #collection: #(
  1216           #collection: #(
  1215            #(#MenuPanelSpec
  1217            #(#MenuPanelSpec
  2588 
  2590 
  2589     treeView selectedNodeChangeSequenceOrder:-1.
  2591     treeView selectedNodeChangeSequenceOrder:-1.
  2590     modified := true.
  2592     modified := true.
  2591 ! !
  2593 ! !
  2592 
  2594 
       
  2595 !MenuEditor::Item class methodsFor:'constants'!
       
  2596 
       
  2597 separatorList
       
  2598     "get the list of available separator types"
       
  2599 
       
  2600     ^#('blank' 'single line' 'double line')
       
  2601 !
       
  2602 
       
  2603 separatorSlices
       
  2604     "get the list of menu spec values of the corresponding separator types"
       
  2605 
       
  2606    ^ #(
       
  2607         ( #blank        ''  )
       
  2608         ( #single       '-' )
       
  2609         ( #double       '=' )
       
  2610       )
       
  2611 ! !
       
  2612 
       
  2613 !MenuEditor::Item class methodsFor:'documentation'!
       
  2614 
       
  2615 documentation
       
  2616 "
       
  2617     implements the contents assigned to a TreeItem. An instance
       
  2618     is associated with one item and keeps all its information
       
  2619 
       
  2620     [see also:]
       
  2621         TreeItem
       
  2622         MenuEditor
       
  2623 
       
  2624     [author:]
       
  2625         Claus Atzkern
       
  2626 "
       
  2627 
       
  2628 
       
  2629 ! !
       
  2630 
       
  2631 !MenuEditor::Item methodsFor:'accessing'!
       
  2632 
       
  2633 activeHelpKey
       
  2634     "get the help key of the menu item"
       
  2635 
       
  2636     ^activeHelpKey
       
  2637 !
       
  2638 
       
  2639 activeHelpKey:aKey
       
  2640     "set the help key of the menu item"
       
  2641 
       
  2642     activeHelpKey := aKey
       
  2643 !
       
  2644 
       
  2645 label
       
  2646     "get the value of the menu item"
       
  2647 
       
  2648     ^label
       
  2649 !
       
  2650 
       
  2651 label:something
       
  2652     "set the value of the menu item"
       
  2653 
       
  2654     label := something ? '-'
       
  2655 !
       
  2656 
       
  2657 separatorType
       
  2658     "get the separator type assigned to item or nil"
       
  2659 
       
  2660     label size > 1 
       
  2661     ifFalse:
       
  2662     [
       
  2663         label size  == 0  ifTrue:[^#blank].
       
  2664         label first == $- ifTrue:[^#single].
       
  2665         label first == $= ifTrue:[^#double].
       
  2666     ].    
       
  2667     ^nil
       
  2668 
       
  2669 !
       
  2670 
       
  2671 startGroup:aSymbolOrNil
       
  2672     "set the startGroup attribute"
       
  2673 
       
  2674     startGroup := aSymbolOrNil
       
  2675 
       
  2676     "Created: / 23.8.1998 / 15:56:03 / cg"
       
  2677 !
       
  2678 
       
  2679 submenuChannel
       
  2680     "return the value of the instance variable 'submenuChannel' (automatically generated)"
       
  2681 
       
  2682     ^submenuChannel
       
  2683 !
       
  2684 
       
  2685 submenuChannel:aChannel
       
  2686     "get the submenuChannel"
       
  2687 
       
  2688     submenuChannel := aChannel
       
  2689 !
       
  2690 
       
  2691 translateLabel:aBoolean
       
  2692     "set/clear the translate to national-language flag"
       
  2693 
       
  2694     translateLabel := aBoolean
       
  2695 
       
  2696     "Created: / 6.6.1998 / 17:23:33 / cg"
       
  2697 !
       
  2698 
       
  2699 value:aSymbol
       
  2700     "set the value attribute"
       
  2701 
       
  2702     value := aSymbol
       
  2703 
       
  2704     "Created: / 23.8.1998 / 16:02:10 / cg"
       
  2705 ! !
       
  2706 
       
  2707 !MenuEditor::Item methodsFor:'building'!
       
  2708 
       
  2709 buildFromAspects:aspects
       
  2710     "read the values of the aspects into my values"
       
  2711 
       
  2712     |name|
       
  2713     self isSeparator 
       
  2714     ifFalse:
       
  2715     [
       
  2716         name  := label.
       
  2717         label := (aspects at:#label) value.
       
  2718 
       
  2719         (label isNil or:[self isSeparator]) ifTrue:[
       
  2720             (aspects at:#label) value:(label := name)
       
  2721         ].
       
  2722 
       
  2723         enabled            := (aspects at:#enabled) value.
       
  2724         value              := (aspects at:#value) value.
       
  2725         nameKey            := (aspects at:#nameKey) value.
       
  2726         indication         := (aspects at:#indication) value.
       
  2727         choice             := (aspects at:#choice) value.
       
  2728         choiceValue        := (aspects at:#choiceValue) value.
       
  2729         shortcutKey        := (aspects at:#shortcutKey) value.
       
  2730         startGroup         := (aspects at:#startGroup) value.
       
  2731         accessCharacterPos := (aspects at:#accessCharacterPos) value.
       
  2732         argument           := (aspects at:#argument) value.
       
  2733         translateLabel     := (aspects at:#translateLabel) value.
       
  2734         isButton           := (aspects at:#isButton) value.
       
  2735         auxValue           := (aspects at:#auxValue) value.
       
  2736 
       
  2737         argument isString ifTrue:[
       
  2738             argument size > 1 ifTrue:[
       
  2739                 (argument at:1) == $# ifTrue:[
       
  2740                     argument := (argument copyFrom:2) asSymbol
       
  2741                 ]
       
  2742             ]
       
  2743         ].
       
  2744         submenuChannel    := (aspects at:#submenuChannel) value.
       
  2745         retriever         := (aspects at:#retriever) value.
       
  2746         icon              := (aspects at:#icon) value.
       
  2747         iconAndLabel      := (aspects at:#iconAndLabel) value.
       
  2748     ]
       
  2749     ifTrue:
       
  2750     [
       
  2751         name  := (aspects at:#seperatorSelection) selectionIndex.
       
  2752         label := (self class separatorSlices at:name) last.
       
  2753     ].
       
  2754     isVisible := (aspects at:#isVisible) value.
       
  2755 
       
  2756     "Modified: / 14.8.1998 / 15:36:38 / cg"
       
  2757 !
       
  2758 
       
  2759 buildFromMenuItem:anItem
       
  2760     "read the attributes of anItem into my values"
       
  2761 
       
  2762     |rtv|
       
  2763 
       
  2764     self label:(anItem rawLabel).
       
  2765     activeHelpKey := anItem activeHelpKey.
       
  2766 
       
  2767     (enabled := anItem enabled) isSymbol ifFalse:[
       
  2768         enabled := nil
       
  2769     ].
       
  2770     (value := anItem value) isSymbol ifFalse:[
       
  2771         value := nil.
       
  2772     ].
       
  2773     (indication := anItem indication) isSymbol ifFalse:[
       
  2774         indication := nil
       
  2775     ].
       
  2776     (choice := anItem choice) isSymbol ifFalse:[
       
  2777         choice := nil
       
  2778     ].
       
  2779     choiceValue := anItem choiceValue.
       
  2780 
       
  2781     nameKey            := anItem nameKey.
       
  2782     shortcutKey        := anItem shortcutKeyCharacter.
       
  2783     startGroup         := anItem startGroup.
       
  2784     accessCharacterPos := anItem accessCharacterPosition.
       
  2785     argument           := anItem argument.
       
  2786 
       
  2787     submenuChannel     := anItem submenuChannel.
       
  2788     translateLabel     := anItem translateLabel.
       
  2789     isButton           := anItem isButton.
       
  2790     isVisible          := anItem isVisible.
       
  2791     auxValue           := anItem auxValue.
       
  2792 
       
  2793     (((rtv := anItem adornment) notNil)
       
  2794     and:[(rtv := rtv labelImage) isKindOf:ResourceRetriever])
       
  2795     ifTrue:
       
  2796     [
       
  2797         retriever := rtv className.
       
  2798         icon      := rtv selector.
       
  2799         (iconAndLabel := rtv labelText notNil) ifTrue:[
       
  2800             label := rtv labelText.
       
  2801         ]
       
  2802     ]
       
  2803 
       
  2804     "Modified: / 29.9.1998 / 11:18:25 / cg"
       
  2805 ! !
       
  2806 
       
  2807 !MenuEditor::Item methodsFor:'conversion'!
       
  2808 
       
  2809 asMenuItem
       
  2810     "converts self to a menu item"
       
  2811 
       
  2812     |item rcv|
       
  2813 
       
  2814     item := MenuItem labeled:label.
       
  2815     item isVisible:isVisible.
       
  2816 
       
  2817     self isSeparator ifFalse:[    
       
  2818         item activeHelpKey:activeHelpKey.
       
  2819         item enabled:enabled.
       
  2820         item accessCharacterPosition:accessCharacterPos.
       
  2821         item argument:argument.
       
  2822         item submenuChannel:submenuChannel.
       
  2823         item nameKey:nameKey.
       
  2824         item shortcutKeyCharacter:shortcutKey.
       
  2825         item startGroup:startGroup.
       
  2826         item value:value.
       
  2827         item indication:indication.
       
  2828         item choice:choice.
       
  2829         item choiceValue:choiceValue.
       
  2830         item translateLabel: translateLabel.
       
  2831         item isButton: isButton.
       
  2832         item auxValue: auxValue.
       
  2833 
       
  2834         icon notNil ifTrue:[
       
  2835             rcv := ResourceRetriever new.
       
  2836             rcv className:retriever.
       
  2837             rcv selector:icon.
       
  2838             iconAndLabel == true ifTrue:[
       
  2839                 rcv labelText:label
       
  2840             ].
       
  2841             item labelImage:rcv
       
  2842         ]
       
  2843     ].
       
  2844     ^item
       
  2845 
       
  2846     "Modified: / 14.8.1998 / 15:36:35 / cg"
       
  2847 !
       
  2848 
       
  2849 toAspects:aspects
       
  2850     "put my values into the values of aspects"
       
  2851 
       
  2852     |type|
       
  2853     (type := self separatorType) notNil ifTrue: [
       
  2854         type := self class separatorSlices findFirst:[:el| el first == type ].
       
  2855         (aspects at:#seperatorSelection) selectionIndex:type.
       
  2856     ] ifFalse: [
       
  2857         (aspects at:#label)                value:label.
       
  2858         (aspects at:#enabled)              value:enabled.
       
  2859         (aspects at:#value)                value:value.
       
  2860         (aspects at:#nameKey)              value:nameKey.
       
  2861         (aspects at:#indication)           value:indication.
       
  2862         (aspects at:#choice)               value:choice.
       
  2863         (aspects at:#choiceValue)          value:choiceValue.
       
  2864         (aspects at:#shortcutKey)          value:shortcutKey.
       
  2865         (aspects at:#startGroup)           value:startGroup.
       
  2866         (aspects at:#accessCharacterPos)   value:accessCharacterPos.
       
  2867         (aspects at:#translateLabel)       value:translateLabel.
       
  2868         (aspects at:#submenuChannel)       value:submenuChannel.
       
  2869         (aspects at:#retriever)            value:retriever.
       
  2870         (aspects at:#icon)                 value:icon.
       
  2871         (aspects at:#iconAndLabel)         value:iconAndLabel.
       
  2872         (aspects at:#isButton)             value:isButton.
       
  2873         (aspects at:#auxValue)             value:auxValue.
       
  2874 
       
  2875         (aspects at:#argument)
       
  2876             value:(argument isSymbol
       
  2877                         ifTrue: ['#', argument] 
       
  2878                         ifFalse:[argument]).
       
  2879     ].
       
  2880     (aspects at:#isVisible) value:isVisible.
       
  2881 
       
  2882     "Modified: / 14.8.1998 / 15:37:29 / cg"
       
  2883 ! !
       
  2884 
       
  2885 !MenuEditor::Item methodsFor:'queries'!
       
  2886 
       
  2887 iconFor: aNode
       
  2888     "get the icon of the menu item for the tree view"
       
  2889 
       
  2890     (aNode hasChildren or: [aNode parent isNil])
       
  2891     ifTrue:
       
  2892     [
       
  2893         ^MenuEditor submenuImage
       
  2894     ]
       
  2895     ifFalse:
       
  2896     [
       
  2897         submenuChannel notNil 
       
  2898         ifTrue:
       
  2899         [
       
  2900             ^MenuEditor linkSubmenuImage
       
  2901         ]
       
  2902         ifFalse:
       
  2903         [
       
  2904             self isSeparator 
       
  2905                 ifTrue:  [^MenuEditor menuSeparatorImage]
       
  2906                 ifFalse: [^MenuEditor menuItemImage]
       
  2907         ]
       
  2908     ]
       
  2909 !
       
  2910 
       
  2911 isSeparator
       
  2912     "return true if item is a seperator"
       
  2913 
       
  2914     ^self separatorType notNil
       
  2915 !
       
  2916 
       
  2917 treeViewLabel
       
  2918     "get the label of the menu item for the tree view"
       
  2919 
       
  2920     ^label
       
  2921 " asBoldText, 
       
  2922         (value notNil ifTrue: [': [', 
       
  2923                 value ,
       
  2924                 (argument isString ifTrue: [' ', (Text string: argument emphasis: #italic)] ifFalse: ['']),
       
  2925                  ']'] ifFalse: [''])
       
  2926 
       
  2927 
       
  2928 "
       
  2929 ! !
       
  2930 
  2593 !MenuEditor::TreeView class methodsFor:'documentation'!
  2931 !MenuEditor::TreeView class methodsFor:'documentation'!
  2594 
  2932 
  2595 documentation
  2933 documentation
  2596 "
  2934 "
  2597     This tree view class provides a hierarchical representation
  2935     This tree view class provides a hierarchical representation
  3049 
  3387 
  3050     (app := self topView application) modified: true.
  3388     (app := self topView application) modified: true.
  3051     app updateChannels
  3389     app updateChannels
  3052 ! !
  3390 ! !
  3053 
  3391 
  3054 !MenuEditor::Item class methodsFor:'constants'!
       
  3055 
       
  3056 separatorList
       
  3057     "get the list of available separator types"
       
  3058 
       
  3059     ^#('blank' 'single line' 'double line')
       
  3060 !
       
  3061 
       
  3062 separatorSlices
       
  3063     "get the list of menu spec values of the corresponding separator types"
       
  3064 
       
  3065    ^ #(
       
  3066         ( #blank        ''  )
       
  3067         ( #single       '-' )
       
  3068         ( #double       '=' )
       
  3069       )
       
  3070 ! !
       
  3071 
       
  3072 !MenuEditor::Item class methodsFor:'documentation'!
       
  3073 
       
  3074 documentation
       
  3075 "
       
  3076     implements the contents assigned to a TreeItem. An instance
       
  3077     is associated with one item and keeps all its information
       
  3078 
       
  3079     [see also:]
       
  3080         TreeItem
       
  3081         MenuEditor
       
  3082 
       
  3083     [author:]
       
  3084         Claus Atzkern
       
  3085 "
       
  3086 
       
  3087 
       
  3088 ! !
       
  3089 
       
  3090 !MenuEditor::Item methodsFor:'accessing'!
       
  3091 
       
  3092 activeHelpKey
       
  3093     "get the help key of the menu item"
       
  3094 
       
  3095     ^activeHelpKey
       
  3096 !
       
  3097 
       
  3098 activeHelpKey:aKey
       
  3099     "set the help key of the menu item"
       
  3100 
       
  3101     activeHelpKey := aKey
       
  3102 !
       
  3103 
       
  3104 label
       
  3105     "get the value of the menu item"
       
  3106 
       
  3107     ^label
       
  3108 !
       
  3109 
       
  3110 label:something
       
  3111     "set the value of the menu item"
       
  3112 
       
  3113     label := something ? '-'
       
  3114 !
       
  3115 
       
  3116 separatorType
       
  3117     "get the separator type assigned to item or nil"
       
  3118 
       
  3119     label size > 1 
       
  3120     ifFalse:
       
  3121     [
       
  3122         label size  == 0  ifTrue:[^#blank].
       
  3123         label first == $- ifTrue:[^#single].
       
  3124         label first == $= ifTrue:[^#double].
       
  3125     ].    
       
  3126     ^nil
       
  3127 
       
  3128 !
       
  3129 
       
  3130 startGroup:aSymbolOrNil
       
  3131     "set the startGroup attribute"
       
  3132 
       
  3133     startGroup := aSymbolOrNil
       
  3134 
       
  3135     "Created: / 23.8.1998 / 15:56:03 / cg"
       
  3136 !
       
  3137 
       
  3138 submenuChannel
       
  3139     "return the value of the instance variable 'submenuChannel' (automatically generated)"
       
  3140 
       
  3141     ^submenuChannel
       
  3142 !
       
  3143 
       
  3144 submenuChannel:aChannel
       
  3145     "get the submenuChannel"
       
  3146 
       
  3147     submenuChannel := aChannel
       
  3148 !
       
  3149 
       
  3150 translateLabel:aBoolean
       
  3151     "set/clear the translate to national-language flag"
       
  3152 
       
  3153     translateLabel := aBoolean
       
  3154 
       
  3155     "Created: / 6.6.1998 / 17:23:33 / cg"
       
  3156 !
       
  3157 
       
  3158 value:aSymbol
       
  3159     "set the value attribute"
       
  3160 
       
  3161     value := aSymbol
       
  3162 
       
  3163     "Created: / 23.8.1998 / 16:02:10 / cg"
       
  3164 ! !
       
  3165 
       
  3166 !MenuEditor::Item methodsFor:'building'!
       
  3167 
       
  3168 buildFromAspects:aspects
       
  3169     "read the values of the aspects into my values"
       
  3170 
       
  3171     |name|
       
  3172     self isSeparator 
       
  3173     ifFalse:
       
  3174     [
       
  3175         name  := label.
       
  3176         label := (aspects at:#label) value.
       
  3177 
       
  3178         (label isNil or:[self isSeparator]) ifTrue:[
       
  3179             (aspects at:#label) value:(label := name)
       
  3180         ].
       
  3181 
       
  3182         enabled            := (aspects at:#enabled) value.
       
  3183         value              := (aspects at:#value) value.
       
  3184         nameKey            := (aspects at:#nameKey) value.
       
  3185         indication         := (aspects at:#indication) value.
       
  3186         choice             := (aspects at:#choice) value.
       
  3187         choiceValue        := (aspects at:#choiceValue) value.
       
  3188         shortcutKey        := (aspects at:#shortcutKey) value.
       
  3189         startGroup         := (aspects at:#startGroup) value.
       
  3190         accessCharacterPos := (aspects at:#accessCharacterPos) value.
       
  3191         argument           := (aspects at:#argument) value.
       
  3192         translateLabel     := (aspects at:#translateLabel) value.
       
  3193         isButton           := (aspects at:#isButton) value.
       
  3194         auxValue           := (aspects at:#auxValue) value.
       
  3195 
       
  3196         argument isString ifTrue:[
       
  3197             argument size > 1 ifTrue:[
       
  3198                 (argument at:1) == $# ifTrue:[
       
  3199                     argument := (argument copyFrom:2) asSymbol
       
  3200                 ]
       
  3201             ]
       
  3202         ].
       
  3203         submenuChannel    := (aspects at:#submenuChannel) value.
       
  3204         retriever         := (aspects at:#retriever) value.
       
  3205         icon              := (aspects at:#icon) value.
       
  3206         iconAndLabel      := (aspects at:#iconAndLabel) value.
       
  3207     ]
       
  3208     ifTrue:
       
  3209     [
       
  3210         name  := (aspects at:#seperatorSelection) selectionIndex.
       
  3211         label := (self class separatorSlices at:name) last.
       
  3212     ].
       
  3213     isVisible := (aspects at:#isVisible) value.
       
  3214 
       
  3215     "Modified: / 14.8.1998 / 15:36:38 / cg"
       
  3216 !
       
  3217 
       
  3218 buildFromMenuItem:anItem
       
  3219     "read the attributes of anItem into my values"
       
  3220 
       
  3221     |rtv|
       
  3222 
       
  3223     self label:(anItem rawLabel).
       
  3224     activeHelpKey := anItem activeHelpKey.
       
  3225 
       
  3226     (enabled := anItem enabled) isSymbol ifFalse:[
       
  3227         enabled := nil
       
  3228     ].
       
  3229     (value := anItem value) isSymbol ifFalse:[
       
  3230         value := nil.
       
  3231     ].
       
  3232     (indication := anItem indication) isSymbol ifFalse:[
       
  3233         indication := nil
       
  3234     ].
       
  3235     (choice := anItem choice) isSymbol ifFalse:[
       
  3236         choice := nil
       
  3237     ].
       
  3238     choiceValue := anItem choiceValue.
       
  3239 
       
  3240     nameKey            := anItem nameKey.
       
  3241     shortcutKey        := anItem shortcutKeyCharacter.
       
  3242     startGroup         := anItem startGroup.
       
  3243     accessCharacterPos := anItem accessCharacterPosition.
       
  3244     argument           := anItem argument.
       
  3245 
       
  3246     submenuChannel     := anItem submenuChannel.
       
  3247     translateLabel     := anItem translateLabel.
       
  3248     isButton           := anItem isButton.
       
  3249     isVisible          := anItem isVisible.
       
  3250     auxValue           := anItem auxValue.
       
  3251 
       
  3252     (((rtv := anItem adornment) notNil)
       
  3253     and:[(rtv := rtv labelImage) isKindOf:ResourceRetriever])
       
  3254     ifTrue:
       
  3255     [
       
  3256         retriever := rtv className.
       
  3257         icon      := rtv selector.
       
  3258         (iconAndLabel := rtv labelText notNil) ifTrue:[
       
  3259             label := rtv labelText.
       
  3260         ]
       
  3261     ]
       
  3262 
       
  3263     "Modified: / 29.9.1998 / 11:18:25 / cg"
       
  3264 ! !
       
  3265 
       
  3266 !MenuEditor::Item methodsFor:'conversion'!
       
  3267 
       
  3268 asMenuItem
       
  3269     "converts self to a menu item"
       
  3270 
       
  3271     |item rcv|
       
  3272 
       
  3273     item := MenuItem labeled:label.
       
  3274     item isVisible:isVisible.
       
  3275 
       
  3276     self isSeparator ifFalse:[    
       
  3277         item activeHelpKey:activeHelpKey.
       
  3278         item enabled:enabled.
       
  3279         item accessCharacterPosition:accessCharacterPos.
       
  3280         item argument:argument.
       
  3281         item submenuChannel:submenuChannel.
       
  3282         item nameKey:nameKey.
       
  3283         item shortcutKeyCharacter:shortcutKey.
       
  3284         item startGroup:startGroup.
       
  3285         item value:value.
       
  3286         item indication:indication.
       
  3287         item choice:choice.
       
  3288         item choiceValue:choiceValue.
       
  3289         item translateLabel: translateLabel.
       
  3290         item isButton: isButton.
       
  3291         item auxValue: auxValue.
       
  3292 
       
  3293         icon notNil ifTrue:[
       
  3294             rcv := ResourceRetriever new.
       
  3295             rcv className:retriever.
       
  3296             rcv selector:icon.
       
  3297             iconAndLabel == true ifTrue:[
       
  3298                 rcv labelText:label
       
  3299             ].
       
  3300             item labelImage:rcv
       
  3301         ]
       
  3302     ].
       
  3303     ^item
       
  3304 
       
  3305     "Modified: / 14.8.1998 / 15:36:35 / cg"
       
  3306 !
       
  3307 
       
  3308 toAspects:aspects
       
  3309     "put my values into the values of aspects"
       
  3310 
       
  3311     |type|
       
  3312     (type := self separatorType) notNil ifTrue: [
       
  3313         type := self class separatorSlices findFirst:[:el| el first == type ].
       
  3314         (aspects at:#seperatorSelection) selectionIndex:type.
       
  3315     ] ifFalse: [
       
  3316         (aspects at:#label)                value:label.
       
  3317         (aspects at:#enabled)              value:enabled.
       
  3318         (aspects at:#value)                value:value.
       
  3319         (aspects at:#nameKey)              value:nameKey.
       
  3320         (aspects at:#indication)           value:indication.
       
  3321         (aspects at:#choice)               value:choice.
       
  3322         (aspects at:#choiceValue)          value:choiceValue.
       
  3323         (aspects at:#shortcutKey)          value:shortcutKey.
       
  3324         (aspects at:#startGroup)           value:startGroup.
       
  3325         (aspects at:#accessCharacterPos)   value:accessCharacterPos.
       
  3326         (aspects at:#translateLabel)       value:translateLabel.
       
  3327         (aspects at:#submenuChannel)       value:submenuChannel.
       
  3328         (aspects at:#retriever)            value:retriever.
       
  3329         (aspects at:#icon)                 value:icon.
       
  3330         (aspects at:#iconAndLabel)         value:iconAndLabel.
       
  3331         (aspects at:#isButton)             value:isButton.
       
  3332         (aspects at:#auxValue)             value:auxValue.
       
  3333 
       
  3334         (aspects at:#argument)
       
  3335             value:(argument isSymbol
       
  3336                         ifTrue: ['#', argument] 
       
  3337                         ifFalse:[argument]).
       
  3338     ].
       
  3339     (aspects at:#isVisible) value:isVisible.
       
  3340 
       
  3341     "Modified: / 14.8.1998 / 15:37:29 / cg"
       
  3342 ! !
       
  3343 
       
  3344 !MenuEditor::Item methodsFor:'queries'!
       
  3345 
       
  3346 iconFor: aNode
       
  3347     "get the icon of the menu item for the tree view"
       
  3348 
       
  3349     (aNode hasChildren or: [aNode parent isNil])
       
  3350     ifTrue:
       
  3351     [
       
  3352         ^MenuEditor submenuImage
       
  3353     ]
       
  3354     ifFalse:
       
  3355     [
       
  3356         submenuChannel notNil 
       
  3357         ifTrue:
       
  3358         [
       
  3359             ^MenuEditor linkSubmenuImage
       
  3360         ]
       
  3361         ifFalse:
       
  3362         [
       
  3363             self isSeparator 
       
  3364                 ifTrue:  [^MenuEditor menuSeparatorImage]
       
  3365                 ifFalse: [^MenuEditor menuItemImage]
       
  3366         ]
       
  3367     ]
       
  3368 !
       
  3369 
       
  3370 isSeparator
       
  3371     "return true if item is a seperator"
       
  3372 
       
  3373     ^self separatorType notNil
       
  3374 !
       
  3375 
       
  3376 treeViewLabel
       
  3377     "get the label of the menu item for the tree view"
       
  3378 
       
  3379     ^label
       
  3380 " asBoldText, 
       
  3381         (value notNil ifTrue: [': [', 
       
  3382                 value ,
       
  3383                 (argument isString ifTrue: [' ', (Text string: argument emphasis: #italic)] ifFalse: ['']),
       
  3384                  ']'] ifFalse: [''])
       
  3385 
       
  3386 
       
  3387 "
       
  3388 ! !
       
  3389 
       
  3390 !MenuEditor class methodsFor:'documentation'!
  3392 !MenuEditor class methodsFor:'documentation'!
  3391 
  3393 
  3392 version
  3394 version
  3393     ^ '$Header$'
  3395     ^ '$Header$'
  3394 ! !
  3396 ! !