diff --git a/src/Toplo-Examples/ToSandBox.class.st b/src/Toplo-Examples/ToSandBox.class.st index ab0a6b00..2157643c 100644 --- a/src/Toplo-Examples/ToSandBox.class.st +++ b/src/Toplo-Examples/ToSandBox.class.st @@ -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). @@ -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 ]. @@ -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 @@ -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: diff --git a/src/Toplo-Widget-Select/ToMultiSelectElement.class.st b/src/Toplo-Widget-Select/ToMultiSelectElement.class.st index 2a950d4a..349d216d 100644 --- a/src/Toplo-Widget-Select/ToMultiSelectElement.class.st +++ b/src/Toplo-Widget-Select/ToMultiSelectElement.class.st @@ -3,7 +3,7 @@ Class { #superclass : #ToSelectElement, #instVars : [ 'hideSelected', - 'nodesWithCloseButton' + 'withCloseButton' ], #category : #'Toplo-Widget-Select-Multi' } @@ -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 [ @@ -151,3 +139,15 @@ ToMultiSelectElement >> updateSelectedCountLabel [ self iconContainer updateSelectedCountLabel ] + +{ #category : #accessing } +ToMultiSelectElement >> withCloseButton [ + + ^ withCloseButton ifNil: [ withCloseButton := true ] +] + +{ #category : #accessing } +ToMultiSelectElement >> withCloseButton: aBoolean [ + + withCloseButton := aBoolean +] diff --git a/src/Toplo-Widget-Select/ToMultiSelectHolder.class.st b/src/Toplo-Widget-Select/ToMultiSelectHolder.class.st index d4e4cbb2..46b53e48 100644 --- a/src/Toplo-Widget-Select/ToMultiSelectHolder.class.st +++ b/src/Toplo-Widget-Select/ToMultiSelectHolder.class.st @@ -22,7 +22,7 @@ ToMultiSelectHolder >> removeNodeFromBar [ self selecter deselectIndex: index ] -{ #category : #'as yet unclassified' } +{ #category : #'t - select inner container' } ToMultiSelectHolder >> selectElement [ ^ self listElement selectElement @@ -33,3 +33,9 @@ ToMultiSelectHolder >> selecter [ ^ self selectElement selecter ] + +{ #category : #accessing } +ToMultiSelectHolder >> withCloseButton [ + + ^ self selectElement withCloseButton +] diff --git a/src/Toplo-Widget-Tag/TToTagElement.trait.st b/src/Toplo-Widget-Tag/TToTagElement.trait.st index df131f99..6d714cfc 100644 --- a/src/Toplo-Widget-Tag/TToTagElement.trait.st +++ b/src/Toplo-Widget-Tag/TToTagElement.trait.st @@ -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 ]. @@ -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 [ diff --git a/src/Toplo-Widget-Tag/ToTagBarElement.class.st b/src/Toplo-Widget-Tag/ToTagBarElement.class.st index 81e362f7..2dc74fdf 100644 --- a/src/Toplo-Widget-Tag/ToTagBarElement.class.st +++ b/src/Toplo-Widget-Tag/ToTagBarElement.class.st @@ -73,12 +73,6 @@ ToTagBarElement >> nodesSelect: aBlock [ ^ self innerContainer nodesSelect: aBlock ] -{ #category : #accessing } -ToTagBarElement >> nodesWithCloseButton [ - - ^ false -] - { #category : #accessing } ToTagBarElement >> sample: aData [ @@ -86,3 +80,9 @@ ToTagBarElement >> sample: aData [ data: aData; yourself) ] + +{ #category : #accessing } +ToTagBarElement >> withCloseButton [ + + ^ false +] diff --git a/src/Toplo-Widget-Tag/ToTagLabelSkin.class.st b/src/Toplo-Widget-Tag/ToTagLabelSkin.class.st index 1d8a3a4c..34154fe4 100644 --- a/src/Toplo-Widget-Tag/ToTagLabelSkin.class.st +++ b/src/Toplo-Widget-Tag/ToTagLabelSkin.class.st @@ -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 ] ] diff --git a/src/Toplo-Widget-Tag/ToTagNodeHolder.class.st b/src/Toplo-Widget-Tag/ToTagNodeHolder.class.st index bcde8af5..b9666e05 100644 --- a/src/Toplo-Widget-Tag/ToTagNodeHolder.class.st +++ b/src/Toplo-Widget-Tag/ToTagNodeHolder.class.st @@ -9,8 +9,8 @@ ToTagNodeHolder >> removeNodeFromBar [ ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } ToTagNodeHolder >> withCloseButton [ - ^ self listElement nodesWithCloseButton + ^ self listElement withCloseButton ] diff --git a/src/Toplo-Widget-Tag/ToTagRemoveButtonSkin.class.st b/src/Toplo-Widget-Tag/ToTagRemoveButtonSkin.class.st index 40f579d9..87db680a 100644 --- a/src/Toplo-Widget-Tag/ToTagRemoveButtonSkin.class.st +++ b/src/Toplo-Widget-Tag/ToTagRemoveButtonSkin.class.st @@ -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 [ @@ -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. diff --git a/src/Toplo-Widget-Tag/ToTagSkin.class.st b/src/Toplo-Widget-Tag/ToTagSkin.class.st index 952e8234..5c7a12c8 100644 --- a/src/Toplo-Widget-Tag/ToTagSkin.class.st +++ b/src/Toplo-Widget-Tag/ToTagSkin.class.st @@ -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