Skip to content

Commit

Permalink
[Clean] - better submenus for space selector
Browse files Browse the repository at this point in the history
  • Loading branch information
YannLEGOFF committed Jul 4, 2023
1 parent ef448df commit b1d4e2c
Showing 1 changed file with 17 additions and 29 deletions.
46 changes: 17 additions & 29 deletions src/Pyramid-Bloc/PyramidSelectionMakerController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -221,40 +221,28 @@ PyramidSelectionMakerController >> selectionStrategy: anObject [
{ #category : #'as yet unclassified' }
PyramidSelectionMakerController >> showSubMenu [

| menu |
| menu colors chooseColorSubMenu |
menu := self subMenu builder menuFor: self activeProject selection.
colors := {
Color white.
Color gray.
Color black }.
chooseColorSubMenu := SpMenuPresenter new.
colors do: [ :color |
chooseColorSubMenu addItem: [ :item |
item
name: color printString;
action: [ (self overlay model at: #spaceColor) object: color ];
icon: [
(self overlay model at: #spaceColor) object = color
ifTrue: [ self iconNamed: #testGreen ]
ifFalse: [ self iconNamed: #testNotRun ] ] ] ].

menu addGroup: [ :group |
group addItem: [ :item |
item
name: 'Space backgorund color';
subMenu: (SpMenuPresenter new
addItem: [ :subItem |
subItem
name: 'Color black';
icon: [
(self overlay model at: #spaceColor) object = Color black
ifTrue: [ self iconNamed: #testGreen ]
ifFalse: [ self iconNamed: #testNotRun ] ];
action: [
(self overlay model at: #spaceColor) object: Color black ] ];
addItem: [ :subItem |
subItem
name: 'Color gray';
icon: [
(self overlay model at: #spaceColor) object = Color gray
ifTrue: [ self iconNamed: #testGreen ]
ifFalse: [ self iconNamed: #testNotRun ] ];
action: [
(self overlay model at: #spaceColor) object: Color gray ] ];
addItem: [ :subItem |
subItem
name: 'Color white';
icon: [
(self overlay model at: #spaceColor) object = Color white
ifTrue: [ self iconNamed: #testGreen ]
ifFalse: [ self iconNamed: #testNotRun ] ];
action: [
(self overlay model at: #spaceColor) object: Color white ] ]) ] ].
subMenu: chooseColorSubMenu ] ].
menu openWithSpecAt: self currentHand position
]

Expand Down

0 comments on commit b1d4e2c

Please sign in to comment.