home *** CD-ROM | disk | FTP | other *** search
-
- 'From Squeak2.6 of 11 October 1999 [latest update: #1559] on 21 October 1999 at 3:48:21 pm'!
-
- !Clock methodsFor: 'time management' stamp: 'mjg 10/21/1999 14:20'!
- nextSecond
- time _ time addTime: (Time fromSeconds: 1).
- self changed: #display.
- ! !
-
-
- !ClockWindow methodsFor: 'window processing' stamp: 'mjg 10/21/1999 14:20'!
- openAsMorph
- | win component clock |
-
- "Create the clock"
- clock := Clock new.
- clock setTime: (Time now printString).
- clock start.
-
- "Create a window for it"
- win := SystemWindow labelled: 'Clock'.
- win model: self.
-
- "Set up the text view and the various pieces"
- component := PluggableTextMorph on: clock text: #display accept: nil.
- win addMorph: component frame: (0.3@0.3 extent: 0.3@0.3).
-
- component := PluggableButtonMorph new
- model: clock;
- action: #addHour;
- label: 'Hours +';
- borderWidth: 1.
- win addMorph: component frame: (0@0.6 extent: 0.5@0.2).
- component := PluggableButtonMorph new
- model: clock;
- action: #subtractHour;
- label: 'Hours -';
- borderWidth: 1.
- win addMorph: component frame: (0.5@0.6 extent: 0.5@0.2).
- component := PluggableButtonMorph new
- model: clock;
- action: #addMinute;
- label: 'Minutes +';
- borderWidth: 1.
- win addMorph: component frame: (0@0.8 extent: 0.5@0.1).
- component := PluggableButtonMorph new
- model: clock;
- action: #subtractMinute;
- label: 'Minutes -';
- borderWidth: 1.
- win addMorph: component frame: (0.5@0.8 extent: 0.5@0.1).
-
- component := PluggableButtonMorph new
- model: clock;
- action: #stop;
- label: 'STOP';
- borderWidth: 1.
- win addMorph: component frame: (0@0.9 extent: 1@0.1).
-
- win openInWorld.
- ^win! !
-
- !ClockWindow methodsFor: 'window processing' stamp: 'mjg 10/21/1999 15:26'!
- openAsMorph2
- | win component filler clock |
-
- "Create the clock"
- clock := Clock new.
- clock setTime: (Time now printString).
- clock start.
-
- "Create a window for it"
- win := SystemWindow labelled: 'Clock'.
- win model: self.
-
- "Set up the text view and the various pieces"
- filler := AlignmentMorph newRow.
- filler centering: #center.
- win addMorph: filler frame: (0@0 extent: 1.0@0.6).
- component := PluggableTextMorph on: clock text: #display accept: nil.
- filler addMorph: component.
-
- component := PluggableButtonMorph new
- model: clock;
- action: #addHour;
- label: 'Hours +';
- borderWidth: 1.
- win addMorph: component frame: (0@0.6 extent: 0.5@0.2).
- component := PluggableButtonMorph new
- model: clock;
- action: #subtractHour;
- label: 'Hours -';
- borderWidth: 1.
- win addMorph: component frame: (0.5@0.6 extent: 0.5@0.2).
- component := PluggableButtonMorph new
- model: clock;
- action: #addMinute;
- label: 'Minutes +';
- borderWidth: 1.
- win addMorph: component frame: (0@0.8 extent: 0.5@0.1).
- component := PluggableButtonMorph new
- model: clock;
- action: #subtractMinute;
- label: 'Minutes -';
- borderWidth: 1.
- win addMorph: component frame: (0.5@0.8 extent: 0.5@0.1).
-
- component := PluggableButtonMorph new
- model: clock;
- action: #stop;
- label: 'STOP';
- borderWidth: 1.
- win addMorph: component frame: (0@0.9 extent: 1@0.1).
-
- win openInWorld.
- ^win! !
-
- !ClockWindow methodsFor: 'window processing' stamp: 'mjg 10/21/1999 14:59'!
- openInMVC
- | win component clock textArea hoursPlusButton minutesPlusButton|
-
- "Create the clock"
- clock := Clock new.
- clock setTime: (Time now printString).
- clock start.
-
- "Create a window for it"
- win := (StandardSystemView new) model: self.
- win borderWidth: 1.
-
- "Set up the text view and the various pieces"
- textArea := PluggableTextView on: clock text: #display accept: nil.
- textArea window: (0@0 extent: 100@100).
- win addSubView: textArea.
-
- hoursPlusButton := PluggableButtonView new
- model: clock;
- action: #addHour;
- label: 'Hours +';
- borderWidth: 1.
- hoursPlusButton window: (0@100 extent: 100@50).
- win addSubView: hoursPlusButton below: textArea.
- component := PluggableButtonView new
- model: clock;
- action: #subtractHour;
- label: 'Hours -';
- borderWidth: 1.
- component window: (100@100 extent: 100@50).
- win addSubView: component toRightOf: hoursPlusButton.
- minutesPlusButton := PluggableButtonView new
- model: clock;
- action: #addMinute;
- label: 'Minutes +';
- borderWidth: 1.
- minutesPlusButton window: (0@150 extent: 100@50).
- win addSubView: minutesPlusButton below: hoursPlusButton.
- component := PluggableButtonView new
- model: clock;
- action: #subtractMinute;
- label: 'Minutes -';
- borderWidth: 1.
- component window: (100@150 extent: 100@50).
- win addSubView: component toRightOf: minutesPlusButton.
-
- component := PluggableButtonView new
- model: clock;
- action: #stop;
- label: 'STOP';
- borderWidth: 1.
- component window: (0@200 extent: 200@100).
- win addSubView: component below: minutesPlusButton.
-
- win label: 'Clock'.
- win minimumSize: 300 @ 300.
- win controller open! !
-
-
-
-