A new version of MorphicExtras was added to project The Inbox:
http://source.squeak.org/inbox/MorphicExtras-ct.280.mcz ==================== Summary ==================== Name: MorphicExtras-ct.280 Author: ct Time: 18 September 2020, 3:03:41.759788 pm UUID: 05c39684-111e-485f-a27b-03597f1a1a97 Ancestors: MorphicExtras-kfr.276 Add BannerMorph example to demonstrate ScreeningMorph, BackgroundMorph and other Morph techniques. Reuploaded to fix bad dependency in example (it has to be #asTextFromHtml instead of #asHtmlText). Replaces MorphicExtras-ct.271, which can be moved to the treated inbox. 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-kfr.276 =============== 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 asTextFromHtml + 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 |