-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from OpenSmock/ft_layout
Ft layout
- Loading branch information
Showing
42 changed files
with
2,081 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Extension { #name : #BlBasicLayout } | ||
|
||
{ #category : #'*Pyramid-Bloc' } | ||
BlBasicLayout >> setLayoutOn: aPyramidLayoutInputPresenter [ | ||
|
||
aPyramidLayoutInputPresenter setBasic | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Extension { #name : #BlFlowLayout } | ||
|
||
{ #category : #'*Pyramid-Bloc' } | ||
BlFlowLayout >> = anObject [ | ||
|
||
self == anObject ifTrue: [ ^ true ]. | ||
self class = anObject class ifFalse: [ ^ false ]. | ||
self orientation = anObject orientation ifFalse: [ ^ false ]. | ||
self horizontalAlignment = anObject horizontalAlignment ifFalse: [ ^ false ]. | ||
self verticalAlignment = anObject verticalAlignment ifFalse: [ ^ false ]. | ||
^ true | ||
] | ||
|
||
{ #category : #'*Pyramid-Bloc' } | ||
BlFlowLayout >> setLayoutOn: aPyramidLayoutInputPresenter [ | ||
|
||
aPyramidLayoutInputPresenter setFlow | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Extension { #name : #BlLayout } | ||
|
||
{ #category : #'*Pyramid-Bloc' } | ||
BlLayout >> = anObject [ | ||
|
||
self == anObject ifTrue: [ ^ true ]. | ||
^ self class = anObject class | ||
] |
13 changes: 13 additions & 0 deletions
13
src/Pyramid-Bloc/BlLayoutCommonConstraintsAxis.extension.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Extension { #name : #BlLayoutCommonConstraintsAxis } | ||
|
||
{ #category : #'*Pyramid-Bloc' } | ||
BlLayoutCommonConstraintsAxis >> asPyramidConstraintsArgument [ | ||
|
||
^ self resizer asPyramidConstraintsArgument | ||
] | ||
|
||
{ #category : #'*Pyramid-Bloc' } | ||
BlLayoutCommonConstraintsAxis >> setConstraintsOn: aPyramidBasicConstraintsInputPresenter [ | ||
|
||
self resizer setResizerConstraintsOn: aPyramidBasicConstraintsInputPresenter | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Extension { #name : #BlLayoutExactResizer } | ||
|
||
{ #category : #'*Pyramid-Bloc' } | ||
BlLayoutExactResizer >> asPyramidConstraintsArgument [ | ||
|
||
^ { | ||
#exact:. | ||
self size } | ||
] | ||
|
||
{ #category : #'*Pyramid-Bloc' } | ||
BlLayoutExactResizer >> setResizerConstraintsOn: aPyramidBasicConstraintsInputPresenter [ | ||
|
||
aPyramidBasicConstraintsInputPresenter setExact | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Extension { #name : #BlLayoutFitContentResizer } | ||
|
||
{ #category : #'*Pyramid-Bloc' } | ||
BlLayoutFitContentResizer >> asPyramidConstraintsArgument [ | ||
|
||
^ #fitContent | ||
] | ||
|
||
{ #category : #'*Pyramid-Bloc' } | ||
BlLayoutFitContentResizer >> setResizerConstraintsOn: aPyramidBasicConstraintsInputPresenter [ | ||
|
||
aPyramidBasicConstraintsInputPresenter setFitContent | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Extension { #name : #BlLayoutHorizontal } | ||
|
||
{ #category : #'*Pyramid-Bloc' } | ||
BlLayoutHorizontal >> asBooleanForPyramid [ | ||
|
||
^ false | ||
] | ||
|
||
{ #category : #'*Pyramid-Bloc' } | ||
BlLayoutHorizontal >> switchOrientation [ | ||
|
||
^ BlLayoutOrientation vertical | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Extension { #name : #BlLayoutMatchParentResizer } | ||
|
||
{ #category : #'*Pyramid-Bloc' } | ||
BlLayoutMatchParentResizer >> asPyramidConstraintsArgument [ | ||
|
||
^ #matchParent | ||
] | ||
|
||
{ #category : #'*Pyramid-Bloc' } | ||
BlLayoutMatchParentResizer >> setResizerConstraintsOn: aPyramidBasicConstraintsInputPresenter [ | ||
|
||
aPyramidBasicConstraintsInputPresenter setMatchParent | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Extension { #name : #BlLayoutVertical } | ||
|
||
{ #category : #'*Pyramid-Bloc' } | ||
BlLayoutVertical >> asBooleanForPyramid [ | ||
|
||
^ true | ||
] | ||
|
||
{ #category : #'*Pyramid-Bloc' } | ||
BlLayoutVertical >> switchOrientation [ | ||
|
||
^ BlLayoutOrientation horizontal | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Extension { #name : #BlProportionalLayout } | ||
|
||
{ #category : #'*Pyramid-Bloc' } | ||
BlProportionalLayout >> setLayoutOn: aPyramidLayoutInputPresenter [ | ||
|
||
aPyramidLayoutInputPresenter setProportionnal | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Extension { #name : #False } | ||
|
||
{ #category : #'*Pyramid-Bloc' } | ||
False >> asOrientationForPyramid [ | ||
|
||
^ BlLayoutOrientation horizontal | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Class { | ||
#name : #PyramidBasicConstraintsCommand, | ||
#superclass : #PyramidAbstractBlocCommand, | ||
#category : #'Pyramid-Bloc-plugin-bloc-layout' | ||
} | ||
|
||
{ #category : #testing } | ||
PyramidBasicConstraintsCommand >> canBeUsedFor: anObject [ | ||
|
||
^ (super canBeUsedFor: anObject) and: [ | ||
anObject hasParent and: [ | ||
self targetsLayoutClass includes: anObject parent layout class ] ] | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
PyramidBasicConstraintsCommand >> targetsLayoutClass [ | ||
|
||
^ { | ||
BlBasicLayout. | ||
BlFlowLayout } | ||
] |
140 changes: 140 additions & 0 deletions
140
src/Pyramid-Bloc/PyramidBasicConstraintsInputPresenter.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
Class { | ||
#name : #PyramidBasicConstraintsInputPresenter, | ||
#superclass : #PyramidInputPresenter, | ||
#instVars : [ | ||
'buttonExact', | ||
'buttonMatchParent', | ||
'buttonFitContent', | ||
'whenValueChangedDo', | ||
'value' | ||
], | ||
#category : #'Pyramid-Bloc-plugin-bloc-layout' | ||
} | ||
|
||
{ #category : #accessing } | ||
PyramidBasicConstraintsInputPresenter >> buttonExact [ | ||
|
||
^ buttonExact | ||
] | ||
|
||
{ #category : #accessing } | ||
PyramidBasicConstraintsInputPresenter >> buttonFitContent [ | ||
|
||
^ buttonFitContent | ||
] | ||
|
||
{ #category : #accessing } | ||
PyramidBasicConstraintsInputPresenter >> buttonMatchParent [ | ||
|
||
^ buttonMatchParent | ||
] | ||
|
||
{ #category : #layout } | ||
PyramidBasicConstraintsInputPresenter >> defaultLayout [ | ||
|
||
^ SpBoxLayout newHorizontal | ||
spacing: 4; | ||
add: self buttonExact; | ||
add: self buttonMatchParent; | ||
add: self buttonFitContent; | ||
yourself | ||
] | ||
|
||
{ #category : #initialization } | ||
PyramidBasicConstraintsInputPresenter >> initializePresenters [ | ||
|
||
whenValueChangedDo := [ :visibility | ]. | ||
buttonExact := SpButtonPresenter new | ||
label: 'Exact'; | ||
action: [ | ||
self value: | ||
(BlLayoutCommonConstraintsAxis new exact: 50). | ||
self whenValueChangedDo value: self value ]; | ||
enabled: false; | ||
yourself. | ||
buttonMatchParent := SpButtonPresenter new | ||
label: 'Match Parent'; | ||
action: [ | ||
self value: | ||
(BlLayoutCommonConstraintsAxis new matchParent). | ||
self whenValueChangedDo value: self value ]; | ||
enabled: false; | ||
yourself. | ||
buttonFitContent := SpButtonPresenter new | ||
label: 'Fit Content'; | ||
action: [ | ||
self value: | ||
(BlLayoutCommonConstraintsAxis new fitContent). | ||
self whenValueChangedDo value: self value ]; | ||
enabled: false; | ||
yourself | ||
] | ||
|
||
{ #category : #initialization } | ||
PyramidBasicConstraintsInputPresenter >> setExact [ | ||
|
||
self buttonExact | ||
enabled: true; | ||
icon: (self iconNamed: #checkboxSelected). | ||
self buttonFitContent | ||
enabled: true; | ||
icon: (self iconNamed: #checkboxUnselected). | ||
self buttonMatchParent | ||
enabled: true; | ||
icon: (self iconNamed: #checkboxUnselected) | ||
] | ||
|
||
{ #category : #initialization } | ||
PyramidBasicConstraintsInputPresenter >> setFitContent [ | ||
|
||
self buttonExact | ||
enabled: true; | ||
icon: (self iconNamed: #checkboxUnselected). | ||
self buttonFitContent | ||
enabled: true; | ||
icon: (self iconNamed: #checkboxSelected). | ||
self buttonMatchParent | ||
enabled: true; | ||
icon: (self iconNamed: #checkboxUnselected) | ||
] | ||
|
||
{ #category : #initialization } | ||
PyramidBasicConstraintsInputPresenter >> setMatchParent [ | ||
|
||
self buttonExact enabled: true; icon: (self iconNamed: #checkboxUnselected). | ||
self buttonFitContent enabled: true; icon: (self iconNamed: #checkboxUnselected). | ||
self buttonMatchParent enabled: true; icon: (self iconNamed: #checkboxSelected). | ||
] | ||
|
||
{ #category : #initialization } | ||
PyramidBasicConstraintsInputPresenter >> setUnknowValue [ | ||
|
||
self buttonExact enabled: false; icon: (self iconNamed: #checkboxUnselected). | ||
self buttonFitContent enabled: false; icon: (self iconNamed: #checkboxUnselected). | ||
self buttonMatchParent enabled: false; icon: (self iconNamed: #checkboxUnselected). | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
PyramidBasicConstraintsInputPresenter >> value [ | ||
|
||
^ value asPyramidConstraintsArgument | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
PyramidBasicConstraintsInputPresenter >> value: aCommonConstraints [ | ||
|
||
value := aCommonConstraints. | ||
aCommonConstraints setConstraintsOn: self | ||
] | ||
|
||
{ #category : #accessing } | ||
PyramidBasicConstraintsInputPresenter >> whenValueChangedDo [ | ||
|
||
^ whenValueChangedDo | ||
] | ||
|
||
{ #category : #accessing } | ||
PyramidBasicConstraintsInputPresenter >> whenValueChangedDo: anObject [ | ||
|
||
whenValueChangedDo := anObject | ||
] |
24 changes: 24 additions & 0 deletions
24
src/Pyramid-Bloc/PyramidBasicExactHorizontalConstraintsBlocCommand.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Class { | ||
#name : #PyramidBasicExactHorizontalConstraintsBlocCommand, | ||
#superclass : #PyramidBasicConstraintsCommand, | ||
#category : #'Pyramid-Bloc-plugin-bloc-layout' | ||
} | ||
|
||
{ #category : #'as yet unclassified' } | ||
PyramidBasicExactHorizontalConstraintsBlocCommand >> canBeUsedFor: anObject [ | ||
|
||
^ (super canBeUsedFor: anObject) and: [ | ||
anObject constraints horizontal resizer isExact ] | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
PyramidBasicExactHorizontalConstraintsBlocCommand >> getValueFor: anObject [ | ||
|
||
^ anObject constraints horizontal resizer size | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
PyramidBasicExactHorizontalConstraintsBlocCommand >> setValueFor: anObject with: anArgument [ | ||
|
||
^ anObject constraintsDo: [ :c | c horizontal exact: anArgument ] | ||
] |
24 changes: 24 additions & 0 deletions
24
src/Pyramid-Bloc/PyramidBasicExactVerticalConstraintsBlocCommand.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Class { | ||
#name : #PyramidBasicExactVerticalConstraintsBlocCommand, | ||
#superclass : #PyramidBasicConstraintsCommand, | ||
#category : #'Pyramid-Bloc-plugin-bloc-layout' | ||
} | ||
|
||
{ #category : #'as yet unclassified' } | ||
PyramidBasicExactVerticalConstraintsBlocCommand >> canBeUsedFor: anObject [ | ||
|
||
^ (super canBeUsedFor: anObject) and: [ | ||
anObject constraints vertical resizer isExact ] | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
PyramidBasicExactVerticalConstraintsBlocCommand >> getValueFor: anObject [ | ||
|
||
^ anObject constraints vertical resizer size | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
PyramidBasicExactVerticalConstraintsBlocCommand >> setValueFor: anObject with: anArgument [ | ||
|
||
^ anObject constraintsDo: [ :c | c vertical exact: anArgument ] | ||
] |
38 changes: 38 additions & 0 deletions
38
src/Pyramid-Bloc/PyramidBasicHorizontalConstraintsBlocCommand.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Class { | ||
#name : #PyramidBasicHorizontalConstraintsBlocCommand, | ||
#superclass : #PyramidBasicConstraintsCommand, | ||
#category : #'Pyramid-Bloc-plugin-bloc-layout' | ||
} | ||
|
||
{ #category : #'as yet unclassified' } | ||
PyramidBasicHorizontalConstraintsBlocCommand >> getValueFor: anObject [ | ||
|
||
^ anObject constraints horizontal | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
PyramidBasicHorizontalConstraintsBlocCommand >> saveStatesOf: aCollection withCommand: aCommand withArguments: anArguments [ | ||
|
||
| mementos | | ||
mementos := aCollection collect: [ :each | | ||
PyramidCommandMemento new | ||
command: aCommand; | ||
target: each; | ||
arguments: (self getValueFor: each) asPyramidConstraintsArgument; | ||
yourself ]. | ||
mementos size = 1 ifTrue: [ ^ mementos first ]. | ||
^ PyramidCompositeMemento new | ||
mementos: mementos; | ||
yourself | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
PyramidBasicHorizontalConstraintsBlocCommand >> setValueFor: anObject with: anArgument [ | ||
|
||
anArgument isSymbol | ||
ifFalse: [ | ||
anObject constraintsDo: [ :c | | ||
c horizontal perform: anArgument first with: anArgument last ] ] | ||
ifTrue: [ | ||
anObject constraintsDo: [ :c | c horizontal perform: anArgument ] ] | ||
] |
Oops, something went wrong.