diff --git a/src/Toplo-Examples/ToSandBox.class.st b/src/Toplo-Examples/ToSandBox.class.st index 9dcb6979..7c9312be 100644 --- a/src/Toplo-Examples/ToSandBox.class.st +++ b/src/Toplo-Examples/ToSandBox.class.st @@ -3869,7 +3869,7 @@ ToSandBox class >> example_menuBar2 [ bar addItem: menu ]. frame pane addChild: bar. - frame openInSpace + frame openInSpace ] { #category : #menu } diff --git a/src/Toplo-Widget-List/ToAbstractBarNodeManager.class.st b/src/Toplo-Widget-List/ToAbstractBarNodeManager.class.st index c1bcabed..d6ecd640 100644 --- a/src/Toplo-Widget-List/ToAbstractBarNodeManager.class.st +++ b/src/Toplo-Widget-List/ToAbstractBarNodeManager.class.st @@ -16,13 +16,13 @@ ToAbstractBarNodeManager >> constraintFakeNode: aNode [ ifTrue: [ aNode constraintsDo: [ :c | c horizontal exact: 0. - c vertical fitContent. + c vertical exact: 0. c flow vertical alignCenter. c linear vertical alignCenter ] ] ifFalse: [ aNode constraintsDo: [ :c | c vertical exact: 0. - c horizontal fitContent. + c horizontal exact: 0. c flow horizontal alignCenter. c linear horizontal alignCenter ] ]. ] @@ -37,38 +37,27 @@ ToAbstractBarNodeManager >> constraintNode: aNode [ bar isVertical ifTrue: [ bar isHMatchParent - ifTrue: [ - aNode constraintsDo: [ :c | - c horizontal matchParent. - c vertical fitContent ] ] - ifFalse: [ - aNode constraintsDo: [ :c | - c horizontal fitContent. - c vertical fitContent ] ] ] - ifFalse: [ + ifTrue: [ aNode hMatchParent ] + ifFalse: [ aNode hFitContent ]. + aNode vFitContent ] + ifFalse: [ bar isVMatchParent - ifTrue: [ - aNode constraintsDo: [ :c | - c vertical matchParent. - c horizontal fitContent ] ] - ifFalse: [ - aNode constraintsDo: [ :c | - c horizontal fitContent. - c vertical fitContent ] ]] ] - ifTrue: [ - aNode constraintsDo: [ :c | - c horizontal fitContent. - c vertical fitContent ] ]. - + ifTrue: [ aNode vMatchParent ] + ifFalse: [ aNode vFitContent ]. + aNode hFitContent ] ] + ifTrue: [ aNode fitContent ]. + aNode constraintsDo: [ :c | c linear vertical alignCenter. c flow vertical alignCenter ]. - + + bar nodeWrapping ifTrue: [ ^ self ]. bar nodeScrolling ifTrue: [ ^ self ]. - bar nodeAutoDistribution ifTrue: [ - bar isHorizontal - ifTrue: [ aNode hMatchParent ] - ifFalse: [ aNode vMatchParent ] ] + bar nodeAutoDistribution ifFalse: [ ^ self ]. + + bar isHorizontal + ifTrue: [ aNode hMatchParent ] + ifFalse: [ aNode vMatchParent ] ] { #category : #initialization } diff --git a/src/Toplo-Widget-List/ToItemNode.class.st b/src/Toplo-Widget-List/ToItemNode.class.st index df1dbb64..bb4171f4 100644 --- a/src/Toplo-Widget-List/ToItemNode.class.st +++ b/src/Toplo-Widget-List/ToItemNode.class.st @@ -16,7 +16,7 @@ ToItemNode >> item: aMenuItem [ aMenuItem ifNil: [ ^ self ]. aMenuItem parent = self ifTrue: [ ^ self ]. aMenuItem removeFromParent. - self addChild: aMenuItem + self addChild: aMenuItem at: 1 ] { #category : #skin } diff --git a/src/Toplo-Widget-List/ToItemNodeManager.class.st b/src/Toplo-Widget-List/ToItemNodeManager.class.st index ba6ae856..6a40bc5a 100644 --- a/src/Toplo-Widget-List/ToItemNodeManager.class.st +++ b/src/Toplo-Widget-List/ToItemNodeManager.class.st @@ -12,30 +12,6 @@ ToItemNodeManager >> buildNode: aNode [ aNode item: holder dataItem ] -{ #category : #initialization } -ToItemNodeManager >> constraintFakeNode: aNode [ - - | bar | - bar := aNode holder listElement. - aNode visibility: BlVisibility hidden. - aNode constraintsDo: [ :c | - c horizontal exact: 0. - c vertical exact: 0 ] -] - -{ #category : #initialization } -ToItemNodeManager >> constraintNode: aNode [ - - | bar | - super constraintNode: aNode. - bar := aNode holder listElement. - bar nodeScrolling ifTrue: [ ^ self ]. - bar nodeAutoDistribution ifTrue: [ - aNode item constraintsDo: [ :c | - c horizontal matchParent. - c vertical matchParent ] ] -] - { #category : #initialization } ToItemNodeManager >> defaultFakeDataItem [ diff --git a/src/Toplo-Widget-List/ToListElementEventHandler.class.st b/src/Toplo-Widget-List/ToListElementEventHandler.class.st index ab2d5348..7834e4f3 100644 --- a/src/Toplo-Widget-List/ToListElementEventHandler.class.st +++ b/src/Toplo-Widget-List/ToListElementEventHandler.class.st @@ -26,7 +26,6 @@ ToListElementEventHandler >> boundsHasChangedDuringScrollingEvent: anEvent [ { #category : #'event handling' } ToListElementEventHandler >> clickEvent: anEvent [ - anEvent isConsumed ifTrue: [ ^ self ]. anEvent ifPrimary: [ self primaryClickEvent: anEvent ] secondary: [ self secondaryClickEvent: anEvent ] middle: [ self middleClickEvent: anEvent ] diff --git a/src/Toplo-Widget-List/ToListNodeSelectionEventHandler.class.st b/src/Toplo-Widget-List/ToListNodeSelectionEventHandler.class.st index ac54eeab..60704197 100644 --- a/src/Toplo-Widget-List/ToListNodeSelectionEventHandler.class.st +++ b/src/Toplo-Widget-List/ToListNodeSelectionEventHandler.class.st @@ -13,8 +13,7 @@ ToListNodeSelectionEventHandler >> clickEvent: anEvent [ listElement isEnabled ifFalse: [ ^ self ]. mode := listElement primarySelectionMode. mode selectOnPressed ifTrue: [ ^ self ]. - self notifyClickOnNodeFromEvent: anEvent. - "anEvent consume" + self notifyClickOnNodeFromEvent: anEvent ] { #category : #'mouse handlers' } diff --git a/src/Toplo-Widget-Menu/ToMenuBar.class.st b/src/Toplo-Widget-Menu/ToMenuBar.class.st index 139b74c1..f7ff2e0a 100644 --- a/src/Toplo-Widget-Menu/ToMenuBar.class.st +++ b/src/Toplo-Widget-Menu/ToMenuBar.class.st @@ -101,6 +101,7 @@ ToMenuBar >> itemContaining: anElement [ self = anElement ifTrue: [ ^ self ]. ^ (self itemList itemContaining: anElement) ifNotNil: [ :found | | item | + found = anElement ifTrue: [ ^ self ]. item := found item. item isMenuBar ifTrue: [ item itemContaining: anElement ] diff --git a/src/Toplo-Widget-Menu/ToMenuItemElement.class.st b/src/Toplo-Widget-Menu/ToMenuItemElement.class.st index 1b290264..982019fc 100644 --- a/src/Toplo-Widget-Menu/ToMenuItemElement.class.st +++ b/src/Toplo-Widget-Menu/ToMenuItemElement.class.st @@ -29,14 +29,9 @@ ToMenuItemElement >> constraintMenuNode: aNode [ " Sent to let any menu item to adapt its resizer/layout constraints before the node is added in the menu list. Notice that I am sent before the node adding + the selections shift is actually finished. Thus, this place is not adequate for changing one of the list selections (use #addedInMenu for that) " aNode holder listElement isHorizontal - ifTrue: [ - self constraintsDo: [ :c | - c horizontal fitContent. - c vertical fitContent ] ] - ifFalse: [ - self constraintsDo: [ :c | - c horizontal matchParent. - c vertical fitContent ] ] + ifTrue: [ self hFitContent ] + ifFalse: [ self hMatchParent ]. + self vFitContent ] { #category : #initialization } diff --git a/src/Toplo-Widget-Segmented/ToSegmentedNode.class.st b/src/Toplo-Widget-Segmented/ToSegmentedNode.class.st index 2f990898..95a2f229 100644 --- a/src/Toplo-Widget-Segmented/ToSegmentedNode.class.st +++ b/src/Toplo-Widget-Segmented/ToSegmentedNode.class.st @@ -19,7 +19,7 @@ ToSegmentedNode >> checkableElement: aCheckable [ { #category : #'t - list node' } ToSegmentedNode >> clickEventHandlerClasses [ - ^ { } + ^ { ToSegmentedNodeSelectionEventHandler } ] { #category : #skin } diff --git a/src/Toplo-Widget-Segmented/ToSegmentedNodeSelectionEventHandler.class.st b/src/Toplo-Widget-Segmented/ToSegmentedNodeSelectionEventHandler.class.st new file mode 100644 index 00000000..3be220aa --- /dev/null +++ b/src/Toplo-Widget-Segmented/ToSegmentedNodeSelectionEventHandler.class.st @@ -0,0 +1,26 @@ +Class { + #name : #ToSegmentedNodeSelectionEventHandler, + #superclass : #BlCustomEventHandler, + #category : #'Toplo-Widget-Segmented-Node' +} + +{ #category : #'event handling' } +ToSegmentedNodeSelectionEventHandler >> clickEvent: anEvent [ + + anEvent + ifPrimary: [ self primaryClickEvent: anEvent ] + secondary: [ ] + middle: [ ] + other: [ ] +] + +{ #category : #'api - accessing' } +ToSegmentedNodeSelectionEventHandler >> eventsToHandle [ + ^ { BlPrimaryClickEvent } +] + +{ #category : #'event handling' } +ToSegmentedNodeSelectionEventHandler >> primaryClickEvent: anEvent [ + + anEvent currentTarget item dispatchEvent: anEvent. +] diff --git a/src/Toplo-Widget-Segmented/ToSegmentedNodeSkin.class.st b/src/Toplo-Widget-Segmented/ToSegmentedNodeSkin.class.st index f8643f85..ae59e098 100644 --- a/src/Toplo-Widget-Segmented/ToSegmentedNodeSkin.class.st +++ b/src/Toplo-Widget-Segmented/ToSegmentedNodeSkin.class.st @@ -4,6 +4,14 @@ Class { #category : #'Toplo-Widget-Segmented-Node' } +{ #category : #'event handling' } +ToSegmentedNodeSkin >> hoveredSkinEvent: anEvent [ + + super hoveredSkinEvent: anEvent. + anEvent elementDo: [ :e | + e mouseCursor: Cursor webLink ] +] + { #category : #'event handling' } ToSegmentedNodeSkin >> installSkinEvent: anEvent [ @@ -15,3 +23,11 @@ ToSegmentedNodeSkin >> installSkinEvent: anEvent [ vertical: (e valueOfTokenNamed: #'segmented-node-padding-V')). e border: (BlBorder empty) ] ] + +{ #category : #'event handling' } +ToSegmentedNodeSkin >> leavedSkinEvent: anEvent [ + + super leavedSkinEvent: anEvent. + anEvent elementDo: [ :e | + e mouseCursor: Cursor normal ] +]