diff --git a/src/Toplo-Demo/ToDemoButterflySkin1.class.st b/src/Toplo-Demo/ToDemoButterflySkin1.class.st index 8f80d5b0..34ca18a9 100644 --- a/src/Toplo-Demo/ToDemoButterflySkin1.class.st +++ b/src/Toplo-Demo/ToDemoButterflySkin1.class.st @@ -8,7 +8,7 @@ Class { ToDemoButterflySkin1 >> hoveredSkinEvent: anEvent [ super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | e background: Color white. e border: (BlBorder paint: Color blue width: 4) ] ] @@ -27,7 +27,7 @@ ToDemoButterflySkin1 >> installSkinEvent: anEvent [ ToDemoButterflySkin1 >> leavedSkinEvent: anEvent [ super leavedSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | e background: Color lightGray. e border: (BlBorder paint: Color yellow width: 4) ] ] diff --git a/src/Toplo-Demo/ToDemoButterflySkin2.class.st b/src/Toplo-Demo/ToDemoButterflySkin2.class.st index 1374652c..03dff1ec 100644 --- a/src/Toplo-Demo/ToDemoButterflySkin2.class.st +++ b/src/Toplo-Demo/ToDemoButterflySkin2.class.st @@ -8,7 +8,7 @@ Class { ToDemoButterflySkin2 >> hoveredSkinEvent: anEvent [ super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | e background: (e valueOfTokenNamed: #'color-success') ] ] @@ -34,7 +34,7 @@ ToDemoButterflySkin2 >> installSkinEvent: anEvent [ ToDemoButterflySkin2 >> leavedSkinEvent: anEvent [ super leavedSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | e background: (e valueOfTokenNamed: #'color-primary') ] ] diff --git a/src/Toplo-Demo/ToDemoSkin2.class.st b/src/Toplo-Demo/ToDemoSkin2.class.st index da9015d5..7260698b 100644 --- a/src/Toplo-Demo/ToDemoSkin2.class.st +++ b/src/Toplo-Demo/ToDemoSkin2.class.st @@ -8,7 +8,7 @@ Class { ToDemoSkin2 >> hoveredSkinEvent: anEvent [ super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | e background: Color red. e border: (BlBorder paint: Color blue width: 4) ] ] @@ -26,7 +26,7 @@ ToDemoSkin2 >> installSkinEvent: anEvent [ ToDemoSkin2 >> leavedSkinEvent: anEvent [ super leavedSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | e background: Color white. e border: (BlBorder paint: Color red width: 1) ] ] diff --git a/src/Toplo-Examples/ToPaneNodeExampleSkin.class.st b/src/Toplo-Examples/ToPaneNodeExampleSkin.class.st index 0bce6bd6..972d7c6a 100644 --- a/src/Toplo-Examples/ToPaneNodeExampleSkin.class.st +++ b/src/Toplo-Examples/ToPaneNodeExampleSkin.class.st @@ -30,7 +30,7 @@ ToPaneNodeExampleSkin >> createNodeButton [ ToPaneNodeExampleSkin >> hoveredSkinEvent: anEvent [ super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | " hovered skin can be dispatched whereas no leaved look event has been dispatched (in case of click event as an example)" nodeButton ifNil: [ @@ -76,6 +76,7 @@ ToPaneNodeExampleSkin >> installSkinEvent: anEvent [ ToPaneNodeExampleSkin >> leavedSkinEvent: anEvent [ super leavedSkinEvent: anEvent. + anEvent target isEnabled ifFalse: [ ^ self ]. nodeButton ifNotNil: [ nodeButton removeFromParent. nodeButton := nil ] diff --git a/src/Toplo-Examples/ToSandBox.class.st b/src/Toplo-Examples/ToSandBox.class.st index 87408e12..e758eed3 100644 --- a/src/Toplo-Examples/ToSandBox.class.st +++ b/src/Toplo-Examples/ToSandBox.class.st @@ -4630,7 +4630,7 @@ ToSandBox class >> example_selectWith5Nodes [ select popupListElement nodeBuilder: [ :node :dataItem :holder | node addChild: (ToLabel text: dataItem asString) hMatchParent ]. innerWindow := ToInnerWindow new. - select windowManager anchorRoot: innerWindow root. + select manager anchorRoot: innerWindow root. select width: 300. select position: 50 @ 50. select popupListElement dataAccessor addAll: @@ -7261,7 +7261,7 @@ ToSandBox class >> selectWithEditingMultiSelection [ fontSize: 24; yourself. select popupMaxHeight: 600. - select windowManager minHeight: 35. + select manager minHeight: 35. select popupListElement placeholderBuilder: [ :placeholder :e | | lab | @@ -7270,21 +7270,20 @@ ToSandBox class >> selectWithEditingMultiSelection [ placeholder addChild: lab ]. select whenSaveAcceptedDo: [ :event | - | d | - d := event client text asString asSymbol. - event client text: ''. - event currentTarget data add: d. - event currentTarget mode selectIndex: - event currentTarget data size ]. + | d | + d := event client text asString asSymbol. + event client text: ''. + event currentTarget data add: d. + event currentTarget mode selectIndex: event currentTarget data size ]. select whenSaveRequestedDo: [ :event | - | target idx | - target := event currentTarget. - idx := target data indexOf: event client text asString asSymbol. - event accepted: idx isZero. - idx > 0 ifTrue: [ - event client text: ''. - target listElement selection selectIndex: idx ] ]. + | target idx | + target := event currentTarget. + idx := target data indexOf: event client text asString asSymbol. + event accepted: idx isZero. + idx > 0 ifTrue: [ + event client text: ''. + target listElement selection selectIndex: idx ] ]. ^ select ] diff --git a/src/Toplo-Examples/ToTabWithCustomSelectionBarSkin.class.st b/src/Toplo-Examples/ToTabWithCustomSelectionBarSkin.class.st index 5a8325d3..e62c15c9 100644 --- a/src/Toplo-Examples/ToTabWithCustomSelectionBarSkin.class.st +++ b/src/Toplo-Examples/ToTabWithCustomSelectionBarSkin.class.st @@ -27,7 +27,7 @@ ToTabWithCustomSelectionBarSkin >> checkedSkinEvent: anEvent [ ToTabWithCustomSelectionBarSkin >> hoveredSkinEvent: anEvent [ super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | e mouseCursor: Cursor webLink. e background: e hoveredBackground. ] ] diff --git a/src/Toplo-Tests/ToSkinStateGeneratorTest.class.st b/src/Toplo-Tests/ToSkinStateGeneratorTest.class.st index 90c0c4b6..a7729852 100644 --- a/src/Toplo-Tests/ToSkinStateGeneratorTest.class.st +++ b/src/Toplo-Tests/ToSkinStateGeneratorTest.class.st @@ -172,5 +172,5 @@ ToSkinStateGeneratorTest >> testWantsEvent [ self assert: (gen wantsEvent: (cC new currentTarget: e)) ]. e disable. self deny: e isEnabled. - gen eventsToHandle do: [ :cC | self deny: (gen wantsEvent: (cC new currentTarget: e)) ]. + gen eventsToHandle do: [ :cC | self assert: (gen wantsEvent: (cC new currentTarget: e)) ]. ] diff --git a/src/Toplo-Widget-Button/ToButtonSkin.class.st b/src/Toplo-Widget-Button/ToButtonSkin.class.st index 565ddb12..3c7c0cf3 100644 --- a/src/Toplo-Widget-Button/ToButtonSkin.class.st +++ b/src/Toplo-Widget-Button/ToButtonSkin.class.st @@ -50,14 +50,14 @@ ToButtonSkin >> enabledSkinEvent: anEvent [ ToButtonSkin >> hoveredSkinEvent: anEvent [ super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | - e iconDo: [ :ic | - ic innerImageColor: (e valueOfTokenNamed: #'color-primary') ]. - e endElementDo: [ :ic | - (ic respondsTo: #innerImageColor:) ifTrue: [ - ic innerImageColor: (e valueOfTokenNamed: #'color-primary') ] ]. - e labelDo: [ :lab | - lab foreground: (e valueOfTokenNamed: #'color-primary') ] ] + anEvent enabledElementDo: [ :e | + e iconDo: [ :ic | + ic innerImageColor: (e valueOfTokenNamed: #'color-primary') ]. + e endElementDo: [ :ic | + (ic respondsTo: #innerImageColor:) ifTrue: [ + ic innerImageColor: (e valueOfTokenNamed: #'color-primary') ] ]. + e labelDo: [ :lab | + lab foreground: (e valueOfTokenNamed: #'color-primary') ] ] ] { #category : #'event handling' } @@ -86,7 +86,7 @@ ToButtonSkin >> installSkinEvent: anEvent [ ToButtonSkin >> leavedSkinEvent: anEvent [ super leavedSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | e withStamp: #'parent-tag' do: [ :tag | diff --git a/src/Toplo-Widget-Button/ToCheckboxSkin.class.st b/src/Toplo-Widget-Button/ToCheckboxSkin.class.st index 52d18841..52035c84 100644 --- a/src/Toplo-Widget-Button/ToCheckboxSkin.class.st +++ b/src/Toplo-Widget-Button/ToCheckboxSkin.class.st @@ -47,9 +47,9 @@ ToCheckboxSkin >> enabledSkinEvent: anEvent [ ToCheckboxSkin >> hoveredSkinEvent: anEvent [ super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | - e border: BlBorder empty. - e icon border: (BlBorder paint: (e valueOfTokenNamed: #'color-primary') width: 1) ] + anEvent enabledElementDo: [ :e | + e border: BlBorder empty. + e icon border: (BlBorder paint: (e valueOfTokenNamed: #'color-primary') width: 1) ] ] { #category : #accessing } @@ -84,7 +84,7 @@ ToCheckboxSkin >> installSkinEvent: anEvent [ ToCheckboxSkin >> leavedSkinEvent: anEvent [ super leavedSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | e border: BlBorder empty. e icon border: (e valueOfTokenNamed: #'color-border') ] ] diff --git a/src/Toplo-Widget-Button/ToGeneralButtonSkin.class.st b/src/Toplo-Widget-Button/ToGeneralButtonSkin.class.st index a5c520b6..7769858e 100644 --- a/src/Toplo-Widget-Button/ToGeneralButtonSkin.class.st +++ b/src/Toplo-Widget-Button/ToGeneralButtonSkin.class.st @@ -34,10 +34,10 @@ ToGeneralButtonSkin >> enabledSkinEvent: anEvent [ ToGeneralButtonSkin >> hoveredSkinEvent: anEvent [ super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | - e mouseCursor: Cursor webLink. - e isMenuButton ifFalse: [ - e border: (BlBorder + anEvent enabledElementDo: [ :e | + e mouseCursor: Cursor webLink. + e isMenuButton ifFalse: [ + e border: (BlBorder paint: (e valueOfTokenNamed: #'color-primary-hover') width: (e valueOfTokenNamed: #'line-width')) ] ] ] @@ -65,10 +65,11 @@ ToGeneralButtonSkin >> leavedSkinEvent: anEvent [ super leavedSkinEvent: anEvent. anEvent elementDo: [ :e | e mouseCursor: Cursor normal. - e isMenuButton ifFalse: [ - e border: (BlBorder + e isEnabled ifTrue: [ + e isMenuButton ifFalse: [ + e border: (BlBorder paint: (e valueOfTokenNamed: #'color-border') - width: (e valueOfTokenNamed: #'line-width')) ] ] + width: (e valueOfTokenNamed: #'line-width')) ] ] ] ] { #category : #'event handling' } diff --git a/src/Toplo-Widget-Button/ToSwitchButtonSkin.class.st b/src/Toplo-Widget-Button/ToSwitchButtonSkin.class.st index f1b23ff9..54a5f112 100644 --- a/src/Toplo-Widget-Button/ToSwitchButtonSkin.class.st +++ b/src/Toplo-Widget-Button/ToSwitchButtonSkin.class.st @@ -30,7 +30,7 @@ ToSwitchButtonSkin >> enabledSkinEvent: anEvent [ ToSwitchButtonSkin >> hoveredSkinEvent: anEvent [ super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | e mouseCursor: Cursor webLink. e labelDo: [ :lab | lab foreground: (e valueOfTokenNamed: #'color-primary') ] ] @@ -68,8 +68,9 @@ ToSwitchButtonSkin >> leavedSkinEvent: anEvent [ super leavedSkinEvent: anEvent. anEvent elementDo: [ :e | e mouseCursor: Cursor normal. - e labelDo: [ :lab | - lab foreground: (e valueOfTokenNamed: #'color-text') ] ] + e isEnabled ifTrue: [ + e labelDo: [ :lab | + lab foreground: (e valueOfTokenNamed: #'color-text') ] ] ] ] { #category : #'event handling' } diff --git a/src/Toplo-Widget-Button/ToSwitchIconSkin.class.st b/src/Toplo-Widget-Button/ToSwitchIconSkin.class.st index 1733aa5c..a87464ab 100644 --- a/src/Toplo-Widget-Button/ToSwitchIconSkin.class.st +++ b/src/Toplo-Widget-Button/ToSwitchIconSkin.class.st @@ -40,7 +40,7 @@ ToSwitchIconSkin >> enabledSkinEvent: anEvent [ ToSwitchIconSkin >> hoveredSkinEvent: anEvent [ super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | ] + anEvent enabledElementDo: [ :e | ] ] { #category : #'event handling' } diff --git a/src/Toplo-Widget-Button/ToToggleButtonSkin.class.st b/src/Toplo-Widget-Button/ToToggleButtonSkin.class.st index bcc5b0cc..42907e80 100644 --- a/src/Toplo-Widget-Button/ToToggleButtonSkin.class.st +++ b/src/Toplo-Widget-Button/ToToggleButtonSkin.class.st @@ -57,18 +57,6 @@ ToToggleButtonSkin >> enabledSkinEvent: anEvent [ lab applyStyle ] ] ] -{ #category : #'event handling' } -ToToggleButtonSkin >> hoveredSkinEvent: anEvent [ - - super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | - e mouseCursor: Cursor webLink. - e isMenuButton ifFalse: [ - e border: (BlBorder - paint: (e valueOfTokenNamed: #'color-primary-hover') - width: (e valueOfTokenNamed: #'line-width')) ] ] -] - { #category : #'event handling' } ToToggleButtonSkin >> indeterminateSkinEvent: anEvent [ @@ -98,18 +86,6 @@ ToToggleButtonSkin >> installSkinEvent: anEvent [ ifFalse: [ e endInterspace: 0 ] ] ] -{ #category : #'event handling' } -ToToggleButtonSkin >> leavedSkinEvent: anEvent [ - - super leavedSkinEvent: anEvent. - anEvent elementDo: [ :e | - e mouseCursor: Cursor normal. - e isMenuButton ifFalse: [ - e border: (BlBorder - paint: (e valueOfTokenNamed: #'color-border') - width: (e valueOfTokenNamed: #'line-width')) ] ] -] - { #category : #'event handling' } ToToggleButtonSkin >> uncheckedSkinEvent: anEvent [ diff --git a/src/Toplo-Widget-List/ToListSecondarySelectionElementEventHandler.class.st b/src/Toplo-Widget-List/ToListSecondarySelectionElementEventHandler.class.st index 0706ae48..00faeb7c 100644 --- a/src/Toplo-Widget-List/ToListSecondarySelectionElementEventHandler.class.st +++ b/src/Toplo-Widget-List/ToListSecondarySelectionElementEventHandler.class.st @@ -24,7 +24,7 @@ ToListSecondarySelectionElementEventHandler >> mouseMoveEvent: anEvent [ | target nodeContainer globalPosition childNode | anEvent anyButtonPressed ifTrue: [ ^ self ]. target := anEvent currentTarget. - target isEnabled ifFalse: [ ^ self ]. + "target isEnabled ifFalse: [ ^ self ]." nodeContainer := target innerElement. globalPosition := anEvent position. diff --git a/src/Toplo-Widget-Menu/ToChoiceMenuSkin.class.st b/src/Toplo-Widget-Menu/ToChoiceMenuSkin.class.st index 74f9ca2f..5bce8d75 100644 --- a/src/Toplo-Widget-Menu/ToChoiceMenuSkin.class.st +++ b/src/Toplo-Widget-Menu/ToChoiceMenuSkin.class.st @@ -34,7 +34,7 @@ ToChoiceMenuSkin >> enabledSkinEvent: anEvent [ ToChoiceMenuSkin >> hoveredSkinEvent: anEvent [ super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | e mouseCursor: Cursor webLink. e border: (BlBorder paint: (e valueOfTokenNamed: #'color-primary-hover') @@ -56,7 +56,7 @@ ToChoiceMenuSkin >> installSkinEvent: anEvent [ ToChoiceMenuSkin >> leavedSkinEvent: anEvent [ super leavedSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | e border: (BlBorder paint: (e valueOfTokenNamed: #'color-border') width: (e valueOfTokenNamed: #'line-width')) ] diff --git a/src/Toplo-Widget-Menu/ToMenuBarSkin.class.st b/src/Toplo-Widget-Menu/ToMenuBarSkin.class.st index 4a7eb545..28513adf 100644 --- a/src/Toplo-Widget-Menu/ToMenuBarSkin.class.st +++ b/src/Toplo-Widget-Menu/ToMenuBarSkin.class.st @@ -8,7 +8,7 @@ Class { ToMenuBarSkin >> hoveredSkinEvent: anEvent [ super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | e itemBar background: BlBackground transparent. e barOwnerDo: [ :l | e background: (Color veryLightGray alpha: 0.1) ] ] diff --git a/src/Toplo-Widget-Menu/ToMenuItemElementSkin.class.st b/src/Toplo-Widget-Menu/ToMenuItemElementSkin.class.st index 513cd418..d0902bd7 100644 --- a/src/Toplo-Widget-Menu/ToMenuItemElementSkin.class.st +++ b/src/Toplo-Widget-Menu/ToMenuItemElementSkin.class.st @@ -16,7 +16,7 @@ ToMenuItemElementSkin >> disabledSkinEvent: anEvent [ ToMenuItemElementSkin >> hoveredSkinEvent: anEvent [ super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | e mouseCursor: Cursor webLink ] ] diff --git a/src/Toplo-Widget-Pane/ToDividerSkin.class.st b/src/Toplo-Widget-Pane/ToDividerSkin.class.st index 8a025dc6..161f6a1c 100644 --- a/src/Toplo-Widget-Pane/ToDividerSkin.class.st +++ b/src/Toplo-Widget-Pane/ToDividerSkin.class.st @@ -26,10 +26,10 @@ ToDividerSkin >> draggedSkinEvent: anEvent [ ToDividerSkin >> hoveredSkinEvent: anEvent [ super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | - e mouseCursor: e resizerCursor. - e border: e hoveredBorder. - e background: e hoveredBackground ] + anEvent enabledElementDo: [ :e | + e mouseCursor: e resizerCursor. + e border: e hoveredBorder. + e background: e hoveredBackground ] ] { #category : #'event handling' } @@ -45,7 +45,7 @@ ToDividerSkin >> installSkinEvent: anEvent [ ToDividerSkin >> leavedSkinEvent: anEvent [ super leavedSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | e border: e defaultBorder. e background: e defaultBackground ] ] diff --git a/src/Toplo-Widget-Segmented/ToSegmentedButtonSkin.class.st b/src/Toplo-Widget-Segmented/ToSegmentedButtonSkin.class.st index c4a25f29..3ab04b6b 100644 --- a/src/Toplo-Widget-Segmented/ToSegmentedButtonSkin.class.st +++ b/src/Toplo-Widget-Segmented/ToSegmentedButtonSkin.class.st @@ -40,7 +40,7 @@ ToSegmentedButtonSkin >> enabledSkinEvent: anEvent [ ToSegmentedButtonSkin >> hoveredSkinEvent: anEvent [ super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | e mouseCursor: Cursor webLink ] ] diff --git a/src/Toplo-Widget-Segmented/ToSegmentedNodeSkin.class.st b/src/Toplo-Widget-Segmented/ToSegmentedNodeSkin.class.st index ae59e098..2b91c90f 100644 --- a/src/Toplo-Widget-Segmented/ToSegmentedNodeSkin.class.st +++ b/src/Toplo-Widget-Segmented/ToSegmentedNodeSkin.class.st @@ -8,7 +8,7 @@ Class { ToSegmentedNodeSkin >> hoveredSkinEvent: anEvent [ super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | e mouseCursor: Cursor webLink ] ] diff --git a/src/Toplo-Widget-Select/ToSelectIconContainerSkin.class.st b/src/Toplo-Widget-Select/ToSelectIconContainerSkin.class.st index 6261e27f..ae2e9da6 100644 --- a/src/Toplo-Widget-Select/ToSelectIconContainerSkin.class.st +++ b/src/Toplo-Widget-Select/ToSelectIconContainerSkin.class.st @@ -16,7 +16,7 @@ ToSelectIconContainerSkin >> disabledSkinEvent: anEvent [ ToSelectIconContainerSkin >> hoveredSkinEvent: anEvent [ super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | e mouseCursor: Cursor webLink ]. ] diff --git a/src/Toplo-Widget-TabPane/ToTabInnerCloseButtonSkin.class.st b/src/Toplo-Widget-TabPane/ToTabInnerCloseButtonSkin.class.st index 7e00ee68..76c10076 100644 --- a/src/Toplo-Widget-TabPane/ToTabInnerCloseButtonSkin.class.st +++ b/src/Toplo-Widget-TabPane/ToTabInnerCloseButtonSkin.class.st @@ -8,7 +8,7 @@ Class { ToTabInnerCloseButtonSkin >> hoveredSkinEvent: anEvent [ super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | e border: (Color red alpha: 0.5) ] + anEvent enabledElementDo: [ :e | e border: (Color red alpha: 0.5) ] ] { #category : #'event handling' } diff --git a/src/Toplo-Widget-TabPane/ToTabSkin.class.st b/src/Toplo-Widget-TabPane/ToTabSkin.class.st index f135533c..7eed928d 100644 --- a/src/Toplo-Widget-TabPane/ToTabSkin.class.st +++ b/src/Toplo-Widget-TabPane/ToTabSkin.class.st @@ -16,7 +16,7 @@ ToTabSkin >> checkedSkinEvent: anEvent [ ToTabSkin >> hoveredSkinEvent: anEvent [ super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | e mouseCursor: Cursor webLink. e border: (BlBorder paint: (e valueOfTokenNamed: #'color-primary-hover') width: (e valueOfTokenNamed: #'line-width')). e isChecked @@ -43,7 +43,7 @@ ToTabSkin >> installSkinEvent: anEvent [ ToTabSkin >> leavedSkinEvent: anEvent [ super leavedSkinEvent: anEvent. - anEvent elementDo: [ :e | + anEvent enabledElementDo: [ :e | e isChecked ifFalse: [e background: e defaultBackground]. e border: (BlBorder paint: (e valueOfTokenNamed: #'color-border') width: (e valueOfTokenNamed: #'line-width')). e isChecked ifTrue: [ ^ self ] ]. diff --git a/src/Toplo-Widget-Tag/ToCheckableTagSkin.class.st b/src/Toplo-Widget-Tag/ToCheckableTagSkin.class.st index 147d2d8c..0fa844b3 100644 --- a/src/Toplo-Widget-Tag/ToCheckableTagSkin.class.st +++ b/src/Toplo-Widget-Tag/ToCheckableTagSkin.class.st @@ -8,7 +8,8 @@ Class { ToCheckableTagSkin >> hoveredSkinEvent: anEvent [ super hoveredSkinEvent: anEvent. - anEvent elementDo: [ :e | e mouseCursor: Cursor webLink ] + anEvent enabledElementDo: [ :e | + e mouseCursor: Cursor webLink ] ] { #category : #'event handling' } diff --git a/src/Toplo/ToSkinEvent.class.st b/src/Toplo/ToSkinEvent.class.st index 9b149ecf..c0f4a064 100644 --- a/src/Toplo/ToSkinEvent.class.st +++ b/src/Toplo/ToSkinEvent.class.st @@ -4,12 +4,26 @@ Class { #category : #'Toplo-Core-SkinEvents' } +{ #category : #accessing } +ToSkinEvent >> disabledElementDo: aBlock [ + + self target isDisabled ifFalse: [ ^ self ]. + aBlock value: self target +] + { #category : #accessing } ToSkinEvent >> elementDo: aBlock [ aBlock value: self target ] +{ #category : #accessing } +ToSkinEvent >> enabledElementDo: aBlock [ + + self target isEnabled ifFalse: [ ^ self ]. + aBlock value: self target +] + { #category : #'instance creation' } ToSkinEvent >> fromState: aState [ ] diff --git a/src/Toplo/ToSkinStateGenerator.class.st b/src/Toplo/ToSkinStateGenerator.class.st index 7a17eb88..30fe6a9e 100644 --- a/src/Toplo/ToSkinStateGenerator.class.st +++ b/src/Toplo/ToSkinStateGenerator.class.st @@ -183,7 +183,6 @@ ToSkinStateGenerator >> mouseDownEvent: anEvent [ { #category : #'mouse handlers' } ToSkinStateGenerator >> mouseEnterEvent: anEvent [ - target isEnabled ifFalse: [ ^ self ]. leaved := false. self enqueueSkinState: (ToTransientState skinEvent: @@ -193,7 +192,6 @@ ToSkinStateGenerator >> mouseEnterEvent: anEvent [ { #category : #'mouse handlers' } ToSkinStateGenerator >> mouseLeaveEvent: anEvent [ - target isEnabled ifFalse: [ ^ self ]. leaved ifTrue: [ ^ self ]. leaved := true. self enqueueSkinState: @@ -339,10 +337,3 @@ ToSkinStateGenerator >> target [ ^ target ] - -{ #category : #'api - event managing' } -ToSkinStateGenerator >> wantsEvent: anEvent [ - - target isEnabled ifFalse: [ ^ false ]. - ^ super wantsEvent: anEvent -]