Skip to content

Commit

Permalink
Branch: dev, hover/left skin event should be sent even for disabled t…
Browse files Browse the repository at this point in the history
…arget
  • Loading branch information
plantec committed Jan 15, 2025
1 parent 68e365d commit d8c5799
Show file tree
Hide file tree
Showing 26 changed files with 82 additions and 98 deletions.
4 changes: 2 additions & 2 deletions src/Toplo-Demo/ToDemoButterflySkin1.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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) ]
]
Expand All @@ -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) ]
]
4 changes: 2 additions & 2 deletions src/Toplo-Demo/ToDemoButterflySkin2.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Class {
ToDemoButterflySkin2 >> hoveredSkinEvent: anEvent [

super hoveredSkinEvent: anEvent.
anEvent elementDo: [ :e |
anEvent enabledElementDo: [ :e |
e background: (e valueOfTokenNamed: #'color-success') ]
]

Expand All @@ -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') ]
]

Expand Down
4 changes: 2 additions & 2 deletions src/Toplo-Demo/ToDemoSkin2.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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) ]
]
Expand All @@ -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) ]
]
3 changes: 2 additions & 1 deletion src/Toplo-Examples/ToPaneNodeExampleSkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down Expand Up @@ -76,6 +76,7 @@ ToPaneNodeExampleSkin >> installSkinEvent: anEvent [
ToPaneNodeExampleSkin >> leavedSkinEvent: anEvent [

super leavedSkinEvent: anEvent.
anEvent target isEnabled ifFalse: [ ^ self ].
nodeButton ifNotNil: [
nodeButton removeFromParent.
nodeButton := nil ]
Expand Down
29 changes: 14 additions & 15 deletions src/Toplo-Examples/ToSandBox.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 |
Expand All @@ -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
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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. ]
]
Expand Down
2 changes: 1 addition & 1 deletion src/Toplo-Tests/ToSkinStateGeneratorTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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)) ].
]
18 changes: 9 additions & 9 deletions src/Toplo-Widget-Button/ToButtonSkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand Down Expand Up @@ -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 |
Expand Down
8 changes: 4 additions & 4 deletions src/Toplo-Widget-Button/ToCheckboxSkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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') ]
]
Expand Down
15 changes: 8 additions & 7 deletions src/Toplo-Widget-Button/ToGeneralButtonSkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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')) ] ]
]
Expand Down Expand Up @@ -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' }
Expand Down
7 changes: 4 additions & 3 deletions src/Toplo-Widget-Button/ToSwitchButtonSkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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') ] ]
Expand Down Expand Up @@ -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' }
Expand Down
2 changes: 1 addition & 1 deletion src/Toplo-Widget-Button/ToSwitchIconSkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ToSwitchIconSkin >> enabledSkinEvent: anEvent [
ToSwitchIconSkin >> hoveredSkinEvent: anEvent [

super hoveredSkinEvent: anEvent.
anEvent elementDo: [ :e | ]
anEvent enabledElementDo: [ :e | ]
]

{ #category : #'event handling' }
Expand Down
24 changes: 0 additions & 24 deletions src/Toplo-Widget-Button/ToToggleButtonSkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 [

Expand Down Expand Up @@ -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 [

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions src/Toplo-Widget-Menu/ToChoiceMenuSkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')) ]
Expand Down
2 changes: 1 addition & 1 deletion src/Toplo-Widget-Menu/ToMenuBarSkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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) ] ]
Expand Down
2 changes: 1 addition & 1 deletion src/Toplo-Widget-Menu/ToMenuItemElementSkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ToMenuItemElementSkin >> disabledSkinEvent: anEvent [
ToMenuItemElementSkin >> hoveredSkinEvent: anEvent [

super hoveredSkinEvent: anEvent.
anEvent elementDo: [ :e |
anEvent enabledElementDo: [ :e |
e mouseCursor: Cursor webLink ]
]

Expand Down
10 changes: 5 additions & 5 deletions src/Toplo-Widget-Pane/ToDividerSkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand All @@ -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 ]
]
Expand Down
2 changes: 1 addition & 1 deletion src/Toplo-Widget-Segmented/ToSegmentedButtonSkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ToSegmentedButtonSkin >> enabledSkinEvent: anEvent [
ToSegmentedButtonSkin >> hoveredSkinEvent: anEvent [

super hoveredSkinEvent: anEvent.
anEvent elementDo: [ :e |
anEvent enabledElementDo: [ :e |
e mouseCursor: Cursor webLink ]
]

Expand Down
2 changes: 1 addition & 1 deletion src/Toplo-Widget-Segmented/ToSegmentedNodeSkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Class {
ToSegmentedNodeSkin >> hoveredSkinEvent: anEvent [

super hoveredSkinEvent: anEvent.
anEvent elementDo: [ :e |
anEvent enabledElementDo: [ :e |
e mouseCursor: Cursor webLink ]
]

Expand Down
2 changes: 1 addition & 1 deletion src/Toplo-Widget-Select/ToSelectIconContainerSkin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ToSelectIconContainerSkin >> disabledSkinEvent: anEvent [
ToSelectIconContainerSkin >> hoveredSkinEvent: anEvent [

super hoveredSkinEvent: anEvent.
anEvent elementDo: [ :e |
anEvent enabledElementDo: [ :e |
e mouseCursor: Cursor webLink ].
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand Down
Loading

0 comments on commit d8c5799

Please sign in to comment.