diff --git a/src/Toplo-Examples/ToSandBox.class.st b/src/Toplo-Examples/ToSandBox.class.st index e758eed3..69ece709 100644 --- a/src/Toplo-Examples/ToSandBox.class.st +++ b/src/Toplo-Examples/ToSandBox.class.st @@ -235,7 +235,7 @@ ToSandBox class >> barWithData: aCollection [ labelText: 'Unable/disable'; whenClickedDo: [ idxes do: [ :idx | - bar disabledSelecter switchIndexSelection: idx ] ]). + (bar nodeAt: idx) disable ] ]). m addItem: (ToMenuItem new labelText: 'Unselectable'; whenClickedDo: [ @@ -6991,9 +6991,9 @@ ToSandBox class >> listWithEditableAndContextMenu [ selectionMenu addItem: (ToMenuItem new labelText: 'Enable/Disable'; whenClickedDo: [ :event | - indexes do: [ :idx | - target disabledSelecter switchIndexSelection: - idx ] ]; + indexes do: [ :idx | | di | + di := (l nodeAt: idx) isDisabled. + (l nodeAt: idx) disabled: di not ] ]; yourself). selectionMenu addItem: (ToMenuItem new labelText: 'Set unselectable'; diff --git a/src/Toplo-Widget-Album/ToLabelSkin.class.st b/src/Toplo-Widget-Album/ToLabelSkin.class.st index 11a021f1..0e34bce4 100644 --- a/src/Toplo-Widget-Album/ToLabelSkin.class.st +++ b/src/Toplo-Widget-Album/ToLabelSkin.class.st @@ -8,7 +8,7 @@ Class { ToLabelSkin >> deselectedSkinEvent: anEvent [ super deselectedSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | | to | to := e valueOfTokenNamed: #'color-text'. e foreground: to ] @@ -48,7 +48,7 @@ ToLabelSkin >> installSkinEvent: anEvent [ ToLabelSkin >> selectedSkinEvent: anEvent [ super selectedSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | | tokname to | tokname := anEvent focused ifTrue: [ #'label-selected-focused' ] diff --git a/src/Toplo-Widget-List-Tests/ToItemBarElementTest.class.st b/src/Toplo-Widget-List-Tests/ToItemBarElementTest.class.st index 3e7e5330..d9b536f6 100644 --- a/src/Toplo-Widget-List-Tests/ToItemBarElementTest.class.st +++ b/src/Toplo-Widget-List-Tests/ToItemBarElementTest.class.st @@ -65,7 +65,7 @@ ToItemBarElementTest >> testDisableItemAfterAdding [ self assert: item positionInBar equals: 1. self assert: (l disabledSelectionModel containsIndex: item positionInBar). self assert: item isDisabled. - self deny: n isDisabled. + self assert: n isDisabled. ] @@ -95,7 +95,7 @@ ToItemBarElementTest >> testDisableItemAfterAdding2 [ self assert: n item positionInBar equals: 2. self assert: (l disabledSelectionModel containsIndex: n item positionInBar). self assert: n item isDisabled. - self deny: n isDisabled. + self assert: n isDisabled. n := l nodes third. self assert: n item positionInBar equals: 3. @@ -124,7 +124,7 @@ ToItemBarElementTest >> testDisableItemBeforeAdding [ self assert: item positionInBar equals: 1. self assert: (l disabledSelectionModel containsIndex: item positionInBar). self assert: item isDisabled. - self deny: n isDisabled. + self assert: n isDisabled. ] @@ -153,7 +153,7 @@ ToItemBarElementTest >> testDisableItemBeforeAdding2 [ self assert: n item positionInBar equals: 2. self assert: (l disabledSelectionModel containsIndex: n item positionInBar). self assert: n item isDisabled. - self deny: n isDisabled. + self assert: n isDisabled. n := l nodes third. self assert: n item positionInBar equals: 3. diff --git a/src/Toplo-Widget-List-Tests/ToListElementTest.class.st b/src/Toplo-Widget-List-Tests/ToListElementTest.class.st index 384b0976..04d15e52 100644 --- a/src/Toplo-Widget-List-Tests/ToListElementTest.class.st +++ b/src/Toplo-Widget-List-Tests/ToListElementTest.class.st @@ -73,6 +73,28 @@ ToListElementTest >> testDataRemovedWhenNodeRemoved [ list primarySelectionMode selectionOption selectionElements isEmpty ] +{ #category : #'test selection - mode' } +ToListElementTest >> testDisable [ + + | l | + l := ToListElement new. + space root addChild: l. + l matchParent. + l dataAccessor addAll: { #A. #B. #C }. + l selecter selectIndex: 2. + l secondarySelecter selectIndex: 3. + self waitTestingSpaces. + self assert: l selectionModel selectedIndexes equals: { 2 }. + self assert: l secondarySelectionModel selectedIndexes equals: { 3 }. + l disable. + self waitTestingSpaces. + self assert: l isDisabled. + self assert: l selectionModel isEmpty. + self assert: l secondarySelectionModel isEmpty. + l nodesDo: [ :n | self assert: n isDisabled ] + +] + { #category : #'test selection - mode' } ToListElementTest >> testDisabledSelectionModel [ @@ -200,6 +222,32 @@ ToListElementTest >> testEmptyListSelectPreviousInSelection [ self assert: l selectionModel isEmpty ] +{ #category : #'test selection - mode' } +ToListElementTest >> testEnable [ + + | l | + l := ToListElement new. + space root addChild: l. + l matchParent. + l dataAccessor addAll: { #A. #B. #C }. + l selecter selectIndex: 2. + l secondarySelecter selectIndex: 3. + l disable. + self waitTestingSpaces. + self assert: l isDisabled. + self assert: l selectionModel isEmpty. + self assert: l secondarySelectionModel isEmpty. + l nodesDo: [ :n | self assert: n isDisabled ]. + l enable. + self assert: l isEnabled. + self assert: l selectionModel isEmpty. + self assert: l secondarySelectionModel isEmpty. + l nodesDo: [ :n | self deny: n isDisabled ]. + + + +] + { #category : #'test selection - mode' } ToListElementTest >> testHiddenSelectionModel [ diff --git a/src/Toplo-Widget-List-Tests/ToSpecificListElementTest.class.st b/src/Toplo-Widget-List-Tests/ToSpecificListElementTest.class.st index 0b6e385c..9e507250 100644 --- a/src/Toplo-Widget-List-Tests/ToSpecificListElementTest.class.st +++ b/src/Toplo-Widget-List-Tests/ToSpecificListElementTest.class.st @@ -114,6 +114,24 @@ ToSpecificListElementTest >> testDisabledWithTwoNodes2 [ self assert: l disabledSelecter selectedIndexes equals: { 2 } ] +{ #category : #tests } +ToSpecificListElementTest >> testDisabledWithTwoNodes3 [ + + l dataAccessor add: 'first'. + space root addChild: l. + self waitTestingSpaces. + self assert: l nodes size equals: 1. + self assert: l disabledSelectionModel isEmpty. + l nodes first disabled: true. + self waitTestingSpaces. + self assert: l disabledSelecter selectedIndex equals: 1. + self assert: l nodes first isDisabled. + l dataAccessor addFirst: 'second'. + self waitTestingSpaces. + self assert: l disabledSelecter selectedIndex equals: 2. + self assert: l disabledSelecter selectedIndexes equals: { 2 } +] + { #category : #tests } ToSpecificListElementTest >> testEmptyList [ diff --git a/src/Toplo-Widget-List/TToItem.trait.st b/src/Toplo-Widget-List/TToItem.trait.st index ccd73d0c..b9942f44 100644 --- a/src/Toplo-Widget-List/TToItem.trait.st +++ b/src/Toplo-Widget-List/TToItem.trait.st @@ -1,66 +1,61 @@ Trait { #name : #TToItem, - #instVars : [ - 'barOwner', - 'barElement', - 'itemConstraints' - ], #category : #'Toplo-Widget-List-ItemBar' } { #category : #'t - item' } TToItem >> barElement [ - ^ barElement + ^ self userData at: #barElement ifAbsent: [ ] ] { #category : #'t - item' } TToItem >> barElement: anItemBarElement [ - barElement := anItemBarElement + self userData at: #barElement put: anItemBarElement ] { #category : #'t - item' } TToItem >> barElementDo: aBlock [ - barElement ifNil: [ ^ self ]. - aBlock value: barElement + self barElement ifNotNil: [ :be | aBlock value: be ] ] { #category : #'t - item' } TToItem >> barOwner [ - ^ barOwner + ^ self userData at: #barOwner ifAbsent: [ ] ] { #category : #'t - item' } TToItem >> barOwner: anItemContainer [ - barOwner := anItemContainer + self userData at: #barOwner put: anItemContainer ] { #category : #'t - item' } TToItem >> barOwnerDo: aBlock [ - barOwner ifNil: [ ^ self ]. - aBlock value: barOwner + self barOwner ifNotNil: [ :bo | aBlock value: bo ] ] { #category : #'t - item' } -TToItem >> disabled: aBoolean [ +TToItem >> ensuredItemConstraints [ - self storeDisabled: aBoolean. - barElement ifNotNil: [ :l | - aBoolean - ifTrue: [ l disabledItem: self ] - ifFalse: [ l enabledItem: self ] ]. - super disabled: aBoolean + ^ self userData + at: #itemConstraints + ifAbsentPut: [self newItemConstraints ] ] { #category : #'t - item' } -TToItem >> ensureConstraintsStorage [ +TToItem >> flagAsDisabled: aBoolean [ - itemConstraints := ToItemConstraints new + self storeDisabled: aBoolean. + self barElementDo: [ :be | + aBoolean + ifTrue: [ be disabledItem: self ] + ifFalse: [ be enabledItem: self ] ]. + super flagAsDisabled: aBoolean ] { #category : #'t - item' } @@ -74,38 +69,46 @@ TToItem >> hidden: aBoolean [ ] { #category : #'t - item' } -TToItem >> positionInBar [ +TToItem >> itemConstraints [ - self barElementDo: [ :pm | ^ pm items indexOf: self ]. - ^ 0 + ^ self userData at: #itemConstraints ifAbsent: [ ] ] { #category : #'t - item' } -TToItem >> storeDisabled: aBoolean [ +TToItem >> itemConstraintsDo: aValuable [ - self ensureConstraintsStorage. - itemConstraints disabled: aBoolean + self itemConstraints ifNil: [ ^ self ]. + aValuable value: self itemConstraints ] { #category : #'t - item' } -TToItem >> storeHidden: aBoolean [ +TToItem >> newItemConstraints [ - self ensureConstraintsStorage. - itemConstraints hidden: aBoolean + ^ ToItemConstraints new ] { #category : #'t - item' } -TToItem >> storeUnselectable: aBoolean [ +TToItem >> positionInBar [ + + ^ self holder position +] + +{ #category : #'t - item' } +TToItem >> storeDisabled: aBoolean [ + + self ensuredItemConstraints disabled: aBoolean +] - self ensureConstraintsStorage. - itemConstraints unselectable: aBoolean +{ #category : #'t - item' } +TToItem >> storeHidden: aBoolean [ + + self ensuredItemConstraints hidden: aBoolean ] { #category : #'t - item' } -TToItem >> storedConstraintsDo: aValuable [ +TToItem >> storeUnselectable: aBoolean [ - itemConstraints ifNil: [ ^ self ]. - aValuable value: itemConstraints + self ensuredItemConstraints unselectable: aBoolean ] { #category : #'t - item' } diff --git a/src/Toplo-Widget-List/TToItemBarOwner.trait.st b/src/Toplo-Widget-List/TToItemBarOwner.trait.st index 352ddcc5..445a5147 100644 --- a/src/Toplo-Widget-List/TToItemBarOwner.trait.st +++ b/src/Toplo-Widget-List/TToItemBarOwner.trait.st @@ -1,49 +1,46 @@ Trait { #name : #TToItemBarOwner, - #instVars : [ - 'itemBar' - ], #category : #'Toplo-Widget-List-ItemBar' } { #category : #'t - item bar owner - adding/removing' } TToItemBarOwner >> addAllItems: aCollection [ - itemBar addAllItems: aCollection + self itemBar addAllItems: aCollection ] { #category : #'t - item bar owner - adding/removing' } TToItemBarOwner >> addItem: anItem [ - itemBar addItem: anItem. + self itemBar addItem: anItem. self onAddedItem: anItem ] { #category : #'t - item bar owner - adding/removing' } TToItemBarOwner >> addItem: anItem after: anotherItem [ - itemBar addItem: anItem after: anotherItem. + self itemBar addItem: anItem after: anotherItem. self onAddedItem: anItem ] { #category : #'t - item bar owner - adding/removing' } TToItemBarOwner >> addItem: anItem afterIndex: anInteger [ - itemBar addItem: anItem afterIndex: anInteger. + self itemBar addItem: anItem afterIndex: anInteger. self onAddedItem: anItem ] { #category : #'t - item bar owner - adding/removing' } TToItemBarOwner >> addItem: anItem before: anotherItem [ - itemBar addItem: anItem before: anotherItem. + self itemBar addItem: anItem before: anotherItem. self onAddedItem: anItem ] { #category : #'t - item bar owner - adding/removing' } TToItemBarOwner >> addItem: anItem beforeIndex: anInteger [ - itemBar addItem: anItem beforeIndex: anInteger. + self itemBar addItem: anItem beforeIndex: anInteger. self onAddedItem: anItem ] @@ -81,13 +78,13 @@ TToItemBarOwner >> disableItem: anItem [ { #category : #'t - item bar owner - disable/ enable' } TToItemBarOwner >> disabledAtPosition: anInteger [ - itemBar disabledAtPosition: anInteger + self itemBar disabledAtPosition: anInteger ] { #category : #'t - item bar owner - disable/ enable' } TToItemBarOwner >> disabledItem: anItem [ - itemBar disabledItem: anItem + self itemBar disabledItem: anItem ] { #category : #'t - item bar owner - disable/ enable' } @@ -104,13 +101,13 @@ TToItemBarOwner >> enableItem: anItem [ { #category : #'t - item bar owner - disable/ enable' } TToItemBarOwner >> enabledAtPosition: anInteger [ - itemBar enabledAtPosition: anInteger + self itemBar enabledAtPosition: anInteger ] { #category : #'t - item bar owner - disable/ enable' } TToItemBarOwner >> enabledItem: anItem [ - itemBar enabledItem: anItem + self itemBar enabledItem: anItem ] { #category : #'t - item bar owner - testing' } @@ -122,19 +119,19 @@ TToItemBarOwner >> hasItems [ { #category : #'t - item bar owner - hidden/visible' } TToItemBarOwner >> hiddenAtPosition: anInteger [ - itemBar hiddenAtPosition: anInteger + self itemBar hiddenAtPosition: anInteger ] { #category : #'t - item bar owner - hidden/visible' } TToItemBarOwner >> hiddenItem: anItem [ - itemBar hiddenItem: anItem + self itemBar hiddenItem: anItem ] { #category : #'t - item bar owner - initializing' } TToItemBarOwner >> initializeAsItemBarOwner [ - itemBar := self newItemBar + self userData at: #itemBar put: self newItemBar ] { #category : #'t - item bar owner - accessing' } @@ -182,7 +179,7 @@ TToItemBarOwner >> isUniformNodeWidth [ { #category : #'t - item bar owner - accessing' } TToItemBarOwner >> itemBar [ - ^ itemBar + ^ self userData at: #itemBar ifAbsent: [ ] ] { #category : #'t - item bar owner - accessing' } @@ -276,26 +273,26 @@ TToItemBarOwner >> primarySelectionMode [ { #category : #'t - item bar owner - adding/removing' } TToItemBarOwner >> removeAllItems [ - itemBar removeAllItems + self itemBar removeAllItems ] { #category : #'t - item bar owner - adding/removing' } TToItemBarOwner >> removeAllItems: aCollection [ - itemBar removeAllItems: aCollection + self itemBar removeAllItems: aCollection ] { #category : #'t - item bar owner - adding/removing' } TToItemBarOwner >> removeItem: anItem [ self onRemovedItem: anItem. - itemBar removeItem: anItem + self itemBar removeItem: anItem ] { #category : #'t - item bar owner - accessing' } TToItemBarOwner >> secondarySelecter [ - ^ itemBar secondarySelecter + ^ self itemBar secondarySelecter ] { #category : #'t - item bar owner - accessing' } @@ -313,13 +310,13 @@ TToItemBarOwner >> secondarySelectionModel [ { #category : #'t - item bar owner - unselectable/selectable' } TToItemBarOwner >> selectableAtPosition: anInteger [ - itemBar selectableAtPosition: anInteger + self itemBar selectableAtPosition: anInteger ] { #category : #'t - item bar owner - unselectable/selectable' } TToItemBarOwner >> selectableItem: anItem [ - itemBar selectableItem: anItem + self itemBar selectableItem: anItem ] { #category : #'t - item bar owner - accessing' } @@ -351,23 +348,23 @@ TToItemBarOwner >> uniformNodeWidth: aBoolean [ { #category : #'t - item bar owner - unselectable/selectable' } TToItemBarOwner >> unselectableAtPosition: anInteger [ - itemBar unselectableAtPosition: anInteger + self itemBar unselectableAtPosition: anInteger ] { #category : #'t - item bar owner - unselectable/selectable' } TToItemBarOwner >> unselectableItem: anItem [ - itemBar unselectableItem: anItem + self itemBar unselectableItem: anItem ] { #category : #'t - item bar owner - hidden/visible' } TToItemBarOwner >> visibleAtPosition: anInteger [ - itemBar visibleAtPosition: anInteger + self itemBar visibleAtPosition: anInteger ] { #category : #'t - item bar owner - hidden/visible' } TToItemBarOwner >> visibleItem: anItem [ - itemBar visibleItem: anItem + self itemBar visibleItem: anItem ] diff --git a/src/Toplo-Widget-List/TToListNode.trait.st b/src/Toplo-Widget-List/TToListNode.trait.st index c088a6c7..00758108 100644 --- a/src/Toplo-Widget-List/TToListNode.trait.st +++ b/src/Toplo-Widget-List/TToListNode.trait.st @@ -8,3 +8,16 @@ TToListNode >> clickEventHandlerClasses [ self explicitRequirement ] + +{ #category : #'t - list node' } +TToListNode >> flagAsDisabled: aBoolean [ + + self holder disabled: aBoolean. + super flagAsDisabled: aBoolean +] + +{ #category : #'t - list node' } +TToListNode >> listElementDo: aValuable [ + + self holder listElement ifNotNil: [ :le | aValuable value: le ] +] diff --git a/src/Toplo-Widget-List/ToAbstractListElement.class.st b/src/Toplo-Widget-List/ToAbstractListElement.class.st index ff60c6cb..68ee194d 100644 --- a/src/Toplo-Widget-List/ToAbstractListElement.class.st +++ b/src/Toplo-Widget-List/ToAbstractListElement.class.st @@ -228,6 +228,15 @@ ToAbstractListElement >> fakeNode [ ^ nil ] +{ #category : #'t - item' } +ToAbstractListElement >> flagAsDisabled: aBoolean [ + + aBoolean ifTrue: [ + self selecter deselectAll. + self secondarySelecter deselectAll ]. + super flagAsDisabled: aBoolean +] + { #category : #'accessing selecters' } ToAbstractListElement >> hiddenAtPosition: anInteger [ diff --git a/src/Toplo-Widget-List/ToItemBarNodeHolder.class.st b/src/Toplo-Widget-List/ToItemBarNodeHolder.class.st index 802646d3..f4c36882 100644 --- a/src/Toplo-Widget-List/ToItemBarNodeHolder.class.st +++ b/src/Toplo-Widget-List/ToItemBarNodeHolder.class.st @@ -4,11 +4,22 @@ Class { #category : #'Toplo-Widget-List-ItemBar' } +{ #category : #accessing } +ToItemBarNodeHolder >> dataItem: aDataItem [ + + | infiniteConstraints | + super dataItem: aDataItem. + infiniteConstraints := aDataItem constraints infinite. + infiniteConstraints holder: self +] + { #category : #accessing } ToItemBarNodeHolder >> initializeNode [ - self dataItem storedConstraintsDo: [ :pd | - pd constraintItem: self dataItem. + self dataItem itemConstraintsDo: [ :ic | + ic constraintItem: self dataItem. self disabled: self dataItem isDisabled. + self node flagAsDisabled: self dataItem isDisabled. self isHidden ifTrue: [ self node height: 0 ] ] + ] diff --git a/src/Toplo-Widget-Menu-Tests/ToMenuItemBarElementTest.class.st b/src/Toplo-Widget-Menu-Tests/ToMenuItemBarElementTest.class.st index 53666710..fba704d7 100644 --- a/src/Toplo-Widget-Menu-Tests/ToMenuItemBarElementTest.class.st +++ b/src/Toplo-Widget-Menu-Tests/ToMenuItemBarElementTest.class.st @@ -65,7 +65,7 @@ ToMenuItemBarElementTest >> testDisableItemAfterAdding [ self assert: item positionInBar equals: 1. self assert: (l disabledSelectionModel containsIndex: item positionInBar). self assert: item isDisabled. - self deny: n isDisabled. + self assert: n isDisabled. ] @@ -95,7 +95,7 @@ ToMenuItemBarElementTest >> testDisableItemAfterAdding2 [ self assert: n item positionInBar equals: 2. self assert: (l disabledSelectionModel containsIndex: n item positionInBar). self assert: n item isDisabled. - self deny: n isDisabled. + self assert: n isDisabled. n := l nodes third. self assert: n item positionInBar equals: 3. @@ -124,7 +124,7 @@ ToMenuItemBarElementTest >> testDisableItemBeforeAdding [ self assert: item positionInBar equals: 1. self assert: (l disabledSelectionModel containsIndex: item positionInBar). self assert: item isDisabled. - self deny: n isDisabled. + self assert: n isDisabled. ] @@ -153,7 +153,7 @@ ToMenuItemBarElementTest >> testDisableItemBeforeAdding2 [ self assert: n item positionInBar equals: 2. self assert: (l disabledSelectionModel containsIndex: n item positionInBar). self assert: n item isDisabled. - self deny: n isDisabled. + self assert: n isDisabled. n := l nodes third. self assert: n item positionInBar equals: 3. diff --git a/src/Toplo-Widget-Menu-Tests/ToMenuTest.class.st b/src/Toplo-Widget-Menu-Tests/ToMenuTest.class.st index ee1214ec..803f7327 100644 --- a/src/Toplo-Widget-Menu-Tests/ToMenuTest.class.st +++ b/src/Toplo-Widget-Menu-Tests/ToMenuTest.class.st @@ -51,7 +51,7 @@ ToMenuTest >> testBuilderDisableItemAfterAdding [ (m menuWindow itemBar disabledSelectionModel containsIndex: item positionInBar). self assert: item isDisabled. - self deny: n isDisabled + self assert: n isDisabled ] { #category : #tests } @@ -70,7 +70,7 @@ ToMenuTest >> testBuilderDisableItemBeforeAdding [ (m menuWindow itemBar disabledSelectionModel containsIndex: item positionInBar). self assert: item isDisabled. - self deny: n isDisabled + self assert: n isDisabled ] { #category : #tests } @@ -88,7 +88,7 @@ ToMenuTest >> testDisableItemAfterAdding [ (m menuWindow itemBar disabledSelectionModel containsIndex: item positionInBar). self assert: item isDisabled. - self deny: n isDisabled + self assert: n isDisabled ] { #category : #tests } @@ -106,5 +106,5 @@ ToMenuTest >> testDisableItemBeforeAdding [ (m menuWindow itemBar disabledSelectionModel containsIndex: item positionInBar). self assert: item isDisabled. - self deny: n isDisabled + self assert: n isDisabled ] diff --git a/src/Toplo-Widget-Segmented/ToSegmentedButtonSkin.class.st b/src/Toplo-Widget-Segmented/ToSegmentedButtonSkin.class.st index 3ab04b6b..63fecb9b 100644 --- a/src/Toplo-Widget-Segmented/ToSegmentedButtonSkin.class.st +++ b/src/Toplo-Widget-Segmented/ToSegmentedButtonSkin.class.st @@ -26,7 +26,7 @@ ToSegmentedButtonSkin >> enabledSkinEvent: anEvent [ super enabledSkinEvent: anEvent. anEvent elementDo: [ :e | e iconDo: [ :ic | - ic formColor: (e valueOfTokenNamed: #'color-text') ]. + ic innerImageColor: (e valueOfTokenNamed: #'color-text') ]. e endElementDo: [ :ic | (ic respondsTo: #innerImageColor:) ifTrue: [ ic innerImageColor: (e valueOfTokenNamed: #'color-text') ] ]. diff --git a/src/Toplo/BlElement.extension.st b/src/Toplo/BlElement.extension.st index a1e66eb3..5f854739 100644 --- a/src/Toplo/BlElement.extension.st +++ b/src/Toplo/BlElement.extension.st @@ -120,14 +120,7 @@ BlElement >> disable [ { #category : #'*Toplo' } BlElement >> disabled: aBoolean [ - self isDisabled = aBoolean ifFalse: [ - aBoolean - ifTrue: [ - self loseFocus. - self flagAsDisabled ] - ifFalse: [ self flagAsEnabled ]. - self dispatchEvent: ToEnablementChangedEvent new. - self skinManagerDo: [ :sm | sm enablementChangedIn: self ] ]. + self flagAsDisabled: aBoolean. self childrenDo: [ :child | child disabled: aBoolean ] ] @@ -207,6 +200,19 @@ BlElement >> flagAsDisabled [ self userData at: #enabled put: false ] +{ #category : #'*Toplo' } +BlElement >> flagAsDisabled: aBoolean [ + + self isDisabled = aBoolean ifTrue: [ ^ self ]. + aBoolean + ifTrue: [ + self loseFocus. + self flagAsDisabled ] + ifFalse: [ self flagAsEnabled ]. + self dispatchEvent: ToEnablementChangedEvent new. + self skinManagerDo: [ :sm | sm enablementChangedIn: self ] +] + { #category : #'*Toplo' } BlElement >> flagAsEnabled [ @@ -627,15 +633,6 @@ BlElement >> skinUninstaller: aSkinUninstaller [ self skinManager setSkinUninstaller: aSkinUninstaller in: self ] -{ #category : #'*Toplo' } -BlElement >> storedConstraintsDo: aValuable [ - - " do nothing at this level. - It redefined for an element that is used as a list data item. - This is the case for a menu or a segmented button as examples - ( see `TToItem` users )" -] - { #category : #'*Toplo' } BlElement >> styleSheet [