-
Notifications
You must be signed in to change notification settings - Fork 2
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
Oscar Nierstrasz
committed
Sep 2, 2024
1 parent
900b95c
commit adcea90
Showing
4 changed files
with
133 additions
and
2 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
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
120 changes: 120 additions & 0 deletions
120
src/GToolkit-Presenter/GtTitleWithCenteredTextsSlide.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,120 @@ | ||
" | ||
Like a title slide but with as many centred texts below as you like. | ||
" | ||
Class { | ||
#name : #GtTitleWithCenteredTextsSlide, | ||
#superclass : #GtTitleLiveSlide, | ||
#instVars : [ | ||
'texts', | ||
'textMargin', | ||
'subtitleBottomPadding', | ||
'textBottomPadding' | ||
], | ||
#category : #'GToolkit-Presenter' | ||
} | ||
|
||
{ #category : #'api - instantiation' } | ||
GtTitleWithCenteredTextsSlide >> create [ | ||
| container textContainer | | ||
container := BlElement new | ||
constraintsDo: [ :c | | ||
c horizontal matchParent. | ||
c vertical matchParent ]; | ||
layout: BlLinearLayout horizontal. | ||
textContainer := BlElement new | ||
constraintsDo: [ :c | | ||
c horizontal matchParent. | ||
c vertical fitContent. | ||
c linear vertical alignCenter ]; | ||
layout: BlLinearLayout vertical. | ||
textContainer | ||
addChild: (BlTextElement new | ||
constraintsDo: [ :c | c linear horizontal alignCenter ]; | ||
padding: (BlInsets | ||
top: 40; | ||
bottom: self titleBottomPadding); | ||
text: title). | ||
subtitle isEmpty | ||
ifFalse: [ textContainer | ||
addChild: (BlTextElement new | ||
constraintsDo: [ :c | c linear horizontal alignCenter ]; | ||
padding: (BlInsets | ||
top: 40; | ||
bottom: self subtitleBottomPadding); | ||
text: subtitle) ]. | ||
texts | ||
do: [ :aText | | ||
textContainer | ||
addChild: (BlTextElement new | ||
constraintsDo: [ :c | c linear horizontal alignCenter ]; | ||
padding: (BlInsets | ||
top: 40; | ||
bottom: self textBottomPadding); | ||
text: aText) ]. | ||
container addChild: textContainer. | ||
^ container | ||
] | ||
|
||
{ #category : #initialization } | ||
GtTitleWithCenteredTextsSlide >> defaultSubtitleBottomPadding [ | ||
^ 40 | ||
] | ||
|
||
{ #category : #initialization } | ||
GtTitleWithCenteredTextsSlide >> defaultTextBottomPadding [ | ||
^ 10 | ||
] | ||
|
||
{ #category : #acccessing } | ||
GtTitleWithCenteredTextsSlide >> defaultTextMargin [ | ||
^ 50 | ||
] | ||
|
||
{ #category : #initialization } | ||
GtTitleWithCenteredTextsSlide >> initialize [ | ||
super initialize. | ||
self subtitleBottomPadding: self defaultSubtitleBottomPadding. | ||
self textBottomPadding: self defaultTextBottomPadding. | ||
self textMargin: self defaultTextMargin. | ||
texts := OrderedCollection new | ||
] | ||
|
||
{ #category : #acccessing } | ||
GtTitleWithCenteredTextsSlide >> newText: aRopedText [ | ||
self newTextWithFormat: (aRopedText asRopedText glamorousRegularFont; fontSize: 20) | ||
] | ||
|
||
{ #category : #acccessing } | ||
GtTitleWithCenteredTextsSlide >> newTextWithFormat: aRopedText [ | ||
texts add: aRopedText asRopedText | ||
] | ||
|
||
{ #category : #accessing } | ||
GtTitleWithCenteredTextsSlide >> subtitleBottomPadding [ | ||
^ subtitleBottomPadding | ||
] | ||
|
||
{ #category : #accessing } | ||
GtTitleWithCenteredTextsSlide >> subtitleBottomPadding: anObject [ | ||
subtitleBottomPadding := anObject | ||
] | ||
|
||
{ #category : #accessing } | ||
GtTitleWithCenteredTextsSlide >> textBottomPadding [ | ||
^ textBottomPadding | ||
] | ||
|
||
{ #category : #accessing } | ||
GtTitleWithCenteredTextsSlide >> textBottomPadding: anObject [ | ||
textBottomPadding := anObject | ||
] | ||
|
||
{ #category : #acccessing } | ||
GtTitleWithCenteredTextsSlide >> textMargin [ | ||
^ textMargin | ||
] | ||
|
||
{ #category : #acccessing } | ||
GtTitleWithCenteredTextsSlide >> textMargin: aNumber [ | ||
textMargin := aNumber | ||
] |
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