Skip to content

Commit

Permalink
Apply context menu trait to button, label and list
Browse files Browse the repository at this point in the history
  • Loading branch information
tinchodias committed Jul 17, 2024
1 parent 20388fc commit 66212e7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
19 changes: 4 additions & 15 deletions src/Spec-Toplo/SpToploButtonAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ I'm a Spec adapter for widgets, in general in the hierarchy of `SpAbstractWidget
Class {
#name : #SpToploButtonAdapter,
#superclass : #SpToploWidgetAdapter,
#traits : 'SpToploTWithContextMenu',
#classTraits : 'SpToploTWithContextMenu classTrait',
#category : #'Spec-Toplo-Adapters'
}

{ #category : #factory }
SpToploButtonAdapter >> buildWidget [

^ ToButton new
contextMenu: [ :win :request |
self inform: win asString ];
yourself
]

{ #category : #accessing }
Expand All @@ -28,12 +27,6 @@ SpToploButtonAdapter >> label [
^ widget labelText
]

{ #category : #factory }
SpToploButtonAdapter >> newContextMenu [

^ model contextMenu ifNotNil: #build
]

{ #category : #initialization }
SpToploButtonAdapter >> subscribeToPresenter [

Expand Down Expand Up @@ -66,7 +59,8 @@ SpToploButtonAdapter >> updateAll [
self
updateLabel;
updateIcon;
updateAction
updateAction;
updateMenu
]

{ #category : #'updating widget' }
Expand All @@ -81,8 +75,3 @@ SpToploButtonAdapter >> updateLabel [

widget labelText: model label
]

{ #category : #'updating widget' }
SpToploButtonAdapter >> updateMenu [
"No need to act; if the menu is opened, it will use the current one."
]
6 changes: 5 additions & 1 deletion src/Spec-Toplo/SpToploLabelAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ I'm a Spec adapter for `SpLabelPresenter`.
Class {
#name : #SpToploLabelAdapter,
#superclass : #SpToploWidgetAdapter,
#traits : 'SpToploTWithContextMenu',
#classTraits : 'SpToploTWithContextMenu classTrait',
#category : #'Spec-Toplo-Adapters'
}

Expand Down Expand Up @@ -38,7 +40,9 @@ SpToploLabelAdapter >> updateAll [

super updateAll.

self updateLabel
self
updateLabel;
updateMenu
]

{ #category : #'updating widget' }
Expand Down
5 changes: 4 additions & 1 deletion src/Spec-Toplo/SpToploListAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ I'm a Spec adapter for `SpListPresenter`.
Class {
#name : #SpToploListAdapter,
#superclass : #SpToploWidgetAdapter,
#traits : 'SpToploTWithContextMenu',
#classTraits : 'SpToploTWithContextMenu classTrait',
#category : #'Spec-Toplo-Adapters'
}

Expand Down Expand Up @@ -107,7 +109,8 @@ SpToploListAdapter >> updateAll [

self
updateItems;
updateSelection
updateSelection;
updateMenu
]

{ #category : #'updating widget' }
Expand Down

0 comments on commit 66212e7

Please sign in to comment.