From 481c167269590ca02064f182ae2554b96331b841 Mon Sep 17 00:00:00 2001 From: Alain Plantec Date: Mon, 21 Oct 2024 13:14:24 +0200 Subject: [PATCH] simplify ToSelectList node and related skins --- src/Toplo-Widget-List/ToListNode.class.st | 10 ++++--- .../ToMultiSelectPopupWindowManager.class.st | 2 +- .../ToSelectDataListNode.class.st | 26 ------------------- .../ToSelectGroupListNode.class.st | 20 +++++--------- .../ToSelectListNode.class.st | 6 ----- .../ToSelectPopupWindowManager.class.st | 2 +- 6 files changed, 16 insertions(+), 50 deletions(-) delete mode 100644 src/Toplo-Widget-Select/ToSelectDataListNode.class.st diff --git a/src/Toplo-Widget-List/ToListNode.class.st b/src/Toplo-Widget-List/ToListNode.class.st index f19c57ab..8aed8eb3 100644 --- a/src/Toplo-Widget-List/ToListNode.class.st +++ b/src/Toplo-Widget-List/ToListNode.class.st @@ -13,8 +13,12 @@ ToListNode >> clickEventHandlerClasses [ ifFalse: [ { ToListNodeSingleSelectionClickEventHandler } ] ] -{ #category : #'instance creation' } -ToListNode >> newRawSkin [ +{ #category : #skin } +ToListNode >> installRawStyle [ - ^ ToListNodeSkin new + super installRawStyle. + self outskirts: BlOutskirts inside. + self padding: (BlInsets + horizontal: (self valueOfTokenNamed: #'list-node-padding-H') + vertical: (self valueOfTokenNamed: #'list-node-padding-V')) ] diff --git a/src/Toplo-Widget-Select/ToMultiSelectPopupWindowManager.class.st b/src/Toplo-Widget-Select/ToMultiSelectPopupWindowManager.class.st index 2d2ac671..864515e2 100644 --- a/src/Toplo-Widget-Select/ToMultiSelectPopupWindowManager.class.st +++ b/src/Toplo-Widget-Select/ToMultiSelectPopupWindowManager.class.st @@ -30,7 +30,7 @@ ToMultiSelectPopupWindowManager >> defaultNodeFactory [ ^ [ :theHolder | theHolder isGroup ifTrue: [ ToSelectGroupListNode new ] - ifFalse: [ ToSelectDataListNode new ] ] + ifFalse: [ ToListNode new ] ] ] { #category : #initialization } diff --git a/src/Toplo-Widget-Select/ToSelectDataListNode.class.st b/src/Toplo-Widget-Select/ToSelectDataListNode.class.st deleted file mode 100644 index 80674089..00000000 --- a/src/Toplo-Widget-Select/ToSelectDataListNode.class.st +++ /dev/null @@ -1,26 +0,0 @@ -Class { - #name : #ToSelectDataListNode, - #superclass : #ToSelectListNode, - #category : #'Toplo-Widget-Select-List' -} - -{ #category : #skin } -ToSelectDataListNode >> installRawStyle [ - - | verticalPadding leftPadding rightPadding | - super installRawStyle. - verticalPadding := self valueOfTokenNamed: #'padding-content-V'. - rightPadding := self valueOfTokenNamed: #'padding-content-H'. - leftPadding := self valueOfTokenNamed: #'padding-content-H'. - self padding: (BlInsets - top: verticalPadding - left: leftPadding - bottom: verticalPadding - right: rightPadding) -] - -{ #category : #skin } -ToSelectDataListNode >> newRawSkin [ - - ^ ToRawSkin new -] diff --git a/src/Toplo-Widget-Select/ToSelectGroupListNode.class.st b/src/Toplo-Widget-Select/ToSelectGroupListNode.class.st index 023a8190..78f8360b 100644 --- a/src/Toplo-Widget-Select/ToSelectGroupListNode.class.st +++ b/src/Toplo-Widget-Select/ToSelectGroupListNode.class.st @@ -1,24 +1,18 @@ Class { #name : #ToSelectGroupListNode, - #superclass : #ToSelectListNode, + #superclass : #ToListNode, #category : #'Toplo-Widget-Select-List' } { #category : #skin } ToSelectGroupListNode >> installRawStyle [ - | verticalPadding leftPadding rightPadding label | + | label | super installRawStyle. - verticalPadding := self valueOfTokenNamed: #'padding-content-V'. - rightPadding := self valueOfTokenNamed: #'padding-content-H'. - leftPadding := (self valueOfTokenNamed: #'padding-content-H') / 3. - self padding: (BlInsets - top: verticalPadding + 6 - left: leftPadding - bottom: verticalPadding - right: rightPadding). + self padding: + ((self padding withTop: self padding top + 6) withBottom: + self padding bottom + 3). label := self firstChild. - label text - foreground: Color lightGray; - light + label foreground: Color lightGray. + label applyStyle ] diff --git a/src/Toplo-Widget-Select/ToSelectListNode.class.st b/src/Toplo-Widget-Select/ToSelectListNode.class.st index 473bb510..f3d64d64 100644 --- a/src/Toplo-Widget-Select/ToSelectListNode.class.st +++ b/src/Toplo-Widget-Select/ToSelectListNode.class.st @@ -3,9 +3,3 @@ Class { #superclass : #ToListNode, #category : #'Toplo-Widget-Select-List' } - -{ #category : #accessing } -ToSelectListNode >> isGroup [ - - ^ self holder isGroup -] diff --git a/src/Toplo-Widget-Select/ToSelectPopupWindowManager.class.st b/src/Toplo-Widget-Select/ToSelectPopupWindowManager.class.st index 6cb492cb..ef53e889 100644 --- a/src/Toplo-Widget-Select/ToSelectPopupWindowManager.class.st +++ b/src/Toplo-Widget-Select/ToSelectPopupWindowManager.class.st @@ -49,7 +49,7 @@ ToSelectPopupWindowManager >> defaultNodeBuilder [ { #category : #initialization } ToSelectPopupWindowManager >> defaultNodeFactory [ - ^ [ :theHolder | ToSelectDataListNode new ] + ^ [ :theHolder | ToListNode new ] ] { #category : #initialization }