Skip to content

Commit

Permalink
ToTagElement: method renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
plantec committed Oct 5, 2024
1 parent 3c5b341 commit 11f7d60
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 36 deletions.
7 changes: 5 additions & 2 deletions src/Toplo-Examples/ToSandBox.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -1771,7 +1771,7 @@ ToSandBox class >> example_SelectAntDesignIconMultiFiltrable [
tag icon: (iconDesc icon size: 48 asPoint).
tag addStamp: #closeIcon.
node addChild: tag ].
select sample: select popupListDataAccessor first.
select sample: select popupListElement dataAccessor first.
select hMatchParent.
select placeholderText:
('Select icons' asRopedText foreground: Color red).
Expand Down Expand Up @@ -1824,7 +1824,7 @@ ToSandBox class >> example_SelectMaterialDesignIconMultiFiltrable [
select nodeBuilder: [ :node :iconDesc :holder |
| tag |
tag := ToTagElement new.
tag closeIcon: true.
tag removable: true.
tag bordered: false.
tag icon: (iconDesc icon size: 48 asPoint).
node addChild: tag ].
Expand Down Expand Up @@ -1906,6 +1906,8 @@ ToSandBox class >> example_SelectMultiFiltrable [
labelText: stateColorAssoc key asString;
hMatchParent;
yourself.
tag removable: true.

tag constraintsDo: [ :c |
c linear vertical alignCenter ].
tag
Expand Down Expand Up @@ -2082,6 +2084,7 @@ ToSandBox class >> example_SelectMultiFiltrableWithHideSelected [

| select innerWindow |
select := ToMultiSelectElement new.
select withCloseButton: true.
select popupListElement primarySelectionMode option masked: true.
select hideSelected: true.
select popupListElement dataAccessor updateAllWith:
Expand Down
26 changes: 13 additions & 13 deletions src/Toplo-Widget-Select/ToMultiSelectElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Class {
#superclass : #ToSelectElement,
#instVars : [
'hideSelected',
'nodesWithCloseButton'
'withCloseButton'
],
#category : #'Toplo-Widget-Select-Multi'
}
Expand Down Expand Up @@ -127,18 +127,6 @@ ToMultiSelectElement >> nodeWrapping: aBoolean [
self innerContainer nodeWrapping: aBoolean
]

{ #category : #accessing }
ToMultiSelectElement >> nodesWithCloseButton [

^ nodesWithCloseButton ifNil: [ nodesWithCloseButton := true ]
]

{ #category : #accessing }
ToMultiSelectElement >> nodesWithCloseButton: aBoolean [

nodesWithCloseButton := aBoolean
]

{ #category : #'accessing - list' }
ToMultiSelectElement >> setGroupIndex: anIndex [

Expand All @@ -151,3 +139,15 @@ ToMultiSelectElement >> updateSelectedCountLabel [

self iconContainer updateSelectedCountLabel
]

{ #category : #accessing }
ToMultiSelectElement >> withCloseButton [

^ withCloseButton ifNil: [ withCloseButton := true ]
]

{ #category : #accessing }
ToMultiSelectElement >> withCloseButton: aBoolean [

withCloseButton := aBoolean
]
8 changes: 7 additions & 1 deletion src/Toplo-Widget-Select/ToMultiSelectHolder.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ToMultiSelectHolder >> removeNodeFromBar [
self selecter deselectIndex: index
]

{ #category : #'as yet unclassified' }
{ #category : #'t - select inner container' }
ToMultiSelectHolder >> selectElement [

^ self listElement selectElement
Expand All @@ -33,3 +33,9 @@ ToMultiSelectHolder >> selecter [

^ self selectElement selecter
]

{ #category : #accessing }
ToMultiSelectHolder >> withCloseButton [

^ self selectElement withCloseButton
]
7 changes: 1 addition & 6 deletions src/Toplo-Widget-Tag/TToTagElement.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ TToTagElement >> addRemoveButton [
| but |
but := ToButton new.
but applySkinInstallerOnFirstRequest: true.
but addStamp: #'parent-tag' withValue: self.
but defaultRawSkin: ToTagRemoveButtonSkin new.
but icon: (ToImage inner: (self iconNamed: #windowClose)).
but constraintsDo: [ :c | c linear vertical alignCenter ].
Expand Down Expand Up @@ -38,12 +39,6 @@ TToTagElement >> bordered: aBoolean [
self addStamp: #bordered withValue: aBoolean
]

{ #category : #accessing }
TToTagElement >> closeIcon: aBoolean [

self addStamp: #closeIcon withValue: aBoolean
]

{ #category : #accessing }
TToTagElement >> rawRemovable [

Expand Down
12 changes: 6 additions & 6 deletions src/Toplo-Widget-Tag/ToTagBarElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@ ToTagBarElement >> nodesSelect: aBlock [
^ self innerContainer nodesSelect: aBlock
]

{ #category : #accessing }
ToTagBarElement >> nodesWithCloseButton [

^ false
]

{ #category : #accessing }
ToTagBarElement >> sample: aData [

super sample: (ToSingleTagModel new
data: aData;
yourself)
]

{ #category : #accessing }
ToTagBarElement >> withCloseButton [

^ false
]
8 changes: 4 additions & 4 deletions src/Toplo-Widget-Tag/ToTagLabelSkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ ToTagLabelSkin >> enabledSkinEvent: anEvent [

super enabledSkinEvent: anEvent.
anEvent elementDo: [ :e |
| foregroundColor defaultTokn |
defaultTokn := #'border-color-primary-selection'.
| foregroundColor defaultToken |
defaultToken := #'border-color-primary-selection'.
e
withStamp: #'parent-tag'
do: [ :tag |
tag
withStamp: #foregroundColor
do: [ :v | foregroundColor := v ]
ifNone: [ foregroundColor := e valueOfTokenNamed: defaultTokn ] ]
ifNone: [ foregroundColor := e valueOfTokenNamed: defaultTokn ].
ifNone: [ foregroundColor := e valueOfTokenNamed: defaultToken ] ]
ifNone: [ foregroundColor := e valueOfTokenNamed: defaultToken ].
e foreground: foregroundColor ]
]

Expand Down
4 changes: 2 additions & 2 deletions src/Toplo-Widget-Tag/ToTagNodeHolder.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ ToTagNodeHolder >> removeNodeFromBar [

]

{ #category : #'as yet unclassified' }
{ #category : #accessing }
ToTagNodeHolder >> withCloseButton [

^ self listElement nodesWithCloseButton
^ self listElement withCloseButton
]
22 changes: 21 additions & 1 deletion src/Toplo-Widget-Tag/ToTagRemoveButtonSkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@ Class {
#category : #'Toplo-Widget-Tag-Core'
}

{ #category : #'event handling' }
ToTagRemoveButtonSkin >> disabledSkinEvent: anEvent [

super disabledSkinEvent: anEvent.
anEvent elementDo: [ :e |
e icon innerImageColor: Color veryLightGray ]
]

{ #category : #'event handling' }
ToTagRemoveButtonSkin >> enabledSkinEvent: anEvent [

super enabledSkinEvent: anEvent.
anEvent elementDo: [ :e |
| c |
c := Color veryLightGray.
e
withStamp: #'parent-tag'
do: [ :tag | tag withStamp: #foregroundColor do: [ :v | c := v ] ].
e icon innerImageColor: c ]
]

{ #category : #'event handling' }
ToTagRemoveButtonSkin >> hoveredSkinEvent: anEvent [

Expand All @@ -18,7 +39,6 @@ ToTagRemoveButtonSkin >> installSkinEvent: anEvent [

super installSkinEvent: anEvent.
anEvent elementDo: [ :e |
e icon innerImageColor: Color gray.
e fitContent.
e geometry: BlCircleGeometry new.
e border: BlBorder empty.
Expand Down
1 change: 0 additions & 1 deletion src/Toplo-Widget-Tag/ToTagSkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ ToTagSkin >> installSkinEvent: anEvent [

super installSkinEvent: anEvent.
anEvent elementDo: [ :e |
e removable: (e valueOfStamp: #closeIcon).
e geometry: (BlRoundedRectangleGeometry cornerRadius:
(e valueOfTokenNamed: 'border-radius')).
e padding: (BlInsets
Expand Down

0 comments on commit 11f7d60

Please sign in to comment.