-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,174 additions
and
26 deletions.
There are no files selected for viewing
335 changes: 335 additions & 0 deletions
335
src/Molecule-Geographical-Position-Example/MolGeoButtonElementAbstract.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,335 @@ | ||
Class { | ||
#name : #MolGeoButtonElementAbstract, | ||
#superclass : #BlElement, | ||
#category : #'Molecule-Geographical-Position-Example-view' | ||
} | ||
|
||
{ #category : #'as yet unclassified' } | ||
MolGeoButtonElementAbstract class >> example [ | ||
|
||
"See subclasses" | ||
] | ||
|
||
{ #category : #testing } | ||
MolGeoButtonElementAbstract class >> isAbstract [ | ||
|
||
^ self == MolGeoButtonElementAbstract | ||
] | ||
|
||
{ #category : #'pyramid-serialized-bloc' } | ||
MolGeoButtonElementAbstract class >> pystonSpec [ | ||
"This class has been generated using Pyramid. | ||
By: YannLEGOFF | ||
2023-10-25 21:58:07" | ||
|
||
<pySTON> | ||
^ '[ | ||
BlElement { | ||
#children : BlChildrenArray [ | ||
BlElement { | ||
#children : BlChildrenArray [ ], | ||
#constraints : BlLayoutCommonConstraints { | ||
#vertical : BlLayoutCommonConstraintsAxis { | ||
#resizer : BlLayoutExactResizer { | ||
#size : 32.0 | ||
} | ||
}, | ||
#horizontal : BlLayoutCommonConstraintsAxis { | ||
#resizer : BlLayoutExactResizer { | ||
#size : 32.0 | ||
} | ||
}, | ||
#constraints : { | ||
Class [ #BlFrameLayout ] : BlFrameLayoutConstraints { | ||
#vertical : BlFrameLayoutConstraintsVertical { | ||
#alignment : BlVerticalCenterAlignment { }, | ||
#weight : 1.0 | ||
}, | ||
#horizontal : BlFrameLayoutConstraintsHorizontal { | ||
#alignment : BlHorizontalCenterAlignment { }, | ||
#weight : 1.0 | ||
} | ||
} | ||
}, | ||
#position : Point [ 0, 0 ], | ||
#margin : BlInsets { | ||
#top : 4.0, | ||
#left : 28.0, | ||
#bottom : 4.0, | ||
#right : 28.0 | ||
}, | ||
#padding : BlInsets { | ||
#top : 0.0, | ||
#left : 0.0, | ||
#bottom : 0.0, | ||
#right : 0.0 | ||
}, | ||
#minHeight : 0.0, | ||
#minWidth : 0.0, | ||
#maxHeight : Float [ #infinity ], | ||
#maxWidth : @21, | ||
#ignoredByLayout : false, | ||
#previouslyAccessedConstraints : @13, | ||
#previouslyAccessedConstraintsType : @12, | ||
#accountTransformation : false | ||
}, | ||
#visuals : BlCustomVisuals { | ||
#background : BlPaintBackground { | ||
#paint : BlColorPaint { | ||
#color : Color [ #green ] | ||
} | ||
} | ||
}, | ||
#userData : IdentityDictionary { | ||
#elementId : BlElementNamedId { | ||
#identifier : #icon | ||
}, | ||
#shouldHandleMousePickOutsideEvent : false | ||
}, | ||
#layout : BlBasicLayout { } | ||
} | ||
], | ||
#constraints : BlLayoutCommonConstraints { | ||
#vertical : BlLayoutCommonConstraintsAxis { | ||
#resizer : BlLayoutFitContentResizer { } | ||
}, | ||
#horizontal : BlLayoutCommonConstraintsAxis { | ||
#resizer : @31 | ||
}, | ||
#position : Point [ 0.0, 0.0 ], | ||
#margin : BlInsets { | ||
#top : 0.0, | ||
#left : 0.0, | ||
#bottom : 4.0, | ||
#right : 0.0 | ||
}, | ||
#padding : BlInsets { | ||
#top : 0.0, | ||
#left : 0.0, | ||
#bottom : 0.0, | ||
#right : 0.0 | ||
}, | ||
#minHeight : 0.0, | ||
#minWidth : 0.0, | ||
#maxHeight : @21, | ||
#maxWidth : @21, | ||
#ignoredByLayout : false, | ||
#accountTransformation : false | ||
}, | ||
#visuals : BlCustomVisuals { | ||
#geometry : BlRoundedRectangleGeometry { | ||
#extent : Point [ 88.0, 40.0 ], | ||
#pathCache : BlPathCache { | ||
#geometry : @37, | ||
#strokedBounds : BlBounds { | ||
#left : 0.0, | ||
#top : 0.0, | ||
#right : 88.0, | ||
#bottom : 40.0 | ||
} | ||
}, | ||
#cornerRadii : BlCornerRadii { | ||
#topLeft : 100, | ||
#topRight : 100, | ||
#bottomLeft : 100, | ||
#bottomRight : 100 | ||
}, | ||
#center : Point [ 44.0, 20.0 ] | ||
}, | ||
#background : BlPaintBackground { | ||
#paint : BlColorPaint { | ||
#color : Color [ #red ] | ||
} | ||
} | ||
}, | ||
#userData : IdentityDictionary { | ||
#layoutNode : BlLayoutParentNode { | ||
#children : BlLayoutNodeChildren [ | ||
BlLayoutChildNodeWithElement { | ||
#childNode : BlLayoutChildNode { | ||
#parent : @47, | ||
#measurement : BlLayoutNodeComputedMeasurement { | ||
#position : Point [ 28.0, 4.0 ], | ||
#extent : Point [ 32.0, 32.0 ] | ||
}, | ||
#constraints : @6, | ||
#actions : Stack [ ] | ||
}, | ||
#element : @4 | ||
} | ||
], | ||
#extentSpec : BlExtentMeasurementSpec { | ||
#widthSpec : BlMeasurementSpec { | ||
#size : 0.0, | ||
#mode : BlMeasurementUnspecifiedMode { } | ||
}, | ||
#heightSpec : BlMeasurementSpec { | ||
#size : 0.0, | ||
#mode : @57 | ||
} | ||
}, | ||
#constraints : @29, | ||
#extent : Point [ 88.0, 40.0 ], | ||
#position : Point [ 0.0, 0.0 ] | ||
}, | ||
#elementId : BlElementNamedId { | ||
#identifier : #background | ||
}, | ||
#shouldHandleMousePickOutsideEvent : false | ||
}, | ||
#layout : BlFrameLayout { } | ||
}, | ||
BlTextElement { | ||
#children : BlChildrenArray [ ], | ||
#constraints : BlLayoutCommonConstraints { | ||
#vertical : BlLayoutCommonConstraintsAxis { | ||
#resizer : BlLayoutFitContentResizer { } | ||
}, | ||
#horizontal : BlLayoutCommonConstraintsAxis { | ||
#resizer : @67 | ||
}, | ||
#position : Point [ 0, 0 ], | ||
#margin : BlInsets { | ||
#top : 0.0, | ||
#left : 0.0, | ||
#bottom : 0.0, | ||
#right : 0.0 | ||
}, | ||
#padding : BlInsets { | ||
#top : 4.0, | ||
#left : 4.0, | ||
#bottom : 4.0, | ||
#right : 4.0 | ||
}, | ||
#minHeight : 0.0, | ||
#minWidth : 0.0, | ||
#maxHeight : @21, | ||
#maxWidth : @21, | ||
#ignoredByLayout : false, | ||
#accountTransformation : false | ||
}, | ||
#visuals : BlCustomVisuals { | ||
#elevation : BlRelativeElevation { | ||
#elevation : 1 | ||
} | ||
}, | ||
#userData : IdentityDictionary { | ||
#elementId : BlElementNamedId { | ||
#identifier : #label | ||
}, | ||
#shouldHandleMousePickOutsideEvent : false | ||
}, | ||
#layout : BlBasicLayout { }, | ||
#text : BlRopedText { | ||
#rope : BlAttributeRope { | ||
#attributes : [ | ||
BlFontSizeAttribute { | ||
#isOverwritableByStyler : true, | ||
#size : 20 | ||
} | ||
], | ||
#rope : BlCollectionRope { | ||
#collection : ''text'' | ||
} | ||
} | ||
} | ||
} | ||
]' | ||
] | ||
|
||
{ #category : #initialization } | ||
MolGeoButtonElementAbstract >> buildElements [ | ||
|
||
self hasChildren ifTrue: [ self removeChildren ]. | ||
self addChildren: self class pystonSpec materializeAsBlElement. | ||
self constraintsDo: [ :c | c vertical fitContent ]. | ||
self clipChildren: false. | ||
|
||
(self childWithId: #background) background: self secondaryColor. | ||
self layout: | ||
(BlLinearLayout vertical alignCenter) | ||
] | ||
|
||
{ #category : #defaults } | ||
MolGeoButtonElementAbstract >> defaultFontSize [ | ||
|
||
^ 16 | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
MolGeoButtonElementAbstract >> hoverColor [ | ||
|
||
^ self shouldBeImplemented | ||
] | ||
|
||
{ #category : #accessing } | ||
MolGeoButtonElementAbstract >> icon: aForm [ | ||
|
||
| background iconElement | | ||
background := self childWithId: #background. | ||
iconElement := background childWithId: #icon. | ||
iconElement constraintsDo: [ :c | | ||
c vertical exact: aForm extent y. | ||
c horizontal exact: aForm extent y ]. | ||
iconElement background: aForm. | ||
self constraintsDo: [ :c | | ||
c horizontal exact: aForm extent y + iconElement margin width ] | ||
] | ||
|
||
{ #category : #initialization } | ||
MolGeoButtonElementAbstract >> initialize [ | ||
|
||
super initialize. | ||
self buildElements. | ||
self | ||
when: BlMouseOverEvent | ||
do: [ :evt | | ||
(self childWithId: #background) background: self hoverColor ]. | ||
self when: BlMouseOutEvent do: [ :evt | | ||
(self childWithId: #background) background: self secondaryColor ]. | ||
] | ||
|
||
{ #category : #accessing } | ||
MolGeoButtonElementAbstract >> label: aString [ | ||
|
||
| newLabel | | ||
newLabel := self makeNewLabelElement: aString. | ||
newLabel | ||
padding: (BlInsets all: 4); | ||
constraintsDo: [ :c | | ||
c frame horizontal alignCenter. | ||
c frame vertical alignBottom ]; | ||
id: #label. | ||
|
||
self replaceChild: (self childWithId: #label) with: newLabel | ||
] | ||
|
||
{ #category : #accessing } | ||
MolGeoButtonElementAbstract >> makeNewIconElement: aForm [ | ||
|
||
^ (aForm collectColors: [ :c | c isTransparent ifTrue: [ c ] ifFalse: [ self primaryColor ] ]) asElement | ||
] | ||
|
||
{ #category : #accessing } | ||
MolGeoButtonElementAbstract >> makeNewLabelElement: aString [ | ||
|
||
| rope | | ||
rope := aString asRopedText | ||
fontSize: self defaultFontSize; | ||
foreground: self primaryColor; | ||
yourself. | ||
^ rope asElement | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
MolGeoButtonElementAbstract >> primaryColor [ | ||
|
||
^ self shouldBeImplemented | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
MolGeoButtonElementAbstract >> secondaryColor [ | ||
|
||
^ self shouldBeImplemented | ||
] |
32 changes: 32 additions & 0 deletions
32
src/Molecule-Geographical-Position-Example/MolGeoButtonElementNotSelected.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,32 @@ | ||
Class { | ||
#name : #MolGeoButtonElementNotSelected, | ||
#superclass : #MolGeoButtonElementAbstract, | ||
#category : #'Molecule-Geographical-Position-Example-view' | ||
} | ||
|
||
{ #category : #'as yet unclassified' } | ||
MolGeoButtonElementNotSelected class >> example [ | ||
|
||
self new | ||
label: 'Test'; | ||
icon: ((self iconNamed: #haloHelp) scaledToSize: 28 @ 28); | ||
openInNewSpace | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
MolGeoButtonElementNotSelected >> hoverColor [ | ||
|
||
^ Color fromHexString: '#bebdbf' | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
MolGeoButtonElementNotSelected >> primaryColor [ | ||
|
||
^ Color fromHexString: '#6c757d' | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
MolGeoButtonElementNotSelected >> secondaryColor [ | ||
|
||
^ Color transparent | ||
] |
Oops, something went wrong.