home *** CD-ROM | disk | FTP | other *** search
-
- Object subclass: #Box
- instanceVariableNames: 'position size tilt '
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Boxes'!
-
- !Box methodsFor: 'drawing' stamp: 'mjg 9/14/1998 15:38'!
- draw
- | myPen |
- myPen _ Pen new.
- myPen up.
- myPen goto: position.
- myPen turn: tilt.
- myPen color: (Color black).
- myPen down.
- 4 timesRepeat: [myPen go: size; turn: 90].
- ! !
-
- !Box methodsFor: 'drawing' stamp: 'mjg 3/27/98 22:02'!
- grow: increment
- self undraw.
- size _ size + increment.
- self draw.
- ! !
-
- !Box methodsFor: 'drawing' stamp: 'mjg 3/27/98 22:02'!
- move: pointIncrement
- self undraw.
- position _ position + pointIncrement.
- self draw.
- ! !
-
- !Box methodsFor: 'drawing' stamp: 'mjg 3/30/98 15:21'!
- moveTo: aPoint
- self undraw.
- position _ aPoint.
- self draw.
- ! !
-
- !Box methodsFor: 'drawing' stamp: 'mjg 3/27/98 22:01'!
- turn: degrees
- self undraw.
- tilt _ tilt + degrees.
- self draw.
- ! !
-
- !Box methodsFor: 'drawing' stamp: 'mjg 9/14/1998 15:50'!
- undraw
- | myPen |
- myPen _ Pen new.
- myPen up.
- myPen goto: position.
- myPen turn: tilt.
- myPen color: (Color white).
- myPen down.
- 4 timesRepeat: [myPen go: size; turn: 90].
- ! !
-
-
- !Box methodsFor: 'initialization' stamp: 'mjg 3/27/98 22:04'!
- initialize
- position _ 50@50.
- size _ 50.
- tilt _ 0.
- self draw.
- ! !
-
- "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
-
- Box class
- instanceVariableNames: ''!
-
- !Box class methodsFor: 'initialization' stamp: 'mjg 3/27/98 21:54'!
- clearWorld
- (Form extent: 600@200) fillWhite display! !
-
- !Box class methodsFor: 'initialization' stamp: 'mjg 3/27/98 21:55'!
- new
- ^super new initialize! !
-
-
-
- Box subclass: #NamedBox
- instanceVariableNames: 'name '
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Boxes'!
-
- !NamedBox methodsFor: 'access' stamp: 'mjg 3/30/98 15:17'!
- name
- ^name! !
-
- !NamedBox methodsFor: 'access' stamp: 'mjg 3/30/98 15:16'!
- name: aName
- name _ aName! !
-
-
- !NamedBox methodsFor: 'drawing' stamp: 'mjg 3/30/98 15:54'!
- draw
- super draw.
- self drawNameColor: (Color black).! !
-
- !NamedBox methodsFor: 'drawing' stamp: 'mjg 3/30/98 15:19'!
- drawNameColor: aColor
- | displayName |
- (name isNil) ifTrue: [name _ 'Unnamed'].
- displayName _ name asDisplayText.
- displayName foregroundColor: aColor backgroundColor: (Color white).
- displayName displayAt: position.
- ! !
-
- !NamedBox methodsFor: 'drawing' stamp: 'mjg 3/30/98 15:54'!
- undraw
- super undraw.
- self drawNameColor: (Color white).! !
-
- "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
-
- NamedBox class
- instanceVariableNames: ''!
-
- !NamedBox class methodsFor: 'initialization' stamp: 'mjg 3/30/98 15:19'!
- named: aName
- | newBox |
- newBox _ super new.
- newBox undraw.
- newBox name: aName.
- newBox draw.
- ^newBox! !
-
-