Marcel Taeumel uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-ct.271.mcz ==================== Summary ==================== Name: MorphicExtras-ct.271 Author: ct Time: 1 October 2019, 8:34:14.776339 pm UUID: c725929f-54bd-d64d-8eb3-ebba10d204f4 Ancestors: MorphicExtras-ct.267 Add BannerMorph example to demonstrate ScreeningMorph, BackgroundMorph and other Morph techniques. This commit is part of reconstruction of Objectland (also known as "The Worlds of Squeak"). For more information, see: http://forum.world.st/The-Inbox-MorphicExtras-ct-267-mcz-td5104764.html =============== Diff against MorphicExtras-ct.267 =============== Item was added: + EllipseMorph subclass: #BannerMorph + instanceVariableNames: 'header contents' + classVariableNames: '' + poolDictionaries: '' + category: 'MorphicExtras-Demo'! + + !BannerMorph commentStamp: 'ct 9/7/2019 10:43' prior: 0! + I display a header and a contents text, arranged in an EllipseMorph in a flamboyant way. I use a ScreeningMorph and a BackgroundMorph to hinder the user to avert his gaze from me.! Item was added: + ----- Method: BannerMorph class>>example (in category 'examples') ----- + example + "BannerMorph example openInWorld" + + ^ self + header: 'Yes, <u>you</u> are ...' withCRs asHtmlText + contents: 'Live in Morphic' asUppercase asText! Item was added: + ----- Method: BannerMorph class>>header:contents: (in category 'instance creation') ----- + header: aStringOrText contents: anotherStringOrText + + ^ self basicNew + header: aStringOrText contents: anotherStringOrText; + initialize; + yourself! Item was added: + ----- Method: BannerMorph>>contents (in category 'accessing') ----- + contents + + ^ contents! Item was added: + ----- Method: BannerMorph>>createBackground (in category 'initialize-release') ----- + createBackground + + | fillMorph fillStyle | + fillStyle := GradientFillStyle colors: + ({Color red. Color green. Color blue} + in: [:colors | colors, colors reverse]). + fillStyle + origin: 0 @ 0; + direction: 150 @ 50. + fillMorph := (Morph new + fillStyle: fillStyle; + yourself). + ^ BackgroundMorph new + extent: 300 @ 130; + addMorph: fillMorph; + yourself! Item was added: + ----- Method: BannerMorph>>createContents (in category 'initialize-release') ----- + createContents + + | text | + text := self contents asText + addAttribute: TextEmphasis bold; + addAttribute: (TextFontReference toFont: + (StrikeFont familyName: #ComicPlain size: 39)); + asMorph. + text readOnly: true; flag: #ct. "We're no *that* life, yet :(" + ^ ScreeningMorph new + addMorph: (self createBackground + extent: text extent; + yourself); + addMorph: text; + showScreened; + cellPositioning: #center; + yourself! Item was added: + ----- Method: BannerMorph>>createHeader (in category 'initialize-release') ----- + createHeader + + | text | + text := (self header copyWithFirst: Character cr) asText + addAttribute: TextEmphasis bold; + addAttribute: (TextFontReference toFont: + (StrikeFont familyName: #Accula size: 29)); + yourself. + ^ text asMorph + centered; + fillsOwner: true; + yourself! Item was added: + ----- Method: BannerMorph>>header (in category 'accessing') ----- + header + + ^ header! Item was added: + ----- Method: BannerMorph>>header:contents: (in category 'accessing') ----- + header: aStringOrText contents: anotherStringOrText + + header := aStringOrText. + contents := anotherStringOrText.! Item was added: + ----- Method: BannerMorph>>initialize (in category 'initialize-release') ----- + initialize + + super initialize. + self extent: 300 @ 200. + self + changeProportionalLayout; + addMorph: (Morph new + color: Color transparent; + changeTableLayout; + listCentering: #center; wrapCentering: #center; + addMorph: self createContents; + yourself) + fullFrame: LayoutFrame fullFrame; + addMorph: self createHeader.! Item was added: + ----- Method: BannerMorph>>initializeToStandAlone (in category 'initialize-release') ----- + initializeToStandAlone + + self header: 'Introducing' contents: self class name. + super initializeToStandAlone.! |
Free forum by Nabble | Edit this page |