245
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1996 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
Object subclass:#VisualComponent
|
|
16 |
instanceVariableNames:'bounds fgColor bgColor'
|
|
17 |
classVariableNames:''
|
|
18 |
poolDictionaries:''
|
|
19 |
category:'Graphics-Display Objects'
|
|
20 |
!
|
|
21 |
|
|
22 |
!VisualComponent class methodsFor:'documentation'!
|
|
23 |
|
|
24 |
copyright
|
|
25 |
"
|
|
26 |
COPYRIGHT (c) 1996 by Claus Gittinger
|
|
27 |
All Rights Reserved
|
|
28 |
|
|
29 |
This software is furnished under a license and may be used
|
|
30 |
only in accordance with the terms of that license and with the
|
|
31 |
inclusion of the above copyright notice. This software may not
|
|
32 |
be provided or otherwise made available to, or used by, any
|
|
33 |
other person. No title to or ownership of the software is
|
|
34 |
hereby transferred.
|
|
35 |
"
|
|
36 |
|
|
37 |
|
|
38 |
!
|
|
39 |
|
|
40 |
documentation
|
|
41 |
"
|
246
|
42 |
abstract superclass for all kinds of visual components.
|
|
43 |
This is still being constructed - not yet finished.
|
245
|
44 |
|
|
45 |
[author:]
|
|
46 |
Claus Gittinger
|
|
47 |
"
|
|
48 |
|
|
49 |
! !
|
|
50 |
|
|
51 |
!VisualComponent class methodsFor:'instance creation'!
|
|
52 |
|
|
53 |
new
|
|
54 |
^ self basicNew initialize
|
|
55 |
! !
|
|
56 |
|
|
57 |
!VisualComponent methodsFor:'accessing'!
|
|
58 |
|
|
59 |
bounds
|
246
|
60 |
"return my bounds"
|
|
61 |
|
245
|
62 |
^ bounds
|
|
63 |
|
|
64 |
"Created: 8.5.1996 / 23:35:19 / cg"
|
246
|
65 |
"Modified: 9.5.1996 / 00:12:00 / cg"
|
245
|
66 |
!
|
|
67 |
|
246
|
68 |
bounds:aRectangle
|
|
69 |
"set my bounds"
|
|
70 |
|
|
71 |
bounds := aRectangle
|
245
|
72 |
|
|
73 |
"Created: 8.5.1996 / 23:36:07 / cg"
|
246
|
74 |
"Modified: 9.5.1996 / 00:13:12 / cg"
|
245
|
75 |
!
|
|
76 |
|
250
|
77 |
container:someContainer
|
|
78 |
"ignored here"
|
|
79 |
|
|
80 |
"Created: 9.5.1996 / 00:48:54 / cg"
|
|
81 |
!
|
|
82 |
|
245
|
83 |
preferredBounds
|
246
|
84 |
"return my preferredBounds"
|
|
85 |
|
245
|
86 |
^ 100@100
|
|
87 |
|
|
88 |
"Created: 8.5.1996 / 23:36:29 / cg"
|
246
|
89 |
"Modified: 9.5.1996 / 00:13:22 / cg"
|
247
|
90 |
!
|
|
91 |
|
|
92 |
setParentViewIn:aView
|
|
93 |
"ignored here - for now"
|
|
94 |
|
|
95 |
"Created: 9.5.1996 / 00:19:39 / cg"
|
245
|
96 |
! !
|
|
97 |
|
|
98 |
!VisualComponent methodsFor:'accessing - look'!
|
|
99 |
|
|
100 |
backgroundColor:aColor
|
246
|
101 |
"set my backgroundColor"
|
|
102 |
|
245
|
103 |
bgColor := aColor
|
|
104 |
|
|
105 |
"Created: 8.5.1996 / 23:47:11 / cg"
|
246
|
106 |
"Modified: 9.5.1996 / 00:13:33 / cg"
|
245
|
107 |
!
|
|
108 |
|
|
109 |
foregroundColor:aColor
|
246
|
110 |
"set my foregroundColor"
|
|
111 |
|
245
|
112 |
fgColor := aColor
|
|
113 |
|
|
114 |
"Created: 8.5.1996 / 23:47:05 / cg"
|
246
|
115 |
"Modified: 9.5.1996 / 00:13:39 / cg"
|
245
|
116 |
! !
|
|
117 |
|
|
118 |
!VisualComponent methodsFor:'event handling'!
|
|
119 |
|
|
120 |
buttonPress:button x:x y:y
|
246
|
121 |
"button was pressed over me - ignored here"
|
245
|
122 |
|
246
|
123 |
"Modified: 9.5.1996 / 00:14:08 / cg"
|
245
|
124 |
!
|
|
125 |
|
|
126 |
buttonRelease:button x:x y:y
|
246
|
127 |
"button was released over me - ignored here"
|
245
|
128 |
|
|
129 |
"Created: 8.5.1996 / 23:38:30 / cg"
|
246
|
130 |
"Modified: 9.5.1996 / 00:14:04 / cg"
|
245
|
131 |
!
|
|
132 |
|
|
133 |
keyPress:key x:x y:y
|
246
|
134 |
"key was pressed over me - ignored here"
|
245
|
135 |
|
|
136 |
"Created: 8.5.1996 / 23:46:03 / cg"
|
246
|
137 |
"Modified: 9.5.1996 / 00:14:14 / cg"
|
245
|
138 |
!
|
|
139 |
|
|
140 |
keyRelease:key x:x y:y
|
246
|
141 |
"key was released over me - ignored here"
|
245
|
142 |
|
|
143 |
"Created: 8.5.1996 / 23:46:07 / cg"
|
246
|
144 |
"Modified: 9.5.1996 / 00:14:19 / cg"
|
245
|
145 |
! !
|
|
146 |
|
|
147 |
!VisualComponent methodsFor:'initialization'!
|
|
148 |
|
|
149 |
initialize
|
|
150 |
fgColor := Color black.
|
|
151 |
bgColor := Color white.
|
|
152 |
|
|
153 |
"Created: 8.5.1996 / 23:49:54 / cg"
|
|
154 |
! !
|
|
155 |
|
247
|
156 |
!VisualComponent methodsFor:'testing'!
|
|
157 |
|
|
158 |
containsPoint:aPoint
|
|
159 |
"return true, if the receiver contains aPoint"
|
|
160 |
|
|
161 |
^ self bounds containsPoint:aPoint
|
|
162 |
|
|
163 |
"Created: 9.5.1996 / 00:21:44 / cg"
|
|
164 |
"Modified: 9.5.1996 / 00:22:00 / cg"
|
|
165 |
!
|
|
166 |
|
|
167 |
hasBorder
|
|
168 |
"return true, if the receiver shows a border"
|
|
169 |
|
|
170 |
^ false
|
|
171 |
|
|
172 |
"Modified: 9.5.1996 / 00:21:29 / cg"
|
|
173 |
!
|
|
174 |
|
|
175 |
intersects:aRectangle
|
|
176 |
"return true, if the receivers bounds intersects aRectangle"
|
|
177 |
|
|
178 |
^ self bounds intersects:aRectangle
|
|
179 |
|
|
180 |
"Created: 9.5.1996 / 00:21:18 / cg"
|
|
181 |
"Modified: 9.5.1996 / 00:22:04 / cg"
|
|
182 |
! !
|
|
183 |
|
245
|
184 |
!VisualComponent class methodsFor:'documentation'!
|
|
185 |
|
|
186 |
version
|
250
|
187 |
^ '$Header: /cvs/stx/stx/libview2/VisualComponent.st,v 1.4 1996-05-08 23:16:39 cg Exp $'
|
245
|
188 |
! !
|