MenuEditor.st
changeset 3138 6fe10704089b
parent 3135 ddfd8044f87c
child 3165 c4e94501002c
equal deleted inserted replaced
3137:3f3d24b1bed7 3138:6fe10704089b
  2353 
  2353 
  2354     menu := listOfItems root submenu.
  2354     menu := listOfItems root submenu.
  2355     menu isNil ifTrue:[^ nil ].
  2355     menu isNil ifTrue:[^ nil ].
  2356 
  2356 
  2357     menu allItemsDo:[:anItem|
  2357     menu allItemsDo:[:anItem|
  2358 	anItem ignoreShortcutKeys:true.
  2358         anItem ignoreShortcutKeys:true.
  2359 	anItem isVisible:true.
  2359         anItem isVisible:true.
  2360 	anItem enabled:true.
  2360         anItem enabled:true.
  2361 	anItem translateLabel:false.
  2361         anItem translateLabel:false.
  2362 
  2362 
  2363 	anItem itemValue notNil ifTrue:[
  2363         anItem itemValue notNil ifTrue:[
  2364 	    anItem itemValue:[ Transcript showCR:(anItem label) ].
  2364             anItem itemValue:[ Transcript showCR:(anItem label) ].
  2365 	].
  2365         ].
  2366 	anItem indication notNil ifTrue:[
  2366         anItem indication notNil ifTrue:[
  2367 	    indication isNil ifTrue:[ indication := true asValue ].
  2367             indication isNil ifTrue:[ indication := true asValue ].
  2368 	    anItem indication:indication
  2368             anItem indication:indication
  2369 	].
  2369         ].
  2370 	anItem choice notNil ifTrue:[
  2370         anItem choice notNil ifTrue:[
  2371 	    choice isNil ifTrue:[ choice := anItem choiceValue asValue ].
  2371             choice isNil ifTrue:[ choice := anItem choiceValue asValue ].
  2372 	    anItem choice:choice
  2372             anItem choice:choice
  2373 	].
  2373         ].
  2374 	anItem isMenuSlice ifTrue:[
  2374         anItem isMenuSlice ifTrue:[
  2375 	    anItem submenuChannel:nil.
  2375             anItem submenuChannel:nil.
  2376 	    anItem label:'... Slice Menu ...'.
  2376             anItem label:'... Slice Menu ...'.
  2377 	].
  2377         ].
  2378 	anItem submenuChannel notNil ifTrue:[
  2378         anItem submenuChannel notNil ifTrue:[
  2379 	    anItem submenuChannel:nil.
  2379             anItem submenuChannel:nil.
  2380 	    anItem submenu isNil ifTrue:[
  2380             anItem submenu isNil ifTrue:[
  2381 		submenu isNil ifTrue:[
  2381                 submenu isNil ifTrue:[
  2382 		    submenu := Menu new.
  2382                     submenu := Menu new.
  2383 		    submenu addItem:(MenuItem labeled:'Linked Menu...').
  2383                     submenu addItem:(MenuItem label:'Linked Menu...').
  2384 		].
  2384                 ].
  2385 		anItem submenu:submenu.
  2385                 anItem submenu:submenu.
  2386 	    ].
  2386             ].
  2387 	].
  2387         ].
  2388 	retriever := anItem resourceRetriever.
  2388         retriever := anItem resourceRetriever.
  2389 	retriever notNil ifTrue:[
  2389         retriever notNil ifTrue:[
  2390 	    retriever labelText notNil ifTrue:[ retriever labelText:(anItem label) ]
  2390             retriever labelText notNil ifTrue:[ retriever labelText:(anItem label) ]
  2391 	].
  2391         ].
  2392     ].
  2392     ].
  2393     menu findGuiResourcesIn:(self resolveName:specClass).
  2393     menu findGuiResourcesIn:(self resolveName:specClass).
  2394     ^ menu
  2394     ^ menu
  2395 ! !
  2395 ! !
  2396 
  2396 
  3827 menuItem:aMenuItem
  3827 menuItem:aMenuItem
  3828     "rebuild self from a MenuItem
  3828     "rebuild self from a MenuItem
  3829     "
  3829     "
  3830     |value|
  3830     |value|
  3831 
  3831 
  3832     menuItem := MenuItem labeled:(self rawLabel).
  3832     menuItem := MenuItem label:(self rawLabel).
  3833 
  3833 
  3834     MenuEditor aspects do:[:aKey|
  3834     MenuEditor aspects do:[:aKey|
  3835 	value := self validateValue:(aMenuItem perform:aKey).
  3835         value := self validateValue:(aMenuItem perform:aKey).
  3836 
  3836 
  3837 	value notNil ifTrue:[
  3837         value notNil ifTrue:[
  3838 	    self aspectAt:aKey put:value.
  3838             self aspectAt:aKey put:value.
  3839 	].
  3839         ].
  3840     ].
  3840     ].
  3841 !
  3841 !
  3842 
  3842 
  3843 rawLabel
  3843 rawLabel
  3844     "returns the label assigned to the item
  3844     "returns the label assigned to the item