Skip to content

Commit

Permalink
Improve box layout support (driven by ToDoList example)
Browse files Browse the repository at this point in the history
  • Loading branch information
tinchodias committed Jun 26, 2024
1 parent 08bab96 commit e3956db
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Spec-Toplo/SpHorizontalLayoutDirection.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Extension { #name : #SpHorizontalLayoutDirection }

{ #category : #'*Spec-Toplo' }
SpHorizontalLayoutDirection >> setRigidityOfNonExpandedBlElement: aBlElement [

aBlElement
vMatchParent;
hFitContent
]
8 changes: 8 additions & 0 deletions src/Spec-Toplo/SpLayoutDirection.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Extension { #name : #SpLayoutDirection }

{ #category : #'*Spec-Toplo' }
SpLayoutDirection >> setRigidityOfNonExpandedBlElement: aBlElement [
"Set the layout contraints according to this direction. Inspired on the Morphic backend."

self subclassResponsibility
]
13 changes: 13 additions & 0 deletions src/Spec-Toplo/SpToploBoxAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,19 @@ SpToploBoxAdapter >> updateAsExpandedChild: childBlElement with: aSpBoxConstrain
childBlElement matchParent
]

{ #category : #'as yet unclassified' }
SpToploBoxAdapter >> updateAsNonExpandedChild: childBlElement with: aSpBoxConstraints [
"Set up child to stay rigid in the layout direction."

layout direction setRigidityOfNonExpandedBlElement: childBlElement.
aSpBoxConstraints width ifNotNil: [ :w |
1 halt.
childBlElement width: w ].
aSpBoxConstraints height ifNotNil: [ :h |
1 halt.
childBlElement height: h ]
]

{ #category : #'as yet unclassified' }
SpToploBoxAdapter >> updateChildPadding: aBlElement with: aSpBoxConstraints [

Expand Down
7 changes: 7 additions & 0 deletions src/Spec-Toplo/SpToploLayoutAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ SpToploLayoutAdapter >> buildWidget [
^ nil
]

{ #category : #building }
SpToploLayoutAdapter >> buildWithSelector: aSelector [
"Inspired on SpMorphicLayoutAdapter>>#buildWithSelector:"

^ self widget
]

{ #category : #accessing }
SpToploLayoutAdapter >> children [
"Debug API. Answer the widgets added to this layout."
Expand Down
9 changes: 9 additions & 0 deletions src/Spec-Toplo/SpVerticalLayoutDirection.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Extension { #name : #SpVerticalLayoutDirection }

{ #category : #'*Spec-Toplo' }
SpVerticalLayoutDirection >> setRigidityOfNonExpandedBlElement: aBlElement [

aBlElement
hMatchParent;
vFitContent
]

0 comments on commit e3956db

Please sign in to comment.