Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Toplo-Examples/ToSandBox.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -9652,12 +9652,12 @@ ToSandBox class >> tripletWith2IconsAnd1Label [
| but |
but := ToTripletElement new.
but startElement: (BlElement new
size: 25 asPoint;
extent: 25 asPoint;
background: Color red;
yourself).
but middleElement: (ToLabel text: 'Middle').
but endElement: (BlElement new
size: 25 asPoint;
extent: 25 asPoint;
background: Color red;
yourself).
^ but
Expand Down
6 changes: 6 additions & 0 deletions src/Toplo/BlLayoutCommonConstraints.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,9 @@ BlLayoutCommonConstraints >> infiniteDo: aValuable [
self hasInfinite ifFalse: [ ^ self ].
aValuable value: self infinite
]

{ #category : #'*Toplo' }
BlLayoutCommonConstraints >> triplet [

^ self at: ToTripletLayout
]
46 changes: 13 additions & 33 deletions src/Toplo/TToTripletElement.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,17 @@ Trait {
'middleElement',
'endElement'
],
#category : #'Toplo-Core'
#category : #'Toplo-Core-Triplet'
}

{ #category : #'t - triplet element - accessing' }
TToTripletElement >> alignCenter [

^ self toConfiguration alignCenter
]

{ #category : #'t - triplet element - accessing' }
TToTripletElement >> alignCenter: aBoolean [

self alignCenter = aBoolean ifTrue: [ ^ self ].
self toConfiguration alignCenter: aBoolean.
self requestConfiguration.
self requestNewSkin
aBoolean
ifTrue: [ self layout alignCenter ]
ifFalse: [ self layout alignCenterLeft ]

]

{ #category : #'t - triplet element - instance creation' }
Expand Down Expand Up @@ -56,7 +51,7 @@ TToTripletElement >> checkStartContainer [
{ #category : #'t - triplet element - instance creation' }
TToTripletElement >> createEndContainer [

endContainer := self newFrameContainer
endContainer := self newLinearContainer
id: #'end-container';
yourself.
self addChild: endContainer
Expand All @@ -74,7 +69,7 @@ TToTripletElement >> createMiddleContainer [
{ #category : #'t - triplet element - instance creation' }
TToTripletElement >> createStartContainer [

startContainer := self newFrameContainer
startContainer := self newLinearContainer
id: #'start-container';
yourself.
self addChild: startContainer at: 1
Expand Down Expand Up @@ -220,6 +215,8 @@ TToTripletElement >> initializeAsTripletElement [

"the midddle container must be created because other parts are added according to its position"
self createMiddleContainer.
self layout: self defaultLayout.
self alignCenter: false.
self addEventHandler: self defaultTripletEventHandler
]

Expand Down Expand Up @@ -277,22 +274,7 @@ TToTripletElement >> newFiller [

^ BlElement new
extent: 0 @ 0;
layout: BlLinearLayout new;
yourself
]

{ #category : #'t - triplet element - instance creation' }
TToTripletElement >> newFrameContainer [

^ BlElement new
constraintsDo: [ :c |
c horizontal fitContent.
c vertical fitContent.
c linear vertical alignCenter.
c linear horizontal alignCenter.
c frame vertical alignCenter.
c frame horizontal alignCenter ];
layout: BlFrameLayout new;
layout: BlBasicLayout new;
yourself
]

Expand All @@ -303,18 +285,16 @@ TToTripletElement >> newLinearContainer [
constraintsDo: [ :c |
c horizontal fitContent.
c vertical fitContent.
c linear vertical alignCenter.
c linear horizontal alignCenter.
c frame vertical alignCenter.
c frame horizontal alignCenter ];
c triplet vertical alignCenter.
c triplet horizontal alignCenter ];
layout: BlLinearLayout new;
yourself
]

{ #category : #'t - triplet element - instance creation' }
TToTripletElement >> newMiddleContainer [

^ self newFrameContainer
^ self newLinearContainer
]

{ #category : #'t - triplet element - accessing' }
Expand Down
74 changes: 25 additions & 49 deletions src/Toplo/TToTripletElementConfiguration.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,11 @@ Trait {
'startAlignment',
'endAlignment',
'endInterspace',
'startInterspace',
'alignCenter'
'startInterspace'
],
#category : #'Toplo-Core'
#category : #'Toplo-Core-Triplet'
}

{ #category : #'t - triplet element accessing' }
TToTripletElementConfiguration >> alignCenter [

^ alignCenter
]

{ #category : #'t - triplet element accessing' }
TToTripletElementConfiguration >> alignCenter: aBoolean [

alignCenter := aBoolean
]

{ #category : #'t - triplet element configuration' }
TToTripletElementConfiguration >> applyTripletElementConfigurationOn: anElement [

Expand All @@ -52,15 +39,11 @@ TToTripletElementConfiguration >> configureChildrenIn: anElement [
anElement isHorizontal
ifTrue: [
allChildren do: [ :child |
child constraints linear vertical alignCenter.
child constraints frame vertical alignCenter ] ]
child constraints triplet vertical alignCenter ] ]
ifFalse: [
allChildren do: [ :child |
child constraints linear horizontal alignCenter.
child constraints frame horizontal alignCenter ] ].
alignCenter
ifTrue: [ anElement layout alignCenter ]
ifFalse: [ anElement layout alignCenterLeft ].
child constraints triplet horizontal alignCenter ] ].

anElement requestLayout
]

Expand Down Expand Up @@ -89,30 +72,27 @@ TToTripletElementConfiguration >> configureEndElementIn: anElement [
anElement endElement ifNil: [ ^ self ].
anElement isHorizontal
ifTrue: [
anElement endElement constraints frame horizontal alignRight.
anElement endElement constraints linear horizontal alignRight ]
anElement endElement constraints linear horizontal alignRight ]
ifFalse: [
anElement endElement constraints frame vertical alignBottom.
anElement endElement constraints linear vertical alignBottom ]
anElement endElement constraints linear vertical alignBottom ]
]

{ #category : #'t - triplet element configuration' }
TToTripletElementConfiguration >> configureEndFillerIn: anElement [

endFlexible
ifTrue: [
endFiller ifNil: [
endFiller ifNotNil: [ ^ self ].
endFiller := anElement newFiller
id: #'end-filler';
yourself.
anElement addChild: endFiller after: anElement middleContainer ].
self on: endFiller resizerDo: [ :c |
c vertical matchParent.
c horizontal matchParent ] ]
id: #'end-filler';
yourself.
endFiller constraints vertical matchParent.
endFiller constraints horizontal matchParent.
anElement addChild: endFiller after: anElement middleContainer ]
ifFalse: [
endFiller ifNil: [ ^ self ].
endFiller removeFromParent.
endFiller := nil ]
endFiller ifNil: [ ^ self ].
endFiller removeFromParent.
endFiller := nil ]
]

{ #category : #'t - triplet element configuration' }
Expand Down Expand Up @@ -165,30 +145,27 @@ TToTripletElementConfiguration >> configureStartElementIn: anElement [
anElement startElement ifNil: [ ^ self ].
anElement isHorizontal
ifTrue: [
anElement startElement constraints frame horizontal alignLeft.
anElement startElement constraints linear horizontal alignLeft ]
anElement startElement constraints linear horizontal alignLeft ]
ifFalse: [
anElement startElement constraints frame vertical alignBottom.
anElement startElement constraints linear vertical alignBottom ]
anElement startElement constraints linear vertical alignBottom ]
]

{ #category : #'t - triplet element configuration' }
TToTripletElementConfiguration >> configureStartFillerIn: anElement [

startFlexible
ifTrue: [
startFiller ifNil: [
startFiller ifNotNil: [ ^ self ].
startFiller := anElement newFiller
id: #'start-filler';
yourself.
anElement addChild: startFiller before: anElement middleContainer ].
self on: startFiller resizerDo: [ :c |
c vertical matchParent.
c horizontal matchParent ] ]
startFiller constraints vertical matchParent.
startFiller constraints horizontal matchParent.
anElement addChild: startFiller before: anElement middleContainer ]
ifFalse: [
startFiller ifNil: [ ^ self ].
startFiller removeFromParent.
startFiller := nil ]
startFiller ifNil: [ ^ self ].
startFiller removeFromParent.
startFiller := nil ]
]

{ #category : #'t - triplet element configuration' }
Expand Down Expand Up @@ -269,7 +246,6 @@ TToTripletElementConfiguration >> endInterspace: aNumber [
{ #category : #'t - triplet element configuration' }
TToTripletElementConfiguration >> initializeAsTripletElementConfiguration [

alignCenter := false.
startFlexible := false.
endFlexible := false.
startInterspace := 0.
Expand Down
2 changes: 1 addition & 1 deletion src/Toplo/ToLabeledIcon.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ Class {
#superclass : #ToTripletElement,
#traits : 'TToLabeledIcon',
#classTraits : 'TToLabeledIcon classTrait',
#category : #'Toplo-Core'
#category : #'Toplo-Core-Triplet'
}
16 changes: 2 additions & 14 deletions src/Toplo/ToTripletElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ Class {
#superclass : #ToElement,
#traits : 'TToOrientable + TToTripletElement',
#classTraits : 'TToOrientable classTrait + TToTripletElement classTrait',
#category : #'Toplo-Core'
#category : #'Toplo-Core-Triplet'
}

{ #category : #initialization }
ToTripletElement >> defaultLayout [

^ BlLinearLayout horizontal.
^ ToTripletLayout horizontal.

]

Expand All @@ -20,18 +20,6 @@ ToTripletElement >> initialize [
self initializeAsTripletElement
]

{ #category : #skin }
ToTripletElement >> installRawStyle [

super installRawStyle.
self childrenDo: [ :child |
child constraintsDo: [ :c |
c linear vertical alignCenter.
c linear horizontal alignCenter ] ].


]

{ #category : #configuration }
ToTripletElement >> newToConfiguration [

Expand Down
2 changes: 1 addition & 1 deletion src/Toplo/ToTripletElementConfiguration.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Class {
#superclass : #ToWidgetConfiguration,
#traits : 'TToTripletElementConfiguration',
#classTraits : 'TToTripletElementConfiguration classTrait',
#category : #'Toplo-Core'
#category : #'Toplo-Core-Triplet'
}

{ #category : #hook }
Expand Down
2 changes: 1 addition & 1 deletion src/Toplo/ToTripletElementEventHandler.class.st
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Class {
#name : #ToTripletElementEventHandler,
#superclass : #BlCustomEventHandler,
#category : #'Toplo-Core'
#category : #'Toplo-Core-Triplet'
}

{ #category : #'events handling' }
Expand Down
Loading
Loading