diff --git a/src/Pyramid-Bloc/BlBasicLayout.extension.st b/src/Pyramid-Bloc/BlBasicLayout.extension.st index 04c7965c..46a35316 100644 --- a/src/Pyramid-Bloc/BlBasicLayout.extension.st +++ b/src/Pyramid-Bloc/BlBasicLayout.extension.st @@ -1,7 +1,7 @@ Extension { #name : #BlBasicLayout } { #category : #'*Pyramid-Bloc' } -BlBasicLayout >> setLayoutOn: aPyramidLayoutInputPresenter [ +BlBasicLayout >> asIcon [ - aPyramidLayoutInputPresenter setBasic + ^ self iconNamed: #radioButtonUnselected ] diff --git a/src/Pyramid-Bloc/BlBottomAlignment.extension.st b/src/Pyramid-Bloc/BlBottomAlignment.extension.st new file mode 100644 index 00000000..2683598c --- /dev/null +++ b/src/Pyramid-Bloc/BlBottomAlignment.extension.st @@ -0,0 +1,9 @@ +Extension { #name : #BlBottomAlignment } + +{ #category : #'*Pyramid-Bloc' } +BlBottomAlignment >> pyramidSelectOn: aFrameConstraintsPresenter [ + + aFrameConstraintsPresenter selectEnd. + aFrameConstraintsPresenter inputHasRelative state: false. + aFrameConstraintsPresenter inputRelative value: 0 +] diff --git a/src/Pyramid-Bloc/BlElement.extension.st b/src/Pyramid-Bloc/BlElement.extension.st index eed6d21b..fa3b7f48 100644 --- a/src/Pyramid-Bloc/BlElement.extension.st +++ b/src/Pyramid-Bloc/BlElement.extension.st @@ -3,5 +3,5 @@ Extension { #name : #BlElement } { #category : #'*Pyramid-Bloc' } BlElement >> asIcon [ - ^ self iconNamed: #class + ^ self layout asIcon ] diff --git a/src/Pyramid-Bloc/BlFlowLayout.extension.st b/src/Pyramid-Bloc/BlFlowLayout.extension.st index 5813f904..fd33d9ab 100644 --- a/src/Pyramid-Bloc/BlFlowLayout.extension.st +++ b/src/Pyramid-Bloc/BlFlowLayout.extension.st @@ -12,7 +12,7 @@ BlFlowLayout >> = anObject [ ] { #category : #'*Pyramid-Bloc' } -BlFlowLayout >> setLayoutOn: aPyramidLayoutInputPresenter [ +BlFlowLayout >> asIcon [ - aPyramidLayoutInputPresenter setFlow + ^ self iconNamed: #smallJustified ] diff --git a/src/Pyramid-Bloc/BlFrameLayout.extension.st b/src/Pyramid-Bloc/BlFrameLayout.extension.st new file mode 100644 index 00000000..fd888ddb --- /dev/null +++ b/src/Pyramid-Bloc/BlFrameLayout.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlFrameLayout } + +{ #category : #'*Pyramid-Bloc' } +BlFrameLayout >> asIcon [ + + ^ self iconNamed: #windowMaximize +] diff --git a/src/Pyramid-Bloc/BlHorizontalCenterAlignment.extension.st b/src/Pyramid-Bloc/BlHorizontalCenterAlignment.extension.st new file mode 100644 index 00000000..0c592c15 --- /dev/null +++ b/src/Pyramid-Bloc/BlHorizontalCenterAlignment.extension.st @@ -0,0 +1,9 @@ +Extension { #name : #BlHorizontalCenterAlignment } + +{ #category : #'*Pyramid-Bloc' } +BlHorizontalCenterAlignment >> pyramidSelectOn: aFrameConstraintsPresenter [ + + aFrameConstraintsPresenter selectCenter. + aFrameConstraintsPresenter inputHasRelative state: false. + aFrameConstraintsPresenter inputRelative value: 0 +] diff --git a/src/Pyramid-Bloc/BlHorizontalCoordinateEndAlignment.extension.st b/src/Pyramid-Bloc/BlHorizontalCoordinateEndAlignment.extension.st new file mode 100644 index 00000000..e5ba3cff --- /dev/null +++ b/src/Pyramid-Bloc/BlHorizontalCoordinateEndAlignment.extension.st @@ -0,0 +1,9 @@ +Extension { #name : #BlHorizontalCoordinateEndAlignment } + +{ #category : #'*Pyramid-Bloc' } +BlHorizontalCoordinateEndAlignment >> pyramidSelectOn: aFrameConstraintsPresenter [ + + aFrameConstraintsPresenter selectCenter. + aFrameConstraintsPresenter inputHasRelative state: true. + aFrameConstraintsPresenter inputRelative value: self coordinate negated +] diff --git a/src/Pyramid-Bloc/BlHorizontalCoordinateLeftAlignment.extension.st b/src/Pyramid-Bloc/BlHorizontalCoordinateLeftAlignment.extension.st new file mode 100644 index 00000000..a1e09b0a --- /dev/null +++ b/src/Pyramid-Bloc/BlHorizontalCoordinateLeftAlignment.extension.st @@ -0,0 +1,11 @@ +Extension { #name : #BlHorizontalCoordinateLeftAlignment } + +{ #category : #'*Pyramid-Bloc' } +BlHorizontalCoordinateLeftAlignment >> pyramidSelectOn: aFrameConstraintsPresenter [ + + aFrameConstraintsPresenter selectStart. + aFrameConstraintsPresenter inputHasRelative + state: true. + aFrameConstraintsPresenter inputRelative + value: self coordinate +] diff --git a/src/Pyramid-Bloc/BlHorizontalCoordinateRightAlignment.extension.st b/src/Pyramid-Bloc/BlHorizontalCoordinateRightAlignment.extension.st new file mode 100644 index 00000000..e9f5b757 --- /dev/null +++ b/src/Pyramid-Bloc/BlHorizontalCoordinateRightAlignment.extension.st @@ -0,0 +1,9 @@ +Extension { #name : #BlHorizontalCoordinateRightAlignment } + +{ #category : #'*Pyramid-Bloc' } +BlHorizontalCoordinateRightAlignment >> pyramidSelectOn: aFrameConstraintsPresenter [ + + aFrameConstraintsPresenter selectEnd. + aFrameConstraintsPresenter inputHasRelative state: true. + aFrameConstraintsPresenter inputRelative value: self coordinate +] diff --git a/src/Pyramid-Bloc/BlHorizontalCoordinateStartAlignment.extension.st b/src/Pyramid-Bloc/BlHorizontalCoordinateStartAlignment.extension.st new file mode 100644 index 00000000..b571a509 --- /dev/null +++ b/src/Pyramid-Bloc/BlHorizontalCoordinateStartAlignment.extension.st @@ -0,0 +1,9 @@ +Extension { #name : #BlHorizontalCoordinateStartAlignment } + +{ #category : #'*Pyramid-Bloc' } +BlHorizontalCoordinateStartAlignment >> pyramidSelectOn: aFrameConstraintsPresenter [ + + aFrameConstraintsPresenter selectCenter. + aFrameConstraintsPresenter inputHasRelative state: true. + aFrameConstraintsPresenter inputRelative value: self coordinate +] diff --git a/src/Pyramid-Bloc/BlHorizontalEndAlignment.extension.st b/src/Pyramid-Bloc/BlHorizontalEndAlignment.extension.st new file mode 100644 index 00000000..39362c5e --- /dev/null +++ b/src/Pyramid-Bloc/BlHorizontalEndAlignment.extension.st @@ -0,0 +1,9 @@ +Extension { #name : #BlHorizontalEndAlignment } + +{ #category : #'*Pyramid-Bloc' } +BlHorizontalEndAlignment >> pyramidSelectOn: aFrameConstraintsPresenter [ + + aFrameConstraintsPresenter selectEnd. + aFrameConstraintsPresenter inputHasRelative state: false. + aFrameConstraintsPresenter inputRelative value: 0 +] diff --git a/src/Pyramid-Bloc/BlHorizontalStartAlignment.extension.st b/src/Pyramid-Bloc/BlHorizontalStartAlignment.extension.st new file mode 100644 index 00000000..0b37baf7 --- /dev/null +++ b/src/Pyramid-Bloc/BlHorizontalStartAlignment.extension.st @@ -0,0 +1,9 @@ +Extension { #name : #BlHorizontalStartAlignment } + +{ #category : #'*Pyramid-Bloc' } +BlHorizontalStartAlignment >> pyramidSelectOn: aFrameConstraintsPresenter [ + + aFrameConstraintsPresenter selectStart. + aFrameConstraintsPresenter inputHasRelative state: false. + aFrameConstraintsPresenter inputRelative value: 0 +] diff --git a/src/Pyramid-Bloc/BlLayout.extension.st b/src/Pyramid-Bloc/BlLayout.extension.st index 8a9cdf18..ef45ada7 100644 --- a/src/Pyramid-Bloc/BlLayout.extension.st +++ b/src/Pyramid-Bloc/BlLayout.extension.st @@ -8,7 +8,7 @@ BlLayout >> = anObject [ ] { #category : #'*Pyramid-Bloc' } -BlLayout >> setLayoutOn: aPyramidLayoutInputPresenter [ +BlLayout >> asIcon [ - aPyramidLayoutInputPresenter setUnknowValue + ^ self iconNamed: #smallQuestion ] diff --git a/src/Pyramid-Bloc/BlLinearLayout.extension.st b/src/Pyramid-Bloc/BlLinearLayout.extension.st new file mode 100644 index 00000000..db887d29 --- /dev/null +++ b/src/Pyramid-Bloc/BlLinearLayout.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #BlLinearLayout } + +{ #category : #'*Pyramid-Bloc' } +BlLinearLayout >> asIcon [ + + ^ self iconNamed: #smallLeftFlush +] diff --git a/src/Pyramid-Bloc/BlLinearLayoutHorizontalOrientation.extension.st b/src/Pyramid-Bloc/BlLinearLayoutHorizontalOrientation.extension.st new file mode 100644 index 00000000..a6549508 --- /dev/null +++ b/src/Pyramid-Bloc/BlLinearLayoutHorizontalOrientation.extension.st @@ -0,0 +1,13 @@ +Extension { #name : #BlLinearLayoutHorizontalOrientation } + +{ #category : #'*Pyramid-Bloc' } +BlLinearLayoutHorizontalOrientation >> asBooleanForPyramid [ + + ^ false +] + +{ #category : #'*Pyramid-Bloc' } +BlLinearLayoutHorizontalOrientation >> switchOrientation [ + + ^ BlLinearLayoutVerticalOrientation new +] diff --git a/src/Pyramid-Bloc/BlLinearLayoutVerticalOrientation.extension.st b/src/Pyramid-Bloc/BlLinearLayoutVerticalOrientation.extension.st new file mode 100644 index 00000000..86c3321b --- /dev/null +++ b/src/Pyramid-Bloc/BlLinearLayoutVerticalOrientation.extension.st @@ -0,0 +1,13 @@ +Extension { #name : #BlLinearLayoutVerticalOrientation } + +{ #category : #'*Pyramid-Bloc' } +BlLinearLayoutVerticalOrientation >> asBooleanForPyramid [ + + ^ true +] + +{ #category : #'*Pyramid-Bloc' } +BlLinearLayoutVerticalOrientation >> switchOrientation [ + + ^ BlLinearLayoutHorizontalOrientation new +] diff --git a/src/Pyramid-Bloc/BlNullHorizontalAlignment.extension.st b/src/Pyramid-Bloc/BlNullHorizontalAlignment.extension.st new file mode 100644 index 00000000..c23a7bf5 --- /dev/null +++ b/src/Pyramid-Bloc/BlNullHorizontalAlignment.extension.st @@ -0,0 +1,9 @@ +Extension { #name : #BlNullHorizontalAlignment } + +{ #category : #'*Pyramid-Bloc' } +BlNullHorizontalAlignment >> pyramidSelectOn: aFrameConstraintsPresenter [ + + aFrameConstraintsPresenter selectNull. + aFrameConstraintsPresenter inputHasRelative state: false. + aFrameConstraintsPresenter inputRelative value: 0 +] diff --git a/src/Pyramid-Bloc/BlNullVerticalAlignment.extension.st b/src/Pyramid-Bloc/BlNullVerticalAlignment.extension.st new file mode 100644 index 00000000..73f64c9b --- /dev/null +++ b/src/Pyramid-Bloc/BlNullVerticalAlignment.extension.st @@ -0,0 +1,9 @@ +Extension { #name : #BlNullVerticalAlignment } + +{ #category : #'*Pyramid-Bloc' } +BlNullVerticalAlignment >> pyramidSelectOn: aFrameConstraintsPresenter [ + + aFrameConstraintsPresenter selectNull. + aFrameConstraintsPresenter inputHasRelative state: false. + aFrameConstraintsPresenter inputRelative value: 0 +] diff --git a/src/Pyramid-Bloc/BlProportionalLayout.extension.st b/src/Pyramid-Bloc/BlProportionalLayout.extension.st index 10f1204c..25bf27d4 100644 --- a/src/Pyramid-Bloc/BlProportionalLayout.extension.st +++ b/src/Pyramid-Bloc/BlProportionalLayout.extension.st @@ -1,7 +1,7 @@ Extension { #name : #BlProportionalLayout } { #category : #'*Pyramid-Bloc' } -BlProportionalLayout >> setLayoutOn: aPyramidLayoutInputPresenter [ +BlProportionalLayout >> asIcon [ - aPyramidLayoutInputPresenter setProportionnal + ^ self iconNamed: #haloScale ] diff --git a/src/Pyramid-Bloc/BlTextElement.extension.st b/src/Pyramid-Bloc/BlTextElement.extension.st index 131c8409..3e98b88a 100644 --- a/src/Pyramid-Bloc/BlTextElement.extension.st +++ b/src/Pyramid-Bloc/BlTextElement.extension.st @@ -3,5 +3,5 @@ Extension { #name : #BlTextElement } { #category : #'*Pyramid-Bloc' } BlTextElement >> asIcon [ - ^ self iconNamed: #haloFontStyle + ^ self iconNamed: #smallFonts ] diff --git a/src/Pyramid-Bloc/BlTopAlignment.extension.st b/src/Pyramid-Bloc/BlTopAlignment.extension.st new file mode 100644 index 00000000..4a7ea7ef --- /dev/null +++ b/src/Pyramid-Bloc/BlTopAlignment.extension.st @@ -0,0 +1,9 @@ +Extension { #name : #BlTopAlignment } + +{ #category : #'*Pyramid-Bloc' } +BlTopAlignment >> pyramidSelectOn: aFrameConstraintsPresenter [ + + aFrameConstraintsPresenter selectStart. + aFrameConstraintsPresenter inputHasRelative state: false. + aFrameConstraintsPresenter inputRelative value: 0 +] diff --git a/src/Pyramid-Bloc/BlVerticalCenterAlignment.extension.st b/src/Pyramid-Bloc/BlVerticalCenterAlignment.extension.st new file mode 100644 index 00000000..9892aa8d --- /dev/null +++ b/src/Pyramid-Bloc/BlVerticalCenterAlignment.extension.st @@ -0,0 +1,9 @@ +Extension { #name : #BlVerticalCenterAlignment } + +{ #category : #'*Pyramid-Bloc' } +BlVerticalCenterAlignment >> pyramidSelectOn: aFrameConstraintsPresenter [ + + aFrameConstraintsPresenter selectCenter. + aFrameConstraintsPresenter inputHasRelative state: false. + aFrameConstraintsPresenter inputRelative value: 0 +] diff --git a/src/Pyramid-Bloc/BlVerticalCoordinateBottomAlignment.extension.st b/src/Pyramid-Bloc/BlVerticalCoordinateBottomAlignment.extension.st new file mode 100644 index 00000000..fcb941ef --- /dev/null +++ b/src/Pyramid-Bloc/BlVerticalCoordinateBottomAlignment.extension.st @@ -0,0 +1,9 @@ +Extension { #name : #BlVerticalCoordinateBottomAlignment } + +{ #category : #'*Pyramid-Bloc' } +BlVerticalCoordinateBottomAlignment >> pyramidSelectOn: aFrameConstraintsPresenter [ + + aFrameConstraintsPresenter selectEnd. + aFrameConstraintsPresenter inputHasRelative state: true. + aFrameConstraintsPresenter inputRelative value: self coordinate +] diff --git a/src/Pyramid-Bloc/BlVerticalCoordinateTopAlignment.extension.st b/src/Pyramid-Bloc/BlVerticalCoordinateTopAlignment.extension.st new file mode 100644 index 00000000..9efda788 --- /dev/null +++ b/src/Pyramid-Bloc/BlVerticalCoordinateTopAlignment.extension.st @@ -0,0 +1,9 @@ +Extension { #name : #BlVerticalCoordinateTopAlignment } + +{ #category : #'*Pyramid-Bloc' } +BlVerticalCoordinateTopAlignment >> pyramidSelectOn: aFrameConstraintsPresenter [ + + aFrameConstraintsPresenter selectStart. + aFrameConstraintsPresenter inputHasRelative state: true. + aFrameConstraintsPresenter inputRelative value: self coordinate +] diff --git a/src/Pyramid-Bloc/False.extension.st b/src/Pyramid-Bloc/False.extension.st index 5cf991d7..b5527117 100644 --- a/src/Pyramid-Bloc/False.extension.st +++ b/src/Pyramid-Bloc/False.extension.st @@ -1,7 +1,13 @@ Extension { #name : #False } { #category : #'*Pyramid-Bloc' } -False >> asOrientationForPyramid [ +False >> asOrientationForFlowPyramid [ ^ BlLayoutOrientation horizontal ] + +{ #category : #'*Pyramid-Bloc' } +False >> asOrientationForLinearPyramid [ + + ^ BlLinearLayoutHorizontalOrientation new +] diff --git a/src/Pyramid-Bloc/PyramidAbstractFrameConstraintsInputPresenter.class.st b/src/Pyramid-Bloc/PyramidAbstractFrameConstraintsInputPresenter.class.st new file mode 100644 index 00000000..f1993d4a --- /dev/null +++ b/src/Pyramid-Bloc/PyramidAbstractFrameConstraintsInputPresenter.class.st @@ -0,0 +1,275 @@ +Class { + #name : #PyramidAbstractFrameConstraintsInputPresenter, + #superclass : #PyramidInputPresenter, + #instVars : [ + 'buttonNull', + 'buttonStart', + 'buttonCenter', + 'buttonEnd', + 'inputHasRelative', + 'inputRelative', + 'whenValueChangedDo', + 'shouldTrigger' + ], + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #testing } +PyramidAbstractFrameConstraintsInputPresenter class >> isAbstract [ + + ^ self == PyramidAbstractFrameConstraintsInputPresenter +] + +{ #category : #layout } +PyramidAbstractFrameConstraintsInputPresenter >> buttonCenter [ + + ^ buttonCenter +] + +{ #category : #layout } +PyramidAbstractFrameConstraintsInputPresenter >> buttonEnd [ + + ^ buttonEnd +] + +{ #category : #layout } +PyramidAbstractFrameConstraintsInputPresenter >> buttonNull [ + + ^ buttonNull +] + +{ #category : #layout } +PyramidAbstractFrameConstraintsInputPresenter >> buttonStart [ + ^ buttonStart +] + +{ #category : #initialization } +PyramidAbstractFrameConstraintsInputPresenter >> connectPresenters [ + + self inputHasRelative whenChangedDo: [ :aBoolean | + self inputRelative enabled: aBoolean. + self triggerValueChanged ]. + self inputRelative whenValueChangedDo: [ :aValue | + self whenValueChangedDo value: self value ]. + self buttonNull action: [ + self selectNull. + self triggerValueChanged ]. + self buttonStart action: [ + self selectStart. + self triggerValueChanged ]. + self buttonCenter action: [ + self selectCenter. + self triggerValueChanged ]. + self buttonEnd action: [ + self selectEnd. + self triggerValueChanged. ] +] + +{ #category : #'as yet unclassified' } +PyramidAbstractFrameConstraintsInputPresenter >> currentRelativeValue [ + + ^ self inputRelative value isNumber ifTrue: [ ^ self inputRelative value ] ifFalse: [ ^ 0 ] +] + +{ #category : #layout } +PyramidAbstractFrameConstraintsInputPresenter >> defaultLayout [ + + ^ SpBoxLayout newHorizontal + spacing: 4; + add: self buttonNull withConstraints: [ :c | c width: 32 ]; + add: self buttonStart withConstraints: [ :c | c width: 32 ]; + add: self buttonCenter withConstraints: [ :c | c width: 32 ]; + add: self buttonEnd withConstraints: [ :c | c width: 32 ]; + add: self inputHasRelative withConstraints: [ :c | c width: 64 ]; + add: self inputRelative expand: true; + yourself +] + +{ #category : #'as yet unclassified' } +PyramidAbstractFrameConstraintsInputPresenter >> doNotTriggerWhile: aBlock [ + + self shouldTrigger: false. + aBlock value. + self shouldTrigger: true. +] + +{ #category : #'as yet unclassified' } +PyramidAbstractFrameConstraintsInputPresenter >> helpCenter [ + + ^ self shouldBeImplemented +] + +{ #category : #'as yet unclassified' } +PyramidAbstractFrameConstraintsInputPresenter >> helpEnd [ + + ^ self shouldBeImplemented +] + +{ #category : #'as yet unclassified' } +PyramidAbstractFrameConstraintsInputPresenter >> helpNull [ + + ^ self shouldBeImplemented +] + +{ #category : #'as yet unclassified' } +PyramidAbstractFrameConstraintsInputPresenter >> helpStart [ + + ^ self shouldBeImplemented +] + +{ #category : #'as yet unclassified' } +PyramidAbstractFrameConstraintsInputPresenter >> iconCenter [ + + ^ self shouldBeImplemented +] + +{ #category : #'as yet unclassified' } +PyramidAbstractFrameConstraintsInputPresenter >> iconEnd [ + + ^ self shouldBeImplemented +] + +{ #category : #'as yet unclassified' } +PyramidAbstractFrameConstraintsInputPresenter >> iconNull [ + + ^ self shouldBeImplemented +] + +{ #category : #'as yet unclassified' } +PyramidAbstractFrameConstraintsInputPresenter >> iconStart [ + + ^ self shouldBeImplemented +] + +{ #category : #initialization } +PyramidAbstractFrameConstraintsInputPresenter >> initialize [ + + super initialize. + whenValueChangedDo := [ :newVal ] +] + +{ #category : #initialization } +PyramidAbstractFrameConstraintsInputPresenter >> initializePresenters [ + + buttonNull := SpButtonPresenter new + icon: self iconNull; + help: self helpNull; + yourself. + buttonStart := SpButtonPresenter new + icon: self iconStart; + help: self helpStart; + yourself. + buttonCenter := SpButtonPresenter new + icon: self iconCenter; + help: self helpCenter; + yourself. + buttonEnd := SpButtonPresenter new + icon: self iconEnd; + help: self helpEnd; + yourself. + inputHasRelative := SpCheckBoxPresenter new + label: 'at:'; + state: true; + yourself. + inputRelative := PyramidNumberInputPresenter new value: 0; yourself +] + +{ #category : #layout } +PyramidAbstractFrameConstraintsInputPresenter >> inputHasRelative [ + + ^ inputHasRelative +] + +{ #category : #layout } +PyramidAbstractFrameConstraintsInputPresenter >> inputRelative [ + + ^ inputRelative +] + +{ #category : #initialization } +PyramidAbstractFrameConstraintsInputPresenter >> selectCenter [ + self buttonNull state: false. + self buttonStart state: false. + self buttonCenter state: true. + self buttonEnd state: false. + +] + +{ #category : #initialization } +PyramidAbstractFrameConstraintsInputPresenter >> selectEnd [ + self buttonNull state: false. + self buttonStart state: false. + self buttonCenter state: false. + self buttonEnd state: true. + +] + +{ #category : #initialization } +PyramidAbstractFrameConstraintsInputPresenter >> selectNull [. + self buttonNull state: true. + self buttonStart state: false. + self buttonCenter state: false. + self buttonEnd state: false. + +] + +{ #category : #initialization } +PyramidAbstractFrameConstraintsInputPresenter >> selectStart [. + self buttonNull state: false. + self buttonStart state: true. + self buttonCenter state: false. + self buttonEnd state: false. + +] + +{ #category : #'as yet unclassified' } +PyramidAbstractFrameConstraintsInputPresenter >> shouldTrigger [ + + ^ shouldTrigger +] + +{ #category : #'as yet unclassified' } +PyramidAbstractFrameConstraintsInputPresenter >> shouldTrigger: aBoolean [ +shouldTrigger:=aBoolean +] + +{ #category : #initialization } +PyramidAbstractFrameConstraintsInputPresenter >> triggerValueChanged [ + + self shouldTrigger ifFalse: [ ^ self ]. + self whenValueChangedDo value: self value +] + +{ #category : #initialization } +PyramidAbstractFrameConstraintsInputPresenter >> unselectAll [ + + self buttonNull state: false. + self buttonStart state: false. + self buttonCenter state: false. + self buttonEnd state: false +] + +{ #category : #'as yet unclassified' } +PyramidAbstractFrameConstraintsInputPresenter >> value [ + + ^ self shouldBeImplemented +] + +{ #category : #'as yet unclassified' } +PyramidAbstractFrameConstraintsInputPresenter >> value: aValue [ + + self doNotTriggerWhile: [ aValue pyramidSelectOn: self ] + +] + +{ #category : #'as yet unclassified' } +PyramidAbstractFrameConstraintsInputPresenter >> whenValueChangedDo [ + + ^ whenValueChangedDo +] + +{ #category : #'as yet unclassified' } +PyramidAbstractFrameConstraintsInputPresenter >> whenValueChangedDo: aBlock [ + + whenValueChangedDo := aBlock. +] diff --git a/src/Pyramid-Bloc/PyramidAbstractLayoutOrientationPresenter.class.st b/src/Pyramid-Bloc/PyramidAbstractLayoutOrientationPresenter.class.st new file mode 100644 index 00000000..91ef518e --- /dev/null +++ b/src/Pyramid-Bloc/PyramidAbstractLayoutOrientationPresenter.class.st @@ -0,0 +1,27 @@ +Class { + #name : #PyramidAbstractLayoutOrientationPresenter, + #superclass : #PyramidSwitchInputPresenter, + #instVars : [ + 'buttonSwitch' + ], + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #'as yet unclassified' } +PyramidAbstractLayoutOrientationPresenter >> switchState [ + + self value: self value switchOrientation. + self whenValueChangedDo value: self value +] + +{ #category : #'as yet unclassified' } +PyramidAbstractLayoutOrientationPresenter >> value [ + + ^ self shouldBeImplemented +] + +{ #category : #'as yet unclassified' } +PyramidAbstractLayoutOrientationPresenter >> value: anOrientation [ + + super value: anOrientation asBooleanForPyramid +] diff --git a/src/Pyramid-Bloc/PyramidBasicConstraintsCommand.class.st b/src/Pyramid-Bloc/PyramidBasicConstraintsCommand.class.st index 47df5075..37fb42eb 100644 --- a/src/Pyramid-Bloc/PyramidBasicConstraintsCommand.class.st +++ b/src/Pyramid-Bloc/PyramidBasicConstraintsCommand.class.st @@ -4,18 +4,17 @@ Class { #category : #'Pyramid-Bloc-plugin-bloc-layout' } +{ #category : #'as yet unclassified' } +PyramidBasicConstraintsCommand >> authorizedLayouts [ + + + ^ { BlBasicLayout . BlFlowLayout . BlLinearLayout . BlFrameLayout } +] + { #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 } + self authorizedLayouts includes: anObject parent layout class ] ] ] diff --git a/src/Pyramid-Bloc/PyramidBlocPlugin.class.st b/src/Pyramid-Bloc/PyramidBlocPlugin.class.st index a6f8b8a9..b39d3ea4 100644 --- a/src/Pyramid-Bloc/PyramidBlocPlugin.class.st +++ b/src/Pyramid-Bloc/PyramidBlocPlugin.class.st @@ -101,12 +101,38 @@ PyramidBlocPlugin class >> constraintsBasicVExact [ ^ property ] +{ #category : #accessing } +PyramidBlocPlugin class >> constraintsFrameH [ + + | property | + property := PyramidProperty new + name: 'Constraints - Frame - horizontal'; + command: PyramidFrameHorizontalConstraintsCommand new; + pyramidInputPresenterClass: + PyramidHorizontalFrameConstraintsInputPresenter; + yourself. + ^ property +] + +{ #category : #accessing } +PyramidBlocPlugin class >> constraintsFrameV [ + + | property | + property := PyramidProperty new + name: 'Constraints - Frame - vertical'; + command: PyramidFrameVerticalConstraintsCommand new; + pyramidInputPresenterClass: + PyramidVerticalFrameConstraintsInputPresenter; + yourself. + ^ property +] + { #category : #accessing } PyramidBlocPlugin class >> constraintsPropH [ | property | property := PyramidProperty new - name: 'Constraints - horizontal'; + name: 'Constraints - Proportionnal - horizontal'; command: PyramidProportionnalHorizontalConstraintsCommand new; pyramidInputPresenterClass: PyramidPointInputPresenter; @@ -123,7 +149,7 @@ PyramidBlocPlugin class >> constraintsPropV [ | property | property := PyramidProperty new - name: 'Constraints - vertical'; + name: 'Constraints - Proportionnal - vertical'; command: PyramidProportionnalVerticalConstraintsCommand new; pyramidInputPresenterClass: PyramidPointInputPresenter; @@ -172,7 +198,7 @@ PyramidBlocPlugin class >> flowLayoutOrientation [ | property | property := PyramidProperty new name: 'Orientation'; - command: PyramidFlowLayoutChangeOrientationCommand new; + command: PyramidLayoutChangeOrientationForFlowCommand new; pyramidInputPresenterClass: PyramidFlowLayoutOrientationPresenter; yourself. @@ -203,11 +229,27 @@ PyramidBlocPlugin class >> layout [ | property | property := PyramidProperty new name: 'Layout'; - command: - PyramidLayoutBlocCommand new; + command: PyramidLayoutBlocCommand new; + pyramidInputPresenterClass: PyramidLayoutInputPresenter; + yourself. + ^ property +] + +{ #category : #accessing } +PyramidBlocPlugin class >> linearLayoutOrientation [ + + | property | + property := PyramidProperty new + name: 'Orientation'; + command: PyramidLayoutChangeOrientationForLinearCommand new; pyramidInputPresenterClass: - PyramidLayoutInputPresenter; + PyramidLinearLayoutOrientationPresenter; yourself. + property pyramidInputPresenterStrings help: + 'Change the orientation of the flow layout.'. + property pyramidInputPresenterStrings onLabel: 'Vertical'. + property pyramidInputPresenterStrings offLabel: 'Horizontal'. + property pyramidInputPresenterStrings uncertainLabel: 'Uncertain'. ^ property ] @@ -306,11 +348,16 @@ PyramidBlocPlugin >> connectOn: aPyramidEditor [ aPyramidEditor propertiesManager addProperty: self class geometry. aPyramidEditor propertiesManager addProperty: self class cornerRadii. aPyramidEditor propertiesManager addProperty: self class position. - + aPyramidEditor propertiesManager addProperty: self class layout. - aPyramidEditor propertiesManager addProperty: self class flowLayoutOrientation. + aPyramidEditor propertiesManager addProperty: + self class flowLayoutOrientation. + aPyramidEditor propertiesManager addProperty: + self class linearLayoutOrientation. "Constraints - horizontal" + aPyramidEditor propertiesManager addProperty: + self class constraintsFrameH. aPyramidEditor propertiesManager addProperty: self class constraintsPropH. aPyramidEditor propertiesManager addProperty: @@ -319,6 +366,8 @@ PyramidBlocPlugin >> connectOn: aPyramidEditor [ self class constraintsBasicHExact. "Constraints - vertical" + aPyramidEditor propertiesManager addProperty: + self class constraintsFrameV. aPyramidEditor propertiesManager addProperty: self class constraintsPropV. aPyramidEditor propertiesManager addProperty: diff --git a/src/Pyramid-Bloc/PyramidFlowLayoutChangeOrientationCommand.class.st b/src/Pyramid-Bloc/PyramidFlowLayoutChangeOrientationCommand.class.st deleted file mode 100644 index a6587570..00000000 --- a/src/Pyramid-Bloc/PyramidFlowLayoutChangeOrientationCommand.class.st +++ /dev/null @@ -1,23 +0,0 @@ -Class { - #name : #PyramidFlowLayoutChangeOrientationCommand, - #superclass : #PyramidAbstractBlocCommand, - #category : #'Pyramid-Bloc-plugin-bloc-layout' -} - -{ #category : #testing } -PyramidFlowLayoutChangeOrientationCommand >> canBeUsedFor: anObject [ - - ^ (super canBeUsedFor: anObject) and: [ anObject layout class == BlFlowLayout ] -] - -{ #category : #'as yet unclassified' } -PyramidFlowLayoutChangeOrientationCommand >> getValueFor: anObject [ - - ^ anObject layout orientation -] - -{ #category : #'as yet unclassified' } -PyramidFlowLayoutChangeOrientationCommand >> setValueFor: anObject with: anArgument [ - - anObject layout orientation: anArgument -] diff --git a/src/Pyramid-Bloc/PyramidFlowLayoutOrientationPresenter.class.st b/src/Pyramid-Bloc/PyramidFlowLayoutOrientationPresenter.class.st index a3403f1a..d2f245bf 100644 --- a/src/Pyramid-Bloc/PyramidFlowLayoutOrientationPresenter.class.st +++ b/src/Pyramid-Bloc/PyramidFlowLayoutOrientationPresenter.class.st @@ -1,27 +1,11 @@ Class { #name : #PyramidFlowLayoutOrientationPresenter, - #superclass : #PyramidSwitchInputPresenter, - #instVars : [ - 'buttonSwitch' - ], + #superclass : #PyramidAbstractLayoutOrientationPresenter, #category : #'Pyramid-Bloc-plugin-bloc-layout' } -{ #category : #'as yet unclassified' } -PyramidFlowLayoutOrientationPresenter >> switchState [ - - self value: self value switchOrientation. - self whenValueChangedDo value: self value -] - { #category : #'as yet unclassified' } PyramidFlowLayoutOrientationPresenter >> value [ - ^ self state asOrientationForPyramid -] - -{ #category : #'as yet unclassified' } -PyramidFlowLayoutOrientationPresenter >> value: anOrientation [ - - super value: anOrientation asBooleanForPyramid + ^ self state asOrientationForFlowPyramid ] diff --git a/src/Pyramid-Bloc/PyramidFrameConstraintsCommand.class.st b/src/Pyramid-Bloc/PyramidFrameConstraintsCommand.class.st new file mode 100644 index 00000000..97c01b99 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidFrameConstraintsCommand.class.st @@ -0,0 +1,13 @@ +Class { + #name : #PyramidFrameConstraintsCommand, + #superclass : #PyramidAbstractBlocCommand, + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #testing } +PyramidFrameConstraintsCommand >> canBeUsedFor: anObject [ + + ^ (super canBeUsedFor: anObject) and: [ + anObject hasParent and: [ + BlFrameLayout = anObject parent layout class ] ] +] diff --git a/src/Pyramid-Bloc/PyramidFrameHorizontalConstraintsCommand.class.st b/src/Pyramid-Bloc/PyramidFrameHorizontalConstraintsCommand.class.st new file mode 100644 index 00000000..271f6c0e --- /dev/null +++ b/src/Pyramid-Bloc/PyramidFrameHorizontalConstraintsCommand.class.st @@ -0,0 +1,18 @@ +Class { + #name : #PyramidFrameHorizontalConstraintsCommand, + #superclass : #PyramidFrameConstraintsCommand, + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #'as yet unclassified' } +PyramidFrameHorizontalConstraintsCommand >> getValueFor: anObject [ + + ^ anObject constraints frame horizontal alignment +] + +{ #category : #'as yet unclassified' } +PyramidFrameHorizontalConstraintsCommand >> setValueFor: anObject with: anArgument [ + + anObject constraintsDo: [ :c | + c frame horizontal alignment: anArgument. ] +] diff --git a/src/Pyramid-Bloc/PyramidFrameVerticalConstraintsCommand.class.st b/src/Pyramid-Bloc/PyramidFrameVerticalConstraintsCommand.class.st new file mode 100644 index 00000000..99b53c7a --- /dev/null +++ b/src/Pyramid-Bloc/PyramidFrameVerticalConstraintsCommand.class.st @@ -0,0 +1,18 @@ +Class { + #name : #PyramidFrameVerticalConstraintsCommand, + #superclass : #PyramidFrameConstraintsCommand, + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #'as yet unclassified' } +PyramidFrameVerticalConstraintsCommand >> getValueFor: anObject [ + + ^ anObject constraints frame vertical alignment +] + +{ #category : #'as yet unclassified' } +PyramidFrameVerticalConstraintsCommand >> setValueFor: anObject with: anArgument [ + + anObject constraintsDo: [ :c | + c frame vertical alignment: anArgument ] +] diff --git a/src/Pyramid-Bloc/PyramidHorizontalFrameConstraintsInputPresenter.class.st b/src/Pyramid-Bloc/PyramidHorizontalFrameConstraintsInputPresenter.class.st new file mode 100644 index 00000000..62966d86 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidHorizontalFrameConstraintsInputPresenter.class.st @@ -0,0 +1,78 @@ +Class { + #name : #PyramidHorizontalFrameConstraintsInputPresenter, + #superclass : #PyramidAbstractFrameConstraintsInputPresenter, + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #'as yet unclassified' } +PyramidHorizontalFrameConstraintsInputPresenter >> helpCenter [ + + ^ 'Align the horizontal axis on the center of the shape.' +] + +{ #category : #'as yet unclassified' } +PyramidHorizontalFrameConstraintsInputPresenter >> helpEnd [ + + ^ 'Align on the Right border.' +] + +{ #category : #'as yet unclassified' } +PyramidHorizontalFrameConstraintsInputPresenter >> helpNull [ + + ^ 'Do not align horizontaly.' +] + +{ #category : #'as yet unclassified' } +PyramidHorizontalFrameConstraintsInputPresenter >> helpStart [ + + ^ 'Align on the Left border.' +] + +{ #category : #'as yet unclassified' } +PyramidHorizontalFrameConstraintsInputPresenter >> iconCenter [ + + ^ (self iconNamed: #windowMinimize) rotateBy: #left centerAt: 8 @ 8 +] + +{ #category : #'as yet unclassified' } +PyramidHorizontalFrameConstraintsInputPresenter >> iconEnd [ + + ^( self iconNamed: #windowMenu) rotateBy: -90 +] + +{ #category : #'as yet unclassified' } +PyramidHorizontalFrameConstraintsInputPresenter >> iconNull [ + + ^ self iconNamed: #windowMaximize +] + +{ #category : #'as yet unclassified' } +PyramidHorizontalFrameConstraintsInputPresenter >> iconStart [ + + ^ (self iconNamed: #windowMenu) rotateBy: 90 +] + +{ #category : #'as yet unclassified' } +PyramidHorizontalFrameConstraintsInputPresenter >> value [ + + self buttonNull state ifTrue: [ ^ BlHorizontalAlignment null ]. + self inputHasRelative state + ifTrue: [ + self buttonStart state ifTrue: [ + ^ (BlFrameLayoutConstraintsHorizontal new alignLeftAt: + self currentRelativeValue) alignment ]. + self buttonCenter state ifTrue: [ + ^ (BlFrameLayoutConstraintsHorizontal new alignCenterAt: + self currentRelativeValue) alignment ]. + self buttonEnd state ifTrue: [ + ^ (BlFrameLayoutConstraintsHorizontal new alignRightAt: + self currentRelativeValue) alignment ] ] + ifFalse: [ + self buttonStart state ifTrue: [ + ^ BlFrameLayoutConstraintsHorizontal new alignLeft alignment ]. + self buttonCenter state ifTrue: [ + ^ BlFrameLayoutConstraintsHorizontal new alignCenter alignment ]. + self buttonEnd state ifTrue: [ + ^ BlFrameLayoutConstraintsHorizontal new alignRight alignment ] ]. + ^ PyramidUnknowState new. +] diff --git a/src/Pyramid-Bloc/PyramidLayoutChangeOrientationCommand.class.st b/src/Pyramid-Bloc/PyramidLayoutChangeOrientationCommand.class.st new file mode 100644 index 00000000..57cc5aab --- /dev/null +++ b/src/Pyramid-Bloc/PyramidLayoutChangeOrientationCommand.class.st @@ -0,0 +1,24 @@ +Class { + #name : #PyramidLayoutChangeOrientationCommand, + #superclass : #PyramidAbstractBlocCommand, + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #testing } +PyramidLayoutChangeOrientationCommand >> canBeUsedFor: anObject [ + + ^ (super canBeUsedFor: anObject) and: [ + { BlFlowLayout . BlLinearLayout } includes: anObject layout class ] +] + +{ #category : #'as yet unclassified' } +PyramidLayoutChangeOrientationCommand >> getValueFor: anObject [ + + ^ anObject layout orientation +] + +{ #category : #'as yet unclassified' } +PyramidLayoutChangeOrientationCommand >> setValueFor: anObject with: anArgument [ + + anObject layout orientation: anArgument +] diff --git a/src/Pyramid-Bloc/PyramidLayoutChangeOrientationForFlowCommand.class.st b/src/Pyramid-Bloc/PyramidLayoutChangeOrientationForFlowCommand.class.st new file mode 100644 index 00000000..64aafc1b --- /dev/null +++ b/src/Pyramid-Bloc/PyramidLayoutChangeOrientationForFlowCommand.class.st @@ -0,0 +1,13 @@ +Class { + #name : #PyramidLayoutChangeOrientationForFlowCommand, + #superclass : #PyramidLayoutChangeOrientationCommand, + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #testing } +PyramidLayoutChangeOrientationForFlowCommand >> canBeUsedFor: anObject [ + + ^ (super canBeUsedFor: anObject) and: [ + + BlFlowLayout = anObject layout class ] +] diff --git a/src/Pyramid-Bloc/PyramidLayoutChangeOrientationForLinearCommand.class.st b/src/Pyramid-Bloc/PyramidLayoutChangeOrientationForLinearCommand.class.st new file mode 100644 index 00000000..f6380468 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidLayoutChangeOrientationForLinearCommand.class.st @@ -0,0 +1,12 @@ +Class { + #name : #PyramidLayoutChangeOrientationForLinearCommand, + #superclass : #PyramidLayoutChangeOrientationCommand, + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #testing } +PyramidLayoutChangeOrientationForLinearCommand >> canBeUsedFor: anObject [ + + ^ (super canBeUsedFor: anObject) and: [ + BlLinearLayout = anObject layout class ] +] diff --git a/src/Pyramid-Bloc/PyramidLayoutInputPresenter.class.st b/src/Pyramid-Bloc/PyramidLayoutInputPresenter.class.st index cb1a9123..31182138 100644 --- a/src/Pyramid-Bloc/PyramidLayoutInputPresenter.class.st +++ b/src/Pyramid-Bloc/PyramidLayoutInputPresenter.class.st @@ -2,154 +2,132 @@ Class { #name : #PyramidLayoutInputPresenter, #superclass : #PyramidInputPresenter, #instVars : [ - 'buttonBasic', - 'buttonFlow', - 'buttonProportionnal', - 'whenValueChangedDo', - 'value' + 'buttonsDictionary', + 'buttons', + 'whenValueChangedDo' ], #category : #'Pyramid-Bloc-plugin-bloc-layout' } -{ #category : #accessing } -PyramidLayoutInputPresenter >> buttonBasic [ +{ #category : #'as yet unclassified' } +PyramidLayoutInputPresenter >> allAssociationsLayoutClass [ + + ^ { + (BlBasicLayout -> #basic). + (BlLinearLayout -> #linear). + (BlFlowLayout -> #flow). + (BlFrameLayout -> #frame). + (BlProportionalLayout -> #proportion) } +] - ^ buttonBasic +{ #category : #'as yet unclassified' } +PyramidLayoutInputPresenter >> associatedClassOf: aLabel [ + + | allClasses | + allClasses := self allAssociationsLayoutClass select: [ :each | each value = aLabel ] thenCollect: [ :each | each key ]. + allClasses ifEmpty: [ ^ PyramidUnknowState new ]. + allClasses size = 1 ifTrue: [ ^ allClasses first new ]. + ^ PyramidUnknowState new ] { #category : #accessing } -PyramidLayoutInputPresenter >> buttonFlow [ +PyramidLayoutInputPresenter >> buttons [ - ^ buttonFlow + ^ buttons ] { #category : #accessing } -PyramidLayoutInputPresenter >> buttonProportionnal [ +PyramidLayoutInputPresenter >> buttonsDictionary [ - ^ buttonProportionnal + ^ buttonsDictionary ] { #category : #layout } PyramidLayoutInputPresenter >> defaultLayout [ - ^ SpBoxLayout newHorizontal - spacing: 4; - add: self buttonBasic; - add: self buttonFlow; - add: self buttonProportionnal; - yourself + | defaultLayout currentLine counter | + defaultLayout := SpBoxLayout newVertical + spacing: 4; + yourself. + currentLine := SpBoxLayout newHorizontal spacing: 4. + counter := 1. + self buttons do: [ :each | + currentLine add: each. + counter := counter + 1. + counter = 3 ifTrue: [ + defaultLayout add: currentLine. + currentLine := SpBoxLayout newHorizontal spacing: 4. + counter := 1 ] ]. + defaultLayout add: currentLine. + ^ defaultLayout ] { #category : #initialization } PyramidLayoutInputPresenter >> initializePresenters [ - whenValueChangedDo := [ :visibility | ]. - buttonBasic := SpButtonPresenter new - label: 'No layout'; - help: - 'Remove the layout. The children will be place according to their position.'; - action: [ - self value: BlBasicLayout new. - self whenValueChangedDo value: self value ]; - enabled: false; - yourself. - buttonFlow := SpButtonPresenter new - label: 'Flow'; - help: - 'Set the layout as Flow. The children will be place according to their order. The flow layout will display all children in line and will wrap arround if it does not have enought place.'; - action: [ - self value: BlFlowLayout horizontal. - self whenValueChangedDo value: self value ]; - enabled: false; - yourself. - buttonProportionnal := SpButtonPresenter new - label: 'ST layout'; - help: - 'Set the layout as Proportional. The children will be place according to their relative top/bottom and left/right proportion.'; - action: [ - self value: BlProportionalLayout new. - self whenValueChangedDo value: self value ]; - enabled: false; - yourself + whenValueChangedDo := [ :newVal | ]. + buttonsDictionary := Dictionary new. + buttons := OrderedCollection new. + self allAssociationsLayoutClass do: [ :association | + | button | + button := self makeButtonFor: association. + buttons add: button. + buttonsDictionary at: association key put: button ] ] -{ #category : #initialization } -PyramidLayoutInputPresenter >> setBasic [ - - self buttonBasic - enabled: true; - icon: (self iconNamed: #checkboxSelected). - self buttonFlow - enabled: true; - icon: (self iconNamed: #checkboxUnselected). - self buttonProportionnal - enabled: true; - icon: (self iconNamed: #checkboxUnselected) -] +{ #category : #'as yet unclassified' } +PyramidLayoutInputPresenter >> makeButtonFor: anAssociation [ -{ #category : #initialization } -PyramidLayoutInputPresenter >> setFlow [ - - self buttonBasic - enabled: true; - icon: (self iconNamed: #checkboxUnselected). - self buttonFlow - enabled: true; - icon: (self iconNamed: #checkboxSelected). - self buttonProportionnal - enabled: true; - icon: (self iconNamed: #checkboxUnselected) -] + | class label | + class := anAssociation key. + label := anAssociation value. -{ #category : #initialization } -PyramidLayoutInputPresenter >> setProportionnal [ - - self buttonBasic - enabled: true; - icon: (self iconNamed: #checkboxUnselected). - self buttonFlow - enabled: true; - icon: (self iconNamed: #checkboxUnselected). - self buttonProportionnal - enabled: true; - icon: (self iconNamed: #checkboxSelected) + ^ SpButtonPresenter new + icon: class new asIcon; + label: label; + action: [ self triggerFor: class ]; + yourself ] -{ #category : #initialization } -PyramidLayoutInputPresenter >> setUnknowValue [ - - self buttonBasic - enabled: false; - icon: (self iconNamed: #checkboxUnselected). - self buttonFlow - enabled: false; - icon: (self iconNamed: #checkboxUnselected). - self buttonProportionnal - enabled: false; - icon: (self iconNamed: #checkboxUnselected) +{ #category : #'as yet unclassified' } +PyramidLayoutInputPresenter >> triggerFor: aLayoutClass [ + + self whenValueChangedDo value: aLayoutClass new. + ] { #category : #'as yet unclassified' } PyramidLayoutInputPresenter >> value [ - ^ value + self buttons do: [ :each | + each state ifTrue: [ ^ self associatedClassOf: each label ] ]. + ^ PyramidUnknowState new. ] { #category : #'as yet unclassified' } -PyramidLayoutInputPresenter >> value: anObject [ +PyramidLayoutInputPresenter >> value: aLayout [ - value := anObject. - anObject setLayoutOn: self + self buttons do: [ :each | each state: false ]. + self buttonsDictionary + at: aLayout class + ifPresent: [ :button | button state: true ] ] -{ #category : #accessing } +{ #category : #'as yet unclassified' } +PyramidLayoutInputPresenter >> valueButtons [ + "used for testing" + + ^ self buttons select: [ :each | each state ] +] + +{ #category : #'as yet unclassified' } PyramidLayoutInputPresenter >> whenValueChangedDo [ ^ whenValueChangedDo ] -{ #category : #accessing } -PyramidLayoutInputPresenter >> whenValueChangedDo: anObject [ +{ #category : #'as yet unclassified' } +PyramidLayoutInputPresenter >> whenValueChangedDo: aBlock [ - whenValueChangedDo := anObject + whenValueChangedDo := aBlock ] diff --git a/src/Pyramid-Bloc/PyramidLinearLayoutOrientationPresenter.class.st b/src/Pyramid-Bloc/PyramidLinearLayoutOrientationPresenter.class.st new file mode 100644 index 00000000..0482a18a --- /dev/null +++ b/src/Pyramid-Bloc/PyramidLinearLayoutOrientationPresenter.class.st @@ -0,0 +1,11 @@ +Class { + #name : #PyramidLinearLayoutOrientationPresenter, + #superclass : #PyramidAbstractLayoutOrientationPresenter, + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #'as yet unclassified' } +PyramidLinearLayoutOrientationPresenter >> value [ + + ^ self state asOrientationForLinearPyramid +] diff --git a/src/Pyramid-Bloc/PyramidVerticalFrameConstraintsInputPresenter.class.st b/src/Pyramid-Bloc/PyramidVerticalFrameConstraintsInputPresenter.class.st new file mode 100644 index 00000000..e4a36d60 --- /dev/null +++ b/src/Pyramid-Bloc/PyramidVerticalFrameConstraintsInputPresenter.class.st @@ -0,0 +1,78 @@ +Class { + #name : #PyramidVerticalFrameConstraintsInputPresenter, + #superclass : #PyramidAbstractFrameConstraintsInputPresenter, + #category : #'Pyramid-Bloc-plugin-bloc-layout' +} + +{ #category : #'as yet unclassified' } +PyramidVerticalFrameConstraintsInputPresenter >> helpCenter [ + + ^ 'Align the vertical axis on the center of the shape.' +] + +{ #category : #'as yet unclassified' } +PyramidVerticalFrameConstraintsInputPresenter >> helpEnd [ + + ^ 'Align on the Bottom border.' +] + +{ #category : #'as yet unclassified' } +PyramidVerticalFrameConstraintsInputPresenter >> helpNull [ + + ^ 'Do not align vertically.' +] + +{ #category : #'as yet unclassified' } +PyramidVerticalFrameConstraintsInputPresenter >> helpStart [ + + ^ 'Align on the Top border.' +] + +{ #category : #'as yet unclassified' } +PyramidVerticalFrameConstraintsInputPresenter >> iconCenter [ + + ^ self iconNamed: #windowMinimize +] + +{ #category : #'as yet unclassified' } +PyramidVerticalFrameConstraintsInputPresenter >> iconEnd [ + + ^ (self iconNamed: #windowMenu) +] + +{ #category : #'as yet unclassified' } +PyramidVerticalFrameConstraintsInputPresenter >> iconNull [ + + ^ self iconNamed: #windowMaximize +] + +{ #category : #'as yet unclassified' } +PyramidVerticalFrameConstraintsInputPresenter >> iconStart [ + + ^ (self iconNamed: #windowMenu) rotateBy: 180 +] + +{ #category : #'as yet unclassified' } +PyramidVerticalFrameConstraintsInputPresenter >> value [ + + self buttonNull state ifTrue: [ ^ BlVerticalAlignment null ]. + self inputHasRelative state + ifTrue: [ + self buttonStart state ifTrue: [ + ^ (BlFrameLayoutConstraintsVertical new alignTopAt: + self currentRelativeValue) alignment ]. + self buttonCenter state ifTrue: [ + ^ (BlFrameLayoutConstraintsVertical new alignCenterAt: + self currentRelativeValue) alignment ]. + self buttonEnd state ifTrue: [ + ^ (BlFrameLayoutConstraintsVertical new alignBottomAt: + self currentRelativeValue) alignment ] ] + ifFalse: [ + self buttonStart state ifTrue: [ + ^ BlFrameLayoutConstraintsVertical new alignTop alignment ]. + self buttonCenter state ifTrue: [ + ^ BlFrameLayoutConstraintsVertical new alignCenter alignment ]. + self buttonEnd state ifTrue: [ + ^ BlFrameLayoutConstraintsVertical new alignBottom alignment ] ]. + ^ PyramidUnknowState new +] diff --git a/src/Pyramid-Bloc/True.extension.st b/src/Pyramid-Bloc/True.extension.st index 0e0f3b6f..de1a7a0a 100644 --- a/src/Pyramid-Bloc/True.extension.st +++ b/src/Pyramid-Bloc/True.extension.st @@ -1,7 +1,12 @@ Extension { #name : #True } { #category : #'*Pyramid-Bloc' } -True >> asOrientationForPyramid [ +True >> asOrientationForFlowPyramid [ ^ BlLayoutOrientation vertical ] + +{ #category : #'*Pyramid-Bloc' } +True >> asOrientationForLinearPyramid [ + ^ BlLinearLayoutVerticalOrientation new +] diff --git a/src/Pyramid-Tests/PyramidHorizontalFrameConstraintsInputPresenterTest.class.st b/src/Pyramid-Tests/PyramidHorizontalFrameConstraintsInputPresenterTest.class.st new file mode 100644 index 00000000..e50b71f6 --- /dev/null +++ b/src/Pyramid-Tests/PyramidHorizontalFrameConstraintsInputPresenterTest.class.st @@ -0,0 +1,45 @@ +Class { + #name : #PyramidHorizontalFrameConstraintsInputPresenterTest, + #superclass : #TestCase, + #traits : 'TPyramidInputPresenterTest', + #classTraits : 'TPyramidInputPresenterTest classTrait', + #category : #'Pyramid-Tests-cases-specs-custom' +} + +{ #category : #accessing } +PyramidHorizontalFrameConstraintsInputPresenterTest >> dummyValues [ + + ^ { + BlFrameLayoutConstraintsHorizontal new alignNone; alignment. + BlFrameLayoutConstraintsHorizontal new alignLeft; alignment. + BlFrameLayoutConstraintsHorizontal new alignCenter; alignment. + BlFrameLayoutConstraintsHorizontal new alignRight; alignment. + BlFrameLayoutConstraintsHorizontal new alignLeftAt: 0.5; alignment. + BlFrameLayoutConstraintsHorizontal new alignCenterAt: 0.5; alignment. + BlFrameLayoutConstraintsHorizontal new alignRightAt: 0.5; alignment } +] + +{ #category : #accessing } +PyramidHorizontalFrameConstraintsInputPresenterTest >> expectedEmptyValue [ + + ^ PyramidUnknowState new +] + +{ #category : #accessing } +PyramidHorizontalFrameConstraintsInputPresenterTest >> expectedMixedValues [ + + ^ PyramidUnknowState new +] + +{ #category : #tests } +PyramidHorizontalFrameConstraintsInputPresenterTest >> makeNewInput [ + + ^ PyramidHorizontalFrameConstraintsInputPresenter new +] + +{ #category : #'as yet unclassified' } +PyramidHorizontalFrameConstraintsInputPresenterTest >> triggerValueChangedOf: anInput [ + + anInput inputRelative inputNumber contextKeyBindings keymaps do: [ :bind | + bind action value ] +] diff --git a/src/Pyramid-Tests/PyramidFlowLayoutChangeOrientationCommandTest.class.st b/src/Pyramid-Tests/PyramidLayoutChangeOrientationCommandTest.class.st similarity index 81% rename from src/Pyramid-Tests/PyramidFlowLayoutChangeOrientationCommandTest.class.st rename to src/Pyramid-Tests/PyramidLayoutChangeOrientationCommandTest.class.st index 63fe8381..b0e2e9e5 100644 --- a/src/Pyramid-Tests/PyramidFlowLayoutChangeOrientationCommandTest.class.st +++ b/src/Pyramid-Tests/PyramidLayoutChangeOrientationCommandTest.class.st @@ -1,5 +1,5 @@ Class { - #name : #PyramidFlowLayoutChangeOrientationCommandTest, + #name : #PyramidLayoutChangeOrientationCommandTest, #superclass : #TestCase, #traits : 'TPyramidCommandTest', #classTraits : 'TPyramidCommandTest classTrait', @@ -7,13 +7,13 @@ Class { } { #category : #accessing } -PyramidFlowLayoutChangeOrientationCommandTest >> command [ +PyramidLayoutChangeOrientationCommandTest >> command [ - ^ PyramidFlowLayoutChangeOrientationCommand new + ^ PyramidLayoutChangeOrientationCommand new ] { #category : #'as yet unclassified' } -PyramidFlowLayoutChangeOrientationCommandTest >> targetContainers [ +PyramidLayoutChangeOrientationCommandTest >> targetContainers [ ^ { (PyramidCommandTestContainer no: (BlElement new @@ -50,7 +50,7 @@ PyramidFlowLayoutChangeOrientationCommandTest >> targetContainers [ ] { #category : #'as yet unclassified' } -PyramidFlowLayoutChangeOrientationCommandTest >> targetsCannotBeUsedFor [ +PyramidLayoutChangeOrientationCommandTest >> targetsCannotBeUsedFor [ "override if needed" ^ { diff --git a/src/Pyramid-Tests/PyramidLayoutInputPresenterTest.class.st b/src/Pyramid-Tests/PyramidLayoutInputPresenterTest.class.st index ba98dbe2..3a5b2ea9 100644 --- a/src/Pyramid-Tests/PyramidLayoutInputPresenterTest.class.st +++ b/src/Pyramid-Tests/PyramidLayoutInputPresenterTest.class.st @@ -11,10 +11,24 @@ PyramidLayoutInputPresenterTest >> dummyValues [ ^ { BlBasicLayout new. - BlFlowLayout horizontal. - BlFlowLayout vertical. - BlProportionalLayout new - } + BlFlowLayout horizontal. + BlFlowLayout vertical. + BlLinearLayout horizontal. + BlLinearLayout vertical. + BlFrameLayout new. + BlProportionalLayout new } +] + +{ #category : #accessing } +PyramidLayoutInputPresenterTest >> expectedEmptyValue [ + + ^ PyramidUnknowState new +] + +{ #category : #accessing } +PyramidLayoutInputPresenterTest >> expectedMixedValues [ + + ^ PyramidUnknowState new ] { #category : #tests } @@ -26,5 +40,5 @@ PyramidLayoutInputPresenterTest >> makeNewInput [ { #category : #'as yet unclassified' } PyramidLayoutInputPresenterTest >> triggerValueChangedOf: anInput [ - anInput buttonBasic click + anInput valueButtons first click ] diff --git a/src/Pyramid-Tests/PyramidLinearLayoutOrientationPresenterTest.class.st b/src/Pyramid-Tests/PyramidLinearLayoutOrientationPresenterTest.class.st new file mode 100644 index 00000000..65542524 --- /dev/null +++ b/src/Pyramid-Tests/PyramidLinearLayoutOrientationPresenterTest.class.st @@ -0,0 +1,42 @@ +Class { + #name : #PyramidLinearLayoutOrientationPresenterTest, + #superclass : #TestCase, + #traits : 'TPyramidInputPresenterTest', + #classTraits : 'TPyramidInputPresenterTest classTrait', + #category : #'Pyramid-Tests-cases-specs-custom' +} + +{ #category : #accessing } +PyramidLinearLayoutOrientationPresenterTest >> dummyValues [ + + ^ { + BlLinearLayoutHorizontalOrientation new. + BlLinearLayoutVerticalOrientation new. + BlLinearLayoutHorizontalOrientation new. + BlLinearLayoutVerticalOrientation new. + BlLinearLayoutHorizontalOrientation new } +] + +{ #category : #accessing } +PyramidLinearLayoutOrientationPresenterTest >> expectedEmptyValue [ + + ^ PyramidUnknowState new +] + +{ #category : #accessing } +PyramidLinearLayoutOrientationPresenterTest >> expectedMixedValues [ + + ^ PyramidUnknowState new +] + +{ #category : #tests } +PyramidLinearLayoutOrientationPresenterTest >> makeNewInput [ + + ^ PyramidLinearLayoutOrientationPresenter new +] + +{ #category : #'as yet unclassified' } +PyramidLinearLayoutOrientationPresenterTest >> triggerValueChangedOf: anInput [ + + anInput button click +] diff --git a/src/Pyramid-Tests/PyramidVerticalFrameConstraintsInputPresenterTest.class.st b/src/Pyramid-Tests/PyramidVerticalFrameConstraintsInputPresenterTest.class.st new file mode 100644 index 00000000..54377d79 --- /dev/null +++ b/src/Pyramid-Tests/PyramidVerticalFrameConstraintsInputPresenterTest.class.st @@ -0,0 +1,59 @@ +Class { + #name : #PyramidVerticalFrameConstraintsInputPresenterTest, + #superclass : #TestCase, + #traits : 'TPyramidInputPresenterTest', + #classTraits : 'TPyramidInputPresenterTest classTrait', + #category : #'Pyramid-Tests-cases-specs-custom' +} + +{ #category : #accessing } +PyramidVerticalFrameConstraintsInputPresenterTest >> dummyValues [ + + ^ { + (BlFrameLayoutConstraintsVertical new + alignNone; + alignment). + (BlFrameLayoutConstraintsVertical new + alignTop; + alignment). + (BlFrameLayoutConstraintsVertical new + alignCenter; + alignment). + (BlFrameLayoutConstraintsVertical new + alignBottom; + alignment). + (BlFrameLayoutConstraintsVertical new + alignTopAt: 0.5; + alignment). + (BlFrameLayoutConstraintsVertical new + alignCenterAt: 0.5; + alignment). + (BlFrameLayoutConstraintsVertical new + alignBottomAt: 0.5; + alignment) } +] + +{ #category : #accessing } +PyramidVerticalFrameConstraintsInputPresenterTest >> expectedEmptyValue [ + + ^ PyramidUnknowState new +] + +{ #category : #accessing } +PyramidVerticalFrameConstraintsInputPresenterTest >> expectedMixedValues [ + + ^ PyramidUnknowState new +] + +{ #category : #tests } +PyramidVerticalFrameConstraintsInputPresenterTest >> makeNewInput [ + + ^ PyramidVerticalFrameConstraintsInputPresenter new +] + +{ #category : #'as yet unclassified' } +PyramidVerticalFrameConstraintsInputPresenterTest >> triggerValueChangedOf: anInput [ + + anInput inputRelative inputNumber contextKeyBindings keymaps do: [ :bind | + bind action value ] +] diff --git a/src/Pyramid/PyramidUnknowState.class.st b/src/Pyramid/PyramidUnknowState.class.st index 378d93a9..deec45d9 100644 --- a/src/Pyramid/PyramidUnknowState.class.st +++ b/src/Pyramid/PyramidUnknowState.class.st @@ -36,7 +36,13 @@ PyramidUnknowState >> asIcon [ ] { #category : #converting } -PyramidUnknowState >> asOrientationForPyramid [ +PyramidUnknowState >> asOrientationForFlowPyramid [ + + ^ self +] + +{ #category : #converting } +PyramidUnknowState >> asOrientationForLinearPyramid [ ^ self ] @@ -53,6 +59,12 @@ PyramidUnknowState >> asString [ ^ '@ Unknow state' ] +{ #category : #'as yet unclassified' } +PyramidUnknowState >> pyramidSelectOn: anInput [ + + anInput unselectAll +] + { #category : #initialization } PyramidUnknowState >> setConstraintsOn: aPyramidBasicConstraintsInputPresenter [ @@ -70,9 +82,3 @@ PyramidUnknowState >> setInsetsOn: aPyramidInsetsInputPresenter [ aPyramidInsetsInputPresenter inputArray value: self ] - -{ #category : #initialization } -PyramidUnknowState >> setLayoutOn: aPyramidLayoutInputPresenter [ - - aPyramidLayoutInputPresenter setUnknowValue -]