1: ================================================================================
2:
3: Smalltalk defineClass: #MyFirstView
4: superclass: #{UI.View}
5: indexedType: #none
6: private: false
7: instanceVariableNames: ''
8: classInstanceVariableNames: ''
9: imports: ''
10: category: ''
11:
12: ================================================================================
13:
14: MyFirstView method for 'displaying'
15:
16: displayOn: aGraphicsContext
17:
18: self model rectangles with: (1 to: self model rectangles size)
19: do:
20: [:aRectangle :anIndex |
21: | aText |
22: aGraphicsContext paint: ColorValue red.
23: aGraphicsContext displayRectangle: aRectangle.
24: self model selection = anIndex
25: ifTrue: [aGraphicsContext paint: ColorValue pink]
26: ifFalse: [aGraphicsContext paint: ColorValue white].
27: aGraphicsContext displayRectangle: (aRectangle insetBy: 1).
28: aGraphicsContext paint: ColorValue black.
29: aText := anIndex printString asComposedText.
30: aText displayOn: aGraphicsContext at: aRectangle center - aText bounds center]
31:
32: ------------------------------------------------------------
33:
34: MyFirstView method for 'display box accessing'
35:
36: preferredBounds
37:
38: | preferredBounds |
39: preferredBounds := 0 @ 0 extent: 0 @ 0.
40: self model rectangles
41: do: [:aRectangle | preferredBounds := preferredBounds merge: aRectangle].
42: ^preferredBounds
43:
44: ================================================================================
45:
46: Smalltalk.MyFirstView class
47: instanceVariableNames: ''
48:
49: ================================================================================
This document was generated by KSU.TextDoclet on 2012/09/19 at 23:48:21.