Skip to content
Merged
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
37 changes: 33 additions & 4 deletions src/Spec2-Adapters-Morphic/SpMorphicBoxAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ SpMorphicBoxAdapter >> addConstraints: constraints toChild: childMorph [
ifFalse: [
"Set morph to stay rigid"
layout direction setRigidityOfNonExpandedMorph: theMorph.
constraints width ifNotNil: [ :w | theMorph width: w ].
constraints height ifNotNil: [ :h | theMorph height: h ] ].
constraints width ifNotNil: [ :w | self setFixedWidth: w toMorph: theMorph].
constraints height ifNotNil: [ :h | self setFixedHeight: h toMorph: theMorph ] ].

^ theMorph
]
Expand Down Expand Up @@ -169,6 +169,17 @@ SpMorphicBoxAdapter >> childrenWidgets [
^ self children
]

{ #category : 'private' }
SpMorphicBoxAdapter >> hasFixedSize: aPanel [

| props minCellSize |
props := aPanel layoutProperties.
props ifNil: [ ^ false ].
minCellSize := props minCellSize.
minCellSize ifNil: [ ^ false ].
^ minCellSize = props maxCellSize
]

{ #category : 'factory' }
SpMorphicBoxAdapter >> layout: aLayout [

Expand Down Expand Up @@ -307,6 +318,24 @@ SpMorphicBoxAdapter >> replace: aPresenter with: otherPresenter withConstraints:
panel replaceSubmorph: oldMorph by: newMorph
]

{ #category : 'private' }
SpMorphicBoxAdapter >> setFixedHeight: aNumber toMorph: aMorph [

aMorph
minCellSize: aNumber;
maxCellSize: aNumber;
height: aNumber
]

{ #category : 'private' }
SpMorphicBoxAdapter >> setFixedWidth: aNumber toMorph: aMorph [

aMorph
minCellSize: aNumber;
maxCellSize: aNumber;
width: aNumber
]

{ #category : 'updating' }
SpMorphicBoxAdapter >> updateSpacing [

Expand Down Expand Up @@ -347,10 +376,10 @@ SpMorphicBoxAdapter >> verifyBoxExtentOf: aPanel withChild: childMorph [
ifTrue: [ height := height + aPanel height + spacing ]
ifFalse: [ width := width + aPanel width + spacing ].

newPanelWidth := aPanel hResizing = #rigid
newPanelWidth := (layout isHorizontal and: [ self hasFixedSize: aPanel ])
ifTrue: [ aPanel width ]
ifFalse: [ aPanel width max: width ].
newPanelHeight := aPanel vResizing = #rigid
newPanelHeight := (layout isVertical and: [ self hasFixedSize: aPanel ])
ifTrue: [ aPanel height ]
ifFalse: [ aPanel height max: height ].
aPanel extent: newPanelWidth @ newPanelHeight
Expand Down
Loading