-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add dynamic group first iteration (working, in morphic... not yet in …
…gtk)
- Loading branch information
Showing
5 changed files
with
110 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
" | ||
An action group is a spec command group (`SpCommandGroup`) that will be used for dynamic context menus in the presenters that implement `SpTActionContainer` | ||
" | ||
Class { | ||
#name : 'SpDynamicActionGroup', | ||
#superclass : 'SpCommandGroup', | ||
#instVars : [ | ||
'id', | ||
'dynamicBuilder' | ||
], | ||
#category : 'Spec2-Commander2-Action', | ||
#package : 'Spec2-Commander2', | ||
#tag : 'Action' | ||
} | ||
|
||
{ #category : 'instance creation' } | ||
SpDynamicActionGroup class >> newName: aName [ | ||
|
||
^ self new | ||
name: aName; | ||
yourself | ||
] | ||
|
||
{ #category : 'instance creation' } | ||
SpDynamicActionGroup class >> newName: aName with: aBlock [ | ||
|
||
^ (self newName: aName) | ||
in: [ :this | aBlock value: this ]; | ||
yourself | ||
] | ||
|
||
{ #category : 'comparing' } | ||
SpDynamicActionGroup >> = anObject [ | ||
"Answer whether the receiver and anObject represent the same object." | ||
|
||
self == anObject ifTrue: [ ^ true ]. | ||
self class = anObject class ifFalse: [ ^ false ]. | ||
^ self id = anObject id | ||
] | ||
|
||
{ #category : 'visiting' } | ||
SpDynamicActionGroup >> acceptVisitor: aVisitor [ | ||
|
||
^ aVisitor visitCommandDynamicGroup: self | ||
] | ||
|
||
{ #category : 'converting' } | ||
SpDynamicActionGroup >> asMenuPresenter [ | ||
|
||
^ SpActionMenuPresenterBuilder new | ||
visit: self; | ||
menuPresenter | ||
] | ||
|
||
{ #category : 'private' } | ||
SpDynamicActionGroup >> dynamicBuilder [ | ||
|
||
^ dynamicBuilder | ||
] | ||
|
||
{ #category : 'comparing' } | ||
SpDynamicActionGroup >> hash [ | ||
"Answer an integer value that is related to the identity of the receiver." | ||
|
||
^ self id hash | ||
] | ||
|
||
{ #category : 'accessing' } | ||
SpDynamicActionGroup >> id [ | ||
|
||
^ id ifNil: [ id := super id ] | ||
] | ||
|
||
{ #category : 'initialization' } | ||
SpDynamicActionGroup >> initialize [ | ||
|
||
decoratedGroup := SpBaseActionGroup new. | ||
super initialize | ||
] | ||
|
||
{ #category : 'accessing' } | ||
SpDynamicActionGroup >> with: aBlock [ | ||
|
||
dynamicBuilder := aBlock | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,7 @@ | ||
Extension { #name : 'SpMenuPresenter' } | ||
|
||
{ #category : '*Spec2-Commander2' } | ||
SpMenuPresenter >> fillWith: aCommandGroup [ | ||
|
||
self removeAllItems. | ||
self presenterBuilderClass new | ||
menuPresenter: self; | ||
visit: aCommandGroup | ||
] | ||
|
||
{ #category : '*Spec2-Commander2' } | ||
SpMenuPresenter >> presenterBuilderClass [ | ||
|
||
^ SpMenuPresenterBuilder | ||
^ SpActionMenuPresenterBuilder | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters