home *** CD-ROM | disk | FTP | other *** search
-
- 'From Squeak 2.2 of Sept 23, 1998 on 2 November 1998 at 3:06:55 pm'!
- Object subclass: #Clock
- instanceVariableNames: 'time timer displayFormat '
- classVariableNames: ''
- poolDictionaries: ''
- category: 'ClockWorks'!
- Object subclass: #ClockText
- instanceVariableNames: 'model position query '
- classVariableNames: ''
- poolDictionaries: ''
- category: 'ClockWorks'!
- Object subclass: #ClockWindow
- instanceVariableNames: 'position buttons '
- classVariableNames: ''
- poolDictionaries: ''
- category: 'ClockWorks'!
-
-
- !Clock methodsFor: 'time management'!
- nextSecond
- time _ time addTime: (Time fromSeconds: 1).
- self changed: #time.
-
- ! !
-
- !ClockWindow methodsFor: 'window processing'!
- openOn: aModel
- | button |
- position isNil ifTrue: [self error: 'Must set position first.'].
-
- "Open the blank frame"
- (Form extent: 200@200) fillWhite displayAt: position.
-
- "Setup the textArea"
- ClockText at: (position + (50@50)) on: aModel for: #display.
-
- "Draw the Buttons"
- button := ClockButton make: 'Hours +' at: ((position x) @ ((position y)+100) extent: 100@50) for: aModel triggering: #addHour.
- self addButton: button.
- button := ClockButton make: 'Hours -' at: (((position x)+100) @ ((position y)+100) extent: 100@50) for: aModel triggering: #subtractHour.
- self addButton: button.
- button := ClockButton make: 'Minutes +' at: ((position x) @ ((position y)+150) extent: 100@50) for: aModel triggering: #addMinute.
- self addButton: button.
- button := ClockButton make: 'Minutes -' at: (((position x)+100) @ ((position y)+150) extent: 100@50) for: aModel triggering: #subtractMinute.
- self addButton: button.
- ! !
-
- !ClockText methodsFor: 'changeProcessing'!
- update: anEvent
- anEvent = #time ifTrue: [
- ' ' displayAt: position . "Erase whatever time was there before"
- (model perform: query) displayAt: position.]! !
-
- !ClockText methodsFor: 'accessing'!
- query: aMessage
- query _ aMessage.!
- position: aPoint
- position _ aPoint.
- !
- position
- ^position
- !
- query
- ^query!
- model: aModel
- model := aModel.
- aModel addDependent: self.
-
- !
- model
- ^model
- ! !
-
- !ClockText class methodsFor: 'creation'!
- at: aPosition on: aModel for: aQuery
- | text |
- text := self new.
- text position: aPosition.
- text model: aModel.
- text query: aQuery.
- ^text
- ! !
-
-
-
-