CrossMorph
Last updated at 11:01 pm UTC on 3 November 2020
Copied from http://pharo.gforge.inria.fr/PBE1/PBE1ch12.html (PBE = Pharo by Example)
or more appropriately see Chapter 11 Section 4 in SBE (Squeak By Example) Version 2009-09-29
Morph subclass: #CrossMorph
instanceVariableNames: ’’
classVariableNames: ’’
poolDictionaries: ’’
category: ’PBE-Morphic’
drawOn: aCanvas
| crossHeight crossWidth horizontalBar verticalBar |
crossHeight := self height / 3.0 .
crossWidth := self width / 3.0 .
horizontalBar := self bounds insetBy: 0 @ crossHeight.
verticalBar := self bounds insetBy: crossWidth @ 0.
aCanvas fillRectangle: horizontalBar color: self color.
aCanvas fillRectangle: verticalBar color: self color
In Cuis
- #morphHeight instead of #height
- #morphWidth instead of #width
- #morphBounds instead of #bounds
drawOn: aCanvas
| crossHeight crossWidth horizontalBar verticalBar |
crossHeight := self morphHeight / 3.0 .
crossWidth := self morphWidth / 3.0 .
horizontalBar := self morphBounds insetBy: 0 @ crossHeight.
verticalBar := self morphBounds insetBy: crossWidth @ 0.
aCanvas fillRectangle: horizontalBar color: self color.
aCanvas fillRectangle: verticalBar color: self color
tagBeginner