MenuEditor.st
changeset 860 3e5171aad09f
parent 854 2d96630daf4a
child 872 eb3bd8e609f1
equal deleted inserted replaced
859:c3e7a82c602b 860:3e5171aad09f
  2171 
  2171 
  2172 submenuChannel:aChannel
  2172 submenuChannel:aChannel
  2173     "get the submenuChannel"
  2173     "get the submenuChannel"
  2174 
  2174 
  2175     submenuChannel := aChannel
  2175     submenuChannel := aChannel
  2176 ! !
  2176 !
  2177 
  2177 
  2178 !MenuEditor::Item methodsFor:'conversion'!
  2178 translateLabel:aBoolean
  2179 
  2179     "set/clear the translate to national-language flag"
  2180 asMenuItem
  2180 
  2181     "converts self to a menu item"
  2181     translateLabel := aBoolean
  2182 
  2182 
  2183     |item rcv|
  2183     "Created: / 6.6.1998 / 17:23:33 / cg"
  2184 
  2184 ! !
  2185     item := MenuItem labeled:label.
  2185 
  2186     item isVisible:isVisible.
  2186 !MenuEditor::Item methodsFor:'building'!
  2187 
       
  2188     self isSeparator ifFalse:[    
       
  2189         item activeHelpKey:activeHelpKey.
       
  2190         item enabled:enabled.
       
  2191         item accessCharacterPosition:accessCharacterPos.
       
  2192         item argument:argument.
       
  2193         item submenuChannel:submenuChannel.
       
  2194         item nameKey:nameKey.
       
  2195         item shortcutKeyCharacter:shortcutKey.
       
  2196         item startGroup:startGroup.
       
  2197         item value:value.
       
  2198         item indication:indication.
       
  2199         item translateLabel: translateLabel.
       
  2200         item isButton: isButton.
       
  2201 
       
  2202         icon notNil ifTrue:[
       
  2203             rcv := ResourceRetriever new.
       
  2204             rcv className:retriever.
       
  2205             rcv selector:icon.
       
  2206             iconAndLabel == true ifTrue:[
       
  2207                 rcv labelText:label
       
  2208             ].
       
  2209             item labelImage:rcv
       
  2210         ]
       
  2211     ].
       
  2212     ^item
       
  2213 !
       
  2214 
  2187 
  2215 buildFromAspects:aspects
  2188 buildFromAspects:aspects
  2216     "read the values of the aspects into my values"
  2189     "read the values of the aspects into my values"
  2217 
  2190 
  2218     |name|
  2191     |name|
  2254         name  := (aspects at:#seperatorSelection) selectionIndex.
  2227         name  := (aspects at:#seperatorSelection) selectionIndex.
  2255         label := (self class separatorSlices at:name) last.
  2228         label := (self class separatorSlices at:name) last.
  2256     ].
  2229     ].
  2257     isVisible := (aspects at:#isVisible) value.
  2230     isVisible := (aspects at:#isVisible) value.
  2258 
  2231 
       
  2232     "Modified: / 6.6.1998 / 17:20:59 / cg"
  2259 !
  2233 !
  2260 
  2234 
  2261 buildFromMenuItem:anItem
  2235 buildFromMenuItem:anItem
  2262     "read the attributes of anItem into my values"
  2236     "read the attributes of anItem into my values"
  2263 
  2237 
  2297         icon      := rtv selector.
  2271         icon      := rtv selector.
  2298         (iconAndLabel := rtv labelText notNil) ifTrue:[
  2272         (iconAndLabel := rtv labelText notNil) ifTrue:[
  2299             label := rtv labelText.
  2273             label := rtv labelText.
  2300         ]
  2274         ]
  2301     ]
  2275     ]
       
  2276 ! !
       
  2277 
       
  2278 !MenuEditor::Item methodsFor:'conversion'!
       
  2279 
       
  2280 asMenuItem
       
  2281     "converts self to a menu item"
       
  2282 
       
  2283     |item rcv|
       
  2284 
       
  2285     item := MenuItem labeled:label.
       
  2286     item isVisible:isVisible.
       
  2287 
       
  2288     self isSeparator ifFalse:[    
       
  2289         item activeHelpKey:activeHelpKey.
       
  2290         item enabled:enabled.
       
  2291         item accessCharacterPosition:accessCharacterPos.
       
  2292         item argument:argument.
       
  2293         item submenuChannel:submenuChannel.
       
  2294         item nameKey:nameKey.
       
  2295         item shortcutKeyCharacter:shortcutKey.
       
  2296         item startGroup:startGroup.
       
  2297         item value:value.
       
  2298         item indication:indication.
       
  2299         item translateLabel: translateLabel.
       
  2300         item isButton: isButton.
       
  2301 
       
  2302         icon notNil ifTrue:[
       
  2303             rcv := ResourceRetriever new.
       
  2304             rcv className:retriever.
       
  2305             rcv selector:icon.
       
  2306             iconAndLabel == true ifTrue:[
       
  2307                 rcv labelText:label
       
  2308             ].
       
  2309             item labelImage:rcv
       
  2310         ]
       
  2311     ].
       
  2312     ^item
  2302 !
  2313 !
  2303 
  2314 
  2304 toAspects:aspects
  2315 toAspects:aspects
  2305     "put my values into the values of aspects"
  2316     "put my values into the values of aspects"
  2306 
  2317 
  2736     ^self topView application askForItemModification
  2747     ^self topView application askForItemModification
  2737 !
  2748 !
  2738 
  2749 
  2739 nodeLabel:aLabel
  2750 nodeLabel:aLabel
  2740 
  2751 
  2741     ^TreeItem new contents: (MenuEditor::Item new label:aLabel)
  2752     ^TreeItem new contents: ((MenuEditor::Item new label:aLabel) translateLabel:true)
       
  2753 
       
  2754     "Modified: / 6.6.1998 / 17:22:35 / cg"
  2742 !
  2755 !
  2743 
  2756 
  2744 selectedNodeAdd:something
  2757 selectedNodeAdd:something
  2745 
  2758 
  2746     |node|
  2759     |node|