Skip to content

Commit

Permalink
innerContainer renamed as innerElement
Browse files Browse the repository at this point in the history
  • Loading branch information
plantec committed Oct 27, 2024
1 parent 29f427c commit b1d4032
Show file tree
Hide file tree
Showing 28 changed files with 159 additions and 117 deletions.
47 changes: 40 additions & 7 deletions src/Toplo-Examples/ToSandBox.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ ToSandBox class >> example_BasicListWithAllClasses3 [
l dataAccessor addAll: Smalltalk globals allClasses.
l selecter selectIndexes: #(10 12 3).

l innerContainer requestFocus.
l innerElement requestFocus.
l openInInnerWindow
]

Expand Down Expand Up @@ -847,7 +847,7 @@ ToSandBox class >> example_EditableList2WithAllClassesNames [
c margin: (BlInsets right: 2).
c ignored horizontal alignRight.
c ignored vertical alignBottom ].
vscrollBar attachTo: l innerContainer.
vscrollBar attachTo: l innerElement.
innerWin := ToInnerWindow new.
innerWin pane addChild: l.
innerWin pane addChild: vscrollBar.
Expand Down Expand Up @@ -1058,7 +1058,7 @@ ToSandBox class >> example_HugeIntegerList [
c margin: (BlInsets left: 10).
c ignored horizontal alignRight.
c ignored vertical alignBottom ].
vscrollBar attachTo: l innerContainer.
vscrollBar attachTo: l innerElement.

space := BlSpace new
extent: 100 @ 600;
Expand Down Expand Up @@ -1279,7 +1279,7 @@ ToSandBox class >> example_ListWithAllClassesAndTraitsSorted [
c margin: (BlInsets left: 10).
c ignored horizontal alignRight.
c ignored vertical alignBottom ].
vscrollBar attachTo: l innerContainer.
vscrollBar attachTo: l innerElement.

space := BlSpace new.
space root addChild: l.
Expand Down Expand Up @@ -1381,7 +1381,7 @@ ToSandBox class >> example_ListWithAllMethods [
c margin: (BlInsets left: 10).
c ignored horizontal alignRight.
c ignored vertical alignBottom ].
vscrollBar attachTo: l innerContainer.
vscrollBar attachTo: l innerElement.

space := BlSpace new.

Expand Down Expand Up @@ -1415,7 +1415,7 @@ ToSandBox class >> example_ListWithIndexedColors [
c margin: (BlInsets right: 2).
c ignored horizontal alignRight.
c ignored vertical alignBottom ].
vscrollBar attachTo: l innerContainer.
vscrollBar attachTo: l innerElement.
space := BlSpace new.
space root addChild: l.
space root addChild: vscrollBar.
Expand Down Expand Up @@ -1595,7 +1595,7 @@ ToSandBox class >> example_PicsumPhotosGallery [
c margin: (BlInsets left: 10).
c ignored horizontal alignRight.
c ignored vertical alignBottom ].
vscrollBar attachTo: list innerContainer.
vscrollBar attachTo: list innerElement.

space := BlSpace new
extent: 200 @ 600;
Expand Down Expand Up @@ -2603,6 +2603,18 @@ ToSandBox class >> example_TagBar [
tb openInSpace
]

{ #category : #select }
ToSandBox class >> example_ThemeDropdown [

| dd |
dd := self themeDropdown.
dd placeholderText:
('Select a Toplo theme' asRopedText foreground: Color lightGray).
dd selecter selectIndex: 4.
dd allowDeselection: false.
dd openInSpace
]

{ #category : #select }
ToSandBox class >> example_ThemeSelect [

Expand Down Expand Up @@ -6020,6 +6032,27 @@ ToSandBox class >> subsubsubTabPane [
^ nb
]

{ #category : #select }
ToSandBox class >> themeDropdown [

| dd themes |
dd := ToDropdownButton new.
themes := {
('Bee Light' -> ToBeeTheme new).
('Bee Dark' -> ToBeeDarkTheme new).
('Raw Light' -> ToRawTheme new).
('Raw Dark' -> ToRawDarkTheme new) }.

dd dataViewBuilder: [ :dataItemView :themeAssoc |
dataItemView addChild: (ToLabel text: themeAssoc key) ].

dd popupListElement nodeBuilder: [ :node :themeAssoc :holder |
node addChild: (ToLabel text: themeAssoc key) ].

dd popupListElement dataAccessor addAll: themes.
^ dd
]

{ #category : #select }
ToSandBox class >> themeSelect [

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ ToAlbumAutocompletionEventHandler >> newListElement [
"newListElement withDecoration: ToAutocompleteListSideBackgroundDecoration."
newListElement nodeBuilder: self defaultNodeBuilder.
newListElement fontSize: self defaultFontSize.
newListElement innerContainer maxHeight: self defaultMaxHeight.
newListElement innerContainer minHeight: self defaultMinHeight.
newListElement innerContainer vFitContent.
newListElement innerElement maxHeight: self defaultMaxHeight.
newListElement innerElement minHeight: self defaultMinHeight.
newListElement innerElement vFitContent.
newListElement vFitContent.
newListElement hMatchParent.
^ newListElement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ Class {
{ #category : #'event handling' }
ToDropdownEventHandler >> elementAddedToSceneGraphEvent: anEvent [

| select |
select := anEvent currentTarget.
select refresh

]

{ #category : #'element handlers' }
Expand Down
15 changes: 15 additions & 0 deletions src/Toplo-Widget-DropdownButton/ToDropdownListElement.class.st
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
Class {
#name : #ToDropdownListElement,
#superclass : #ToListElement,
#instVars : [
'dropdownButton'
],
#category : #'Toplo-Widget-DropdownButton'
}

{ #category : #accessing }
ToDropdownListElement >> dropdownButton [

^ dropdownButton
]

{ #category : #accessing }
ToDropdownListElement >> dropdownButton: aDropDown [

dropdownButton := aDropDown
]

{ #category : #initialization }
ToDropdownListElement >> initialize [

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ ToDropdownPopupWindowManager >> newListElement [
| newListElement |
newListElement := self listElementClass new.
newListElement primarySelectionMode multiple: false.
newListElement innerContainer maxHeight: self defaultMaxHeight.
newListElement innerContainer minHeight: self defaultMinHeight.
newListElement innerContainer vFitContent.
newListElement innerElement maxHeight: self defaultMaxHeight.
newListElement innerElement minHeight: self defaultMinHeight.
newListElement innerElement vFitContent.
newListElement vFitContent.
newListElement hMatchParent.
^ newListElement
Expand All @@ -99,7 +99,7 @@ ToDropdownPopupWindowManager >> onInstalledIn: anElement [

super onInstalledIn: anElement.
listElement := self newListElement.
listElement selectElement: self element.
listElement dropdownButton: self element.
listElement focusability: BlFocusability none.
self builder: [ :selectWin :request |
selectWin root hMatchParent.
Expand Down
10 changes: 5 additions & 5 deletions src/Toplo-Widget-List-Tests/ToListElementTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -365,17 +365,17 @@ ToListElementTest >> testRemoveAll [
| l |
l := ToListElement new.
space root addChild: l.
l innerContainer size: 800 @ 600.
l innerElement size: 800 @ 600.
l fitContent.
l dataAccessor addAll: (self statesOfAmerica copyFrom: 1 to: 5).
self waitTestingSpaces.
self assert: l innerContainer children size equals: 5.
self assert: l innerElement children size equals: 5.
l selecter selectOnlyIndex: 2.
self waitTestingSpaces.
self assert: l selectionModel selectedIndexes equals: #( 2 ).
l dataAccessor removeAll.
self waitTestingSpaces.
self assert: l innerContainer children size equals: 0.
self assert: l innerElement children size equals: 0.
self assert: l selectionModel selectedIndexes isEmpty
]

Expand Down Expand Up @@ -471,10 +471,10 @@ ToListElementTest >> testSelectionUpdatedAfterInsert1 [
self assert: l selectionModel selectedIndexes equals: { 3 }.
self assert: l selecter currentIndex equals: 3.
l forceLayout.
self assert: l innerContainer children size equals: 5.
self assert: l innerElement children size equals: 5.
l dataAccessor addAllFirst: (self statesOfAmerica copyFrom: 6 to: 10).
self assert: l dataAccessor size equals: 10.
self assert: l innerContainer children size equals: 5.
self assert: l innerElement children size equals: 5.
self waitTestingSpaces.
self assert: l selectionModel lastIndex equals: 8
]
Expand Down
6 changes: 3 additions & 3 deletions src/Toplo-Widget-List/TToBarNode.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ TToBarNode >> isFullyVisible [

| bnds list |
list := self holder listElement.
bnds := (self measuredBounds inParent: list innerContainer) asRectangle.
bnds := (self measuredBounds inParent: list innerElement) asRectangle.
^ self nodeContainerIntersection = bnds
]

Expand All @@ -41,8 +41,8 @@ TToBarNode >> nodeContainerIntersection [
| intersection bnds pbnds list |
self measuredWidth isZero ifTrue: [ ^ nil ].
list := self holder listElement.
bnds := (self measuredBounds inParent: list innerContainer) asRectangle.
pbnds := list innerContainer measuredBounds asRectangle.
bnds := (self measuredBounds inParent: list innerElement) asRectangle.
pbnds := list innerElement measuredBounds asRectangle.
pbnds := pbnds withRight: pbnds right.
intersection := bnds intersect: pbnds.
^ intersection
Expand Down
4 changes: 2 additions & 2 deletions src/Toplo-Widget-List/TToListElementDecorator.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ TToListElementDecorator >> findElementHolderForDataSourcePosition: anInteger [
]

{ #category : #'t - infinite accessing' }
TToListElementDecorator >> innerContainer [
TToListElementDecorator >> innerElement [

^ self next innerContainer
^ self next innerElement
]

{ #category : #'t - infinite accessing' }
Expand Down
4 changes: 2 additions & 2 deletions src/Toplo-Widget-List/TToListElementEventHandler.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ TToListElementEventHandler >> withTargetNodeFromEvent: anEvent do: aValuable [
node holder isSelectable and: [
node containsGlobalPoint: globalPosition ] ]
ifNone: [
target innerContainer nodes
target innerElement nodes
detect: [ :node |
| gap |
gap := target isHorizontal
Expand All @@ -26,7 +26,7 @@ TToListElementEventHandler >> withTargetNodeFromEvent: anEvent do: aValuable [
node containsGlobalPoint:
globalPosition - (0 @ gap) ] ]
ifNone: [
target innerContainer nodes
target innerElement nodes
detect: [ :node |
| gap |
gap := target isHorizontal
Expand Down
12 changes: 6 additions & 6 deletions src/Toplo-Widget-List/ToAbstractListElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ ToAbstractListElement >> defaultEventHandler [
]

{ #category : #initialization }
ToAbstractListElement >> defaultInnerContainer [
ToAbstractListElement >> defaultInnerElement [

^ self subclassResponsibility
]
Expand Down Expand Up @@ -227,7 +227,7 @@ ToAbstractListElement >> initialize [
selectionModeMap := IdentityDictionary new.

self initializeDataSource.
self initializeInnerContainer.
self initializeInnerElement.

self layout: self defaultLayout.

Expand All @@ -251,9 +251,9 @@ ToAbstractListElement >> initializeDataSource [
]

{ #category : #initialization }
ToAbstractListElement >> initializeInnerContainer [
ToAbstractListElement >> initializeInnerElement [

next := self defaultInnerContainer.
next := self defaultInnerElement.
self next elevation: (BlRelativeElevation elevation: 10).
self addChild: self next.

Expand All @@ -274,7 +274,7 @@ ToAbstractListElement >> itemCount [
{ #category : #'t - orientable - accessing' }
ToAbstractListElement >> layoutStrategy [

^ self innerContainer layout
^ self innerElement layout


]
Expand Down Expand Up @@ -404,7 +404,7 @@ ToAbstractListElement >> onSievedWith: aSieve [
{ #category : #'t - element with placeholder' }
ToAbstractListElement >> placeholderElevation [

^ self innerContainer elevation
^ self innerElement elevation
]

{ #category : #accessing }
Expand Down
16 changes: 8 additions & 8 deletions src/Toplo-Widget-List/ToBarElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ Class {
{ #category : #layout }
ToBarElement >> checkFullyVisibleNodes [

self innerContainer checkFullyVisibleNodes
self innerElement checkFullyVisibleNodes
]

{ #category : #layout }
ToBarElement >> configureLayout [

self innerContainer configureLayoutIn: self
self innerElement configureLayoutIn: self
]

{ #category : #initialization }
Expand All @@ -35,7 +35,7 @@ ToBarElement >> defaultEventHandler [
]

{ #category : #initialization }
ToBarElement >> defaultInnerContainer [
ToBarElement >> defaultInnerElement [

^ ToInnerBarElement onBarElement: self
]
Expand All @@ -49,7 +49,7 @@ ToBarElement >> defaultNodeManagerClass [
{ #category : #accessing }
ToBarElement >> fakeNode [

^ self innerContainer fakeNode
^ self innerElement fakeNode
]

{ #category : #layout }
Expand All @@ -74,16 +74,16 @@ ToBarElement >> initialize [
]

{ #category : #initialization }
ToBarElement >> initializeInnerContainer [
ToBarElement >> initializeInnerElement [

super initializeInnerContainer.
super initializeInnerElement.
self installFakeNode
]

{ #category : #initialization }
ToBarElement >> installFakeNode [

self innerContainer installFakeNode
self innerElement installFakeNode
]

{ #category : #skin }
Expand Down Expand Up @@ -192,5 +192,5 @@ ToBarElement >> uniformNodeWidth: aBoolean [
{ #category : #initialization }
ToBarElement >> uninstallFakeNode [

self innerContainer uninstallFakeNode
self innerElement uninstallFakeNode
]
4 changes: 2 additions & 2 deletions src/Toplo-Widget-List/ToInfiniteElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ ToInfiniteElement >> fullyVisibleNodesSelect: aBlock [
ToInfiniteElement >> initialize [

super initialize.
self addEventHandler: ToListInnerContainerEventHandler new.
self addEventHandler: ToListInnerElementEventHandler new.
self matchParent
]

{ #category : #'t - infinite accessing' }
ToInfiniteElement >> innerContainer [
ToInfiniteElement >> innerElement [

^ self
]
Expand Down
Loading

0 comments on commit b1d4032

Please sign in to comment.