diff --git a/src/Toplo-Widget-Album/ToLabelSkin.class.st b/src/Toplo-Widget-Album/ToLabelSkin.class.st index 8263105a..fb0fd3be 100644 --- a/src/Toplo-Widget-Album/ToLabelSkin.class.st +++ b/src/Toplo-Widget-Album/ToLabelSkin.class.st @@ -56,5 +56,6 @@ ToLabelSkin >> selectedSkinEvent: anEvent [ ifTrue: [ #'label-selected-focused' ] ifFalse: [ #'label-selected-unfocused' ]. to := e valueOfTokenNamed: tokname. - e foreground: to ] + e foreground: to. + e applyStyle ] ] diff --git a/src/Toplo-Widget-List/ToListNodeSelectionEventHandler.class.st b/src/Toplo-Widget-List/ToListNodeSelectionEventHandler.class.st index 1a15cc98..1daaa0a5 100644 --- a/src/Toplo-Widget-List/ToListNodeSelectionEventHandler.class.st +++ b/src/Toplo-Widget-List/ToListNodeSelectionEventHandler.class.st @@ -10,6 +10,7 @@ ToListNodeSelectionEventHandler >> clickEvent: anEvent [ | node listElement mode | node := anEvent currentTarget. listElement := node holder listElement. + listElement isEnabled ifFalse: [ ^ self ]. mode := listElement primarySelectionMode. mode selectOnMouseDown ifTrue: [ ^ self ]. self notifyClickOnNodeFromEvent: anEvent. @@ -47,11 +48,16 @@ ToListNodeSelectionEventHandler >> listClickOnNodeRequestEvent: aListClickOnNode { #category : #'mouse handlers' } ToListNodeSelectionEventHandler >> mouseDownEvent: anEvent [ - anEvent - ifPrimary: [ self primaryMouseDownEvent: anEvent ] - secondary: [ ] - middle: [ ] - other: [ ] + | node listElement | + node := anEvent currentTarget. + listElement := node holder listElement. + listElement isEnabled ifFalse: [ ^ self ]. + + anEvent + ifPrimary: [ self primaryMouseDownEvent: anEvent ] + secondary: [ ] + middle: [ ] + other: [ ] ] { #category : #'mouse handlers' } diff --git a/src/Toplo-Widget-List/ToListPrimarySelectionElementSkin.class.st b/src/Toplo-Widget-List/ToListPrimarySelectionElementSkin.class.st index 2535df8a..e68022d9 100644 --- a/src/Toplo-Widget-List/ToListPrimarySelectionElementSkin.class.st +++ b/src/Toplo-Widget-List/ToListPrimarySelectionElementSkin.class.st @@ -5,32 +5,27 @@ Class { } { #category : #'event handling' } -ToListPrimarySelectionElementSkin >> focusedSkinEvent: anEvent [ +ToListPrimarySelectionElementSkin >> disabledSkinEvent: anEvent [ - super focusedSkinEvent: anEvent. + super disabledSkinEvent: anEvent. anEvent elementDo: [ :e | - e isBeneath - ifTrue: [ - e background: - (e valueOfTokenNamed: #'color-primary-selection-focused') ] - ifFalse: [ - e background: - (e valueOfTokenNamed: #'color-primary-selection-over-focused') ] ] + e border: (BlBorder + paint: (e valueOfTokenNamed: #'color-primary-selection-disabled') + width: (e valueOfTokenNamed: #'border-width-primary-selection')). + e background: BlBackground transparent ] ] { #category : #'event handling' } -ToListPrimarySelectionElementSkin >> installSkinEvent: anEvent [ +ToListPrimarySelectionElementSkin >> enabledSkinEvent: anEvent [ - super installSkinEvent: anEvent. + super enabledSkinEvent: anEvent. anEvent elementDo: [ :e | - - e geometry: (BlRoundedRectangleGeometry cornerRadius: - (e valueOfTokenNamed: #'border-radius-SM')). - - e selectionOption isGrouped ifTrue: [ - e border: (BlBorder - paint: (e valueOfTokenNamed: #'border-color-primary-selection') - width: (e valueOfTokenNamed: #'border-width-primary-selection')) ]. + e selectionOption isGrouped + ifTrue: [ + e border: (BlBorder + paint: (e valueOfTokenNamed: #'border-color-primary-selection') + width: (e valueOfTokenNamed: #'border-width-primary-selection')) ] + ifFalse: [ e border: BlBorder empty ]. " I must take into account the focused state of the node container element here to start with the right background " @@ -53,6 +48,29 @@ ToListPrimarySelectionElementSkin >> installSkinEvent: anEvent [ (e valueOfTokenNamed: #'color-primary-selection-over-unfocused') ] ] ] ] +{ #category : #'event handling' } +ToListPrimarySelectionElementSkin >> focusedSkinEvent: anEvent [ + + super focusedSkinEvent: anEvent. + anEvent elementDo: [ :e | + e isBeneath + ifTrue: [ + e background: + (e valueOfTokenNamed: #'color-primary-selection-focused') ] + ifFalse: [ + e background: + (e valueOfTokenNamed: #'color-primary-selection-over-focused') ] ] +] + +{ #category : #'event handling' } +ToListPrimarySelectionElementSkin >> installSkinEvent: anEvent [ + + super installSkinEvent: anEvent. + anEvent elementDo: [ :e | + e geometry: (BlRoundedRectangleGeometry cornerRadius: + (e valueOfTokenNamed: #'border-radius-SM')) ] +] + { #category : #'event handling' } ToListPrimarySelectionElementSkin >> unfocusedSkinEvent: anEvent [ diff --git a/src/Toplo-Widget-List/ToListSecondarySelectionElementEventHandler.class.st b/src/Toplo-Widget-List/ToListSecondarySelectionElementEventHandler.class.st index 0b9508eb..fc7ba29f 100644 --- a/src/Toplo-Widget-List/ToListSecondarySelectionElementEventHandler.class.st +++ b/src/Toplo-Widget-List/ToListSecondarySelectionElementEventHandler.class.st @@ -27,6 +27,7 @@ ToListSecondarySelectionElementEventHandler >> mouseMoveEvent: anEvent [ | target nodeContainer globalPosition childNode | anEvent anyButtonPressed ifTrue: [ ^ self ]. target := anEvent currentTarget. + target isEnabled ifFalse: [ ^ self ]. nodeContainer := target innerContainer. globalPosition := anEvent position. diff --git a/src/Toplo/ToSkinStateGenerator.class.st b/src/Toplo/ToSkinStateGenerator.class.st index 3424ce60..1d926535 100644 --- a/src/Toplo/ToSkinStateGenerator.class.st +++ b/src/Toplo/ToSkinStateGenerator.class.st @@ -15,6 +15,7 @@ Class { { #category : #'focus events handling' } ToSkinStateGenerator >> blurEvent: anEvent [ + target isEnabled ifFalse: [ ^ self ]. self generateBlurStateFromEvent: anEvent ] @@ -28,6 +29,7 @@ ToSkinStateGenerator >> checkableCheckEvent: anEvent [ { #category : #'mouse handlers' } ToSkinStateGenerator >> clickEvent: anEvent [ + target isEnabled ifFalse: [ ^ self ]. anEvent ifPrimary: [ self primaryClickEvent: anEvent ] secondary: [ ] @@ -38,6 +40,7 @@ ToSkinStateGenerator >> clickEvent: anEvent [ { #category : #'dnd handlers' } ToSkinStateGenerator >> dragEndEvent: anEvent [ + target isEnabled ifFalse: [ ^ self ]. self dragged: false. self leaved ifTrue: [ ^ self ]. self leaved: true. @@ -50,12 +53,14 @@ ToSkinStateGenerator >> dragEndEvent: anEvent [ { #category : #'dnd handlers' } ToSkinStateGenerator >> dragEnterEvent: anEvent [ + target isEnabled ifFalse: [ ^ self ]. self leaved: false ] { #category : #'dnd handlers' } ToSkinStateGenerator >> dragEvent: anEvent [ + target isEnabled ifFalse: [ ^ self ]. self dragged ifFalse: [ ^ self ]. self generateDraggedStateFromEvent: anEvent ] @@ -63,12 +68,14 @@ ToSkinStateGenerator >> dragEvent: anEvent [ { #category : #'dnd handlers' } ToSkinStateGenerator >> dragLeaveEvent: anEvent [ + target isEnabled ifFalse: [ ^ self ]. self leaved: true ] { #category : #'dnd handlers' } ToSkinStateGenerator >> dragStartEvent: anEvent [ + target isEnabled ifFalse: [ ^ self ]. self dragged: true. self generateDragStartedStateFromEvent: anEvent ] @@ -88,6 +95,7 @@ ToSkinStateGenerator >> dragged: aBoolean [ { #category : #'dnd handlers' } ToSkinStateGenerator >> dropEvent: anEvent [ + target isEnabled ifFalse: [ ^ self ]. self generateDroppedStateFromEvent: anEvent ] @@ -123,12 +131,14 @@ ToSkinStateGenerator >> eventsToHandle [ { #category : #'focus events handling' } ToSkinStateGenerator >> focusEvent: anEvent [ + target isEnabled ifFalse: [ ^ self ]. self generateFocusStateFromEvent: anEvent ] { #category : #'state generating' } ToSkinStateGenerator >> generateBlurStateFromEvent: anEvent [ + target isEnabled ifFalse: [ ^ self ]. target skinManagerDo: [ :sm | sm addSkinStateGeneration: [ @@ -337,6 +347,7 @@ ToSkinStateGenerator >> listNodeSelectedEvent: anEvent [ { #category : #'mouse handlers' } ToSkinStateGenerator >> mouseDownEvent: anEvent [ + target isEnabled ifFalse: [ ^ self ]. anEvent ifPrimary: [ self primaryMouseDownEvent: anEvent ] secondary: [ ] @@ -347,6 +358,7 @@ ToSkinStateGenerator >> mouseDownEvent: anEvent [ { #category : #'mouse handlers' } ToSkinStateGenerator >> mouseEnterEvent: anEvent [ + target isEnabled ifFalse: [ ^ self ]. self leaved: false. self dragged ifTrue: [ ^ self ]. target isEnabled ifFalse: [ ^ self ]. @@ -357,6 +369,7 @@ ToSkinStateGenerator >> mouseEnterEvent: anEvent [ { #category : #'mouse handlers' } ToSkinStateGenerator >> mouseLeaveEvent: anEvent [ + target isEnabled ifFalse: [ ^ self ]. self dragged ifTrue: [ ^ self ]. self leaved ifTrue: [ ^ self ]. self leaved: true. @@ -367,6 +380,7 @@ ToSkinStateGenerator >> mouseLeaveEvent: anEvent [ { #category : #'mouse handlers' } ToSkinStateGenerator >> mouseUpEvent: anEvent [ + target isEnabled ifFalse: [ ^ self ]. anEvent ifPrimary: [ self primaryMouseUpEvent: anEvent ] secondary: [ ] @@ -380,6 +394,7 @@ ToSkinStateGenerator >> mouseUpOutsideEvent: anEvent [ In that case, no action is triggered " | wasPressed | + target isEnabled ifFalse: [ ^ self ]. wasPressed := self pressed. self pressed: false. self dragged: false. @@ -457,6 +472,7 @@ ToSkinStateGenerator >> startStillHoveredEvent: anEvent [ | startDelay space | target ifNil: [ ^ self ]. + target isEnabled ifFalse: [ ^ self ]. target space ifNil: [ ^ self ]. space := target space. startDelay := target stillHoveredStartDelay. @@ -478,6 +494,7 @@ ToSkinStateGenerator >> startStillPressedEvent: anEvent [ | startDelay space targetPos | target space ifNil: [ ^ self ]. + target isEnabled ifFalse: [ ^ self ]. space := target space. startDelay := target stillPressedStartDelay. startDelay ifNil: [ ^ self ]. diff --git a/src/Toplo/ToSkinStateQueue.class.st b/src/Toplo/ToSkinStateQueue.class.st index 14fa5bf5..5312ae75 100644 --- a/src/Toplo/ToSkinStateQueue.class.st +++ b/src/Toplo/ToSkinStateQueue.class.st @@ -30,16 +30,22 @@ ToSkinStateQueue >> applyOn: anElement [ { #category : #adding } ToSkinStateQueue >> enqueueEnablementStateForElement: anElement [ - " restitute the intrasic states (as enablement, check) - enablement state must always be the last one to be enqueued " + enablement state must always be the first one for an enabled element, + it must be the last one to be enqueued for a disabled element " + + anElement isEnabled ifTrue: [ + self + enqueueState: (ToEnablementState new enabled: true) + for: anElement ]. + self intrinsicStatesDo: [ :state | self enqueueState: state for: anElement ]. - self - enqueueState: (ToEnablementState new enabled: anElement isEnabled) - for: anElement. - + anElement isEnabled ifFalse: [ + self + enqueueState: (ToEnablementState new enabled: false) + for: anElement ] ] { #category : #adding }