diff --git a/src/GToolkit-Presenter/GtProtoLiveSlide.class.st b/src/GToolkit-Presenter/GtProtoLiveSlide.class.st index da857849..d565e5c5 100644 --- a/src/GToolkit-Presenter/GtProtoLiveSlide.class.st +++ b/src/GToolkit-Presenter/GtProtoLiveSlide.class.st @@ -245,6 +245,12 @@ GtProtoLiveSlide >> title [ definingMethod: (GtPhlowDefiningMethodsCollector forContext: thisContext) collect ] +{ #category : #decorating } +GtProtoLiveSlide >> titleWithCenteredTexts [ + ^ GtTitleWithCenteredTextsSlide new + definingMethod: (GtPhlowDefiningMethodsCollector forContext: thisContext) collect +] + { #category : #decorating } GtProtoLiveSlide >> titleWithFooter [ ^ GtTitleWithFooterLiveSlide new diff --git a/src/GToolkit-Presenter/GtTitleLiveSlide.class.st b/src/GToolkit-Presenter/GtTitleLiveSlide.class.st index 16b8743d..de16c2e2 100644 --- a/src/GToolkit-Presenter/GtTitleLiveSlide.class.st +++ b/src/GToolkit-Presenter/GtTitleLiveSlide.class.st @@ -41,12 +41,17 @@ GtTitleLiveSlide >> create [ text: subtitle)) ] +{ #category : #initialization } +GtTitleLiveSlide >> defaultTitleBottomPadding [ + ^ 30 +] + { #category : #initialization } GtTitleLiveSlide >> initialize [ super initialize. self title: ''. self subtitle: ''. - self titleBottomPadding: 10 + self titleBottomPadding: self defaultTitleBottomPadding ] { #category : #accessing } diff --git a/src/GToolkit-Presenter/GtTitleWithCenteredTextsSlide.class.st b/src/GToolkit-Presenter/GtTitleWithCenteredTextsSlide.class.st new file mode 100644 index 00000000..22c8528b --- /dev/null +++ b/src/GToolkit-Presenter/GtTitleWithCenteredTextsSlide.class.st @@ -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 +] diff --git a/src/GToolkit-Presenter/GtTitleWithFooterLiveSlide.class.st b/src/GToolkit-Presenter/GtTitleWithFooterLiveSlide.class.st index 05f15d86..dffd2769 100644 --- a/src/GToolkit-Presenter/GtTitleWithFooterLiveSlide.class.st +++ b/src/GToolkit-Presenter/GtTitleWithFooterLiveSlide.class.st @@ -51,7 +51,7 @@ GtTitleWithFooterLiveSlide >> footerWithFormat: aText [ footer := aText ] -{ #category : #accessing } +{ #category : #initialization } GtTitleWithFooterLiveSlide >> initialize [ super initialize. self subtitleBottomPadding: 10