author | Claus Gittinger <cg@exept.de> |
Tue, 25 May 1999 15:11:50 +0200 | |
changeset 2726 | c0a05c874843 |
parent 2721 | 2575a1e771cc |
child 2727 | 2047aa7dd3ac |
permissions | -rw-r--r-- |
135 | 1 |
" |
2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
2721 | 3 |
All Rights Reserved |
135 | 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 |
||
727
bf23a306b6f2
renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents:
724
diff
changeset
|
13 |
DisplaySurface subclass:#SimpleView |
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
14 |
instanceVariableNames:'superView subViews components styleSheet resources borderColor |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
15 |
borderWidth viewShape top left extentChanged originChanged |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
16 |
cornerChanged relativeOrigin relativeExtent relativeCorner |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
17 |
originRule extentRule cornerRule insets layout shown |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
18 |
hiddenOnRealize name level margin innerClipRect shadowColor |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
19 |
lightColor bitGravity viewGravity controller windowGroup |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
20 |
preferredExtent explicitExtent dependents layoutManager' |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
21 |
classVariableNames:'Grey CentPoint ViewSpacing DefaultStyle StyleSheet |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
22 |
DefaultViewBackgroundColor DefaultBorderColor DefaultLightColor |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
23 |
DefaultShadowColor DefaultBorderWidth DefaultFocusColor |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
24 |
DefaultFocusBorderWidth ReturnFocusWhenClosingModalBoxes' |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
25 |
poolDictionaries:'' |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
26 |
category:'Views-Basic' |
135 | 27 |
! |
28 |
||
452
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
29 |
SimpleView class instanceVariableNames:'ClassResources DefaultFont' |
734 | 30 |
|
31 |
" |
|
32 |
The following class instance variables are inherited by this class: |
|
33 |
||
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
34 |
DisplaySurface - |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
35 |
GraphicsMedium - |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
36 |
DeviceGraphicsContext - |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
37 |
GraphicsContext - |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
38 |
Object - |
734 | 39 |
" |
140 | 40 |
! |
135 | 41 |
|
1903 | 42 |
Object subclass:#ViewShape |
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
43 |
instanceVariableNames:'viewShapeForm borderShapeForm' |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
44 |
classVariableNames:'' |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
45 |
poolDictionaries:'' |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
46 |
privateIn:SimpleView |
1903 | 47 |
! |
48 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
49 |
!SimpleView class methodsFor:'documentation'! |
135 | 50 |
|
51 |
copyright |
|
52 |
" |
|
53 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
2721 | 54 |
All Rights Reserved |
135 | 55 |
|
56 |
This software is furnished under a license and may be used |
|
57 |
only in accordance with the terms of that license and with the |
|
58 |
inclusion of the above copyright notice. This software may not |
|
59 |
be provided or otherwise made available to, or used by, any |
|
60 |
other person. No title to or ownership of the software is |
|
61 |
hereby transferred. |
|
62 |
" |
|
63 |
! |
|
64 |
||
65 |
documentation |
|
66 |
" |
|
67 |
this class implements functions common to all Views which do not work on / show a model. |
|
68 |
Previously, all of this functionality used to be in the old View class, but has been |
|
69 |
separated into this new SimpleView (which does not know about models) and the new View, which |
|
70 |
does so. |
|
484 | 71 |
I'd prefer to call this class View and the current View class a ModelView, |
72 |
but for backward compatibility its better to leave things the way they are |
|
73 |
(there are simply too many subclasses of View around ...). |
|
74 |
||
135 | 75 |
Instances of SimpleView are seldom used, most views in the system inherit |
76 |
from this class. |
|
77 |
However, sometimes a view is used to create a dummy view for framing |
|
78 |
or layout purposes. |
|
79 |
||
616 | 80 |
[Instance variables:] |
135 | 81 |
|
2721 | 82 |
superView <View> my superview i.e. the view I am in |
83 |
||
84 |
subViews <Collection> the collection of subviews |
|
85 |
||
86 |
components <Collection> collection of gadgets (will be merged with subViews, soon) |
|
87 |
||
88 |
borderColor <Color> color of border |
|
89 |
||
90 |
borderWidth <Number> borderWidth in pixels (device dep.) |
|
91 |
||
92 |
viewShape <Form> shape of view & border (if device supports it) |
|
93 |
||
94 |
top <Number> actual top coordinate (pixels) in superview |
|
95 |
||
96 |
left <Number> actual left coordinate (pixels) in superview |
|
97 |
||
98 |
extendChanged <Boolean> true if extend changed during setup |
|
99 |
||
100 |
originChanged <Boolean> true if origin changed during setup |
|
101 |
||
102 |
relativeOrigin <Number> relative origin in percent within superview |
|
103 |
||
104 |
relativeExtent <Number> relative extent in percent within superview |
|
105 |
||
106 |
relativeCorner <Number> relative corner in percent within superview |
|
107 |
||
108 |
originRule <Block> rule to compute origin if superview changes size |
|
109 |
||
110 |
extentRule <Block> rule to compute extent if superview changes size |
|
111 |
||
112 |
cornerRule <Block> rule to compute corner if superview changes size |
|
113 |
||
114 |
insets <Array> array with top, left, bottom & right insets (or nil) |
|
115 |
||
116 |
layout <LayoutObject> not yet implemented - will replace the above layout |
|
117 |
variables. |
|
118 |
||
119 |
shown <Boolean> true if visible (false if iconified, unmapped or covered) |
|
120 |
||
121 |
hiddenOnRealize <Boolean> dont show automatically when superview is realized |
|
122 |
||
123 |
name <String> my name (future use for resources) |
|
124 |
||
125 |
level <Number> 3D level relative to superview |
|
126 |
||
127 |
margin <Number> convenient margin |
|
128 |
||
129 |
innerClipRect <Rectangle> convenient inner clip (minus margin) |
|
130 |
||
131 |
shadowColor <Color> color used to draw 3D shadowed edges |
|
132 |
||
133 |
lightColor <Color> color used to draw 3D lighted edges |
|
134 |
||
135 |
bitGravity <nil | Symbol> gravity of contents (if device supports it) |
|
136 |
||
137 |
viewGravity <nil | Symbol> gravity of view (if device supports it) |
|
138 |
||
139 |
controller <nil | Controller> the controller (if any) |
|
140 |
||
141 |
windowGroup <WindowGroup> the windowGroup |
|
484 | 142 |
|
135 | 143 |
|
144 |
||
616 | 145 |
[Class variables:] |
135 | 146 |
|
2721 | 147 |
Grey <Color> the color grey - its used so often |
148 |
||
149 |
ViewSpacing <Number> preferred spacing between views; 1mm |
|
150 |
||
151 |
CentPoint <Point> 100 @ 100 - its used so often |
|
152 |
||
153 |
StyleSheet <ResourcePack> contains all view-style specifics |
|
154 |
||
155 |
ReturnFocusWhenClosingModalBoxes if true, a closing modalBox returns |
|
156 |
<Boolean> the keyboard focus to the view which was |
|
157 |
active when the box was opened. |
|
158 |
If false (the default), it is left to |
|
159 |
window manager to assign a new focus. |
|
160 |
If running on olwm/olvwm (which requires an |
|
161 |
explicit click to reassign a focus), it is |
|
162 |
better to turn this on in a private.rc file. |
|
135 | 163 |
|
616 | 164 |
[styleSheet parameters:] |
135 | 165 |
|
2721 | 166 |
popupShadow <Boolean> if true, popupViews show a shadow below |
167 |
||
168 |
popupLevel <nil | Integer> 3D level |
|
169 |
||
170 |
borderWidth <nil | Integer> borderWidth (ignored in 3D styles) |
|
171 |
||
172 |
borderColor <nil | Color> borderColor (ignored in 3D styles) |
|
173 |
||
174 |
viewBackground <nil | Color> views background |
|
175 |
||
176 |
shadowColor <nil | Color> color for shadow edges (ignored in 2D styles) |
|
177 |
||
178 |
lightColor <nil | Color> color for light edges (ignored in 2D styles) |
|
179 |
||
180 |
font <nil | Font> font to use |
|
135 | 181 |
|
182 |
||
183 |
TODO: |
|
2721 | 184 |
get rid of relativeOrigin, relativeCorner, originRule, extentRule, |
185 |
and insets; replace by a single object which defines the size |
|
186 |
(mhmh - ST-80 seems to call this LayoutFrame ?) |
|
187 |
-> be prepared for a change here in the near future and ONLY use |
|
188 |
access methods to get those instance variables' values |
|
189 |
||
190 |
get rid of 3D level & margin, move it to extra wrappers |
|
191 |
(although this will make view setup more complicated, it will remove |
|
192 |
complexity from the internals of view. Also, it will allow for more |
|
193 |
varieties of borders.) |
|
151 | 194 |
|
2721 | 195 |
add components (could also call them gadgets or lightweight views) |
196 |
- views are expensive in terms of X resources. This would make all |
|
197 |
framing/edge and panel helper views become cheap ST objects, instead |
|
198 |
of views. |
|
616 | 199 |
|
200 |
||
201 |
[see also:] |
|
2721 | 202 |
StandardSystemView DialogBox |
203 |
WindowGroup WindowEvent |
|
204 |
Layout |
|
205 |
( introduction to view programming :html: programming/viewintro.html ) |
|
616 | 206 |
|
207 |
[author:] |
|
2721 | 208 |
Claus Gittinger |
135 | 209 |
" |
151 | 210 |
! |
211 |
||
212 |
examples |
|
213 |
" |
|
214 |
(all examples below use different viewBackgrounds, |
|
215 |
to make the individual subviews visible) |
|
216 |
||
616 | 217 |
a subView in a topView: |
2721 | 218 |
[exBegin] |
219 |
|top v| |
|
220 |
||
221 |
top := StandardSystemView new. |
|
222 |
v := View new. |
|
223 |
v origin:0.25 @ 0.25 corner:0.75 @ 0.75. |
|
224 |
top addSubView:v. |
|
225 |
top open |
|
226 |
[exEnd] |
|
616 | 227 |
|
228 |
||
229 |
the same, a bit more compact: |
|
2721 | 230 |
[exBegin] |
231 |
|top v| |
|
232 |
||
233 |
top := StandardSystemView new. |
|
234 |
v := View origin:0.25 @ 0.25 corner:0.75 @ 0.75 in:top. |
|
235 |
top open |
|
236 |
[exEnd] |
|
616 | 237 |
|
238 |
||
151 | 239 |
fixed position/size: |
2721 | 240 |
[exBegin] |
151 | 241 |
|top v1 v2| |
242 |
||
243 |
top := StandardSystemView new. |
|
244 |
top extent:300@300. |
|
245 |
||
246 |
v1 := View origin:10@10 |
|
2721 | 247 |
corner:50@50 |
248 |
in:top. |
|
151 | 249 |
v2 := View origin:60@10 |
2721 | 250 |
corner:150@100 |
251 |
in:top. |
|
151 | 252 |
|
253 |
v1 viewBackground:(Color red). |
|
254 |
v2 viewBackground:(Color yellow). |
|
255 |
||
256 |
top open |
|
2721 | 257 |
[exEnd] |
151 | 258 |
|
259 |
same, using ST-80 way of bulding up view hierarchies |
|
260 |
(recommended, if you plan to port applications later) |
|
2721 | 261 |
[exBegin] |
151 | 262 |
|top v1 v2| |
263 |
||
264 |
top := StandardSystemView new. |
|
265 |
top extent:300@300. |
|
266 |
||
267 |
v1 := View new. |
|
268 |
v1 origin:10@10 corner:50@50. |
|
269 |
||
270 |
v2 := View new. |
|
271 |
v2 origin:60@10 corner:150@100. |
|
272 |
||
273 |
v1 viewBackground:(Color red). |
|
274 |
v2 viewBackground:(Color yellow). |
|
275 |
||
276 |
top add:v1. |
|
277 |
top add:v2. |
|
278 |
||
279 |
v1 viewBackground:(Color red). |
|
280 |
v2 viewBackground:(Color yellow). |
|
281 |
||
282 |
top open |
|
2721 | 283 |
[exEnd] |
151 | 284 |
|
285 |
fixed origin, variable size: |
|
2721 | 286 |
[exBegin] |
151 | 287 |
|top v1 v2| |
288 |
||
289 |
top := StandardSystemView new. |
|
290 |
top extent:300@300. |
|
291 |
||
292 |
v1 := View new. |
|
293 |
v1 origin:10@10 corner:50@0.5. |
|
294 |
||
295 |
v2 := View new. |
|
296 |
v2 origin:60@10 corner:150@0.5. |
|
297 |
||
298 |
v1 viewBackground:(Color red). |
|
299 |
v2 viewBackground:(Color yellow). |
|
300 |
||
301 |
top add:v1. |
|
302 |
top add:v2. |
|
303 |
||
304 |
top open |
|
2721 | 305 |
[exEnd] |
151 | 306 |
|
307 |
fixed origin, variable size, |
|
308 |
bottomInset for constant distance from bottom: |
|
2721 | 309 |
[exBegin] |
151 | 310 |
|top v1 v2| |
311 |
||
312 |
top := StandardSystemView new. |
|
313 |
top extent:300@300. |
|
314 |
||
315 |
v1 := View new. |
|
316 |
v1 origin:10@10 corner:50@1.0. |
|
317 |
v1 bottomInset:10. |
|
318 |
||
319 |
v2 := View new. |
|
320 |
v2 origin:60@10 corner:150@1.0. |
|
321 |
v2 bottomInset:10. |
|
322 |
||
323 |
v1 viewBackground:(Color red). |
|
324 |
v2 viewBackground:(Color yellow). |
|
325 |
||
326 |
top add:v1. |
|
327 |
top add:v2. |
|
328 |
||
329 |
top open |
|
2721 | 330 |
[exEnd] |
151 | 331 |
|
332 |
variable origin, variable size, |
|
2721 | 333 |
[exBegin] |
151 | 334 |
|top v1 v2| |
335 |
||
336 |
top := StandardSystemView new. |
|
337 |
top extent:300@300. |
|
338 |
||
339 |
v1 := View new. |
|
340 |
v1 origin:0.0@0.0 corner:0.5@0.5. |
|
341 |
||
342 |
v2 := View new. |
|
343 |
v2 origin:0.5@0.0 corner:1.0@0.5. |
|
344 |
||
345 |
v1 viewBackground:(Color red). |
|
346 |
v2 viewBackground:(Color yellow). |
|
347 |
||
348 |
top add:v1. |
|
349 |
top add:v2. |
|
350 |
||
351 |
top open |
|
2721 | 352 |
[exEnd] |
151 | 353 |
|
354 |
variable origin, variable size, |
|
355 |
insets for some constant distance |
|
2721 | 356 |
[exBegin] |
151 | 357 |
|top v1 v2| |
358 |
||
359 |
top := StandardSystemView new. |
|
360 |
top extent:300@300. |
|
361 |
||
362 |
v1 := View new. |
|
363 |
v1 origin:0.0@0.0 corner:0.5@0.5. |
|
364 |
v1 rightInset:5. |
|
365 |
||
366 |
v2 := View new. |
|
367 |
v2 origin:0.5@0.0 corner:1.0@0.5. |
|
368 |
v2 leftInset:5. |
|
369 |
||
370 |
v1 viewBackground:(Color red). |
|
371 |
v2 viewBackground:(Color yellow). |
|
372 |
||
373 |
top add:v1. |
|
374 |
top add:v2. |
|
375 |
||
376 |
top open |
|
2721 | 377 |
[exEnd] |
151 | 378 |
|
379 |
using layout objects (ST-80 style): |
|
380 |
fully specifying the frame |
|
2721 | 381 |
[exBegin] |
151 | 382 |
|top v1 v2| |
383 |
||
384 |
top := StandardSystemView new. |
|
385 |
top extent:300@300. |
|
386 |
||
387 |
v1 := View new. |
|
388 |
v2 := View new. |
|
389 |
||
390 |
v1 viewBackground:(Color red). |
|
391 |
v2 viewBackground:(Color yellow). |
|
392 |
||
393 |
top add:v1 in:(LayoutFrame new |
|
2721 | 394 |
leftFraction:0.25; |
395 |
rightFraction:0.75; |
|
396 |
topFraction:0.0; |
|
397 |
bottomFraction:0.5). |
|
151 | 398 |
top add:v2 in:(LayoutFrame new |
2721 | 399 |
leftFraction:0.5; |
400 |
rightFraction:1.0; |
|
401 |
topFraction:0.5; |
|
402 |
bottomFraction:0.75). |
|
151 | 403 |
|
404 |
top open |
|
2721 | 405 |
[exEnd] |
151 | 406 |
|
407 |
another one, with offsets: |
|
2721 | 408 |
[exBegin] |
151 | 409 |
|top v1 v2| |
410 |
||
411 |
top := StandardSystemView new. |
|
412 |
top extent:300@300. |
|
413 |
||
414 |
v1 := View new. |
|
415 |
v2 := View new. |
|
416 |
||
417 |
v1 viewBackground:(Color red). |
|
418 |
v2 viewBackground:(Color yellow). |
|
419 |
||
420 |
top add:v1 in:(LayoutFrame new |
|
2721 | 421 |
leftFraction:0.0 offset:10; |
422 |
rightFraction:1.0 offset:-10; |
|
423 |
topFraction:0.0 offset:10; |
|
424 |
bottomFraction:0.5). |
|
151 | 425 |
top add:v2 in:(LayoutFrame new |
2721 | 426 |
leftFraction:0.0 offset:30; |
427 |
rightFraction:1.0 offset:-30; |
|
428 |
topFraction:0.5 offset:10; |
|
429 |
bottomFraction:0.75). |
|
151 | 430 |
|
431 |
top open |
|
2721 | 432 |
[exEnd] |
151 | 433 |
|
434 |
specifying origin only. Extent is views preferred |
|
435 |
(notice, that plain views have some defaultExtent of 100@100) |
|
2721 | 436 |
[exBegin] |
151 | 437 |
|top v1 v2| |
438 |
||
439 |
top := StandardSystemView new. |
|
440 |
top extent:300@300. |
|
441 |
||
442 |
v1 := View new. |
|
443 |
v2 := View new. |
|
444 |
||
445 |
v1 viewBackground:(Color red). |
|
446 |
v2 viewBackground:(Color yellow). |
|
447 |
||
448 |
top add:v1 in:(LayoutOrigin new |
|
2721 | 449 |
leftFraction:0.25; |
450 |
topFraction:0.0). |
|
151 | 451 |
top add:v2 in:(LayoutOrigin new |
2721 | 452 |
leftFraction:0.5; |
453 |
topFraction:0.5). |
|
151 | 454 |
|
455 |
top open |
|
2721 | 456 |
[exEnd] |
151 | 457 |
|
458 |
same example, using buttons which compute their preferredBounds: |
|
2721 | 459 |
[exBegin] |
151 | 460 |
|top v1 v2| |
461 |
||
462 |
top := StandardSystemView new. |
|
463 |
top extent:300@300. |
|
464 |
||
465 |
v1 := Button label:'foo'. |
|
466 |
v2 := Button label:'a very long buttonLabel'. |
|
467 |
||
468 |
v1 backgroundColor:(Color red). |
|
469 |
v2 backgroundColor:(Color yellow). |
|
470 |
||
471 |
top add:v1 in:(LayoutOrigin new |
|
2721 | 472 |
leftFraction:0.25; |
473 |
topFraction:0.0). |
|
151 | 474 |
top add:v2 in:(LayoutOrigin new |
2721 | 475 |
leftFraction:0.5; |
476 |
topFraction:0.5). |
|
151 | 477 |
|
478 |
top open |
|
2721 | 479 |
[exEnd] |
151 | 480 |
" |
269 | 481 |
! |
482 |
||
483 |
layoutComputation |
|
484 |
" |
|
485 |
Due to historic reasons, there are 2 mechanisms to resize a view: |
|
2721 | 486 |
- (old, to be eliminated mechanism) |
487 |
based upon info found in |
|
488 |
relativeOrigin / relativeCorner / relativeExtent |
|
489 |
originRule / cornerRule / extentRule |
|
490 |
||
491 |
- (new, will migrate to that one) |
|
492 |
letting a layoutObject compute things |
|
269 | 493 |
|
494 |
Actually, the old mechanism is just as powerful, as the new (layoutObject |
|
495 |
based) mechanism; with the help of block=rules, you can compute whatever |
|
496 |
geometry is desired. |
|
497 |
However, having 6 instance variables in every view creates some overhead, |
|
498 |
which can be avoided in most cases (most views are either fixed-size or |
|
499 |
relative-sized). |
|
500 |
Therefore (and also to make porting of ST-80 apps easier), ST/X will migrate |
|
501 |
to use layoutObjects. |
|
502 |
You will not see a difference at the views protocol level, since |
|
503 |
existing interfaces will (silently) create layoutObjects as appropriate. |
|
504 |
However, you should remove all direct accesses to the above mentioned |
|
505 |
instance variables, to be prepared for that change. |
|
506 |
||
507 |
Notice, that a view recomputes its size whenever its superview |
|
508 |
changes size. This is done via: |
|
2721 | 509 |
sizeChanged |
510 |
-> allSubviews: superViewChangedSize |
|
269 | 511 |
|
512 |
If the geometry computation as performed in superViewChangedSize |
|
513 |
is not powerful enough for your application, you can either: |
|
2721 | 514 |
- redefine superViewChangedSize |
515 |
- create a special layoutObject which computes a new layout. |
|
269 | 516 |
" |
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
517 |
! |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
518 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
519 |
popupMenus |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
520 |
" |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
521 |
Due to historic reasons, there are multiple mechanisms for popupMenu |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
522 |
definition: |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
523 |
|
2721 | 524 |
- static menus |
525 |
||
526 |
- dynamic menus from the view |
|
527 |
||
528 |
- dynamic menus from the model / menuHolder |
|
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
529 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
530 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
531 |
static menus |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
532 |
------------ |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
533 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
534 |
The easiest to use is a static menu; this is useful, if some view |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
535 |
has a constant menu which never changes. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
536 |
It can be defined at initialization time or redefined any time later. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
537 |
The menu is defined with: |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
538 |
|
2721 | 539 |
someView middleButtonMenu:<aPopUpMenu> |
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
540 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
541 |
Compatibility note: |
2721 | 542 |
static menus should no longer be used - their operation |
543 |
is incompatible with ST-80 and ST/X's dynamic menus. |
|
544 |
Do not use them if you care for compatibility. |
|
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
545 |
Also, they do not care for any menuPerformers or menuHolders. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
546 |
(instead, they use a receiver instance variable, which gets the messages). |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
547 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
548 |
example: |
2721 | 549 |
|top v1 v2| |
550 |
||
551 |
top := StandardSystemView new. |
|
552 |
top extent:300@300. |
|
553 |
||
554 |
v1 := View origin:0.0@0.0 corner:0.5@1.0 in:top. |
|
555 |
v1 viewBackground:Color red. |
|
556 |
||
557 |
v2 := View origin:0.5@0.0 corner:1.0@1.0 in:top. |
|
558 |
v2 viewBackground:Color yellow. |
|
559 |
||
560 |
v1 middleButtonMenu:( |
|
561 |
PopUpMenu |
|
562 |
labels:#('foo' 'bar') |
|
563 |
selectors:#(foo bar) |
|
564 |
receiver:v1 |
|
565 |
). |
|
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
566 |
|
2721 | 567 |
top open. |
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
568 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
569 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
570 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
571 |
dynamic menus |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
572 |
------------- |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
573 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
574 |
A dynamic menu can be provided by the view itself, or by the model. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
575 |
In addition, TextViews allow a separate menuHolder to provide the menu |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
576 |
(i.e. it may be different from the model). |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
577 |
If the model shall provide the menu, set the views menuMessage to a selector |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
578 |
which is sent to the model. This message should return a popUpMenu. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
579 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
580 |
For textViews, the above is also valid, except if the menuHolder is explicitely |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
581 |
set - in this case, that one provides the menu; not the model. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
582 |
Dont get confused by the fact that menuHolders are only supported |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
583 |
by textViews. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
584 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
585 |
example: (in your application, the plug would be your application, topView or model) |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
586 |
Notice, that all menu messages are sent to the view (because no model was set) |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
587 |
- so the textView still performs the copy-function correctly |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
588 |
(but of course, does not respond to the fooBar messages). |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
589 |
If a model was set, the menu would try the model first, but send its messages |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
590 |
to the view IFF the model would not respond to the menu message. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
591 |
(this allows mixing of menu messages for the view AND the model). |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
592 |
|
2721 | 593 |
|top v1 v2 holder| |
594 |
||
595 |
holder := Plug new. |
|
596 |
holder respondTo:#menu1 |
|
597 |
with:[ |
|
598 |
v1 menuMessage:#otherMenu1. |
|
599 |
PopUpMenu |
|
600 |
labels:#('foo' 'bar') |
|
601 |
selectors:#(foo bar). |
|
602 |
]. |
|
603 |
holder respondTo:#otherMenu1 |
|
604 |
with:[ |
|
605 |
v1 menuMessage:#menu1. |
|
606 |
PopUpMenu |
|
607 |
labels:#('other foo' 'other bar') |
|
608 |
selectors:#(foo bar). |
|
609 |
]. |
|
610 |
holder respondTo:#menu2 |
|
611 |
with:[ PopUpMenu |
|
612 |
labels:#('copy' 'bar2') |
|
613 |
selectors:#(copySelection bar2) |
|
614 |
]. |
|
615 |
||
616 |
top := StandardSystemView new. |
|
617 |
top extent:300@300. |
|
618 |
||
619 |
v1 := View origin:0.0@0.0 corner:0.5@1.0 in:top. |
|
620 |
v1 viewBackground:Color red. |
|
621 |
||
622 |
v2 := TextView origin:0.5@0.0 corner:1.0@1.0 in:top. |
|
623 |
v2 contents:'pop me up'. |
|
624 |
||
625 |
v1 model:holder; menuMessage:#menu1. |
|
626 |
v2 menuHolder:holder; menuMessage:#menu2. |
|
627 |
||
628 |
top open. |
|
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
629 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
630 |
an additional goody is the possibility, to change the menuPerformer (textViews only). |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
631 |
If defined, that one will get the menus message (instead of the model/view). |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
632 |
However, like above, if it does not respond to the message, its still sent to |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
633 |
the view. Notice, that with non-textViews, the menuPerformer is always the model. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
634 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
635 |
example: |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
636 |
(Notice: the executor understands the #copySelection message - therefore, the |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
637 |
views built-in copy is NOT performed |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
638 |
- it could be forwarded to the view, though. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
639 |
This could be useful to intercept/filter things). |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
640 |
|
2721 | 641 |
|top v menuProvider menuExecutor | |
642 |
||
643 |
menuProvider := Plug new. |
|
644 |
menuProvider respondTo:#menu |
|
645 |
with:[ PopUpMenu |
|
646 |
labels:#('copy' 'foo') |
|
647 |
selectors:#(copySelection foo) |
|
648 |
]. |
|
649 |
||
650 |
menuExecutor := Plug new. |
|
651 |
menuExecutor respondTo:#copySelection |
|
652 |
with:[Transcript showCR:'copy function']. |
|
653 |
menuExecutor respondTo:#foo |
|
654 |
with:[Transcript showCR:'foo function']. |
|
655 |
||
656 |
top := StandardSystemView new. |
|
657 |
top extent:300@300. |
|
658 |
||
659 |
v := TextView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
660 |
v contents:'pop me up'. |
|
661 |
||
662 |
v menuHolder:menuProvider; menuMessage:#menu. |
|
663 |
v menuPerformer:menuExecutor. |
|
664 |
||
665 |
top open. |
|
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
666 |
" |
135 | 667 |
! ! |
668 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
669 |
!SimpleView class methodsFor:'initialization'! |
135 | 670 |
|
671 |
initialize |
|
672 |
DefaultStyle isNil ifTrue:[ |
|
2721 | 673 |
Font initialize. |
674 |
Form initialize. |
|
675 |
Color initialize. |
|
676 |
||
677 |
self == SimpleView ifTrue:[ |
|
678 |
Smalltalk addDependent:self "/ to get language changes |
|
679 |
] |
|
364
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
680 |
]. |
365 | 681 |
ReturnFocusWhenClosingModalBoxes := false. |
696 | 682 |
|
683 |
"Modified: 18.5.1996 / 16:56:28 / cg" |
|
135 | 684 |
! |
685 |
||
686 |
postAutoload |
|
687 |
self updateStyleCache. |
|
688 |
! ! |
|
689 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
690 |
!SimpleView class methodsFor:'instance creation'! |
135 | 691 |
|
269 | 692 |
extent:extent |
693 |
"create a new view with given extent" |
|
694 |
||
695 |
^ self origin:nil extent:extent borderWidth:nil |
|
2721 | 696 |
font:nil label:nil in:nil |
269 | 697 |
! |
698 |
||
699 |
extent:extent in:aView |
|
700 |
"create a new view as a subview of aView with given extent" |
|
701 |
||
702 |
^ self origin:nil extent:extent borderWidth:nil |
|
2721 | 703 |
font:nil label:nil in:aView |
269 | 704 |
! |
705 |
||
706 |
extent:extent label:label |
|
707 |
"create a new view with given extent and label" |
|
708 |
||
709 |
^ self origin:nil extent:extent borderWidth:nil |
|
2721 | 710 |
font:nil label:label in:nil |
135 | 711 |
! |
712 |
||
713 |
in:aView |
|
714 |
"return a new view as a subview of aView. |
|
715 |
If aView is nil, it is left unspecified, in which superview |
|
716 |
the new view will be placed. The view can later be assigned |
|
717 |
by adding it to the superview via #addSubView:. |
|
1918
a4042019bc8b
no need to set the container twice in SimpleView class>>in:
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
718 |
If its later realized and no superview has ever been set, |
a4042019bc8b
no need to set the container twice in SimpleView class>>in:
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
719 |
it will come up as a topview." |
135 | 720 |
|
721 |
|newView| |
|
722 |
||
723 |
newView := self basicNew. |
|
724 |
aView notNil ifTrue:[ |
|
2721 | 725 |
newView device:(aView graphicsDevice). |
2302
9525834a6be7
manual bg-pixmap drawing on devices which do not support them (win32)
Claus Gittinger <cg@exept.de>
parents:
2294
diff
changeset
|
726 |
"/ newView container:aView. |
135 | 727 |
] ifFalse:[ |
2721 | 728 |
newView device:Screen current "Display" |
135 | 729 |
]. |
730 |
newView initialize. |
|
731 |
aView notNil ifTrue:[aView addSubView:newView]. |
|
732 |
^ newView |
|
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
733 |
|
743 | 734 |
"Modified: 28.5.1996 / 20:24:58 / cg" |
135 | 735 |
! |
736 |
||
140 | 737 |
label:label |
738 |
"create a new view with given label" |
|
135 | 739 |
|
740 |
^ self origin:nil extent:nil borderWidth:nil |
|
2721 | 741 |
font:nil label:label in:nil |
140 | 742 |
! |
743 |
||
269 | 744 |
label:label in:aView |
745 |
"create a new view as subview of aView with given label" |
|
746 |
||
747 |
^ self origin:nil extent:nil borderWidth:nil |
|
2721 | 748 |
font:nil label:label in:aView |
269 | 749 |
! |
750 |
||
1393
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
751 |
model:aModel |
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
752 |
"st-80 style view creation: create a new view and set its model. |
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
753 |
Notice, that simpleViews do not understand #model:; however, |
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
754 |
subclasses may." |
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
755 |
|
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
756 |
^ self new model:aModel |
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
757 |
|
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
758 |
"Created: 28.2.1997 / 19:27:40 / cg" |
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
759 |
"Modified: 28.2.1997 / 19:28:12 / cg" |
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
760 |
! |
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
761 |
|
269 | 762 |
on:aModel |
763 |
"create a new drawable on aModel" |
|
764 |
||
765 |
"although this one does not know about models, |
|
766 |
it can still send the model-assign message. This was done |
|
767 |
to catch obsolete calls to on:aDevice. |
|
768 |
" |
|
769 |
^ self new model:aModel. |
|
770 |
! |
|
771 |
||
772 |
onSameDeviceAs:anotherView |
|
773 |
"create a view on the same device as anotherView. |
|
774 |
Used with popUpMenus, which should be created on the device of |
|
775 |
its masterView." |
|
776 |
||
777 |
|device| |
|
778 |
||
779 |
anotherView notNil ifTrue:[ |
|
2721 | 780 |
device := anotherView graphicsDevice. |
269 | 781 |
] ifFalse:[ |
2721 | 782 |
device := Screen current. |
269 | 783 |
]. |
784 |
^ self onDevice:device |
|
743 | 785 |
|
786 |
"Modified: 28.5.1996 / 20:25:05 / cg" |
|
269 | 787 |
! |
788 |
||
789 |
origin:origin corner:corner |
|
790 |
"create a new view with given origin and extent" |
|
135 | 791 |
|
140 | 792 |
^ self origin:origin corner:corner borderWidth:nil |
2721 | 793 |
font:nil label:nil in:nil |
135 | 794 |
! |
795 |
||
796 |
origin:anOrigin corner:aCorner borderWidth:bw font:aFont label:aLabel in:aView |
|
797 |
|newView| |
|
798 |
||
799 |
aView notNil ifTrue:[ |
|
2721 | 800 |
newView := self basicNew. |
801 |
newView device:(aView graphicsDevice). |
|
802 |
newView initialize. |
|
803 |
aView addSubView:newView. |
|
135 | 804 |
] ifFalse:[ |
2721 | 805 |
newView := self onDevice:Screen current "Display" |
135 | 806 |
]. |
807 |
bw notNil ifTrue:[newView borderWidth:bw]. |
|
808 |
anOrigin notNil ifTrue:[newView origin:anOrigin]. |
|
809 |
aCorner notNil ifTrue:[newView corner:aCorner]. |
|
810 |
aFont notNil ifTrue:[newView font:aFont]. |
|
811 |
aLabel notNil ifTrue:[newView label:aLabel]. |
|
812 |
^ newView |
|
743 | 813 |
|
814 |
"Modified: 28.5.1996 / 20:25:15 / cg" |
|
135 | 815 |
! |
816 |
||
269 | 817 |
origin:origin corner:corner borderWidth:bw in:aView |
818 |
"create a new view as a subview of aView with given origin and extent" |
|
819 |
||
820 |
^ self origin:origin corner:corner borderWidth:bw |
|
2721 | 821 |
font:nil label:nil in:aView |
269 | 822 |
! |
823 |
||
824 |
origin:origin corner:corner in:aView |
|
825 |
"create a new view as a subview of aView with given origin and extent" |
|
826 |
||
827 |
^ self origin:origin corner:corner borderWidth:nil |
|
2721 | 828 |
font:nil label:nil in:aView |
269 | 829 |
! |
830 |
||
831 |
origin:origin extent:extent |
|
832 |
"create a new view with given origin and extent" |
|
833 |
||
834 |
^ self origin:origin extent:extent borderWidth:nil |
|
2721 | 835 |
font:nil label:nil in:nil |
269 | 836 |
! |
837 |
||
838 |
origin:origin extent:extent borderWidth:bw |
|
839 |
"create a new view with given origin, extent and borderWidth" |
|
840 |
||
841 |
^ self origin:origin extent:extent borderWidth:bw |
|
2721 | 842 |
font:nil label:nil in:nil |
269 | 843 |
! |
844 |
||
845 |
origin:anOrigin extent:anExtent borderWidth:bw font:aFont label:aLabel in:aView |
|
846 |
|newView| |
|
847 |
||
848 |
aView notNil ifTrue:[ |
|
2721 | 849 |
newView := self basicNew. |
850 |
newView device:(aView graphicsDevice). |
|
851 |
newView initialize. |
|
852 |
aView addSubView:newView. |
|
140 | 853 |
] ifFalse:[ |
2721 | 854 |
newView := self onDevice:Screen current "Display" |
140 | 855 |
]. |
269 | 856 |
bw notNil ifTrue:[newView borderWidth:bw]. |
857 |
anExtent notNil ifTrue:[newView extent:anExtent]. |
|
858 |
anOrigin notNil ifTrue:[newView origin:anOrigin]. |
|
859 |
aFont notNil ifTrue:[newView font:aFont]. |
|
860 |
aLabel notNil ifTrue:[newView label:aLabel]. |
|
861 |
^ newView |
|
743 | 862 |
|
863 |
"Modified: 28.5.1996 / 20:25:19 / cg" |
|
269 | 864 |
! |
865 |
||
866 |
origin:origin extent:extent borderWidth:bw in:aView |
|
867 |
"create a new view as a subview of aView with given origin, extent |
|
868 |
and borderWidth" |
|
869 |
||
870 |
^ self origin:origin extent:extent borderWidth:bw |
|
2721 | 871 |
font:nil label:nil in:aView |
269 | 872 |
! |
873 |
||
874 |
origin:origin extent:extent font:aFont label:label |
|
875 |
^ self origin:origin extent:extent borderWidth:nil |
|
2721 | 876 |
font:nil label:label in:nil |
269 | 877 |
! |
878 |
||
879 |
origin:origin extent:extent font:aFont label:label in:aView |
|
880 |
^ self origin:origin extent:extent borderWidth:nil |
|
2721 | 881 |
font:aFont label:label in:aView |
269 | 882 |
! |
883 |
||
884 |
origin:origin extent:extent in:aView |
|
885 |
"create a new view as a subview of aView with given origin and extent" |
|
886 |
||
887 |
^ self origin:origin extent:extent borderWidth:nil |
|
2721 | 888 |
font:nil label:nil in:aView |
269 | 889 |
! |
890 |
||
891 |
origin:origin extent:extent label:label |
|
892 |
"create a new view with given origin, extent and label" |
|
893 |
||
894 |
^ self origin:origin extent:extent borderWidth:nil |
|
2721 | 895 |
font:nil label:label in:nil |
135 | 896 |
! |
897 |
||
898 |
origin:anOrigin extent:anExtent |
|
2721 | 899 |
label:aLabel icon:aForm |
900 |
minExtent:minExtent maxExtent:maxExtent |
|
135 | 901 |
|newView| |
902 |
||
151 | 903 |
newView := self onDevice:Screen current "Display". |
135 | 904 |
anOrigin notNil ifTrue:[newView origin:anOrigin]. |
905 |
anExtent notNil ifTrue:[newView extent:anExtent]. |
|
906 |
aLabel notNil ifTrue:[newView label:aLabel]. |
|
907 |
aForm notNil ifTrue:[newView icon:aForm]. |
|
908 |
minExtent notNil ifTrue:[newView minExtent:minExtent]. |
|
909 |
maxExtent notNil ifTrue:[newView maxExtent:maxExtent]. |
|
910 |
^ newView |
|
911 |
! |
|
912 |
||
140 | 913 |
origin:origin in:aView |
914 |
"create a new view as a subview of aView with given origin" |
|
915 |
||
916 |
^ self origin:origin extent:nil borderWidth:nil |
|
2721 | 917 |
font:nil label:nil in:aView |
135 | 918 |
! ! |
919 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
920 |
!SimpleView class methodsFor:'change & update'! |
269 | 921 |
|
867 | 922 |
update:something with:aParameter from:changedObject |
269 | 923 |
something == #Language ifTrue:[ |
2721 | 924 |
"flush resources on language changes" |
925 |
self flushAllClassResources |
|
135 | 926 |
] |
867 | 927 |
|
928 |
"Created: 15.6.1996 / 15:23:04 / cg" |
|
135 | 929 |
! ! |
930 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
931 |
!SimpleView class methodsFor:'defaults'! |
135 | 932 |
|
140 | 933 |
defaultExtent |
586 | 934 |
"return the default extent of my instances. |
935 |
The value returned here is usually ignored, and |
|
936 |
the value from preferredExtent taken instead." |
|
140 | 937 |
|
938 |
CentPoint isNil ifTrue:[CentPoint := 100 @ 100]. |
|
939 |
^ CentPoint |
|
586 | 940 |
|
941 |
"Modified: 22.4.1996 / 23:38:39 / cg" |
|
140 | 942 |
! |
943 |
||
269 | 944 |
defaultFont |
990 | 945 |
|f| |
946 |
||
452
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
947 |
DefaultFont notNil ifTrue:[^ DefaultFont]. |
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
948 |
|
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
949 |
DefaultFont isNil ifTrue:[ |
2721 | 950 |
self == SimpleView ifFalse:[ |
951 |
f := self superclass defaultFont. |
|
952 |
] ifTrue:[ |
|
953 |
f := super defaultFont |
|
954 |
]. |
|
452
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
955 |
]. |
997 | 956 |
|
990 | 957 |
f notNil ifTrue:[ |
2721 | 958 |
DefaultFont := f. |
959 |
f := f on:Display. |
|
960 |
f notNil ifTrue:[ |
|
961 |
DefaultFont := f. |
|
962 |
] |
|
990 | 963 |
]. |
452
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
964 |
^ DefaultFont |
467 | 965 |
|
966 |
"Modified: 27.2.1996 / 02:20:54 / cg" |
|
269 | 967 |
! |
968 |
||
450 | 969 |
defaultFont:aFont |
452
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
970 |
"set the default font used for drawing" |
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
971 |
|
997 | 972 |
|f| |
973 |
||
527
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
974 |
DefaultFont := aFont. |
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
975 |
aFont notNil ifTrue:[ |
2721 | 976 |
f := aFont on:Display. |
977 |
f notNil ifTrue:[ |
|
978 |
DefaultFont := f. |
|
979 |
] |
|
527
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
980 |
] |
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
981 |
|
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
982 |
"Modified: 18.3.1996 / 12:56:20 / cg" |
450 | 983 |
! |
984 |
||
269 | 985 |
defaultStyle |
986 |
"return the default view style" |
|
987 |
||
988 |
^ DefaultStyle |
|
989 |
||
990 |
" |
|
991 |
View defaultStyle |
|
992 |
" |
|
135 | 993 |
! |
994 |
||
995 |
defaultStyle:aStyle |
|
996 |
"set the view style for new views" |
|
997 |
||
180 | 998 |
"/ aStyle ~~ DefaultStyle ifTrue:[ |
2721 | 999 |
DefaultStyle := aStyle. |
1000 |
self readStyleSheetAndUpdateAllStyleCaches. |
|
180 | 1001 |
"/ ] |
135 | 1002 |
|
1003 |
" |
|
1004 |
View defaultStyle:#next. SystemBrowser start |
|
1005 |
View defaultStyle:#motif. SystemBrowser start |
|
1006 |
View defaultStyle:#iris. SystemBrowser start |
|
1007 |
View defaultStyle:#st80. SystemBrowser start |
|
1008 |
View defaultStyle:#normal. SystemBrowser start |
|
1009 |
" |
|
2351
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1010 |
|
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1011 |
"Modified: / 15.9.1998 / 22:05:02 / cg" |
135 | 1012 |
! |
1013 |
||
1860
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1014 |
defaultViewBackgroundColor |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1015 |
"return the default view background" |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1016 |
|
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1017 |
^ DefaultViewBackgroundColor |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1018 |
|
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1019 |
" |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1020 |
View defaultViewBackgroundColor |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1021 |
" |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1022 |
|
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1023 |
"Modified: 13.8.1997 / 19:37:55 / cg" |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1024 |
! |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1025 |
|
2351
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1026 |
readStyleSheet |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1027 |
"reload the styleSheet." |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1028 |
|
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1029 |
StyleSheet := ViewStyle fromFile:(DefaultStyle , '.style'). |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1030 |
StyleSheet fileReadFailed ifTrue:[ |
2721 | 1031 |
('***** WARNING: no styleSheet for ' , DefaultStyle , '-style.') errorPrintCR. |
1032 |
DefaultStyle ~~ #normal ifTrue:[ |
|
1033 |
DefaultStyle := #normal. |
|
1034 |
StyleSheet := ViewStyle fromFile:(DefaultStyle , '.style'). |
|
2351
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1035 |
|
2721 | 1036 |
StyleSheet fileReadFailed ifTrue:[ |
1037 |
'***** WARNING: not even a styleSheet for normal-style (using defaults).' errorPrintCR. |
|
1038 |
] |
|
1039 |
] |
|
2351
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1040 |
]. |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1041 |
|
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1042 |
"Created: / 15.9.1998 / 22:03:06 / cg" |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1043 |
! |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1044 |
|
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1045 |
readStyleSheetAndUpdateAllStyleCaches |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1046 |
"reload all style caches in all view classes. |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1047 |
Needed after a style change or when a style file has been changed" |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1048 |
|
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1049 |
self readStyleSheet. |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1050 |
self updateAllStyleCaches |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1051 |
|
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1052 |
"Created: / 15.9.1998 / 22:03:59 / cg" |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1053 |
! |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1054 |
|
362 | 1055 |
returnFocusWhenClosingModalBoxes |
364
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1056 |
"return the current focus-return behavior. |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1057 |
See #returnFocusWhenClosingModalBoxes: for a description." |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1058 |
|
362 | 1059 |
^ ReturnFocusWhenClosingModalBoxes |
1060 |
! |
|
1061 |
||
1062 |
returnFocusWhenClosingModalBoxes:aBoolean |
|
364
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1063 |
"control the keyboard-focus behavior when a modal dialog |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1064 |
is closed. The default (true) is to return the focus to the view |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1065 |
which was active when the dialog was opened. |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1066 |
If false, it is left up to the display to set the focus. |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1067 |
For owm / ovwm (which requires an explicit click for the focus), |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1068 |
it is better to return the focus automatically. |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1069 |
For managers which assign the focus according the pointer position, |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1070 |
it may be better to turn the focus-return off. |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1071 |
You should add a corresponding expression into your private.rc or |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1072 |
display.rc file." |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1073 |
|
362 | 1074 |
ReturnFocusWhenClosingModalBoxes := aBoolean |
364
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1075 |
|
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1076 |
" |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1077 |
Dialog returnFocusWhenClosingModalBoxes:false |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1078 |
Dialog returnFocusWhenClosingModalBoxes:true |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1079 |
" |
362 | 1080 |
! |
1081 |
||
2294 | 1082 |
setDefaultStyle |
1083 |
|defStyle| |
|
1084 |
||
1085 |
defStyle := OperatingSystem getEnvironment:'STX_VIEWSTYLE'. |
|
1086 |
defStyle notNil ifTrue:[ |
|
2721 | 1087 |
DefaultStyle := defStyle asSymbol. |
2294 | 1088 |
] ifFalse:[ |
2721 | 1089 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
1090 |
DefaultStyle := #mswindows95 |
|
1091 |
] ifFalse:[ |
|
1092 |
DefaultStyle := #motif |
|
1093 |
] |
|
2294 | 1094 |
]. |
1095 |
! |
|
1096 |
||
1161
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1097 |
styleSheet |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1098 |
"return the view style sheet information (a dictionary)" |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1099 |
|
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1100 |
^ StyleSheet |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1101 |
|
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1102 |
" |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1103 |
View styleSheet |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1104 |
" |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1105 |
|
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1106 |
"Modified: 9.1.1997 / 13:47:42 / cg" |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1107 |
! |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1108 |
|
269 | 1109 |
styleSheet:aViewStyle |
1110 |
"set the view style from a style-sheet" |
|
1111 |
||
1112 |
StyleSheet := aViewStyle. |
|
1113 |
DefaultStyle := (StyleSheet at:'name' ifAbsent:'unknown') asSymbol. |
|
1114 |
self updateAllStyleCaches. |
|
1115 |
! |
|
1116 |
||
1117 |
updateAllStyleCaches |
|
1118 |
"reload all style caches in all view classes. |
|
1119 |
Needed after a style change or when a style file has been changed" |
|
1120 |
||
1121 |
" |
|
1122 |
tell all view classes to flush any |
|
1123 |
cached style-data |
|
1124 |
" |
|
1125 |
self changed:#style. |
|
1126 |
SimpleView updateStyleCache. |
|
1127 |
SimpleView allSubclassesDo:[:aClass | |
|
2721 | 1128 |
aClass defaultFont:nil. |
1129 |
(aClass class implements:#updateStyleCache) ifTrue:[ |
|
1130 |
aClass updateStyleCache |
|
1131 |
]. |
|
269 | 1132 |
] |
1133 |
||
1134 |
" |
|
1135 |
View updateAllStyleCaches |
|
1136 |
" |
|
527
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1137 |
|
2351
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1138 |
"Modified: / 15.9.1998 / 22:04:15 / cg" |
269 | 1139 |
! |
1140 |
||
135 | 1141 |
updateStyleCache |
1142 |
"this method gets some heavily used style stuff and keeps |
|
1143 |
it in class-variables for faster access. |
|
1144 |
Subclasses should redefine this to load any cached style-values |
|
1145 |
into faster class variables as well. These should NOT do a |
|
1146 |
super updateStyleCache, since this method is called for all view-classes |
|
1147 |
anyway." |
|
1148 |
||
2492 | 1149 |
<resource: #style (#viewSpacing #font #borderWidth #borderColor |
2721 | 1150 |
#viewBackground #shadowColor #lightColor |
1151 |
#focusColor #focusBorderWidth)> |
|
2292
8efc5272cf0b
defaultStyle either from environmane (STX_VIEWSTYLE)
Claus Gittinger <cg@exept.de>
parents:
2274
diff
changeset
|
1152 |
|
8efc5272cf0b
defaultStyle either from environmane (STX_VIEWSTYLE)
Claus Gittinger <cg@exept.de>
parents:
2274
diff
changeset
|
1153 |
|bgGrey defStyle| |
135 | 1154 |
|
1155 |
" |
|
1156 |
when coming here the first time, we read the styleSheet |
|
1157 |
and keep the values in fast class variables |
|
1158 |
" |
|
1159 |
StyleSheet isNil ifTrue:[ |
|
2721 | 1160 |
self setDefaultStyle. |
1161 |
StyleSheet := ViewStyle fromFile:(DefaultStyle , '.style'). |
|
135 | 1162 |
]. |
1163 |
||
1164 |
Grey := StyleSheet viewGrey. |
|
1165 |
Grey isNil ifTrue:[ |
|
2721 | 1166 |
Grey := Color grey |
135 | 1167 |
]. |
1168 |
Grey := Grey on:Display. |
|
1169 |
||
151 | 1170 |
StyleSheet fileReadFailed ifTrue:[ |
2721 | 1171 |
bgGrey := White |
135 | 1172 |
] ifFalse:[ |
2721 | 1173 |
Display hasGrayscales ifTrue:[ |
1174 |
bgGrey := Grey |
|
1175 |
] ifFalse:[ |
|
1176 |
bgGrey := White |
|
1177 |
] |
|
135 | 1178 |
]. |
151 | 1179 |
bgGrey := bgGrey on:Display. |
135 | 1180 |
|
2492 | 1181 |
ViewSpacing := StyleSheet at:#viewSpacing. |
135 | 1182 |
ViewSpacing isNil ifTrue:[ |
2721 | 1183 |
ViewSpacing := Display defaultStyleValueFor:#viewSpacing. |
2492 | 1184 |
]. |
1185 |
||
1186 |
DefaultBorderColor := StyleSheet colorAt:#borderColor. |
|
1678
5c93a4791a8b
prepare to fetch style defaults from device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1617
diff
changeset
|
1187 |
DefaultBorderColor isNil ifTrue:[ |
2721 | 1188 |
DefaultBorderColor := Display defaultStyleValueFor:#borderColor |
1678
5c93a4791a8b
prepare to fetch style defaults from device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1617
diff
changeset
|
1189 |
]. |
151 | 1190 |
|
1191 |
StyleSheet fileReadFailed ifTrue:[ |
|
2721 | 1192 |
DefaultBorderWidth := 1. |
1193 |
DefaultShadowColor := Black. |
|
1194 |
DefaultLightColor := White. |
|
1195 |
DefaultFocusColor := Black. |
|
1196 |
DefaultFocusBorderWidth := 2. |
|
1197 |
DefaultViewBackgroundColor := White. |
|
151 | 1198 |
] ifFalse:[ |
2721 | 1199 |
DefaultBorderWidth := StyleSheet at:#borderWidth default:0. |
1200 |
DefaultViewBackgroundColor := StyleSheet colorAt:#viewBackground default:bgGrey. |
|
1201 |
DefaultShadowColor := StyleSheet colorAt:#shadowColor. |
|
1202 |
DefaultLightColor := StyleSheet colorAt:#lightColor. |
|
1203 |
DefaultFocusColor := StyleSheet colorAt:#focusColor default:Color red. |
|
1204 |
DefaultFocusBorderWidth := StyleSheet at:'focusBorderWidth' default:2. |
|
151 | 1205 |
]. |
135 | 1206 |
|
526 | 1207 |
self == SimpleView ifTrue:[ |
2721 | 1208 |
DefaultFont := StyleSheet at:#font. |
1209 |
DefaultFont isNil ifTrue:[ |
|
1210 |
DefaultFont := Font family:'courier' face:'medium' style:'roman' size:12. |
|
1211 |
]. |
|
1212 |
DefaultFont := DefaultFont on:Display. |
|
527
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1213 |
] ifFalse:[ |
2721 | 1214 |
DefaultFont := nil |
135 | 1215 |
]. |
1216 |
||
1217 |
DefaultViewBackgroundColor isNil ifTrue:[ |
|
2721 | 1218 |
'SimpleView [warning]: bad viewBackground in style - using white' errorPrintCR. |
1219 |
DefaultViewBackgroundColor := White |
|
2492 | 1220 |
]. |
1221 |
||
1222 |
"Modified: / 29.4.1997 / 11:16:52 / dq" |
|
1223 |
"Modified: / 8.3.1999 / 01:36:05 / cg" |
|
135 | 1224 |
! |
1225 |
||
269 | 1226 |
viewSpacing |
1227 |
"return a convenient number of pixels used to separate views (usually 1mm). |
|
1228 |
Having this value here at a common place makes certain that all views |
|
1229 |
get a common look" |
|
1230 |
||
1231 |
^ ViewSpacing |
|
1232 |
! ! |
|
1233 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
1234 |
!SimpleView class methodsFor:'resources'! |
269 | 1235 |
|
1236 |
classResources |
|
1237 |
"if not already loaded, get the classes resourcePack |
|
1238 |
and return it" |
|
1239 |
||
1240 |
ClassResources isNil ifTrue:[ |
|
2721 | 1241 |
ClassResources := ResourcePack for:self. |
140 | 1242 |
]. |
269 | 1243 |
^ ClassResources |
1244 |
! |
|
1245 |
||
1246 |
classResources:aResourcePack |
|
1247 |
"allow setting of the classResources" |
|
1248 |
||
1249 |
ClassResources := aResourcePack |
|
1250 |
! |
|
1251 |
||
1252 |
flushAllClassResources |
|
1253 |
"flush all classes resource translations. |
|
1254 |
Needed after a resource file has changed." |
|
1255 |
||
1256 |
ResourcePack flushCachedResourcePacks. |
|
1257 |
SimpleView flushClassResources. |
|
1258 |
SimpleView allSubclasses do:[:aClass | |
|
2721 | 1259 |
aClass flushClassResources. |
140 | 1260 |
] |
1261 |
||
1262 |
" |
|
269 | 1263 |
View flushAllClassResources |
140 | 1264 |
" |
269 | 1265 |
"to change the language: |
2721 | 1266 |
Language := #english. |
1267 |
Smalltalk changed:#Language. |
|
1268 |
View flushAllClassResources |
|
269 | 1269 |
or: |
2721 | 1270 |
Language := #german. |
1271 |
Smalltalk changed:#Language. |
|
1272 |
View flushAllClassResources |
|
269 | 1273 |
" |
1274 |
! |
|
1275 |
||
1276 |
flushClassResources |
|
1277 |
"flush classes resource string translations. |
|
1278 |
Needed whenever a resource file or language has changed" |
|
1279 |
||
1280 |
ClassResources := nil. |
|
1281 |
! |
|
1282 |
||
2130
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
1283 |
resources |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
1284 |
^ self classResources |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
1285 |
|
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
1286 |
"Created: / 25.5.1998 / 13:00:30 / cg" |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
1287 |
! |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
1288 |
|
269 | 1289 |
updateClassResources |
1290 |
"flush classes resource string translations and reload them. |
|
1291 |
Needed whenever a resource file or language has changed" |
|
1292 |
||
1293 |
ClassResources := nil. |
|
1294 |
self classResources |
|
135 | 1295 |
! ! |
1296 |
||
269 | 1297 |
!SimpleView methodsFor:'ST-80 compatibility'! |
1298 |
||
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1299 |
bounds |
1182 | 1300 |
"ST-80 compatibility: return my bounds" |
1301 |
||
971 | 1302 |
^ (self origin) corner:(self corner) |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1303 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1304 |
"Created: 4.6.1996 / 21:23:27 / cg" |
1182 | 1305 |
"Modified: 10.1.1997 / 19:46:21 / cg" |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1306 |
! |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1307 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1308 |
bounds:aRectangle |
1182 | 1309 |
"ST-80 compatibility: change my bounds" |
1310 |
||
971 | 1311 |
explicitExtent := true. |
1312 |
self pixelOrigin:aRectangle origin |
|
2721 | 1313 |
corner:aRectangle corner |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1314 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1315 |
"Created: 4.6.1996 / 21:44:27 / cg" |
1182 | 1316 |
"Modified: 10.1.1997 / 19:46:36 / cg" |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1317 |
! |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1318 |
|
269 | 1319 |
checkForEvents |
1182 | 1320 |
"ST-80 compatibility: |
1321 |
check for any pending events and process them" |
|
1322 |
||
269 | 1323 |
(shown and:[windowGroup notNil]) ifTrue:[windowGroup processEvents]. |
1182 | 1324 |
|
1325 |
"Modified: 10.1.1997 / 19:46:06 / cg" |
|
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1326 |
! |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1327 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1328 |
displayOn:aGC |
1182 | 1329 |
"ST-80 compatibility: (re-)display myself" |
1330 |
||
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1331 |
self redraw |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1332 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1333 |
"Created: 4.6.1996 / 21:25:59 / cg" |
1182 | 1334 |
"Modified: 10.1.1997 / 19:46:58 / cg" |
1363 | 1335 |
! |
1336 |
||
1432 | 1337 |
displayPendingInvalidation |
1338 |
"dummy - for ST-80 compatibility" |
|
1339 |
||
1340 |
"Created: 6.3.1997 / 15:17:14 / cg" |
|
1341 |
"Modified: 6.3.1997 / 15:17:31 / cg" |
|
1342 |
! |
|
1343 |
||
1363 | 1344 |
isEnabled |
1345 |
"return true, if this view is enabled (i.e. accepts user interaction). |
|
1346 |
Most views are enabled - only a few (buttons, SelectionInList etc.) can |
|
1347 |
be disabled. |
|
1348 |
#isEnabled is ST-80's equivalent of #enabled" |
|
1349 |
||
1350 |
^ self enabled |
|
1413 | 1351 |
! |
1352 |
||
2061
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1353 |
isOpen |
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1354 |
"ST80 compatibility" |
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1355 |
|
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1356 |
^ realized |
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1357 |
|
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1358 |
|
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1359 |
! |
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1360 |
|
2159 | 1361 |
lookPreferences:prefs |
1362 |
"ignored - but required for some apps" |
|
1363 |
||
1364 |
"Created: / 19.6.1998 / 00:05:10 / cg" |
|
1365 |
! |
|
1366 |
||
1413 | 1367 |
newLayout:aLayoutObject |
1368 |
"set the layout object which controls my geometry. |
|
1369 |
ST80-compatibility." |
|
1370 |
||
1371 |
here layout:aLayoutObject. |
|
1372 |
||
1373 |
"Created: 3.3.1997 / 18:54:53 / cg" |
|
1427 | 1374 |
! |
1375 |
||
1376 |
refresh |
|
1377 |
self invalidate |
|
151 | 1378 |
! ! |
1379 |
||
2450 | 1380 |
!SimpleView methodsFor:'accessing'! |
1381 |
||
1382 |
keyboardProcessor |
|
1383 |
"return my keyboard processor" |
|
1384 |
||
1385 |
^ nil |
|
1386 |
||
1387 |
"Created: / 13.2.1999 / 10:31:39 / cg" |
|
1388 |
! ! |
|
1389 |
||
2549
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1390 |
!SimpleView methodsFor:'accessing-behavior'! |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1391 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1392 |
disable |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1393 |
"alternative method; redirected to basic mechanism" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1394 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1395 |
self enabled:false |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1396 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1397 |
"Modified: / 30.3.1999 / 14:47:30 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1398 |
"Created: / 30.3.1999 / 15:54:11 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1399 |
! |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1400 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1401 |
enable |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1402 |
"alternative method; redirected to basic mechanism" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1403 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1404 |
self enabled:true |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1405 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1406 |
"Modified: / 30.3.1999 / 14:47:22 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1407 |
"Created: / 30.3.1999 / 15:54:16 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1408 |
! |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1409 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1410 |
enabled |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1411 |
"views are enabled by default" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1412 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1413 |
^ true |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1414 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1415 |
"Modified: / 30.3.1999 / 16:27:57 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1416 |
! |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1417 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1418 |
enabled:bool |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1419 |
"this is the basic machanism to enable/disable a view. |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1420 |
empty in this class; may be redefined by subclasses" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1421 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1422 |
"Modified: / 30.3.1999 / 14:46:24 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1423 |
"Created: / 30.3.1999 / 15:54:21 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1424 |
! |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1425 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1426 |
isEnabled:aState |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1427 |
"ST-80 compatibility; set enabled state |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1428 |
" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1429 |
self enabled:aState |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1430 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1431 |
"Created: / 30.3.1999 / 15:54:29 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1432 |
! ! |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1433 |
|
269 | 1434 |
!SimpleView methodsFor:'accessing-bg & border'! |
1435 |
||
955 | 1436 |
allViewBackground:something |
1437 |
"set the viewBackground to something, a color, image or form, |
|
1438 |
in myself and recursively in all of my subviews" |
|
1439 |
||
1440 |
self viewBackground:something. |
|
1441 |
subViews notNil ifTrue:[ |
|
2721 | 1442 |
subViews do:[:v| |
1443 |
v allViewBackground:something |
|
1444 |
] |
|
955 | 1445 |
] |
1446 |
||
1447 |
"Created: 17.7.1996 / 14:59:08 / cg" |
|
1448 |
"Modified: 18.7.1996 / 13:34:26 / cg" |
|
1449 |
! |
|
1450 |
||
2158
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1451 |
backgroundColor |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1452 |
"return the background color of the contents - |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1453 |
here, (since there is no contents), the viewBackground is returned." |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1454 |
|
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1455 |
^ self viewBackground |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1456 |
|
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1457 |
"Modified: / 3.5.1997 / 10:28:04 / cg" |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1458 |
"Created: / 18.6.1998 / 15:59:36 / cg" |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1459 |
! |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1460 |
|
1726
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1461 |
backgroundColor:aColor |
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1462 |
"set the background color of the contents - |
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1463 |
here, (since there is no contents), the viewBackground is changed." |
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1464 |
|
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1465 |
self viewBackground:aColor |
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1466 |
|
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1467 |
"Created: 3.5.1997 / 10:26:49 / cg" |
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1468 |
"Modified: 3.5.1997 / 10:28:04 / cg" |
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1469 |
! |
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1470 |
|
269 | 1471 |
borderColor |
1472 |
"return my borderColor" |
|
1473 |
||
794 | 1474 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
2721 | 1475 |
^ superView borderColor |
794 | 1476 |
]. |
1477 |
||
269 | 1478 |
^ borderColor |
794 | 1479 |
|
1480 |
"Modified: 5.6.1996 / 14:11:44 / cg" |
|
269 | 1481 |
! |
1482 |
||
1483 |
borderColor:aColor |
|
1484 |
"set my borderColor" |
|
1485 |
||
794 | 1486 |
"/ backward compatibility |
1487 |
"/ superView will be renamed to container soon. |
|
1488 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
|
2721 | 1489 |
^ superView borderColor:aColor |
794 | 1490 |
]. |
1491 |
||
269 | 1492 |
(aColor ~~ borderColor) ifTrue:[ |
2721 | 1493 |
borderColor := aColor. |
1494 |
drawableId notNil ifTrue:[ |
|
1495 |
self setBorderColor |
|
1496 |
] |
|
269 | 1497 |
] |
794 | 1498 |
|
1499 |
"Modified: 5.6.1996 / 14:11:50 / cg" |
|
269 | 1500 |
! |
1501 |
||
1502 |
borderShape:aForm |
|
1503 |
"set the borderShape to aForm" |
|
1504 |
||
1903 | 1505 |
viewShape isNil ifTrue:[ |
2721 | 1506 |
viewShape := ViewShape new |
1903 | 1507 |
]. |
1508 |
viewShape borderShapeForm:aForm. |
|
269 | 1509 |
drawableId notNil ifTrue:[ |
2721 | 1510 |
device setWindowBorderShape:(aForm id) in:drawableId |
269 | 1511 |
] |
1903 | 1512 |
|
1513 |
"Modified: 18.9.1997 / 11:09:40 / cg" |
|
269 | 1514 |
! |
1515 |
||
1516 |
borderWidth |
|
1517 |
"return my borderWidth" |
|
1518 |
||
794 | 1519 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
2721 | 1520 |
^ superView borderWidth |
794 | 1521 |
]. |
1522 |
||
269 | 1523 |
^ borderWidth |
794 | 1524 |
|
1525 |
"Modified: 5.6.1996 / 14:11:57 / cg" |
|
269 | 1526 |
! |
1527 |
||
1528 |
borderWidth:aNumber |
|
1529 |
"set my borderWidth" |
|
1530 |
||
794 | 1531 |
"/ backward compatibility |
1532 |
"/ superView will be renamed to container soon. |
|
1533 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
|
2721 | 1534 |
^ superView borderWidth:aNumber |
794 | 1535 |
]. |
1536 |
||
269 | 1537 |
(aNumber ~~ borderWidth) ifTrue:[ |
2721 | 1538 |
borderWidth := aNumber. |
1539 |
drawableId notNil ifTrue:[ |
|
1540 |
device setWindowBorderWidth:aNumber in:drawableId |
|
1541 |
] |
|
269 | 1542 |
] |
794 | 1543 |
|
1544 |
"Modified: 5.6.1996 / 14:12:05 / cg" |
|
269 | 1545 |
! |
1546 |
||
2158
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1547 |
foregroundColor |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1548 |
"return the foreground color of the contents - |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1549 |
here, (since there is no contents), some default is returned." |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1550 |
|
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1551 |
^ Color black |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1552 |
|
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1553 |
"Modified: / 3.5.1997 / 10:28:04 / cg" |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1554 |
"Created: / 18.6.1998 / 16:57:33 / cg" |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1555 |
! |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1556 |
|
269 | 1557 |
level |
1558 |
"return my level relative to superView (3D)" |
|
1559 |
||
794 | 1560 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
2721 | 1561 |
^ superView level |
794 | 1562 |
]. |
1563 |
||
269 | 1564 |
^ level |
794 | 1565 |
|
1566 |
"Modified: 5.6.1996 / 14:12:10 / cg" |
|
269 | 1567 |
! |
1568 |
||
1569 |
level:aNumber |
|
1570 |
"set my level relative to superView (3D)" |
|
1571 |
||
1572 |
|oldMargin how| |
|
1573 |
||
794 | 1574 |
"/ backward compatibility |
1575 |
"/ superView will be renamed to container soon. |
|
1576 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
|
2721 | 1577 |
^ superView level:aNumber |
794 | 1578 |
]. |
1579 |
||
269 | 1580 |
(aNumber ~~ level and:[aNumber notNil]) ifTrue:[ |
2721 | 1581 |
self is3D ifTrue:[ |
1582 |
level := aNumber. |
|
1583 |
oldMargin := margin. |
|
1584 |
margin := level abs. |
|
1585 |
||
1586 |
realized ifTrue:[ |
|
1587 |
margin ~~ oldMargin ifTrue:[ |
|
1588 |
(margin > oldMargin) ifTrue:[ |
|
1589 |
how := #smaller |
|
1590 |
] ifFalse:[ |
|
1591 |
how := #larger |
|
1592 |
]. |
|
1593 |
self sizeChanged:how. |
|
1594 |
self setInnerClip. |
|
1595 |
]. |
|
1596 |
shown ifTrue:[ |
|
1597 |
margin ~~ oldMargin ifTrue:[ |
|
1598 |
self clear. |
|
1599 |
self redrawX:margin y:margin |
|
1600 |
width:width-(margin*2) |
|
1601 |
height:height-(margin*2) |
|
1602 |
]. |
|
1603 |
self redrawEdges. |
|
1604 |
] |
|
1605 |
] |
|
1606 |
] |
|
135 | 1607 |
] |
794 | 1608 |
|
1609 |
"Modified: 5.6.1996 / 14:12:17 / cg" |
|
269 | 1610 |
! |
1611 |
||
1612 |
lightColor:aColorOrImage |
|
1613 |
"set the color to be used for lighted edges (3D only)" |
|
1614 |
||
1615 |
lightColor := aColorOrImage |
|
1616 |
! |
|
1617 |
||
1618 |
margin |
|
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1619 |
"return my inner margin - this is usually the level, |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1620 |
but can be more for some views |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1621 |
(textViews which add more margin between the border and the text)" |
269 | 1622 |
|
1623 |
^ margin |
|
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1624 |
|
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1625 |
"Modified: 5.6.1996 / 14:37:54 / cg" |
269 | 1626 |
! |
1627 |
||
1628 |
shadowColor:aColorOrImage |
|
1629 |
"set the color to be used for shadowed edges (3D only)" |
|
1630 |
||
1631 |
shadowColor := aColorOrImage |
|
1632 |
! |
|
1633 |
||
1634 |
viewBackground:something |
|
1635 |
"set the viewBackground to something, a color, image or form. |
|
1636 |
If its a color and we run on a color display, also set shadow and light |
|
1637 |
colors - this means, that a red view will get light-red and dark-red |
|
1638 |
edges." |
|
1639 |
||
2584
55a405cec086
when lighting/darkening colors, take the average in the topLeft
Claus Gittinger <cg@exept.de>
parents:
2583
diff
changeset
|
1640 |
|avgColor| |
55a405cec086
when lighting/darkening colors, take the average in the topLeft
Claus Gittinger <cg@exept.de>
parents:
2583
diff
changeset
|
1641 |
|
1808 | 1642 |
"/ debug check only: |
1643 |
something isNil ifTrue:[ |
|
2721 | 1644 |
self halt:'invalid viewBackground argument'. |
1645 |
^ self |
|
1808 | 1646 |
]. |
1647 |
||
269 | 1648 |
something isColor ifTrue:[ |
2721 | 1649 |
device hasGrayscales ifTrue:[ |
1650 |
avgColor := something averageColorIn:(0@0 corner:7@7). |
|
1651 |
||
1652 |
shadowColor := avgColor darkened "on:device". |
|
1653 |
lightColor := avgColor lightened "on:device". |
|
1654 |
] |
|
135 | 1655 |
]. |
269 | 1656 |
super viewBackground:something |
749 | 1657 |
|
1808 | 1658 |
"Modified: 4.7.1997 / 20:09:22 / cg" |
269 | 1659 |
! |
1660 |
||
1661 |
viewShape:aForm |
|
1662 |
"set the viewShape to aForm" |
|
1663 |
||
1903 | 1664 |
viewShape isNil ifTrue:[ |
2721 | 1665 |
viewShape := ViewShape new |
1903 | 1666 |
]. |
1667 |
||
1668 |
viewShape viewShapeForm:aForm. |
|
269 | 1669 |
drawableId notNil ifTrue:[ |
2721 | 1670 |
device setWindowShape:(aForm id) in:drawableId |
135 | 1671 |
] |
1903 | 1672 |
|
1673 |
"Modified: 18.9.1997 / 11:11:04 / cg" |
|
269 | 1674 |
! ! |
1675 |
||
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1676 |
!SimpleView methodsFor:'accessing-contents'! |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1677 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1678 |
heightOfContents |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1679 |
"return the height of the contents in logical units |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1680 |
- defaults to views visible area here. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1681 |
This method MUST be redefined in all view classess which are |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1682 |
going to be scrolled AND show data which has different size than |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1683 |
the view. For example, a view showing A4-size documents should return |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1684 |
the number of vertical pixels such a document has on this device. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1685 |
A view showing a bitmap of height 1000 should return 1000. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1686 |
If not redefined, scrollbars have no way of knowing the actual size |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1687 |
of the contents being shown. This is called by scrollBars to compute |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1688 |
the relative height of the document vs. the views actual size. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1689 |
The value returned here must be based on a scale of 1, since users |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1690 |
of this will scale as appropriate." |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1691 |
|
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1692 |
^ (self innerHeight max:(self maxSubViewBottom)) max:self maxComponentBottom |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1693 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1694 |
"Modified: 26.5.1996 / 12:44:21 / cg" |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1695 |
! |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1696 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1697 |
widthOfContents |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1698 |
"return the width of the contents in logical units |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1699 |
- defaults to views visible area here. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1700 |
This method MUST be redefined in all view classess which are |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1701 |
going to be scrolled AND show data which has different size than |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1702 |
the view. For example, a view showing A4-size documents should return |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1703 |
the number of horizontal pixels such a document has on this device. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1704 |
A view showing a bitmap of width 500 should return 500. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1705 |
If not redefined, scrollbars have no way of knowing the actual size |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1706 |
of the contents being shown. This is called by scrollBars to compute |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1707 |
the relative width of the document vs. the views actual width. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1708 |
The value returned here must be based on a scale of 1, since users |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1709 |
of this will scale as appropriate." |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1710 |
|
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1711 |
^ (self innerWidth max:(self maxSubViewRight)) max:self maxComponentRight |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1712 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1713 |
"Modified: 26.5.1996 / 13:02:50 / cg" |
422
bb19798ffda1
fixed openAutonomous for new model opening setup
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
1714 |
! ! |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1715 |
|
269 | 1716 |
!SimpleView methodsFor:'accessing-dimensions'! |
1717 |
||
1718 |
allInset:aNumber |
|
1719 |
"set all insets; positive makes the view smaller, |
|
1720 |
negative makes it larger." |
|
1721 |
||
1722 |
insets isNil ifTrue:[ |
|
2721 | 1723 |
insets := Array new:4. |
269 | 1724 |
]. |
1725 |
insets atAllPut:aNumber. |
|
1726 |
||
1727 |
"force recomputation" |
|
1728 |
"/ drawableId isNil ifTrue:[ |
|
1729 |
"/ originChanged := true |
|
1730 |
"/ ] ifFalse:[ |
|
2721 | 1731 |
self containerChangedSize. |
269 | 1732 |
"/ ] |
964 | 1733 |
|
1734 |
"Modified: 19.7.1996 / 17:30:18 / cg" |
|
269 | 1735 |
! |
1736 |
||
1737 |
bottom |
|
1738 |
"return the y position of the actual bottom edge (in pixels)" |
|
1739 |
||
1740 |
^ top + height - 1 |
|
1741 |
! |
|
1742 |
||
1743 |
bottom:aNumber |
|
1744 |
"set the corners y position" |
|
1745 |
||
1746 |
self corner:(self corner x @ aNumber) |
|
1747 |
! |
|
1748 |
||
1749 |
bottomInset |
|
1750 |
"return the inset of the bottom edge; positive is to the top, |
|
1751 |
negative to the bottom" |
|
1752 |
||
1753 |
insets isNil ifTrue:[^ 0]. |
|
1754 |
^ insets at:4 |
|
1755 |
! |
|
1756 |
||
1757 |
bottomInset:aNumber |
|
1758 |
"set the inset of the bottom edge; |
|
1759 |
positive is to the top (view becomes smaller), |
|
1760 |
negative to the bottom (becomes larger)" |
|
1761 |
||
1762 |
insets isNil ifTrue:[ |
|
2721 | 1763 |
insets := Array with:0 with:0 with:0 with:0 |
269 | 1764 |
]. |
1765 |
insets at:4 put:aNumber. |
|
1766 |
||
1767 |
"force recomputation" |
|
1768 |
"/ drawableId isNil ifTrue:[ |
|
1769 |
"/ originChanged := true |
|
1770 |
"/ ] ifFalse:[ |
|
2721 | 1771 |
self containerChangedSize |
269 | 1772 |
"/ ] |
964 | 1773 |
|
1774 |
"Modified: 19.7.1996 / 17:30:22 / cg" |
|
269 | 1775 |
! |
1776 |
||
1777 |
center |
|
1778 |
"return the point at the center of the receiver (in pixels)" |
|
1779 |
||
1780 |
^ (left + (width // 2)) @ (top + (height // 2)) |
|
1781 |
! |
|
1782 |
||
1783 |
center:newCenter |
|
1784 |
"move the receiver so that newCenter, aPoint becomes the center point" |
|
1785 |
||
1786 |
self origin:(newCenter - ((width // 2) @ (height // 2))) |
|
1787 |
! |
|
1788 |
||
1789 |
computeCorner |
|
1790 |
"compute my corner; if I have a layoutObject, |
|
1791 |
relative origins or blocks to evaluate, compute it now .. |
|
1792 |
Blocks may return relative values or nil; nil means: take current value. |
|
1793 |
Returns the corner point in device coordinates (pixels)." |
|
1794 |
||
1795 |
|org newCorner newExt x y| |
|
1796 |
||
1797 |
" |
|
1798 |
slowly migrating to use layoutObjects ... |
|
1799 |
" |
|
1800 |
layout notNil ifTrue:[ |
|
2721 | 1801 |
^ (layout rectangleRelativeTo:(superView viewRectangle) |
1802 |
preferred:(self preferredBounds)) corner rounded |
|
269 | 1803 |
]. |
1804 |
||
1805 |
(cornerRule notNil) ifTrue:[ |
|
2721 | 1806 |
newCorner := cornerRule value. |
1807 |
" |
|
1808 |
allow return of relative values ... |
|
1809 |
" |
|
1810 |
x := newCorner x. |
|
1811 |
y := newCorner y. |
|
1812 |
x isNil ifTrue:[x := self corner x]. |
|
1813 |
y isNil ifTrue:[y := self corner y]. |
|
1814 |
((x isInteger not) or:[y isInteger not]) ifTrue:[ |
|
1815 |
newCorner := self cornerFromRelativeCorner:x@y |
|
1816 |
] |
|
269 | 1817 |
] ifFalse:[ |
2721 | 1818 |
(relativeCorner notNil) ifTrue:[ |
1819 |
newCorner := self cornerFromRelativeCorner:relativeCorner |
|
1820 |
] ifFalse:[ |
|
1821 |
org := self computeOrigin. |
|
1822 |
(extentRule notNil) ifTrue:[ |
|
1823 |
newExt := extentRule value |
|
1824 |
] ifFalse:[ |
|
1825 |
(relativeExtent notNil) ifTrue:[ |
|
1826 |
newExt := self extentFromRelativeExtent:relativeExtent |
|
1827 |
] ifFalse:[ |
|
1828 |
newExt := self extent. |
|
1829 |
] |
|
1830 |
]. |
|
1831 |
newCorner := org + newExt |
|
1832 |
] |
|
269 | 1833 |
]. |
1834 |
^ newCorner |
|
1389 | 1835 |
|
1836 |
"Modified: 28.2.1997 / 10:33:39 / cg" |
|
269 | 1837 |
! |
1838 |
||
1839 |
computeExtent |
|
1840 |
"compute my extent; if I have a layoutObject, a relative extent |
|
1841 |
or blocks to evaluate, compute it now .. |
|
1842 |
There is one catch here, if the dimension was defined |
|
1843 |
by origin/corner, compute them here and take that value. |
|
1844 |
I.e. origin/corner definition has precedence over extent definition. |
|
1845 |
Returns the extent in device coordinates (pixels)." |
|
1846 |
||
1847 |
|newOrg newExt newCorner x y| |
|
1848 |
||
1849 |
" |
|
1850 |
slowly migrating to use layoutObjects ... |
|
1851 |
" |
|
1852 |
layout notNil ifTrue:[ |
|
2721 | 1853 |
^ (layout rectangleRelativeTo:(superView viewRectangle) |
1854 |
preferred:(self preferredBounds)) extent rounded |
|
135 | 1855 |
]. |
269 | 1856 |
|
1857 |
(cornerRule notNil) ifTrue:[ |
|
2721 | 1858 |
newCorner := cornerRule value. |
1859 |
" |
|
1860 |
allow return of relative values ... |
|
1861 |
" |
|
1862 |
x := newCorner x. |
|
1863 |
y := newCorner y. |
|
1864 |
x isNil ifTrue:[x := self corner x]. |
|
1865 |
y isNil ifTrue:[y := self corner y]. |
|
1866 |
((x isInteger not) or:[y isInteger not]) ifTrue:[ |
|
1867 |
newCorner := self cornerFromRelativeCorner:x@y |
|
1868 |
] |
|
269 | 1869 |
] ifFalse:[ |
2721 | 1870 |
(relativeCorner notNil) ifTrue:[ |
1871 |
newCorner := self cornerFromRelativeCorner:relativeCorner |
|
1872 |
] ifFalse:[ |
|
1873 |
(extentRule notNil) ifTrue:[ |
|
1874 |
newExt := extentRule value. |
|
1875 |
" |
|
1876 |
allow return of relative values ... |
|
1877 |
" |
|
1878 |
x := newExt x. |
|
1879 |
y := newExt y. |
|
1880 |
x isNil ifTrue:[x := width]. |
|
1881 |
y isNil ifTrue:[y := height]. |
|
1882 |
((x isInteger not) or:[y isInteger not]) ifTrue:[ |
|
1883 |
newExt := self extentFromRelativeExtent:x@y |
|
1884 |
] |
|
1885 |
] ifFalse:[ |
|
1886 |
(relativeExtent notNil) ifTrue:[ |
|
1887 |
newExt := self extentFromRelativeExtent:relativeExtent |
|
1888 |
] ifFalse:[ |
|
1889 |
newExt := (width @ height). |
|
1890 |
]. |
|
1891 |
]. |
|
1892 |
]. |
|
269 | 1893 |
]. |
1894 |
||
1895 |
newCorner notNil ifTrue:[ |
|
2721 | 1896 |
newOrg := self computeOrigin. |
1897 |
^ newCorner - newOrg. |
|
269 | 1898 |
]. |
1899 |
^ newExt. |
|
1900 |
! |
|
1901 |
||
1902 |
computeOrigin |
|
1903 |
"compute my origin; if I have a layoutObject, a relative origin |
|
1904 |
or blocks to evaluate, compute it now .. |
|
1905 |
Blocks may return relative values or nil; nil means: take current value. |
|
1906 |
Returns the origin point in device coordinates (pixels)." |
|
1907 |
||
1908 |
|newOrg x y| |
|
1909 |
||
1910 |
" |
|
1911 |
slowly migrating to use layoutObjects ... |
|
1912 |
" |
|
1913 |
layout notNil ifTrue:[ |
|
2721 | 1914 |
^ (layout rectangleRelativeTo:(superView viewRectangle) |
1915 |
preferred:(self preferredBounds)) origin rounded |
|
269 | 1916 |
]. |
1917 |
||
1918 |
(originRule notNil) ifTrue:[ |
|
2721 | 1919 |
newOrg := originRule value. |
1920 |
" |
|
1921 |
allow return of relative values ... |
|
1922 |
" |
|
1923 |
x := newOrg x. |
|
1924 |
y := newOrg y. |
|
1925 |
x isNil ifTrue:[x := self origin x]. |
|
1926 |
y isNil ifTrue:[y := self origin y]. |
|
1927 |
((x isInteger not) or:[y isInteger not]) ifTrue:[ |
|
1928 |
newOrg := self originFromRelativeOrigin:x@y. |
|
1929 |
] |
|
269 | 1930 |
] ifFalse:[ |
2721 | 1931 |
(relativeOrigin notNil) ifTrue:[ |
1932 |
newOrg := self originFromRelativeOrigin:relativeOrigin. |
|
1933 |
] ifFalse:[ |
|
1934 |
^ (left @ top). |
|
1935 |
]. |
|
269 | 1936 |
]. |
1937 |
^ newOrg |
|
1938 |
! |
|
1939 |
||
1940 |
corner |
|
1941 |
"return the lower right corner-point (in pixels)" |
|
1942 |
||
1943 |
"/ ^ (left + width "- 1") @ (top + height "- 1") |
|
1944 |
^ (left + width - 1) @ (top + height - 1) |
|
1945 |
||
1946 |
"Modified: 31.8.1995 / 16:51:40 / claus" |
|
1947 |
! |
|
1948 |
||
1949 |
corner:corner |
|
1950 |
"set the views corner; |
|
1951 |
the corner argument may be: |
|
2721 | 1952 |
a point |
1953 |
where integer fields mean 'pixel-values' |
|
1954 |
and float values mean 'relative-to-superview' |
|
1955 |
and nil means 'take current value'; |
|
269 | 1956 |
or a block returning a point which is interpreted as above. |
1957 |
Please migrate to use layoutObjects, if possible." |
|
1958 |
||
1959 |
|x y pixelCorner c| |
|
1960 |
||
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1961 |
explicitExtent := true. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1962 |
|
269 | 1963 |
corner isBlock ifTrue:[ |
2721 | 1964 |
cornerRule := corner. |
1965 |
drawableId notNil ifTrue:[ |
|
1966 |
pixelCorner := corner value |
|
1967 |
] ifFalse:[ |
|
1968 |
extentChanged := true |
|
1969 |
] |
|
269 | 1970 |
] ifFalse:[ |
2721 | 1971 |
x := corner x. |
1972 |
y := corner y. |
|
1973 |
x isNil ifTrue:[x := self corner x]. |
|
1974 |
y isNil ifTrue:[y := self corner y]. |
|
1975 |
c := x @ y. |
|
1976 |
((x isInteger not) or:[y isInteger not]) ifTrue:[ |
|
1977 |
relativeCorner := c. |
|
1978 |
pixelCorner := self cornerFromRelativeCorner. |
|
1979 |
pixelCorner isNil ifTrue:[ |
|
1980 |
extentChanged := true |
|
1981 |
] |
|
1982 |
] ifFalse:[ |
|
1983 |
pixelCorner := c |
|
1984 |
] |
|
269 | 1985 |
]. |
1986 |
||
1987 |
pixelCorner notNil ifTrue:[ |
|
2721 | 1988 |
self pixelCorner:pixelCorner |
269 | 1989 |
] |
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1990 |
|
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1991 |
"Modified: 15.7.1996 / 09:51:06 / cg" |
269 | 1992 |
! |
1993 |
||
1327 | 1994 |
cornerRule |
1995 |
"return the corner block - non public; this will vanish without notice" |
|
1996 |
||
1997 |
^ cornerRule |
|
1998 |
! |
|
1999 |
||
269 | 2000 |
extent:extent |
2001 |
"set the views extent; |
|
2002 |
extent may be: |
|
2721 | 2003 |
a point |
2004 |
where integer fields mean 'pixel-values' |
|
2005 |
and float values mean 'relative-to-superview' |
|
2006 |
and nil means 'leave current value'; |
|
269 | 2007 |
or a block returning a point which is interpreted as above. |
2008 |
Be careful when using relative extents: rounding errors may |
|
2009 |
accumulate. Better use origin/corner. |
|
1048
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2010 |
Best: migrate to use layour objects. |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2011 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2012 |
Notice: this sets the views explicitExtent flag, which prevents it normally |
2721 | 2013 |
from resizing itself to its preferredExtent. |
2014 |
See initialExtent: for a variation." |
|
269 | 2015 |
|
2016 |
|w h pixelExtent e| |
|
2017 |
||
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2018 |
explicitExtent := true. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2019 |
|
269 | 2020 |
extent isBlock ifTrue:[ |
2721 | 2021 |
extentRule := extent. |
2022 |
drawableId notNil ifTrue:[ |
|
2023 |
pixelExtent := extent value |
|
2024 |
] ifFalse:[ |
|
2025 |
extentChanged := true |
|
2026 |
] |
|
135 | 2027 |
] ifFalse:[ |
2721 | 2028 |
w := extent x. |
2029 |
h := extent y. |
|
2030 |
w isNil ifTrue:[w := width]. |
|
2031 |
h isNil ifTrue:[h := height]. |
|
2032 |
e := w@h. |
|
2033 |
((w isInteger not) or:[h isInteger not]) ifTrue:[ |
|
2034 |
relativeExtent := e. |
|
2035 |
pixelExtent := self extentFromRelativeExtent. |
|
2036 |
pixelExtent isNil ifTrue:[ |
|
2037 |
extentChanged := true |
|
2038 |
] |
|
2039 |
] ifFalse:[ |
|
2040 |
relativeExtent := nil. |
|
2041 |
pixelExtent := e |
|
2042 |
] |
|
269 | 2043 |
]. |
2044 |
pixelExtent notNil ifTrue:[ |
|
2721 | 2045 |
self pixelExtent:pixelExtent |
269 | 2046 |
] |
573
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2047 |
|
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2048 |
"Modified: 15.7.1996 / 09:51:21 / cg" |
269 | 2049 |
! |
2050 |
||
1327 | 2051 |
extentRule |
2052 |
"return the extent block - non public; this will vanish without notice" |
|
2053 |
||
2054 |
^ extentRule |
|
2055 |
! |
|
2056 |
||
269 | 2057 |
geometryLayout |
2058 |
"this method will vanish, as soon as all implementations of |
|
2059 |
#layout: are removed ... |
|
2060 |
(conflict for example in label>>layout:). |
|
2061 |
DO NOT USE #geometryLayout: in your code; it will be removed without |
|
2062 |
notice." |
|
2063 |
||
2064 |
^ here layout |
|
2065 |
! |
|
2066 |
||
2067 |
geometryLayout:aLayoutObject |
|
2068 |
"this method will vanish, as soon as all implementations of |
|
2069 |
#layout: are removed ... |
|
2070 |
(conflict for example in label>>layout:). |
|
2071 |
DO NOT USE #geometryLayout: in your code; it will be removed without |
|
2072 |
notice." |
|
2073 |
||
2074 |
here layout:aLayoutObject |
|
2075 |
! |
|
2076 |
||
2077 |
height:aNumber |
|
2078 |
"set the views height in pixels" |
|
2079 |
||
2080 |
self extent:(width @ aNumber) |
|
2081 |
! |
|
2082 |
||
2083 |
heightIncludingBorder |
|
2084 |
"return my height including border |
|
2085 |
(this is my height as seen from the outside view; |
|
2086 |
while #height returns the height as seen by myself)" |
|
2087 |
||
2088 |
^ height + (2*borderWidth) |
|
2089 |
! |
|
2090 |
||
2091 |
horizontalInset:aNumber |
|
2092 |
"set the insets of the left/right edge; |
|
2093 |
positive makes it smaller, negative makes it larger" |
|
2094 |
||
2095 |
insets isNil ifTrue:[ |
|
2721 | 2096 |
insets := Array with:0 with:0 with:0 with:0 |
135 | 2097 |
]. |
269 | 2098 |
insets at:1 put:aNumber. |
2099 |
insets at:3 put:aNumber. |
|
2100 |
||
2101 |
"force recomputation" |
|
2102 |
"/ drawableId isNil ifTrue:[ |
|
2103 |
"/ originChanged := true |
|
2104 |
"/ ] ifFalse:[ |
|
2721 | 2105 |
self containerChangedSize. |
269 | 2106 |
"/ ] |
964 | 2107 |
|
2108 |
"Modified: 19.7.1996 / 17:30:25 / cg" |
|
269 | 2109 |
! |
2110 |
||
1048
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2111 |
initialExtent:extent |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2112 |
"set the views extent, but dont change its explicitExtent setting. |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2113 |
a variant of #extent." |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2114 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2115 |
|expl| |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2116 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2117 |
expl := explicitExtent. |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2118 |
self extent:extent. |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2119 |
explicitExtent := expl |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2120 |
! |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2121 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2122 |
initialHeight:aNumber |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2123 |
"set the views height in pixels, but dont change its explicitExtent setting" |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2124 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2125 |
self initialExtent:(width @ aNumber) |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2126 |
! |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2127 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2128 |
initialWidth:aNumber |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2129 |
"set the views width in pixels, but dont change its explicitExtent setting" |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2130 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2131 |
self initialExtent:(aNumber @ height) |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2132 |
! |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2133 |
|
269 | 2134 |
innerHeight |
2135 |
"return the height of the view minus any 3D-shadow-borders" |
|
2136 |
||
2137 |
(margin == 0) ifTrue:[^ height]. |
|
2138 |
^ height - (2 * margin) |
|
2139 |
! |
|
2140 |
||
369 | 2141 |
innerHeight:pixels |
2142 |
"set the height of the view plus any 3D-shadow-borders. |
|
2143 |
This does not work with a relative size." |
|
2144 |
||
2145 |
^ self height:( pixels + (margin + self innerVerticalMargin * 2) ). |
|
2146 |
! |
|
2147 |
||
2148 |
innerHorizontalMargin |
|
2149 |
"return any additional inner margin (i.e. contents margin). |
|
2150 |
This should be redefined by views which do add margins |
|
2151 |
(for example: textViews do this)" |
|
2152 |
||
2153 |
^ 0 |
|
2154 |
! |
|
2155 |
||
2156 |
innerVerticalMargin |
|
2157 |
"return any additional inner margin (i.e. contents margin). |
|
2158 |
This should be redefined by views which do add margins |
|
2159 |
(for example: textViews do this)" |
|
2160 |
||
2161 |
^ 0 |
|
2162 |
! |
|
2163 |
||
269 | 2164 |
innerWidth |
2165 |
"return the width of the view minus any 3D-shadow-borders" |
|
2166 |
||
2167 |
(level == 0) ifTrue:[^ width]. |
|
2168 |
^ width - (2 * margin) |
|
2169 |
! |
|
2170 |
||
369 | 2171 |
innerWidth:pixels |
2172 |
"set the width of the view plus any 3D-shadow-borders. |
|
2173 |
This does not work with a relative size." |
|
2174 |
||
2175 |
^ self width:( pixels + (margin + self innerHorizontalMargin * 2) ). |
|
2176 |
! |
|
2177 |
||
269 | 2178 |
inset:aNumber |
2179 |
"set all insets; positive makes the view smaller, |
|
2180 |
negative makes it larger." |
|
2181 |
||
2182 |
self allInset:aNumber |
|
2183 |
! |
|
2184 |
||
2185 |
layout |
|
2186 |
"return the layout object which controls my geometry. |
|
2187 |
Currently, this is nil in most cases, and my geometry is |
|
2188 |
defined by relativeOrigin/relativeCorner/relativeExtent, |
|
2189 |
originRule/extentRule/cornerRule and inset. |
|
2190 |
Applications should be changed to use layoutObjects, |
|
2191 |
since the above listed instance variables will vanish." |
|
2192 |
||
2193 |
^ layout |
|
2194 |
! |
|
2195 |
||
2196 |
layout:aLayoutObject |
|
2197 |
"set the layout object which controls my geometry. |
|
2198 |
Currently, this is almost nowhere used but views will be |
|
2199 |
incrementally changed to use this new geometry management." |
|
2200 |
||
2201 |
layout := aLayoutObject. |
|
2202 |
superView isNil ifTrue:[ |
|
2721 | 2203 |
originChanged := cornerChanged := extentChanged := true |
269 | 2204 |
] ifFalse:[ |
2721 | 2205 |
self containerChangedSize. |
269 | 2206 |
] |
2207 |
||
2208 |
"Modified: 19.9.1995 / 16:17:25 / claus" |
|
964 | 2209 |
"Modified: 19.7.1996 / 17:30:27 / cg" |
269 | 2210 |
! |
2211 |
||
2212 |
left |
|
2213 |
"return the x position of the left border (in pixels)" |
|
2214 |
||
2215 |
^ left |
|
2216 |
! |
|
2217 |
||
2218 |
left:aNumber |
|
2219 |
"set the x position" |
|
2220 |
||
2221 |
self origin:(aNumber @ top) |
|
2222 |
! |
|
2223 |
||
2224 |
left:newLeft top:newTop width:newWidth height:newHeight |
|
2225 |
"another way of specifying origin and extent" |
|
2226 |
||
2227 |
self origin:(newLeft @ newTop) extent:(newWidth @ newHeight) |
|
2228 |
! |
|
2229 |
||
2230 |
leftInset |
|
2231 |
"return the inset of the left edge; positive is to the right, |
|
2232 |
negative to the left" |
|
2233 |
||
2234 |
insets isNil ifTrue:[^ 0]. |
|
2235 |
^ insets at:1 |
|
2236 |
! |
|
2237 |
||
2238 |
leftInset:aNumber |
|
2239 |
"set the inset of the left edge; |
|
2240 |
positive is to the right (view becomes smaller), |
|
2241 |
negative to the left (becomes larger)" |
|
2242 |
||
2243 |
insets isNil ifTrue:[ |
|
2721 | 2244 |
insets := Array with:0 with:0 with:0 with:0 |
269 | 2245 |
]. |
2246 |
insets at:1 put:aNumber. |
|
2247 |
||
2248 |
"force recomputation" |
|
2249 |
"/ drawableId isNil ifTrue:[ |
|
2250 |
"/ originChanged := true |
|
2251 |
"/ ] ifFalse:[ |
|
2721 | 2252 |
self containerChangedSize. |
269 | 2253 |
"/ ] |
964 | 2254 |
|
2255 |
"Modified: 19.7.1996 / 17:30:30 / cg" |
|
269 | 2256 |
! |
2257 |
||
2258 |
makeFullyVisible |
|
2259 |
"make sure, that the view is fully visible by shifting it |
|
2260 |
into the visible screen area if nescessary. |
|
2261 |
This method will be moved to StandardSystemView ..." |
|
2262 |
||
2263 |
|devBot devRight newTop newLeft| |
|
2264 |
||
2265 |
newTop := top. |
|
2266 |
newLeft := left. |
|
2267 |
||
1703 | 2268 |
((top + height) > (devBot := device usableHeight)) ifTrue:[ |
2721 | 2269 |
newTop := devBot - height |
269 | 2270 |
]. |
1703 | 2271 |
((left + width) > (devRight := device usableWidth)) ifTrue:[ |
2721 | 2272 |
newLeft := devRight - width |
269 | 2273 |
]. |
2274 |
(newTop < 0) ifTrue:[ |
|
2721 | 2275 |
newTop := 0. |
269 | 2276 |
]. |
2277 |
(newLeft < 0) ifTrue:[ |
|
2721 | 2278 |
newLeft := 0 |
269 | 2279 |
]. |
2280 |
((newTop ~~ top) or:[newLeft ~~ left]) ifTrue:[ |
|
2721 | 2281 |
self origin:newLeft @ newTop |
269 | 2282 |
] |
2283 |
! |
|
2284 |
||
2127 | 2285 |
maxExtent |
2103
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2286 |
"for compatibility with StdSysView" |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2287 |
|
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2288 |
^ nil |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2289 |
! |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2290 |
|
2127 | 2291 |
minExtent |
2103
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2292 |
"for compatibility with StdSysView" |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2293 |
|
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2294 |
^ nil |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2295 |
! |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2296 |
|
269 | 2297 |
origin |
2298 |
"return the origin (in pixels)" |
|
2299 |
||
2300 |
^ left@top |
|
2301 |
! |
|
2302 |
||
2303 |
origin:origin |
|
2304 |
"set the views origin; |
|
2305 |
origin may be: |
|
2721 | 2306 |
a point |
2307 |
where integer fields mean 'pixel-values' |
|
2308 |
and float values mean 'relative-to-superview' |
|
2309 |
and nil means 'take current value'; |
|
269 | 2310 |
or a block returning a point which is interpreted as above. |
2311 |
Please migrate to use layout objects." |
|
2312 |
||
2313 |
|newLeft newTop pixelOrigin o| |
|
2314 |
||
2315 |
origin isBlock ifTrue:[ |
|
2721 | 2316 |
originRule := origin. |
2317 |
drawableId notNil ifTrue:[ |
|
2318 |
pixelOrigin := origin value |
|
2319 |
] ifFalse:[ |
|
2320 |
originChanged := true |
|
2321 |
] |
|
269 | 2322 |
] ifFalse:[ |
2721 | 2323 |
o := origin. |
2324 |
newLeft := origin x. |
|
2325 |
newTop := origin y. |
|
2326 |
newLeft isNil ifTrue:[newLeft := left]. |
|
2327 |
newTop isNil ifTrue:[newTop := top]. |
|
2328 |
o := newLeft @ newTop. |
|
2329 |
((newLeft isInteger not) or:[newTop isInteger not]) ifTrue:[ |
|
2330 |
relativeOrigin := o. |
|
2331 |
pixelOrigin := self originFromRelativeOrigin. |
|
2332 |
pixelOrigin isNil ifTrue:[ |
|
2333 |
originChanged := true |
|
2334 |
] |
|
2335 |
] ifFalse:[ |
|
2336 |
relativeOrigin := nil. |
|
2337 |
pixelOrigin := o |
|
2338 |
] |
|
269 | 2339 |
]. |
2340 |
pixelOrigin notNil ifTrue:[ |
|
2721 | 2341 |
self pixelOrigin:pixelOrigin |
269 | 2342 |
]. |
573
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2343 |
|
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2344 |
"Modified: 19.4.1996 / 15:12:36 / cg" |
269 | 2345 |
! |
2346 |
||
2347 |
origin:origin corner:corner |
|
2348 |
"set both origin and extent" |
|
2349 |
||
2350 |
|newLeft newTop newRight newBot| |
|
2351 |
||
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2352 |
explicitExtent := true. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2353 |
|
269 | 2354 |
"do it as one operation if possible" |
2355 |
||
2356 |
origin isBlock ifFalse:[ |
|
2721 | 2357 |
corner isBlock ifFalse:[ |
2358 |
newLeft := origin x. |
|
2359 |
newLeft isInteger ifTrue:[ |
|
2360 |
newTop := origin y. |
|
2361 |
newTop isInteger ifTrue:[ |
|
2362 |
newRight := corner x. |
|
2363 |
newRight isInteger ifTrue:[ |
|
2364 |
newBot := corner y. |
|
2365 |
newBot isInteger ifTrue:[ |
|
2366 |
self pixelOrigin:origin corner:corner |
|
2367 |
] |
|
2368 |
] |
|
2369 |
] |
|
2370 |
] |
|
2371 |
] |
|
135 | 2372 |
]. |
269 | 2373 |
self origin:origin. |
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2374 |
self corner:corner |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2375 |
|
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2376 |
"Modified: 15.7.1996 / 09:52:43 / cg" |
269 | 2377 |
! |
2378 |
||
2379 |
origin:origin extent:extent |
|
2380 |
"set both origin and extent" |
|
2381 |
||
2382 |
|newLeft newTop newWidth newHeight| |
|
2383 |
||
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2384 |
explicitExtent := true. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2385 |
|
269 | 2386 |
"do it as one operation if possible" |
2387 |
||
2388 |
origin isBlock ifFalse:[ |
|
2721 | 2389 |
extent isBlock ifFalse:[ |
2390 |
newLeft := origin x. |
|
2391 |
newLeft isInteger ifTrue:[ |
|
2392 |
newTop := origin y. |
|
2393 |
newTop isInteger ifTrue:[ |
|
2394 |
newWidth := extent x. |
|
2395 |
newWidth isInteger ifTrue:[ |
|
2396 |
newHeight := extent y. |
|
2397 |
newHeight isInteger ifTrue:[ |
|
2398 |
self pixelOrigin:origin extent:extent |
|
2399 |
] |
|
2400 |
] |
|
2401 |
] |
|
2402 |
] |
|
2403 |
] |
|
269 | 2404 |
]. |
2405 |
self extent:extent. |
|
2406 |
self origin:origin |
|
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2407 |
|
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2408 |
"Modified: 15.7.1996 / 09:52:39 / cg" |
269 | 2409 |
! |
2410 |
||
2411 |
originRelativeTo:aView |
|
2412 |
"return the origin (in pixels) relative to a superView, |
|
2413 |
or relative to the rootView (if the aView argument is nil). |
|
2414 |
If the receiver is nonNil and not a subview of aView, return nil." |
|
2415 |
||
2416 |
|currentView |
|
2414 | 2417 |
bw "{ Class: SmallInteger }" |
269 | 2418 |
sumX "{ Class: SmallInteger }" |
2419 |
sumY "{ Class: SmallInteger }" | |
|
2420 |
||
2421 |
currentView := self. |
|
2422 |
sumX := 0. |
|
2423 |
sumY := 0. |
|
2424 |
[currentView notNil] whileTrue:[ |
|
2721 | 2425 |
(currentView == aView) ifTrue:[ |
2426 |
^ (sumX @ sumY) |
|
2427 |
]. |
|
2428 |
bw := currentView borderWidth. |
|
2429 |
sumX := sumX + (currentView left) + bw. |
|
2430 |
sumY := sumY + (currentView top) + bw. |
|
2431 |
currentView := currentView superView |
|
269 | 2432 |
]. |
729
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
2433 |
(aView isNil or:[aView == device rootView]) ifTrue:[ |
2721 | 2434 |
"return relative to screen ..." |
2435 |
^ (sumX @ sumY) |
|
269 | 2436 |
]. |
2437 |
^ nil |
|
2438 |
||
2439 |
" |
|
2440 |
|top sub1 sub2| |
|
2441 |
||
2442 |
top := StandardSystemView new. |
|
2443 |
top extent:200@200. |
|
2444 |
sub1 := View origin:0.2 @ 0.2 corner:0.8 @ 0.8 in:top. |
|
2445 |
sub2 := Button origin:0.3 @ 0.3 corner:0.7 @ 0.7 in:sub1. |
|
2446 |
top openAndWait. |
|
697 | 2447 |
Transcript show:'button in top:'; showCR:(sub2 originRelativeTo:top). |
2448 |
Transcript show:'button on screen:'; showCR:(sub2 originRelativeTo:nil). |
|
269 | 2449 |
" |
2171
df6af7cc7a62
fixed #originRelativeTo: when borderWidth ~~ 0
Claus Gittinger <cg@exept.de>
parents:
2167
diff
changeset
|
2450 |
|
2414 | 2451 |
"Modified: / 5.12.1998 / 14:30:57 / cg" |
269 | 2452 |
! |
2453 |
||
1327 | 2454 |
originRule |
2455 |
"return the origin block - non public; this will vanish without notice" |
|
2456 |
||
2457 |
^ originRule |
|
2458 |
! |
|
2459 |
||
763 | 2460 |
preferredExtent:anExtentPoint |
2461 |
"override the views own preferredExtent computation, |
|
2462 |
and let it prefer the size given by the argument." |
|
2463 |
||
2464 |
preferredExtent := anExtentPoint. |
|
1038
fb193cba16b6
#preferredExtent: no longer changes the extent
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
2465 |
|
fb193cba16b6
#preferredExtent: no longer changes the extent
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
2466 |
"Modified: 22.8.1996 / 13:41:47 / cg" |
763 | 2467 |
! |
2468 |
||
269 | 2469 |
relativeCorner |
2470 |
"return the relative corner or nil" |
|
2471 |
||
2472 |
^ relativeCorner |
|
2473 |
! |
|
2474 |
||
2475 |
relativeCorner:aPoint |
|
2476 |
"set the relative corner" |
|
2477 |
||
2478 |
relativeCorner := aPoint |
|
2479 |
! |
|
2480 |
||
2481 |
relativeExtent |
|
2482 |
"return the relative extent or nil" |
|
2483 |
||
2484 |
^ relativeExtent |
|
2485 |
! |
|
2486 |
||
2487 |
relativeExtent:aPoint |
|
2488 |
"set the relative extent" |
|
2489 |
||
2490 |
relativeExtent := aPoint |
|
2491 |
! |
|
2492 |
||
2493 |
relativeOrigin |
|
2494 |
"return the relative origin or nil" |
|
2495 |
||
2496 |
^ relativeOrigin |
|
2497 |
! |
|
2498 |
||
2499 |
relativeOrigin:aPoint |
|
2500 |
"set the relative origin" |
|
2501 |
||
2502 |
relativeOrigin := aPoint |
|
2503 |
! |
|
2504 |
||
2505 |
right |
|
2506 |
"return the x position of the right edge (in pixels)" |
|
2507 |
||
2508 |
^ left + width - 1 |
|
2509 |
||
2510 |
"Modified: 31.8.1995 / 19:31:10 / claus" |
|
2511 |
! |
|
2512 |
||
2513 |
right:aNumber |
|
2514 |
"set the corners x position" |
|
2515 |
||
2516 |
self corner:(aNumber @ self corner y) |
|
2517 |
! |
|
2518 |
||
2519 |
rightInset |
|
2520 |
"return the inset of the right edge; positive is to the left, |
|
2521 |
negative to the right" |
|
2522 |
||
2523 |
insets isNil ifTrue:[^ 0]. |
|
2524 |
^ insets at:3 |
|
2525 |
! |
|
2526 |
||
2527 |
rightInset:aNumber |
|
2528 |
"set the inset of the right edge; |
|
2529 |
positive is to the left (view becomes smaller), |
|
2530 |
negative to the right (becomes larger)" |
|
2531 |
||
2532 |
insets isNil ifTrue:[ |
|
2721 | 2533 |
insets := Array with:0 with:0 with:0 with:0 |
269 | 2534 |
]. |
2535 |
insets at:3 put:aNumber. |
|
2536 |
||
2537 |
"force recomputation" |
|
2538 |
"/ drawableId isNil ifTrue:[ |
|
2539 |
"/ originChanged := true |
|
2540 |
"/ ] ifFalse:[ |
|
2721 | 2541 |
self containerChangedSize. |
135 | 2542 |
"/ ] |
964 | 2543 |
|
2544 |
"Modified: 19.7.1996 / 17:30:32 / cg" |
|
269 | 2545 |
! |
2546 |
||
2547 |
sizeFixed:aBoolean |
|
2548 |
"set/clear the fix-size attribute, if supported by concrete subclasses. |
|
2549 |
Views which want to resize themselfes as appropriate to their contents |
|
2550 |
should cease to do so and take their current size if sizeFixed is set to |
|
2551 |
true. Currently, only supported by Labels. |
|
2552 |
This does NOT prevent the window manager from resizing the view, |
|
2553 |
instead it tell the view to NOT resize ITSELF. |
|
2554 |
Added here to provide a common protocol for all views." |
|
2555 |
||
2556 |
^ self |
|
2557 |
! |
|
2558 |
||
2559 |
top |
|
2560 |
"return the y position of the top border" |
|
2561 |
||
2562 |
^ top |
|
2563 |
! |
|
2564 |
||
2565 |
top:aNumber |
|
2566 |
"set the y position" |
|
2567 |
||
2568 |
self origin:(left @ aNumber) |
|
2569 |
! |
|
2570 |
||
2571 |
topInset |
|
2572 |
"return the inset of the top edge; positive is to the bottom, |
|
2573 |
negative to the top" |
|
2574 |
||
2575 |
insets isNil ifTrue:[^ 0]. |
|
2576 |
^ insets at:2 |
|
2577 |
! |
|
2578 |
||
2579 |
topInset:aNumber |
|
2580 |
"set the inset of the top edge; |
|
2581 |
positive is to the bottom (view becomes smaller), |
|
2582 |
negative to the top (becomes larger)" |
|
2583 |
||
2584 |
insets isNil ifTrue:[ |
|
2721 | 2585 |
insets := Array with:0 with:0 with:0 with:0 |
269 | 2586 |
]. |
2587 |
insets at:2 put:aNumber. |
|
2588 |
||
2589 |
"force recomputation" |
|
2590 |
"/ drawableId isNil ifTrue:[ |
|
2591 |
"/ originChanged := true |
|
2592 |
"/ ] ifFalse:[ |
|
2721 | 2593 |
self containerChangedSize. |
269 | 2594 |
"/ ] |
964 | 2595 |
|
2596 |
"Modified: 19.7.1996 / 17:30:45 / cg" |
|
269 | 2597 |
! |
2598 |
||
2599 |
verticalInset:aNumber |
|
2600 |
"set the insets of the top/bottom edge; |
|
2601 |
positive makes it smaller, negative makes it larger" |
|
2602 |
||
2603 |
insets isNil ifTrue:[ |
|
2721 | 2604 |
insets := Array with:0 with:0 with:0 with:0 |
269 | 2605 |
]. |
2606 |
insets at:2 put:aNumber. |
|
2607 |
insets at:4 put:aNumber. |
|
2608 |
||
2609 |
"force recomputation" |
|
2610 |
"/ drawableId isNil ifTrue:[ |
|
2611 |
"/ originChanged := true |
|
2612 |
"/ ] ifFalse:[ |
|
2721 | 2613 |
self containerChangedSize. |
269 | 2614 |
"/ ] |
964 | 2615 |
|
2616 |
"Modified: 19.7.1996 / 17:30:50 / cg" |
|
269 | 2617 |
! |
2618 |
||
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2619 |
viewRectangle |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2620 |
"return the inside area. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2621 |
This is used by relative sized subviews and layout-computations |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2622 |
to base relative coordinates on. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2623 |
For most views, the value returned here (actual extent minus any |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2624 |
margins required for 3D levels) is ok. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2625 |
However, views which want some extra area around (for example: FramedBox) |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2626 |
may redefine this method to return a rectangle without this area |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2627 |
(thus, a relative sized subviews coordinates will be based on this net area) " |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2628 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2629 |
|m2| |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2630 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2631 |
m2 := margin + margin. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2632 |
^ (margin @ margin) extent:((width - m2) @ (height - m2)) |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2633 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2634 |
"Modified: 8.2.1996 / 20:05:00 / cg" |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2635 |
! |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2636 |
|
269 | 2637 |
width:aNumber |
2638 |
"set the views width in pixels" |
|
2639 |
||
2640 |
self extent:(aNumber @ height) |
|
2641 |
! |
|
2642 |
||
2643 |
widthIncludingBorder |
|
2644 |
"return my width including border |
|
2645 |
(this is my width as seen from the outside view; |
|
2646 |
while #width returns the width as seen by myself)" |
|
2647 |
||
2648 |
^ width + (2*borderWidth) |
|
2649 |
! ! |
|
2650 |
||
2651 |
!SimpleView methodsFor:'accessing-hierarchy'! |
|
2652 |
||
756 | 2653 |
components |
2654 |
"return the collection of non-view components" |
|
2655 |
||
2656 |
^ components |
|
2657 |
||
2658 |
"Created: 28.5.1996 / 23:59:37 / cg" |
|
2659 |
! |
|
2660 |
||
1182 | 2661 |
container |
2662 |
"return my container" |
|
2663 |
||
2664 |
^ superView |
|
2665 |
||
2666 |
"Created: 5.6.1996 / 01:08:36 / cg" |
|
2667 |
"Modified: 10.1.1997 / 19:47:59 / cg" |
|
2668 |
! |
|
2669 |
||
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2670 |
container:aContainer |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2671 |
"set my container (i.e. superView) to be aContainer" |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2672 |
|
1296 | 2673 |
(superView notNil and:[superView ~~ aContainer]) ifTrue:[ |
2721 | 2674 |
"/ actually, this is worth an exception |
2675 |
('View [warning]: ' , self printString , ' already has a container') errorPrintCR. |
|
2676 |
superView removeComponent:self. |
|
1296 | 2677 |
]. |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2678 |
superView := aContainer |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2679 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2680 |
"Created: 9.5.1996 / 00:40:56 / cg" |
1297 | 2681 |
"Modified: 29.1.1997 / 17:37:38 / cg" |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2682 |
! |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2683 |
|
269 | 2684 |
lower |
2685 |
"bring to back" |
|
2686 |
||
2687 |
drawableId isNil ifTrue:[self create]. |
|
2688 |
device lowerWindow:drawableId |
|
2689 |
||
2690 |
" |
|
2691 |
Transcript topView lower |
|
2692 |
" |
|
2693 |
! |
|
2694 |
||
2695 |
raise |
|
2696 |
"bring to front" |
|
2697 |
||
2698 |
drawableId isNil ifTrue:[self create]. |
|
2699 |
device raiseWindow:drawableId |
|
2700 |
||
2701 |
" |
|
2702 |
Transcript topView raise |
|
2703 |
" |
|
2704 |
! |
|
2705 |
||
2706 |
subViews |
|
2707 |
"return the collection of subviews" |
|
2708 |
||
2709 |
^ subViews |
|
2710 |
! |
|
2711 |
||
2712 |
subViews:aListOfViews |
|
2713 |
"set the collection of subviews" |
|
2714 |
||
2715 |
subViews := aListOfViews. |
|
135 | 2716 |
subViews notNil ifTrue:[ |
2721 | 2717 |
subViews do:[:view | |
2718 |
view container:self |
|
2719 |
] |
|
135 | 2720 |
] |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2721 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2722 |
"Modified: 9.5.1996 / 00:42:28 / cg" |
135 | 2723 |
! |
2724 |
||
269 | 2725 |
superView |
2726 |
"return my superView" |
|
2727 |
||
2728 |
^ superView |
|
2729 |
! |
|
2730 |
||
2731 |
superView:aView |
|
2732 |
"set my superView to be aView" |
|
2733 |
||
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2734 |
self obsoleteMethodWarning:'use #container:'. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2735 |
self container:aView. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2736 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2737 |
"Modified: 9.5.1996 / 00:46:24 / cg" |
269 | 2738 |
! |
2739 |
||
662
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
2740 |
topComponent |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
2741 |
"return the topmost component - thats the one with no superview. |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
2742 |
For ST-80 compatibility." |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
2743 |
|
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
2744 |
^ self topView |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
2745 |
|
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
2746 |
"Modified: 9.5.1996 / 01:40:24 / cg" |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
2747 |
! |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
2748 |
|
269 | 2749 |
topView |
2750 |
"return the topView - thats the one with no superview" |
|
2751 |
||
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2752 |
|v next| |
269 | 2753 |
|
2754 |
v := self. |
|
2755 |
[v notNil] whileTrue:[ |
|
2721 | 2756 |
(next := v container) isNil ifTrue:[^ v]. |
2757 |
v := next |
|
135 | 2758 |
]. |
2759 |
||
269 | 2760 |
^ nil |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2761 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2762 |
"Modified: 5.6.1996 / 01:09:12 / cg" |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2763 |
! |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2764 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2765 |
view |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2766 |
"return my view - for real views, thats the receiver. |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2767 |
For wrappers, its the real view that contains it" |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2768 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2769 |
^ self |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2770 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2771 |
"Created: 4.6.1996 / 21:32:11 / cg" |
269 | 2772 |
! ! |
2773 |
||
2774 |
!SimpleView methodsFor:'accessing-menus'! |
|
2775 |
||
2776 |
menuHolder |
|
2777 |
"who has the menu ? |
|
2778 |
By default, I have it." |
|
2779 |
||
2780 |
^ self |
|
2781 |
! |
|
2782 |
||
2783 |
menuMessage |
|
2784 |
"Return the symbol sent to myself to aquire the menu" |
|
2785 |
||
2786 |
^ #middleButtonMenu |
|
2787 |
! |
|
2788 |
||
2789 |
menuPerformer |
|
2790 |
"who should perform the menu actions ? |
|
2791 |
By default, I do it." |
|
2792 |
||
2793 |
^ self |
|
2794 |
! |
|
2795 |
||
2796 |
yellowButtonMenu |
|
2797 |
"actually, this should be called 'middleButtonMenu'. |
|
2798 |
But for ST-80 compatibility .... |
|
2799 |
This method will vanish, once all views have controllers |
|
2800 |
associated with them; for now, duplicate some code also found in |
|
2801 |
controller." |
|
2802 |
||
2803 |
|sym menuHolder| |
|
2804 |
||
2805 |
"/ middleButtonMenu notNil ifTrue:[ |
|
2806 |
"/ "/ |
|
2807 |
"/ "/ has been assigned a static middleButtonMenu |
|
2808 |
"/ "/ (or a cached menu) |
|
2809 |
"/ "/ |
|
2810 |
"/ ^ middleButtonMenu |
|
2811 |
"/ ]. |
|
2812 |
||
2813 |
menuHolder := self menuHolder. |
|
2814 |
||
2815 |
menuHolder notNil ifTrue:[ |
|
2721 | 2816 |
sym := self menuMessage. |
2817 |
sym notNil ifTrue:[ |
|
2818 |
" |
|
2819 |
mhmh - for backward compatibility, try to ask |
|
2820 |
the model first, then use the views menu. |
|
2821 |
" |
|
2822 |
(menuHolder respondsTo:sym) ifFalse:[ |
|
2823 |
(self respondsTo:sym) ifTrue:[ |
|
2824 |
menuHolder := self |
|
2825 |
] |
|
2826 |
]. |
|
2827 |
" |
|
2828 |
ask the menuHolder for the menu |
|
2829 |
" |
|
2830 |
^ menuHolder perform:sym. |
|
2831 |
]. |
|
269 | 2832 |
]. |
2833 |
||
2834 |
^ nil |
|
135 | 2835 |
! ! |
2836 |
||
2837 |
!SimpleView methodsFor:'accessing-misc'! |
|
2838 |
||
2839 |
bitGravity |
|
2840 |
"return the bitGravity - thats the direction where the contents will move |
|
2841 |
when the the view is resized." |
|
2842 |
||
2843 |
^ bitGravity |
|
2844 |
! |
|
2845 |
||
2846 |
bitGravity:gravity |
|
2847 |
"set the bitGravity - thats the direction where the contents will move |
|
2848 |
when the view is resized." |
|
2849 |
||
2850 |
bitGravity ~~ gravity ifTrue:[ |
|
2721 | 2851 |
bitGravity := gravity. |
2852 |
drawableId notNil ifTrue:[ |
|
2853 |
device setBitGravity:gravity in:drawableId |
|
2854 |
] |
|
135 | 2855 |
] |
2856 |
! |
|
2857 |
||
737 | 2858 |
clippingRectangle:aRectangle |
153 | 2859 |
"set the clipping rectangle for drawing (in logical coordinates); |
754 | 2860 |
a nil argument turns off clipping (i.e. whole view is drawable). |
153 | 2861 |
Redefined to care for any margin." |
2862 |
||
2863 |
|x y w h| |
|
2864 |
||
2865 |
aRectangle isNil ifTrue:[ |
|
2721 | 2866 |
clipRect isNil ifTrue:[^ self]. |
2867 |
gcId notNil ifTrue:[ |
|
2868 |
device noClipIn:drawableId gc:gcId |
|
2869 |
] |
|
153 | 2870 |
] ifFalse:[ |
2721 | 2871 |
clipRect notNil ifTrue:[ |
2872 |
(clipRect = aRectangle) ifTrue:[^ self] |
|
2873 |
]. |
|
2874 |
gcId notNil ifTrue:[ |
|
2875 |
x := aRectangle left. |
|
2876 |
y := aRectangle top. |
|
2877 |
w := aRectangle width. |
|
2878 |
h := aRectangle height. |
|
2879 |
transformation notNil ifTrue:[ |
|
2880 |
x := transformation applyToX:x. |
|
2881 |
y := transformation applyToY:y. |
|
2882 |
w := transformation applyScaleX:w. |
|
2883 |
h := transformation applyScaleY:h. |
|
2884 |
]. |
|
2885 |
(x isMemberOf:SmallInteger) ifFalse:[ |
|
2886 |
w := w + (x - x truncated). |
|
2887 |
x := x truncated |
|
2888 |
]. |
|
2889 |
(y isMemberOf:SmallInteger) ifFalse:[ |
|
2890 |
h := h + (y - y truncated). |
|
2891 |
y := y truncated |
|
2892 |
]. |
|
2893 |
(w isMemberOf:SmallInteger) ifFalse:[ |
|
2894 |
w := w truncated + 1 |
|
2895 |
]. |
|
2896 |
(h isMemberOf:SmallInteger) ifFalse:[ |
|
2897 |
h := h truncated + 1 |
|
2898 |
]. |
|
2899 |
x < margin ifTrue:[ |
|
2900 |
x := margin. |
|
2901 |
]. |
|
2902 |
y < margin ifTrue:[ |
|
2903 |
y := margin. |
|
2904 |
]. |
|
2905 |
x + w - 1 >= (width-margin) ifTrue:[ |
|
2906 |
w := width - margin - x |
|
2907 |
]. |
|
2908 |
y + h - 1 >= (height-margin) ifTrue:[ |
|
2909 |
h := height - margin - y |
|
2910 |
]. |
|
2911 |
device setClipX:x y:y width:w height:h in:drawableId gc:gcId |
|
2912 |
] |
|
153 | 2913 |
]. |
2914 |
clipRect := aRectangle |
|
737 | 2915 |
|
2916 |
"Created: 28.5.1996 / 19:50:03 / cg" |
|
754 | 2917 |
"Modified: 28.5.1996 / 22:32:15 / cg" |
153 | 2918 |
! |
2919 |
||
2920 |
fullName |
|
2921 |
"return my full name to be used for resource-access" |
|
2922 |
||
2923 |
superView notNil ifTrue:[ |
|
2721 | 2924 |
^ superView fullName , '.' , name |
153 | 2925 |
]. |
2926 |
^ name |
|
2927 |
! |
|
2928 |
||
269 | 2929 |
name |
2930 |
"return my name component to be used for resource-access" |
|
2931 |
||
2932 |
^ name |
|
2933 |
! |
|
2934 |
||
2935 |
name:aString |
|
2936 |
"set my name component to be used for resource-access" |
|
2937 |
||
2938 |
name := aString |
|
2939 |
! |
|
2940 |
||
153 | 2941 |
processName |
2942 |
"return a string to be shown in the process monitor" |
|
2943 |
||
2944 |
^ self name |
|
269 | 2945 |
! |
2946 |
||
2947 |
styleSheet |
|
2948 |
"return the styleSheet. This is set at early view-creation time, |
|
2949 |
from the defaultStyleSheet which is valid at that time. |
|
2950 |
It is not affected by later defaultStyle changes" |
|
2951 |
||
2952 |
^ styleSheet |
|
2953 |
||
2954 |
"Created: 10.9.1995 / 11:02:20 / claus" |
|
2955 |
! |
|
2956 |
||
2957 |
viewGravity |
|
2958 |
"return the viewGravity - thats the direction where the view will move |
|
2959 |
when the superView is resized." |
|
2960 |
||
2961 |
^ viewGravity |
|
2962 |
! |
|
2963 |
||
2964 |
viewGravity:gravity |
|
2965 |
"set the viewGravity - thats the direction where the view will move |
|
2966 |
when the superView is resized." |
|
2967 |
||
2968 |
viewGravity ~~ gravity ifTrue:[ |
|
2721 | 2969 |
viewGravity := gravity. |
2970 |
drawableId notNil ifTrue:[ |
|
2971 |
device setWindowGravity:gravity in:drawableId |
|
2972 |
] |
|
269 | 2973 |
] |
140 | 2974 |
! ! |
2975 |
||
2976 |
!SimpleView methodsFor:'accessing-mvc'! |
|
2977 |
||
1187
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
2978 |
application |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
2979 |
"return the application, under which this view was opened, |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
2980 |
or nil, if there is no application" |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
2981 |
|
1751 | 2982 |
superView notNil ifTrue:[ |
2721 | 2983 |
^ superView application |
1187
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
2984 |
]. |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
2985 |
^ nil |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
2986 |
|
1190 | 2987 |
"Modified: 13.1.1997 / 20:30:31 / cg" |
1187
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
2988 |
! |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
2989 |
|
269 | 2990 |
aspect:aspectSymbol |
2991 |
"ST-80 style updating: If a views aspectSymbol is nonNil, |
|
2992 |
it will respond to changes of this aspect from the model. |
|
2993 |
Alias for aspectMessage: for ST-80 compatibility." |
|
2994 |
||
2995 |
self aspectMessage:aspectSymbol |
|
2996 |
! |
|
2997 |
||
140 | 2998 |
controller |
1943 | 2999 |
"return the controller. For views which implement the controller |
3000 |
functionality themself, return the receiver itself" |
|
3001 |
||
3002 |
^ controller ? self |
|
3003 |
||
3004 |
"Modified: / 31.10.1997 / 19:58:10 / cg" |
|
140 | 3005 |
! |
3006 |
||
3007 |
controller:aController |
|
1943 | 3008 |
"set the controller - thats the one handling user events" |
140 | 3009 |
|
3010 |
controller := aController. |
|
3011 |
controller notNil ifTrue:[ |
|
2721 | 3012 |
controller view:self. |
135 | 3013 |
] |
1943 | 3014 |
|
3015 |
"Modified: / 31.10.1997 / 19:58:33 / cg" |
|
135 | 3016 |
! |
3017 |
||
140 | 3018 |
model |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3019 |
"return nil - simpleViews have no model (only providing geometric)" |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3020 |
|
135 | 3021 |
^ nil |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3022 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3023 |
"Modified: 5.6.1996 / 14:17:29 / cg" |
135 | 3024 |
! |
3025 |
||
1182 | 3026 |
sensor |
3027 |
"return the views sensor" |
|
3028 |
||
3029 |
windowGroup notNil ifTrue:[ |
|
2721 | 3030 |
^ windowGroup sensor. |
1182 | 3031 |
]. |
3032 |
^ nil |
|
3033 |
||
3034 |
"Modified: 10.1.1997 / 19:47:13 / cg" |
|
3035 |
! |
|
3036 |
||
954 | 3037 |
setController:aController |
3038 |
"set the controller but do not affect the model/view releationship" |
|
3039 |
||
3040 |
controller := aController. |
|
3041 |
||
3042 |
"Created: 18.7.1996 / 11:43:40 / cg" |
|
3043 |
! |
|
3044 |
||
1874
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3045 |
setWindowGroup:aGroup |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3046 |
"set the window group." |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3047 |
|
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3048 |
windowGroup := aGroup |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3049 |
|
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3050 |
"Created: 19.8.1997 / 17:58:35 / cg" |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3051 |
! |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3052 |
|
269 | 3053 |
windowGroup |
3054 |
"return the window group. For old style views, return nil" |
|
3055 |
||
3056 |
^ windowGroup |
|
3057 |
! |
|
3058 |
||
1874
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3059 |
windowGroup:newGroup |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3060 |
"set the window group of myself and recursively of any children. |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3061 |
If I am currently in a group, remove me from it it." |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3062 |
|
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3063 |
windowGroup notNil ifTrue:[ |
2721 | 3064 |
windowGroup removeView:self. |
3065 |
windowGroup := nil |
|
1874
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3066 |
]. |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3067 |
windowGroup := newGroup. |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3068 |
newGroup notNil ifTrue:[ |
2721 | 3069 |
newGroup addView:self. |
1877 | 3070 |
|
3071 |
]. |
|
1874
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3072 |
subViews notNil ifTrue:[ |
2721 | 3073 |
subViews do:[:aSubview | |
3074 |
aSubview windowGroup:newGroup |
|
3075 |
] |
|
1874
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3076 |
]. |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3077 |
|
1877 | 3078 |
"Modified: 20.8.1997 / 13:26:37 / cg" |
269 | 3079 |
! ! |
3080 |
||
3081 |
!SimpleView methodsFor:'accessing-transformation'! |
|
3082 |
||
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3083 |
maxComponentBottom |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3084 |
"return the maximum of all components bottom" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3085 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3086 |
components isNil ifTrue:[^ 0]. |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3087 |
^ components inject:0 into:[:maxSoFar :sub |
2721 | 3088 |
| (sub bottom) max:maxSoFar]. |
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3089 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3090 |
"Created: 26.5.1996 / 12:44:05 / cg" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3091 |
"Modified: 26.5.1996 / 12:56:39 / cg" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3092 |
! |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3093 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3094 |
maxComponentRight |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3095 |
"return the maximum of all components rights" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3096 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3097 |
components isNil ifTrue:[^ 0]. |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3098 |
^ components inject:0 into:[:maxSoFar :sub |
2721 | 3099 |
| (sub right) max:maxSoFar]. |
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3100 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3101 |
"Modified: 26.5.1996 / 12:56:39 / cg" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3102 |
"Created: 26.5.1996 / 13:02:19 / cg" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3103 |
! |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3104 |
|
269 | 3105 |
maxSubViewBottom |
3106 |
"/ subViews isNil ifTrue:[^ 0]. |
|
3107 |
"/ ^ subViews inject:0 into:[:maxSoFar :sub | (sub top + sub height) max:maxSoFar]. |
|
3108 |
^ 0 |
|
3109 |
! |
|
3110 |
||
3111 |
maxSubViewRight |
|
3112 |
"/ subViews isNil ifTrue:[^ 0]. |
|
3113 |
"/ ^ subViews inject:0 into:[:maxSoFar :sub | (sub left + sub width) max:maxSoFar]. |
|
3114 |
^ 0 |
|
3115 |
! |
|
3116 |
||
3117 |
scale:aPoint |
|
3118 |
"set the scale factor of the transformation" |
|
3119 |
||
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
3120 |
super scale:aPoint. |
269 | 3121 |
self computeInnerClip |
3122 |
! |
|
3123 |
||
3124 |
setViewOrigin:aPoint |
|
3125 |
"set the viewOrigin - i.e. virtually scroll without redrawing" |
|
3126 |
||
3127 |
|p| |
|
3128 |
||
3129 |
p := aPoint negated. |
|
3130 |
transformation isNil ifTrue:[ |
|
2721 | 3131 |
transformation := WindowingTransformation scale:1 translation:p |
269 | 3132 |
] ifFalse:[ |
2721 | 3133 |
transformation translation:p |
269 | 3134 |
]. |
3135 |
clipRect notNil ifTrue:[ |
|
2721 | 3136 |
self setInnerClip. |
269 | 3137 |
]. |
3138 |
! |
|
3139 |
||
3140 |
viewOrigin |
|
3141 |
"return the viewOrigin; thats the coordinate of the contents |
|
3142 |
which is shown topLeft in the view |
|
3143 |
(i.e. the origin of the visible part of the contents)." |
|
3144 |
||
3145 |
transformation isNil ifTrue:[ |
|
2721 | 3146 |
^ 0@0 |
269 | 3147 |
]. |
3148 |
^ transformation translation negated |
|
3149 |
! |
|
3150 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3151 |
visibleArea |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3152 |
"return the rectangle that contains the visible part |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3153 |
of the view in user coordinates." |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3154 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3155 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3156 |
transformation isNil ifTrue:[ |
2721 | 3157 |
^ Rectangle left:0 top:0 width:width height:height. |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3158 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3159 |
^ Rectangle origin:(transformation translation negated) |
2721 | 3160 |
extent:((width @ height) scaledBy:(transformation scale)). |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3161 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3162 |
"Created: 12.7.1996 / 11:57:04 / stefan" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3163 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3164 |
|
269 | 3165 |
xOriginOfContents |
3166 |
"return the x coordinate of the viewOrigin in pixels; |
|
3167 |
used by scrollBars to compute thumb position within the document." |
|
3168 |
||
3169 |
^ self viewOrigin x |
|
3170 |
! |
|
3171 |
||
3172 |
yOriginOfContents |
|
3173 |
"return the y coordinate of the viewOrigin in pixels; |
|
3174 |
used by scrollBars to compute thumb position within the document." |
|
3175 |
||
3176 |
^ self viewOrigin y |
|
3177 |
! ! |
|
3178 |
||
370 | 3179 |
!SimpleView methodsFor:'accessing-visibility'! |
3180 |
||
3181 |
beInvisible |
|
1524 | 3182 |
"make the view invisible; if my container is visible, |
3183 |
change visibility immediately; |
|
3184 |
otherwise, arrange for the receiver to be not realized, |
|
3185 |
when the container is made visible." |
|
3186 |
||
370 | 3187 |
self hiddenOnRealize:true. |
3188 |
realized ifTrue:[ |
|
2721 | 3189 |
(superView isNil "/ I am a topView |
3190 |
or:[superView realized]) "/ superview already shown |
|
3191 |
ifTrue:[ |
|
3192 |
self unmap |
|
3193 |
] |
|
370 | 3194 |
] |
3195 |
||
1524 | 3196 |
"Modified: 3.4.1997 / 21:20:40 / cg" |
370 | 3197 |
! |
3198 |
||
3199 |
beVisible |
|
1524 | 3200 |
"make the view visible; if my container is already visible, |
3201 |
change visibility immediately; otherwise, arrange for the receiver |
|
3202 |
to be made visible when the container is made visible. |
|
3203 |
Notice, that the command may not be sent immediately to the display, |
|
3204 |
and that ST/X considers the view to be still invisible until a |
|
1754 | 3205 |
visibility event arrives from the display. |
3206 |
Thus, the view may remain logically invisible |
|
1524 | 3207 |
for a while. (see #beVisibleNow for more on this)" |
3208 |
||
370 | 3209 |
self hiddenOnRealize:false. |
3210 |
realized ifFalse:[ |
|
2721 | 3211 |
superView isNil "/ I am a topView |
3212 |
ifTrue:[ |
|
3213 |
drawableId isNil ifTrue:[ |
|
3214 |
self realize. |
|
3215 |
] ifFalse:[ |
|
3216 |
self remap. |
|
3217 |
]. |
|
3218 |
] ifFalse:[ |
|
3219 |
superView realized "/ superview already shown |
|
3220 |
ifTrue:[ |
|
3221 |
self realize |
|
3222 |
] |
|
3223 |
] |
|
370 | 3224 |
] |
3225 |
||
3226 |
" |
|
3227 |
|top topFrame check list| |
|
3228 |
||
3229 |
top := StandardSystemView new. |
|
3230 |
top extent:150@400. |
|
3231 |
topFrame := VerticalPanelView origin:0.0@0.0 corner:1.0@0.4 in:top. |
|
3232 |
topFrame horizontalLayout:#leftSpace. |
|
3233 |
||
3234 |
topFrame add:(check := CheckBox label:'hidden'). |
|
3235 |
check pressAction:[list beInvisible]. |
|
3236 |
check releaseAction:[list beVisible]. |
|
3237 |
||
3238 |
list := ScrollableView for:SelectionInListView. |
|
3239 |
list origin:0.0@0.4 corner:1.0@1.0. |
|
3240 |
list list:#('foo' 'bar' 'baz'). |
|
3241 |
top add:list. |
|
3242 |
||
3243 |
check turnOn. |
|
3244 |
list beInvisible. |
|
3245 |
||
3246 |
top open |
|
3247 |
" |
|
3248 |
||
1981
0c3b8ef42df8
Take care of views with nil visibleID in #beVisible
Stefan Vogel <sv@exept.de>
parents:
1960
diff
changeset
|
3249 |
"Created: / 22.9.1995 / 15:50:33 / claus" |
0c3b8ef42df8
Take care of views with nil visibleID in #beVisible
Stefan Vogel <sv@exept.de>
parents:
1960
diff
changeset
|
3250 |
"Modified: / 17.6.1997 / 11:23:00 / cg" |
0c3b8ef42df8
Take care of views with nil visibleID in #beVisible
Stefan Vogel <sv@exept.de>
parents:
1960
diff
changeset
|
3251 |
"Modified: / 14.1.1998 / 17:33:15 / stefan" |
1524 | 3252 |
! |
3253 |
||
3254 |
beVisibleNow |
|
3255 |
"make the view visible immediately. |
|
3256 |
In contrast to #beVisible, this waits until the view is really |
|
3257 |
visible." |
|
3258 |
||
3259 |
self beVisible. |
|
3260 |
device sync. |
|
2721 | 3261 |
"/ realized := true. |
3262 |
"/ shown := true. |
|
1524 | 3263 |
|
3264 |
"Created: 3.4.1997 / 21:23:28 / cg" |
|
370 | 3265 |
! |
3266 |
||
3267 |
hidden |
|
3268 |
"return true, if the view does not want to be realized |
|
3269 |
automatically when superview is realized" |
|
3270 |
||
3271 |
self obsoleteMethodWarning:'use #isHiddenOnRealize'. |
|
3272 |
^ hiddenOnRealize |
|
3273 |
||
1754 | 3274 |
"Modified: 17.6.1997 / 11:19:55 / cg" |
370 | 3275 |
! |
3276 |
||
3277 |
hidden:aBoolean |
|
3278 |
"if the argument is true, the receiver view will not |
|
3279 |
be realized automatically when superview is realized" |
|
3280 |
||
3281 |
self obsoleteMethodWarning:'use #beVisible / #beInvisible'. |
|
3282 |
hiddenOnRealize := aBoolean |
|
3283 |
||
3284 |
"Modified: 17.1.1996 / 11:45:06 / cg" |
|
3285 |
! |
|
3286 |
||
3287 |
hiddenOnRealize:aBoolean |
|
3288 |
"if the argument is true, the receiver view will not |
|
1754 | 3289 |
be mapped (i.e. shown) automatically when the superview is realized. |
370 | 3290 |
The hiddenOnRealize flag is useful to create views which are |
1524 | 3291 |
to be made visible conditionally or later. |
3292 |
For ST-80 compatibility, please use #beVisible / #beInvisible." |
|
370 | 3293 |
|
3294 |
hiddenOnRealize := aBoolean |
|
1524 | 3295 |
|
1754 | 3296 |
"Modified: 17.6.1997 / 11:23:26 / cg" |
3297 |
! |
|
3298 |
||
3299 |
isHiddenOnRealize |
|
370 | 3300 |
"return true, if the receiver will NOT be mapped when |
3301 |
realized. False otherwise. |
|
3302 |
The hiddenOnRealize flag is useful to create views which are |
|
3303 |
to be made visible conditionally or later." |
|
3304 |
||
3305 |
^ hiddenOnRealize |
|
1754 | 3306 |
|
3307 |
"Created: 17.6.1997 / 11:21:42 / cg" |
|
370 | 3308 |
! |
3309 |
||
1938
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3310 |
isVisible:aBoolean |
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3311 |
"make the view visible or invisible" |
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3312 |
|
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3313 |
aBoolean ifTrue:[ |
2721 | 3314 |
self beVisible |
1938
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3315 |
] ifFalse:[ |
2721 | 3316 |
self beInvisible |
1938
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3317 |
] |
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3318 |
|
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3319 |
"Created: / 27.10.1997 / 04:23:04 / cg" |
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3320 |
! |
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3321 |
|
370 | 3322 |
shown |
3323 |
"return true if the view is shown; false if not. |
|
3324 |
Shown means: the view is mapped and is not completely covered." |
|
3325 |
||
3326 |
^ shown |
|
3327 |
! ! |
|
3328 |
||
269 | 3329 |
!SimpleView methodsFor:'adding & removing components'! |
3330 |
||
3331 |
add:aComponent |
|
3332 |
"add a component (either a view or gadget) to the collection of |
|
3333 |
subComponents." |
|
3334 |
||
3335 |
self addComponent:aComponent |
|
3336 |
! |
|
3337 |
||
1335 | 3338 |
add:aComponent at:anOrigin |
3339 |
"for ST-80 compatibility. |
|
3340 |
add a component at some origin" |
|
3341 |
||
3342 |
|l comp| |
|
3343 |
||
1614 | 3344 |
comp := aComponent. |
3345 |
||
3346 |
"/ (comp isWrapper not |
|
3347 |
"/ or:[comp isLayoutWrapper not]) ifTrue:[ |
|
3348 |
"/ comp := LayoutWrapper on:comp |
|
3349 |
"/ ]. |
|
1335 | 3350 |
|
3351 |
l := anOrigin asLayout. |
|
3352 |
comp layout:l. |
|
3353 |
||
3354 |
self addComponent:comp |
|
3355 |
||
1614 | 3356 |
"Modified: 18.4.1997 / 20:00:20 / cg" |
1335 | 3357 |
! |
3358 |
||
1617
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3359 |
add:aComponentOrCollection in:aRectangleOrLayoutFrame |
269 | 3360 |
"for ST-80 compatibility. |
3361 |
add a component in some frame; the argument may be either a rectangle |
|
3362 |
with relative coordinates, or an instance of LayoutFrame, specifying |
|
3363 |
both relative coordinates and the insets." |
|
3364 |
||
1617
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3365 |
|l wrapper| |
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3366 |
|
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3367 |
aComponentOrCollection isCollection ifTrue:[ |
2721 | 3368 |
wrapper := View new. |
3369 |
aComponentOrCollection do:[:aComponent | |
|
3370 |
wrapper add:aComponent |
|
3371 |
] |
|
1617
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3372 |
] ifFalse:[ |
2721 | 3373 |
wrapper := aComponentOrCollection |
1617
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3374 |
]. |
269 | 3375 |
|
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
3376 |
l := aRectangleOrLayoutFrame asLayout. |
269 | 3377 |
|
3378 |
"/ will soon be replaced by: |
|
3379 |
"/ aComponent layout:l. |
|
1617
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3380 |
wrapper geometryLayout:l. |
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3381 |
|
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3382 |
self addComponent:wrapper. |
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3383 |
|
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3384 |
^ wrapper |
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3385 |
|
1756 | 3386 |
"Modified: 17.6.1997 / 18:03:34 / cg" |
269 | 3387 |
! |
3388 |
||
3389 |
addComponent:aComponent |
|
3390 |
"components (i.e. gadgets or lightweight views) are being prepared. |
|
3391 |
Dont use this right now for non-views" |
|
3392 |
||
3393 |
aComponent isView ifTrue:[ |
|
2721 | 3394 |
self addSubView:aComponent |
269 | 3395 |
] ifFalse:[ |
2721 | 3396 |
components isNil ifTrue:[ |
3397 |
components := OrderedCollection new |
|
3398 |
]. |
|
3399 |
components add:aComponent. |
|
3400 |
aComponent container:self. |
|
3401 |
shown ifTrue:[ |
|
3402 |
aComponent displayOn:self |
|
3403 |
] |
|
269 | 3404 |
] |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3405 |
|
683
ecc5d13f22b2
redraw new components if already visible
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
3406 |
"Modified: 13.5.1996 / 21:19:51 / cg" |
269 | 3407 |
! |
3408 |
||
3409 |
addSubView:newView |
|
3410 |
"add a view to the collection of subviews" |
|
3411 |
||
3412 |
subViews isNil ifTrue:[ |
|
2721 | 3413 |
subViews := OrderedCollection with:newView |
269 | 3414 |
] ifFalse:[ |
2721 | 3415 |
subViews add:newView. |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3416 |
]. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3417 |
self setContainerIn:newView. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3418 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3419 |
"Modified: 9.5.1996 / 00:47:16 / cg" |
269 | 3420 |
! |
3421 |
||
3422 |
addSubView:newView after:aView |
|
3423 |
"add a view to the collection of subviews after another view. |
|
3424 |
This makes sense, in Panels and other layout views, to enter a new |
|
3425 |
element at some defined place." |
|
3426 |
||
3427 |
subViews isNil ifTrue:[ |
|
2721 | 3428 |
subViews := OrderedCollection with:newView |
269 | 3429 |
] ifFalse:[ |
2721 | 3430 |
aView isNil ifTrue:[ |
3431 |
subViews add:newView |
|
3432 |
] ifFalse:[ |
|
3433 |
subViews add:newView after:aView. |
|
3434 |
] |
|
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3435 |
]. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3436 |
self setContainerIn:newView. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3437 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3438 |
"Modified: 9.5.1996 / 00:47:20 / cg" |
269 | 3439 |
! |
3440 |
||
3441 |
addSubView:newView before:aView |
|
3442 |
"add a view to the collection of subviews before another view. |
|
3443 |
This makes sense, in Panels and other layout views, to enter a new |
|
3444 |
element at some defined place." |
|
3445 |
||
3446 |
subViews isNil ifTrue:[ |
|
2721 | 3447 |
subViews := OrderedCollection with:newView |
269 | 3448 |
] ifFalse:[ |
2721 | 3449 |
aView isNil ifTrue:[ |
3450 |
subViews addFirst:newView |
|
3451 |
] ifFalse:[ |
|
3452 |
subViews add:newView before:aView. |
|
3453 |
] |
|
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3454 |
]. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3455 |
self setContainerIn:newView. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3456 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3457 |
"Modified: 9.5.1996 / 00:47:23 / cg" |
269 | 3458 |
! |
3459 |
||
3460 |
addSubView:aView in:bounds borderWidth:bw |
|
3461 |
"for ST-80 V2.x compatibility" |
|
3462 |
||
3463 |
aView borderWidth:bw. |
|
3464 |
self add:aView in:bounds. |
|
3465 |
! |
|
3466 |
||
1439 | 3467 |
addSubViewFirst:newView |
3468 |
"add a view to the front of the collection of subviews" |
|
3469 |
||
3470 |
subViews isNil ifTrue:[ |
|
2721 | 3471 |
subViews := OrderedCollection with:newView |
1439 | 3472 |
] ifFalse:[ |
2721 | 3473 |
subViews addFirst:newView. |
1439 | 3474 |
]. |
3475 |
self setContainerIn:newView. |
|
3476 |
||
3477 |
"Modified: 9.5.1996 / 00:47:16 / cg" |
|
3478 |
"Created: 6.3.1997 / 18:43:38 / cg" |
|
3479 |
! |
|
3480 |
||
269 | 3481 |
component:aComponent |
3482 |
"components (i.e. gadgets or lightweight views) are being prepared. |
|
3483 |
Dont use this right now for non-views" |
|
3484 |
||
3485 |
aComponent origin:0.0@0.0 corner:1.0@1.0. |
|
3486 |
aComponent isView ifTrue:[ |
|
2721 | 3487 |
self addSubView:aComponent |
269 | 3488 |
] ifFalse:[ |
2721 | 3489 |
components := OrderedCollection with:aComponent. |
3490 |
aComponent container:self. |
|
3491 |
||
3492 |
shown ifTrue:[ |
|
3493 |
aComponent displayOn:self |
|
3494 |
] |
|
269 | 3495 |
] |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3496 |
|
683
ecc5d13f22b2
redraw new components if already visible
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
3497 |
"Modified: 13.5.1996 / 21:20:29 / cg" |
269 | 3498 |
! |
3499 |
||
3500 |
destroySubViews |
|
3501 |
"remove all subviews" |
|
3502 |
||
3503 |
subViews notNil ifTrue:[ |
|
2721 | 3504 |
subViews copy do:[:aSubView | |
3505 |
aSubView destroy. |
|
3506 |
]. |
|
3507 |
||
3508 |
"/ paranoia ;-) |
|
3509 |
subViews size ~~ 0 ifTrue:[ |
|
3510 |
('View [warning]: some subView(s) did not destroy: ' , subViews printString) infoPrintCR. |
|
3511 |
subViews := nil |
|
3512 |
]. |
|
269 | 3513 |
] |
3514 |
||
3515 |
"Modified: 5.9.1995 / 22:35:36 / claus" |
|
1296 | 3516 |
"Modified: 29.1.1997 / 17:07:45 / cg" |
269 | 3517 |
! |
3518 |
||
3519 |
removeComponent:aComponent |
|
3520 |
"components (i.e. gadgets or lightweight views) are being prepared. |
|
3521 |
Dont use this right now for non-views" |
|
3522 |
||
3523 |
aComponent isView ifTrue:[ |
|
2721 | 3524 |
self removeSubView:aComponent |
269 | 3525 |
] ifFalse:[ |
2721 | 3526 |
components isNil ifTrue:[^self]. |
3527 |
components remove:aComponent ifAbsent:[]. |
|
3528 |
aComponent parent:nil |
|
269 | 3529 |
] |
3530 |
! |
|
3531 |
||
3532 |
removeSubView:aView |
|
3533 |
"remove a view from the collection of subviews" |
|
3534 |
||
3535 |
subViews notNil ifTrue:[ |
|
2721 | 3536 |
subViews remove:aView ifAbsent:[nil]. |
3537 |
(subViews size == 0) ifTrue:[ |
|
3538 |
subViews := nil |
|
3539 |
] |
|
269 | 3540 |
] |
3541 |
! |
|
3542 |
||
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3543 |
setContainerIn:aView |
269 | 3544 |
"common code for addSubView* methods" |
3545 |
||
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3546 |
aView container:self. |
743 | 3547 |
(aView graphicsDevice ~~ device) ifTrue:[ |
2721 | 3548 |
'SimpleView [warning]: subview (' errorPrint. aView class name errorPrint. |
3549 |
') has different device than me (' errorPrint. |
|
3550 |
self class name errorPrint. ').' errorPrintCR. |
|
3551 |
||
3552 |
aView device:device |
|
269 | 3553 |
] |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3554 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3555 |
"Created: 9.5.1996 / 00:46:59 / cg" |
1172
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
3556 |
"Modified: 10.1.1997 / 18:06:49 / cg" |
269 | 3557 |
! ! |
3558 |
||
3559 |
!SimpleView methodsFor:'change & update'! |
|
3560 |
||
1437
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
3561 |
changedPreferredBounds:someArgument |
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
3562 |
"tell any dependents, that I have changed my preferred bounds; |
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
3563 |
Interface is provided mostly provided for ST80 compatibility; |
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
3564 |
here, translate into ST/X's mechanism for telling others about this." |
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
3565 |
|
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
3566 |
^ self changed:#preferredExtent |
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
3567 |
|
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
3568 |
"Modified: 6.3.1997 / 16:12:02 / cg" |
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
3569 |
! |
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
3570 |
|
269 | 3571 |
update:aspect with:aParameter from:changedObject |
3572 |
"an update request" |
|
3573 |
||
3574 |
aspect == #sizeOfView ifTrue:[ |
|
2721 | 3575 |
"one of the views we depend on changed its size" |
3576 |
^ self containerChangedSize. |
|
269 | 3577 |
]. |
3578 |
^super update:aspect with:aParameter from:changedObject |
|
964 | 3579 |
|
3580 |
"Modified: 19.7.1996 / 17:30:48 / cg" |
|
269 | 3581 |
! ! |
3582 |
||
3583 |
!SimpleView methodsFor:'cursor animation'! |
|
3584 |
||
3585 |
showBusyWhile:aBlock |
|
3586 |
"evaluate some time consuming block, while doing this, |
|
1943 | 3587 |
show a spinning wheel cursor. If those bitmaps are not found, |
3588 |
fallback to the standard busy cursor. |
|
3589 |
Experimental." |
|
269 | 3590 |
|
3591 |
|ok bitmaps cursors mask process oldCursor| |
|
3592 |
||
3593 |
oldCursor := cursor. |
|
3594 |
||
3595 |
ok := true. |
|
3596 |
bitmaps := #('wheel1' 'wheel2' 'wheel3' 'wheel4') |
|
2721 | 3597 |
collect:[:name | |
3598 |
|f| |
|
3599 |
||
3600 |
f := Image fromFile:('bitmaps/' , name , '.xbm'). |
|
3601 |
f isNil ifTrue:[ |
|
3602 |
('SimpleView [warning]: no bitmap file: ' , name , '.xbm') errorPrintCR. |
|
3603 |
ok := false |
|
3604 |
]. |
|
3605 |
f |
|
3606 |
]. |
|
1141 | 3607 |
|
3608 |
mask := Image fromFile:'bitmaps/wheelm.xbm'. |
|
269 | 3609 |
mask isNil ifTrue:[ |
2721 | 3610 |
('SimpleView [warning]: no bitmap file: wheelm.xbm') errorPrintCR. |
3611 |
ok := false |
|
269 | 3612 |
]. |
3613 |
||
3614 |
ok ifFalse:[ |
|
2721 | 3615 |
self cursor:Cursor wait. |
3616 |
aBlock valueNowOrOnUnwindDo:[ |
|
3617 |
self cursor:oldCursor |
|
3618 |
] |
|
269 | 3619 |
] ifTrue:[ |
2721 | 3620 |
cursors := bitmaps collect:[:form | (Cursor sourceForm:form |
3621 |
maskForm:mask |
|
3622 |
hotX:8 |
|
3623 |
hotY:8) on:device]. |
|
3624 |
||
3625 |
process := [ |
|
3626 |
Delay waitForSeconds:0.25. |
|
3627 |
[true] whileTrue:[ |
|
3628 |
cursors do:[:curs | |
|
3629 |
self cursor:curs. |
|
3630 |
Delay waitForSeconds:0.05 |
|
3631 |
] |
|
3632 |
] |
|
3633 |
] fork. |
|
3634 |
||
3635 |
Processor activeProcess priority:7. |
|
3636 |
aBlock valueNowOrOnUnwindDo:[ |
|
3637 |
Processor activeProcess priority:8. |
|
3638 |
process terminate. |
|
3639 |
self cursor:oldCursor |
|
3640 |
] |
|
269 | 3641 |
]. |
3642 |
||
3643 |
" |
|
3644 |
View new realize showBusyWhile:[10 timesRepeat:[3000 factorial]] |
|
3645 |
" |
|
1141 | 3646 |
|
1943 | 3647 |
"Modified: / 31.10.1997 / 19:59:49 / cg" |
269 | 3648 |
! ! |
3649 |
||
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3650 |
!SimpleView methodsFor:'dependents access'! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3651 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3652 |
addDependent:anObject |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3653 |
"make the argument, anObject be a dependent of the receiver" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3654 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3655 |
|wasBlocked| |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3656 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3657 |
wasBlocked := OperatingSystem blockInterrupts. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3658 |
[ |
2721 | 3659 |
|deps| |
3660 |
||
3661 |
deps := dependents. |
|
3662 |
"/ |
|
3663 |
"/ store the very first dependent directly in |
|
3664 |
"/ the dependents instVar |
|
3665 |
"/ |
|
3666 |
(deps isNil and:[anObject isCollection not]) ifTrue:[ |
|
3667 |
dependents := anObject |
|
3668 |
] ifFalse:[ |
|
3669 |
"/ |
|
3670 |
"/ store more dependents in the dependents collection |
|
3671 |
"/ |
|
3672 |
deps isCollection ifTrue:[ |
|
3673 |
deps add:anObject |
|
3674 |
] ifFalse:[ |
|
3675 |
deps == anObject ifFalse:[ |
|
3676 |
dependents := (IdentitySet with:dependents with:anObject) |
|
3677 |
] |
|
3678 |
] |
|
3679 |
] |
|
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3680 |
] valueNowOrOnUnwindDo:[ |
2721 | 3681 |
wasBlocked ifFalse:[ |
3682 |
OperatingSystem unblockInterrupts |
|
3683 |
] |
|
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3684 |
] |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3685 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3686 |
"Modified: 8.1.1997 / 23:40:30 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3687 |
"Created: 11.6.1997 / 13:10:40 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3688 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3689 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3690 |
dependents |
2015 | 3691 |
"return a Collection of dependents" |
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3692 |
|
1938
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3693 |
dependents isNil ifTrue:[^ #()]. |
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3694 |
dependents isCollection ifTrue:[ |
2721 | 3695 |
^ dependents |
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3696 |
]. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3697 |
^ IdentitySet with:dependents |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3698 |
|
1938
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3699 |
"Created: / 11.6.1997 / 13:10:44 / cg" |
2015 | 3700 |
"Modified: / 26.1.1998 / 11:18:36 / cg" |
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3701 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3702 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3703 |
dependents:aCollection |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3704 |
"set the collection of dependents" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3705 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3706 |
|dep| |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3707 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3708 |
aCollection size == 1 ifTrue:[ |
2721 | 3709 |
dep := aCollection first. |
3710 |
dep isCollection ifFalse:[ |
|
3711 |
dependents := aCollection first. |
|
3712 |
^ self |
|
3713 |
] |
|
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3714 |
]. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3715 |
dependents := aCollection |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3716 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3717 |
"Modified: 19.4.1996 / 12:23:05 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3718 |
"Created: 11.6.1997 / 13:10:47 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3719 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3720 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3721 |
dependentsDo:aBlock |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3722 |
"evaluate aBlock for all of my dependents" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3723 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3724 |
|deps| |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3725 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3726 |
deps := dependents. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3727 |
deps notNil ifTrue:[ |
2721 | 3728 |
deps isCollection ifTrue:[ |
3729 |
deps do:aBlock |
|
3730 |
] ifFalse:[ |
|
3731 |
aBlock value:deps |
|
3732 |
] |
|
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3733 |
] |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3734 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3735 |
"Created: 11.6.1997 / 13:10:51 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3736 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3737 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3738 |
release |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3739 |
"remove all dependencies from the receiver" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3740 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3741 |
dependents := nil |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3742 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3743 |
"Modified: 19.4.1996 / 10:31:35 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3744 |
"Created: 11.6.1997 / 13:11:53 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3745 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3746 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3747 |
removeDependent:anObject |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3748 |
"make the argument, anObject be independent of the receiver" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3749 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3750 |
|wasBlocked| |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3751 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3752 |
"/ must do this save from interrupts, since the dependents collection |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3753 |
"/ is possibly accessed from multiple threads. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3754 |
"/ Used to use #valueUninterruptably here; inlined that code for slightly |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3755 |
"/ faster execution. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3756 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3757 |
wasBlocked := OperatingSystem blockInterrupts. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3758 |
[ |
2721 | 3759 |
|deps sz dep| |
3760 |
||
3761 |
deps := dependents. |
|
3762 |
deps notNil ifTrue:[ |
|
3763 |
deps isCollection ifTrue:[ |
|
3764 |
deps remove:anObject ifAbsent:[]. |
|
3765 |
(sz := deps size) == 0 ifTrue:[ |
|
3766 |
dependents := nil |
|
3767 |
] ifFalse:[ |
|
3768 |
sz == 1 ifTrue:[ |
|
3769 |
(dep := deps first) isCollection ifFalse:[ |
|
3770 |
dependents := dep |
|
3771 |
] |
|
3772 |
] |
|
3773 |
] |
|
3774 |
] ifFalse:[ |
|
3775 |
deps == anObject ifTrue:[ |
|
3776 |
dependents := nil |
|
3777 |
] |
|
3778 |
] |
|
3779 |
] |
|
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3780 |
] valueNowOrOnUnwindDo:[ |
2721 | 3781 |
wasBlocked ifFalse:[ |
3782 |
OperatingSystem unblockInterrupts |
|
3783 |
] |
|
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3784 |
] |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3785 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3786 |
"Modified: 8.1.1997 / 23:41:39 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3787 |
"Created: 11.6.1997 / 13:11:58 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3788 |
! ! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3789 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3790 |
!SimpleView methodsFor:'dependents access (non weak)'! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3791 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3792 |
addNonWeakDependent:anObject |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3793 |
"make the argument, anObject be a dependent of the receiver. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3794 |
Since all dependencies are nonWeak in Model, this is simply |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3795 |
forwarded to addDependent:" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3796 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3797 |
^ self addDependent:anObject |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3798 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3799 |
"Created: 11.6.1997 / 13:15:40 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3800 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3801 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3802 |
interests |
2037
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
3803 |
"return a Collection of interests - empty if there is none. |
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3804 |
Here, we use the normal dependents collection for interests." |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3805 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3806 |
^ self dependents |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3807 |
|
2037
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
3808 |
"Modified: / 14.10.1996 / 22:19:58 / stefan" |
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
3809 |
"Created: / 11.6.1997 / 13:15:44 / cg" |
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
3810 |
"Modified: / 30.1.1998 / 14:07:48 / cg" |
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3811 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3812 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3813 |
nonWeakDependents |
2037
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
3814 |
"return a Collection of dependents - empty if there is none. |
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3815 |
Since all dependencies are nonWeak in Model, this is a dummy." |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3816 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3817 |
^ self dependents |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3818 |
|
2037
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
3819 |
"Created: / 11.6.1997 / 13:15:48 / cg" |
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
3820 |
"Modified: / 30.1.1998 / 14:06:55 / cg" |
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3821 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3822 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3823 |
removeNonWeakDependent:anObject |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3824 |
"make the argument, anObject be independent of the receiver. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3825 |
Since all dependencies are nonWeak in Model, this is simply |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3826 |
forwarded to removeDependent:" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3827 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3828 |
^ self removeDependent:anObject |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3829 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3830 |
"Created: 11.6.1997 / 13:15:52 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3831 |
! ! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
3832 |
|
1308 | 3833 |
!SimpleView methodsFor:'drag & drop'! |
3834 |
||
1581
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
3835 |
canDrop:aCollectionOfDropObjects |
1308 | 3836 |
"return true, if anObjectOrCollection can be |
3837 |
dropped in the receiver. This method should be |
|
3838 |
redefined in views which can take objects" |
|
3839 |
||
3840 |
|app| |
|
3841 |
||
3842 |
(app := self application) notNil ifTrue:[ |
|
2721 | 3843 |
^ app canDrop:aCollectionOfDropObjects in:self |
1308 | 3844 |
]. |
3845 |
^ false |
|
1581
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
3846 |
|
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
3847 |
"Modified: 11.4.1997 / 12:42:13 / cg" |
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
3848 |
! |
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
3849 |
|
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
3850 |
drop:aCollectionOfDropObjects at:aPoint |
1308 | 3851 |
"drop manager wants to drop. |
3852 |
If I have an application, forward the request. |
|
3853 |
Otherwise, ignore it. This is only sent, if #canDrop: returned true; |
|
3854 |
if you redefined #canDrop: in a subclass, #drop:at: must also be redefined." |
|
3855 |
||
3856 |
|app| |
|
3857 |
||
3858 |
(app := self application) notNil ifTrue:[ |
|
2721 | 3859 |
^ app drop:aCollectionOfDropObjects in:self at:aPoint |
1308 | 3860 |
]. |
3861 |
self subclassResponsibility |
|
1581
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
3862 |
|
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
3863 |
"Modified: 11.4.1997 / 12:44:34 / cg" |
1308 | 3864 |
! ! |
3865 |
||
269 | 3866 |
!SimpleView methodsFor:'edge drawing'! |
3867 |
||
3868 |
drawBottomEdge |
|
3869 |
"draw bottom 3D edge into window frame" |
|
3870 |
||
3871 |
self drawBottomEdgeLevel:level |
|
2721 | 3872 |
shadow:shadowColor |
3873 |
light:lightColor |
|
3874 |
halfShadow:nil |
|
3875 |
halfLight:nil |
|
3876 |
style:nil. |
|
269 | 3877 |
! |
3878 |
||
3879 |
drawBottomEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle |
|
3880 |
|botFg |
|
3881 |
count "{ Class: SmallInteger }" |
|
3882 |
b r| |
|
3883 |
||
3884 |
count := level. |
|
3885 |
count == 0 ifTrue:[^ self]. |
|
3886 |
||
3887 |
(count < 0) ifTrue:[ |
|
2721 | 3888 |
botFg := lightColor. |
3889 |
count := count negated |
|
269 | 3890 |
] ifFalse:[ |
2721 | 3891 |
((edgeStyle == #soft) and:[level > 1]) ifTrue:[ |
3892 |
botFg := halfShadowColor |
|
3893 |
] ifFalse:[ |
|
3894 |
botFg := shadowColor |
|
3895 |
]. |
|
269 | 3896 |
]. |
3897 |
super paint:botFg. |
|
3898 |
super lineWidth:0. |
|
3899 |
||
3900 |
r := width - 1. |
|
3901 |
0 to:(count - 1) do:[:i | |
|
2721 | 3902 |
b := height - 1 - i. |
3903 |
super displayDeviceLineFromX:i y:b toX:(r - i) y:b |
|
269 | 3904 |
]. |
3905 |
||
3906 |
((edgeStyle == #soft) and:[level > 1]) ifTrue:[ |
|
2721 | 3907 |
b := height - 1. |
3908 |
super paint:shadowColor. |
|
3909 |
super displayDeviceLineFromX:1 y:b toX:r y:b. |
|
1444 | 3910 |
]. |
3911 |
||
3912 |
self edgeDrawn:#bottom. |
|
3913 |
||
3914 |
"Modified: 7.3.1997 / 17:59:39 / cg" |
|
269 | 3915 |
! |
3916 |
||
3917 |
drawEdges |
|
3918 |
"draw all of my 3D edges" |
|
3919 |
||
3920 |
self drawEdgesForX:0 y:0 width:width height:height level:level |
|
2721 | 3921 |
shadow:shadowColor |
3922 |
light:lightColor |
|
3923 |
halfShadow:nil |
|
3924 |
halfLight:nil |
|
3925 |
style:nil |
|
269 | 3926 |
! |
3927 |
||
3928 |
drawEdgesForX:x y:y width:w height:h level:l |
|
3929 |
"draw 3D edges into a rectangle" |
|
3930 |
||
3931 |
self drawEdgesForX:x y:y width:w height:h level:l |
|
2721 | 3932 |
shadow:shadowColor |
3933 |
light:lightColor |
|
3934 |
halfShadow:nil |
|
3935 |
halfLight:nil |
|
3936 |
style:nil |
|
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3937 |
! |
269 | 3938 |
|
3939 |
drawLeftEdge |
|
3940 |
"draw left 3D edge into window frame" |
|
3941 |
||
3942 |
self drawLeftEdgeLevel:level |
|
2721 | 3943 |
shadow:shadowColor |
3944 |
light:lightColor |
|
3945 |
halfShadow:nil |
|
3946 |
halfLight:nil |
|
3947 |
style:nil. |
|
269 | 3948 |
! |
3949 |
||
3950 |
drawLeftEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle |
|
3951 |
|leftFg leftHalfFg paint b |
|
3952 |
count "{ Class: SmallInteger }" | |
|
3953 |
||
3954 |
count := level. |
|
3955 |
count == 0 ifTrue:[^ self]. |
|
3956 |
||
3957 |
(count < 0) ifTrue:[ |
|
2721 | 3958 |
leftFg := shadowColor. |
3959 |
leftHalfFg := halfShadowColor. |
|
3960 |
count := count negated. |
|
269 | 3961 |
] ifFalse:[ |
2721 | 3962 |
leftFg := lightColor. |
3963 |
leftHalfFg := halfLightColor. |
|
269 | 3964 |
]. |
3965 |
leftHalfFg isNil ifTrue:[ |
|
2721 | 3966 |
leftHalfFg := leftFg |
269 | 3967 |
]. |
3968 |
||
3969 |
((edgeStyle == #soft) and:[level > 0]) ifTrue:[ |
|
2721 | 3970 |
paint := leftHalfFg |
269 | 3971 |
] ifFalse:[ |
2721 | 3972 |
paint := leftFg |
269 | 3973 |
]. |
3974 |
super paint:paint. |
|
3975 |
super lineWidth:0. |
|
3976 |
||
3977 |
b := height - 1. |
|
3978 |
0 to:(count - 1) do:[:i | |
|
2721 | 3979 |
super displayDeviceLineFromX:i y:i toX:i y:(b - i) |
269 | 3980 |
]. |
3981 |
||
3982 |
((edgeStyle == #soft) and:[level > 2]) ifTrue:[ |
|
2721 | 3983 |
super paint:(device blackColor). |
3984 |
super displayDeviceLineFromX:0 y:0 toX:0 y:b. |
|
1444 | 3985 |
]. |
3986 |
||
3987 |
self edgeDrawn:#left. |
|
3988 |
||
3989 |
"Modified: 7.3.1997 / 17:59:53 / cg" |
|
269 | 3990 |
! |
3991 |
||
3992 |
drawRightEdge |
|
3993 |
"draw right 3D edge into window frame" |
|
3994 |
||
3995 |
self drawRightEdgeLevel:level |
|
2721 | 3996 |
shadow:shadowColor |
3997 |
light:lightColor |
|
3998 |
halfShadow:nil |
|
3999 |
halfLight:nil |
|
4000 |
style:nil. |
|
269 | 4001 |
! |
4002 |
||
4003 |
drawRightEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle |
|
4004 |
|rightFg |
|
4005 |
count "{ Class: SmallInteger }" |
|
4006 |
r b| |
|
4007 |
||
4008 |
count := level. |
|
4009 |
count == 0 ifTrue:[^ self]. |
|
4010 |
||
4011 |
(count < 0) ifTrue:[ |
|
2721 | 4012 |
rightFg := lightColor. |
4013 |
count := count negated |
|
269 | 4014 |
] ifFalse:[ |
2721 | 4015 |
((edgeStyle == #soft) and:[level > 1]) ifTrue:[ |
4016 |
rightFg := halfShadowColor |
|
4017 |
] ifFalse:[ |
|
4018 |
rightFg := shadowColor |
|
4019 |
]. |
|
269 | 4020 |
]. |
4021 |
super paint:rightFg. |
|
4022 |
super lineWidth:0. |
|
4023 |
||
4024 |
b := height - 1. |
|
4025 |
0 to:(count - 1) do:[:i | |
|
2721 | 4026 |
r := width - 1 - i. |
4027 |
super displayDeviceLineFromX:r y:i toX:r y:(b - i) |
|
269 | 4028 |
]. |
4029 |
((edgeStyle == #soft) and:[level > 1]) ifTrue:[ |
|
2721 | 4030 |
r := width - 1. |
4031 |
super paint:shadowColor. |
|
4032 |
super displayDeviceLineFromX:r y:1 toX:r y:b. |
|
1444 | 4033 |
]. |
4034 |
||
4035 |
self edgeDrawn:#right. |
|
4036 |
||
4037 |
"Modified: 7.3.1997 / 18:00:02 / cg" |
|
269 | 4038 |
! |
4039 |
||
4040 |
drawTopEdge |
|
4041 |
"draw top 3D edge into window frame" |
|
4042 |
||
4043 |
self drawTopEdgeLevel:level |
|
2721 | 4044 |
shadow:shadowColor |
4045 |
light:lightColor |
|
4046 |
halfShadow:nil |
|
4047 |
halfLight:nil |
|
4048 |
style:nil. |
|
269 | 4049 |
! |
4050 |
||
4051 |
drawTopEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle |
|
4052 |
|topFg topHalfFg paint r |
|
4053 |
count "{ Class: SmallInteger }" | |
|
4054 |
||
4055 |
count := level. |
|
4056 |
count == 0 ifTrue:[^ self]. |
|
4057 |
||
4058 |
(count < 0) ifTrue:[ |
|
2721 | 4059 |
topFg := shadowColor. |
4060 |
topHalfFg := halfShadowColor. |
|
4061 |
count := count negated |
|
269 | 4062 |
] ifFalse:[ |
2721 | 4063 |
topFg := lightColor. |
4064 |
topHalfFg := halfLightColor. |
|
269 | 4065 |
]. |
4066 |
topHalfFg isNil ifTrue:[ |
|
2721 | 4067 |
topHalfFg := topFg |
269 | 4068 |
]. |
4069 |
||
4070 |
((edgeStyle == #soft) and:[level > 0]) ifTrue:[ |
|
2721 | 4071 |
paint := topHalfFg |
269 | 4072 |
] ifFalse:[ |
2721 | 4073 |
paint := topFg |
269 | 4074 |
]. |
4075 |
super paint:paint. |
|
4076 |
super lineWidth:0. |
|
4077 |
||
4078 |
r := width - 1. |
|
4079 |
0 to:(count - 1) do:[:i | |
|
2721 | 4080 |
super displayDeviceLineFromX:i y:i toX:(r - i) y:i |
269 | 4081 |
]. |
4082 |
((edgeStyle == #soft) and:[level > 2]) ifTrue:[ |
|
2721 | 4083 |
super paint:(device blackColor). |
4084 |
super displayDeviceLineFromX:0 y:0 toX:r y:0. |
|
1444 | 4085 |
]. |
4086 |
||
4087 |
self edgeDrawn:#top. |
|
4088 |
||
4089 |
"Modified: 7.3.1997 / 18:00:11 / cg" |
|
269 | 4090 |
! |
4091 |
||
4092 |
redrawEdges |
|
4093 |
"redraw my edges (if any)" |
|
4094 |
||
4095 |
(level ~~ 0) ifTrue:[ |
|
2721 | 4096 |
shown ifTrue:[ |
4097 |
self clippingRectangle:nil. |
|
4098 |
self drawEdges. |
|
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4099 |
self deviceClippingRectangle:innerClipRect |
2721 | 4100 |
] |
739 | 4101 |
] |
4102 |
||
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4103 |
"Modified: / 25.5.1999 / 14:50:25 / cg" |
269 | 4104 |
! ! |
4105 |
||
4106 |
!SimpleView methodsFor:'enumerating subviews'! |
|
4107 |
||
4108 |
allSubViewsDo:aBlock |
|
4109 |
"evaluate aBlock for all subviews (recursively)" |
|
4110 |
||
1335 | 4111 |
subViews notNil ifTrue:[ |
2721 | 4112 |
subViews do:[:aSubview | |
4113 |
aSubview withAllSubViewsDo:aBlock |
|
4114 |
] |
|
269 | 4115 |
] |
1335 | 4116 |
|
4117 |
"Modified: 12.2.1997 / 12:23:38 / cg" |
|
269 | 4118 |
! |
4119 |
||
1363 | 4120 |
changeSequenceOrderFor:aSubView to:anIndex |
1984 | 4121 |
"change a subview's position in the subviews collection. |
4122 |
Usually, this only affects the order of components in a panelView. |
|
1363 | 4123 |
" |
4124 |
|aView| |
|
4125 |
||
4126 |
(subViews notNil and:[subViews size >= anIndex]) ifTrue:[ |
|
2721 | 4127 |
aView := subViews remove:aSubView ifAbsent:nil. |
4128 |
||
4129 |
aView notNil ifTrue:[ |
|
4130 |
subViews add:aView beforeIndex:anIndex. |
|
4131 |
^ true |
|
4132 |
] |
|
1363 | 4133 |
]. |
4134 |
^ false |
|
4135 |
! |
|
4136 |
||
269 | 4137 |
withAllSubViewsDo:aBlock |
4138 |
"evaluate aBlock for the receiver and all subviews (recursively)" |
|
4139 |
||
4140 |
aBlock value:self. |
|
4141 |
self allSubViewsDo:aBlock |
|
135 | 4142 |
! ! |
4143 |
||
4144 |
!SimpleView methodsFor:'event handling'! |
|
4145 |
||
1581
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
4146 |
alienDrop:aCollectionOfDropObjects |
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
4147 |
"a drop from some other non-ST/X application." |
1555
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4148 |
|
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4149 |
|v| |
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4150 |
|
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4151 |
v := self. |
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4152 |
[v notNil] whileTrue:[ |
2721 | 4153 |
(v canDrop:aCollectionOfDropObjects) ifTrue:[ |
4154 |
v drop:aCollectionOfDropObjects at:nil. |
|
4155 |
^ self. |
|
4156 |
]. |
|
4157 |
v := v superView |
|
1555
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4158 |
] |
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4159 |
|
1581
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
4160 |
"Modified: 11.4.1997 / 12:41:16 / cg" |
1555
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4161 |
! |
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4162 |
|
269 | 4163 |
buttonPress:button x:x y:y |
659 | 4164 |
"button was pressed - check my components for a hit." |
269 | 4165 |
|
4166 |
components notNil ifTrue:[ |
|
2721 | 4167 |
self componentsContainingX:x y:y do:[:comp :cx :cy | |
4168 |
comp buttonPress:button x:cx y:cy. |
|
4169 |
^ self |
|
4170 |
] |
|
140 | 4171 |
]. |
4172 |
||
269 | 4173 |
super buttonPress:button x:x y:y |
271
88d9e485a5da
menu handling: if entry is a checkToggleEntry, AND selector wants an argument,
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
4174 |
|
659 | 4175 |
"Modified: 8.5.1996 / 23:43:41 / cg" |
4176 |
! |
|
4177 |
||
4178 |
buttonRelease:button x:x y:y |
|
4179 |
"button was released - check my components for a hit." |
|
4180 |
||
4181 |
components notNil ifTrue:[ |
|
2721 | 4182 |
self componentsContainingX:x y:y do:[:comp :cx :cy | |
4183 |
comp buttonRelease:button x:cx y:cy. |
|
4184 |
^ self |
|
4185 |
] |
|
659 | 4186 |
]. |
4187 |
||
4188 |
super buttonRelease:button x:x y:y |
|
4189 |
||
4190 |
"Modified: 8.5.1996 / 23:41:58 / cg" |
|
4191 |
"Created: 8.5.1996 / 23:43:25 / cg" |
|
193 | 4192 |
! |
4193 |
||
1544
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4194 |
clientMessage:msgType format:msgFormat eventData:msgData |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4195 |
"a client message - very X-specific and only useful |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4196 |
for special applications. |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4197 |
Ignored here" |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4198 |
|
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4199 |
"Created: 4.4.1997 / 18:56:52 / cg" |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4200 |
! |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4201 |
|
2216
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4202 |
closeRequest |
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4203 |
"programmatic close request" |
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4204 |
|
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4205 |
self destroy |
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4206 |
|
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4207 |
"Modified: / 3.8.1998 / 19:50:50 / cg" |
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4208 |
! |
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4209 |
|
140 | 4210 |
configureX:x y:y width:newWidth height:newHeight |
4211 |
"my size has changed by window manager action" |
|
4212 |
||
180 | 4213 |
|how anyEdge mustRedrawBottomEdge mustRedrawRightEdge p| |
4214 |
||
4215 |
(superView isNil |
|
4216 |
and:[drawableId notNil]) ifTrue:[ |
|
2721 | 4217 |
"/ have to be careful - some window managers (motif) wrap another |
4218 |
"/ view around and the reported origin is relative to that. |
|
4219 |
"/ not relative to the screen. |
|
4220 |
p := device translatePoint:0@0 from:drawableId to:device rootWindowId. |
|
4221 |
left := p x. |
|
4222 |
top := p y. |
|
180 | 4223 |
] ifFalse:[ |
2721 | 4224 |
left := x. |
4225 |
top := y. |
|
2414 | 4226 |
]. |
4227 |
||
140 | 4228 |
((width ~~ newWidth) or:[height ~~ newHeight]) ifTrue:[ |
2721 | 4229 |
realized ifFalse:[ |
4230 |
width := newWidth. |
|
4231 |
height := newHeight. |
|
4232 |
extentChanged := true. |
|
4233 |
^ self |
|
4234 |
]. |
|
4235 |
||
4236 |
((newWidth <= width) and:[newHeight <= height]) ifTrue:[ |
|
4237 |
how := #smaller |
|
4238 |
] ifFalse:[ |
|
4239 |
((newWidth >= width) and:[newHeight >= height]) ifTrue:[ |
|
4240 |
how := #larger |
|
4241 |
] |
|
4242 |
]. |
|
4243 |
||
4244 |
level ~~ 0 ifTrue:[ |
|
4245 |
mustRedrawBottomEdge := newHeight < height. |
|
4246 |
mustRedrawRightEdge := newWidth < width. |
|
4247 |
anyEdge := mustRedrawBottomEdge or:[mustRedrawRightEdge] |
|
4248 |
] ifFalse:[ |
|
4249 |
anyEdge := false |
|
4250 |
]. |
|
4251 |
||
4252 |
width := newWidth. |
|
4253 |
height := newHeight. |
|
4254 |
||
4255 |
"recompute inner-clip if needed" |
|
4256 |
self setInnerClip. |
|
4257 |
||
4258 |
" |
|
4259 |
must first process pending exposes; |
|
4260 |
otherwise, those may be drawn at a wrong position |
|
4261 |
" |
|
971 | 4262 |
"/ claus: no; expose events are in the same queue as configure events; |
4263 |
"/ which is exactly for that reason ... |
|
4264 |
||
4265 |
"/ windowGroup notNil ifTrue:[ |
|
4266 |
"/ windowGroup processExposeEvents |
|
4267 |
"/ ]. |
|
2721 | 4268 |
self sizeChanged:how. |
4269 |
||
4270 |
(anyEdge and:[shown]) ifTrue:[ |
|
4271 |
self clippingRectangle:nil. |
|
4272 |
mustRedrawBottomEdge ifTrue:[ |
|
4273 |
self drawBottomEdge |
|
4274 |
]. |
|
4275 |
mustRedrawRightEdge ifTrue:[ |
|
4276 |
self drawRightEdge |
|
4277 |
]. |
|
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4278 |
self deviceClippingRectangle:innerClipRect |
2721 | 4279 |
] |
140 | 4280 |
] |
739 | 4281 |
|
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4282 |
"Modified: / 25.5.1999 / 14:47:18 / cg" |
138 | 4283 |
! |
4284 |
||
964 | 4285 |
containerChangedSize |
4286 |
"my container has changed size; if I have relative |
|
4287 |
origin/extent or blocks to evaluate, do it now .." |
|
4288 |
||
1063 | 4289 |
|oldWidth oldHeight oldTop oldLeft newExt newOrg r| |
964 | 4290 |
|
4291 |
oldWidth := width. |
|
4292 |
oldHeight := height. |
|
4293 |
oldTop := top. |
|
4294 |
oldLeft := left. |
|
4295 |
||
4296 |
" |
|
4297 |
slowly migrating to use layoutObjects ... |
|
4298 |
" |
|
4299 |
layout isNil ifTrue:[ |
|
2721 | 4300 |
newOrg := self computeOrigin. |
4301 |
newExt := self computeExtent. |
|
964 | 4302 |
] ifFalse:[ |
2721 | 4303 |
r := (layout rectangleRelativeTo:(superView viewRectangle) |
4304 |
preferred:(self preferredBounds)). |
|
4305 |
newOrg := r origin rounded. |
|
4306 |
newExt := r extent rounded. |
|
964 | 4307 |
"/ newOrg printNL. |
4308 |
"/ newExt printNL. |
|
4309 |
]. |
|
4310 |
||
4311 |
newOrg notNil ifTrue:[ |
|
2721 | 4312 |
((newOrg x == oldLeft) and:[newOrg y == oldTop]) ifTrue:[ |
4313 |
newOrg := nil |
|
4314 |
] |
|
964 | 4315 |
]. |
4316 |
newExt notNil ifTrue:[ |
|
2721 | 4317 |
((newExt x == width) and:[newExt y == height]) ifTrue:[ |
4318 |
newExt := nil |
|
4319 |
] |
|
964 | 4320 |
]. |
4321 |
||
4322 |
newExt isNil ifTrue:[ |
|
2721 | 4323 |
newOrg notNil ifTrue:[ |
4324 |
self pixelOrigin:newOrg |
|
4325 |
] |
|
964 | 4326 |
] ifFalse:[ |
2721 | 4327 |
newOrg isNil ifTrue:[ |
4328 |
self pixelExtent:newExt |
|
4329 |
] ifFalse:[ |
|
4330 |
self pixelOrigin:newOrg extent:newExt |
|
4331 |
] |
|
964 | 4332 |
] |
4333 |
||
4334 |
"Modified: 19.7.1996 / 17:32:50 / cg" |
|
4335 |
! |
|
4336 |
||
4337 |
containerMapped |
|
4338 |
"my container was mapped (became visible). |
|
4339 |
If I was previously realized, this implies that I myself |
|
4340 |
am now mapped as well." |
|
4341 |
||
4342 |
"/ if I was not previously shown, tell it to all of |
|
4343 |
"/ my subviews (they remember this in the shown instVar) |
|
4344 |
||
4345 |
realized ifTrue:[ |
|
2721 | 4346 |
shown ifFalse:[ |
964 | 4347 |
"/ old: |
4348 |
"/ shown := true. |
|
4349 |
"/ subViews notNil ifTrue:[ |
|
4350 |
"/ subViews do:[:v | |
|
4351 |
"/ v containerMapped |
|
4352 |
"/ ] |
|
4353 |
"/ ] |
|
4354 |
||
4355 |
"/ which is equivalent to: |
|
2721 | 4356 |
self mapped. |
4357 |
] |
|
964 | 4358 |
]. |
4359 |
||
4360 |
"Modified: 30.5.1996 / 11:41:02 / cg" |
|
4361 |
"Created: 19.7.1996 / 17:41:10 / cg" |
|
4362 |
! |
|
4363 |
||
4364 |
containerUnmapped |
|
4365 |
"my container was unmapped |
|
4366 |
- this implies that the recevier is now also unmapped." |
|
4367 |
||
4368 |
"/ if I was previously shown, tell it to all of |
|
4369 |
"/ my subviews (they remember this in the shown instVar) |
|
4370 |
||
4371 |
realized ifTrue:[ |
|
2721 | 4372 |
shown ifTrue:[ |
4373 |
self unmapped |
|
4374 |
] |
|
964 | 4375 |
] |
4376 |
||
4377 |
"Modified: 30.5.1996 / 11:41:25 / cg" |
|
4378 |
"Created: 19.7.1996 / 17:43:50 / cg" |
|
4379 |
! |
|
4380 |
||
269 | 4381 |
coveredBy:aView |
4382 |
"the receiver has been covered by another view; |
|
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
4383 |
we are not interested in that here (but see modalBox for more)." |
269 | 4384 |
! |
4385 |
||
4386 |
destroyed |
|
4387 |
"view has been destroyed by someone else (usually window system)" |
|
4388 |
||
4389 |
shown := false. |
|
4390 |
super destroyed |
|
4391 |
! |
|
4392 |
||
1555
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4393 |
dropMessage:dropType data:dropValue |
1544
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4394 |
"a drop from some other view. |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4395 |
Convert to the ST/X drag and drop protocol here." |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4396 |
|
1559 | 4397 |
|dropObjects| |
4398 |
||
1555
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4399 |
dropType == #file ifTrue:[ |
2721 | 4400 |
dropObjects := Array with:(DropObject newFile:dropValue) |
1559 | 4401 |
] ifFalse:[ |
2721 | 4402 |
dropType == #directory ifTrue:[ |
4403 |
dropObjects := Array with:(DropObject newFile:dropValue) |
|
4404 |
] ifFalse:[ |
|
4405 |
dropType == #files ifTrue:[ |
|
4406 |
dropObjects := (dropValue collect:[:fn | DropObject newFile:fn]) |
|
4407 |
] ifFalse:[ |
|
4408 |
dropType == #text ifTrue:[ |
|
4409 |
dropObjects := Array with:(DropObject newText:dropValue) |
|
4410 |
] ifFalse:[ |
|
4411 |
dropObjects := Array with:(DropObject new:dropValue) |
|
4412 |
] |
|
4413 |
] |
|
4414 |
] |
|
1559 | 4415 |
]. |
4416 |
||
4417 |
self alienDrop:dropObjects |
|
4418 |
||
4419 |
"Modified: 6.4.1997 / 14:44:43 / cg" |
|
1544
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4420 |
! |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4421 |
|
135 | 4422 |
exposeX:x y:y width:w height:h |
4423 |
"a low level redraw event from device |
|
4424 |
- let subclass handle the redraw and take care of edges here" |
|
4425 |
||
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4426 |
|leftEdge topEdge rightEdge botEdge anyEdge nx ny nw nh dx dy dw dh old| |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4427 |
|
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4428 |
nw := dw := w. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4429 |
nh := dh := h. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4430 |
nx := dx := x. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4431 |
ny := dy := y. |
135 | 4432 |
|
4433 |
anyEdge := false. |
|
4434 |
||
4435 |
" |
|
4436 |
check if there is a need to draw an edge (i.e. if margin is hit) |
|
4437 |
" |
|
4438 |
(margin ~~ 0) ifTrue:[ |
|
2721 | 4439 |
leftEdge := false. |
4440 |
topEdge := false. |
|
4441 |
rightEdge := false. |
|
4442 |
botEdge := false. |
|
4443 |
transformation notNil ifTrue:[ |
|
4444 |
" |
|
4445 |
need device coordinates for this test |
|
4446 |
" |
|
4447 |
nx := transformation applyToX:nx. |
|
4448 |
ny := transformation applyToY:ny. |
|
4449 |
nw := transformation applyScaleX:nw. |
|
4450 |
nh := transformation applyScaleY:nh. |
|
4451 |
]. |
|
4452 |
" |
|
4453 |
adjust expose rectangle, to exclude the margin. |
|
4454 |
Care for rounding errors ... |
|
4455 |
" |
|
4456 |
(nx isMemberOf:SmallInteger) ifFalse:[ |
|
4457 |
old := nx. |
|
4458 |
nx := nx truncated. |
|
4459 |
nw := nw + (nx - old). |
|
4460 |
]. |
|
4461 |
(ny isMemberOf:SmallInteger) ifFalse:[ |
|
4462 |
old := ny. |
|
4463 |
ny := ny truncated. |
|
4464 |
nh := nh + (ny - old). |
|
4465 |
]. |
|
4466 |
(nw isMemberOf:SmallInteger) ifFalse:[ |
|
4467 |
nw := nw truncated + 1 |
|
4468 |
]. |
|
4469 |
(nh isMemberOf:SmallInteger) ifFalse:[ |
|
4470 |
nh := nh truncated + 1 |
|
4471 |
]. |
|
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4472 |
|
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4473 |
dx := nx. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4474 |
dy := ny. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4475 |
dw := nw. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4476 |
dh := nh. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4477 |
|
2721 | 4478 |
(nx < margin) ifTrue:[ |
4479 |
old := nx. |
|
4480 |
nx := margin. |
|
4481 |
nw := nw - (nx - old). |
|
4482 |
leftEdge := anyEdge := true. |
|
4483 |
]. |
|
4484 |
((nx + nw - 1) >= (width - margin)) ifTrue:[ |
|
4485 |
nw := (width - margin - nx). |
|
4486 |
rightEdge := anyEdge := true. |
|
4487 |
]. |
|
4488 |
(ny < margin) ifTrue:[ |
|
4489 |
old := ny. |
|
4490 |
ny := margin. |
|
4491 |
nh := nh - (ny - old). |
|
4492 |
topEdge := anyEdge := true. |
|
4493 |
]. |
|
4494 |
((ny + nh - 1) >= (height - margin)) ifTrue:[ |
|
4495 |
nh := (height - margin - ny). |
|
4496 |
botEdge := anyEdge := true. |
|
4497 |
]. |
|
4498 |
transformation notNil ifTrue:[ |
|
4499 |
" |
|
4500 |
need logical coordinates for redraw |
|
4501 |
" |
|
4502 |
nx := transformation applyInverseToX:nx. |
|
4503 |
ny := transformation applyInverseToY:ny. |
|
4504 |
nw := transformation applyInverseScaleX:nw. |
|
4505 |
nh := transformation applyInverseScaleY:nh. |
|
4506 |
]. |
|
135 | 4507 |
]. |
4508 |
||
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4509 |
(nw > 0 and:[nh > 0]) ifTrue:[ |
2721 | 4510 |
" |
4511 |
redraw inside area |
|
4512 |
" |
|
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4513 |
self clippingRectangle:(Rectangle left:nx top:ny width:nw height:nh). |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4514 |
|
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4515 |
device supportsAnyViewBackgroundPixmaps ifFalse:[ |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4516 |
"/ workaround: non-existing bg-pixmap support (win95) |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4517 |
|
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4518 |
viewBackground isImageOrForm ifTrue:[ |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4519 |
(device supportsViewBackgroundPixmap:viewBackground) ifFalse:[ |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4520 |
self fillRectangleWithViewBackgroundX:nx y:ny width:nw height:nh |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4521 |
] |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4522 |
]. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4523 |
]. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4524 |
|
2721 | 4525 |
self redrawX:nx y:ny width:nw height:nh. |
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4526 |
]. |
135 | 4527 |
|
4528 |
" |
|
4529 |
redraw edge(s) |
|
4530 |
" |
|
4531 |
anyEdge ifTrue:[ |
|
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4532 |
self deviceClippingRectangle:nil. |
2721 | 4533 |
(topEdge and:[leftEdge and:[botEdge and:[rightEdge]]]) ifTrue:[ |
4534 |
self drawEdges |
|
4535 |
] ifFalse:[ |
|
4536 |
topEdge ifTrue:[ |
|
4537 |
self drawTopEdge |
|
4538 |
]. |
|
4539 |
leftEdge ifTrue:[ |
|
4540 |
self drawLeftEdge |
|
4541 |
]. |
|
4542 |
botEdge ifTrue:[ |
|
4543 |
self drawBottomEdge |
|
4544 |
]. |
|
4545 |
rightEdge ifTrue:[ |
|
4546 |
self drawRightEdge |
|
4547 |
] |
|
4548 |
]. |
|
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4549 |
]. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4550 |
self deviceClippingRectangle:innerClipRect. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4551 |
|
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4552 |
"Modified: / 25.5.1999 / 14:57:38 / cg" |
135 | 4553 |
! |
4554 |
||
269 | 4555 |
focusIn |
2506 | 4556 |
"got keyboard focus (via the window manager). |
4557 |
Nothing done here" |
|
4558 |
||
269 | 4559 |
! |
4560 |
||
4561 |
focusOut |
|
2506 | 4562 |
"lost keyboard focus (via the window manager). |
4563 |
Nothing done here" |
|
269 | 4564 |
! |
4565 |
||
4566 |
hasKeyboardFocus:aBoolean |
|
2506 | 4567 |
"notification from the windowGroup that I got the keyboardFocus." |
4568 |
||
4569 |
delegate notNil ifTrue:[ |
|
2721 | 4570 |
delegate perform:#hasKeyboardFocus: with:aBoolean ifNotUnderstood:nil |
2506 | 4571 |
]. |
140 | 4572 |
^ self |
4573 |
! |
|
4574 |
||
4575 |
keyPress:key x:x y:y |
|
4576 |
"a key has been pressed. If there are components, |
|
4577 |
pass it to the corresponding one. |
|
4578 |
Otherwise, forward it to the superview, if there is any." |
|
4579 |
||
510 | 4580 |
<resource: #keyboard ( #Menu ) > |
4581 |
||
140 | 4582 |
components notNil ifTrue:[ |
2721 | 4583 |
components notNil ifTrue:[ |
4584 |
self componentsContainingX:x y:y do:[:comp :cx :cy | |
|
4585 |
comp keyPress:key x:cx y:cy. |
|
4586 |
^ self |
|
4587 |
] |
|
4588 |
]. |
|
490
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4589 |
]. |
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4590 |
|
494 | 4591 |
key == #Menu ifTrue:[ |
2721 | 4592 |
^ self activateMenu. |
135 | 4593 |
]. |
4594 |
||
490
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4595 |
x isNil ifTrue:[ |
2721 | 4596 |
"/ already redelegated, but nowhere handled |
4597 |
superView notNil ifTrue:[ |
|
4598 |
superView keyPress:key x:nil y:nil. |
|
4599 |
]. |
|
4600 |
^ self |
|
490
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4601 |
]. |
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4602 |
|
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4603 |
superView notNil ifTrue:[ |
2721 | 4604 |
superView |
4605 |
dispatchEvent:#keyPress:x:y: |
|
4606 |
arguments:(Array with:key with:0 with:0) |
|
2127 | 4607 |
|
4608 |
"/ WindowEvent |
|
4609 |
"/ sendEvent:#keyPress:x:y: |
|
4610 |
"/ arguments:(Array with:key with:0 with:0) |
|
4611 |
"/ view:superView |
|
411
2d5deb02d8f8
if not already forwarded, let keyEvents be handled by superView
Claus Gittinger <cg@exept.de>
parents:
393
diff
changeset
|
4612 |
] ifFalse:[ |
2721 | 4613 |
super keyPress:key x:x y:y |
135 | 4614 |
] |
411
2d5deb02d8f8
if not already forwarded, let keyEvents be handled by superView
Claus Gittinger <cg@exept.de>
parents:
393
diff
changeset
|
4615 |
|
2127 | 4616 |
"Modified: / 20.5.1998 / 22:55:08 / cg" |
659 | 4617 |
! |
4618 |
||
4619 |
keyRelease:key x:x y:y |
|
4620 |
"a key has been released. If there are components, |
|
4621 |
pass it to the corresponding one. |
|
4622 |
Otherwise, do whatever my superclass would do." |
|
4623 |
||
4624 |
components notNil ifTrue:[ |
|
2721 | 4625 |
components notNil ifTrue:[ |
4626 |
self componentsContainingX:x y:y do:[:comp :cx :cy | |
|
4627 |
comp keyRelease:key x:cx y:cy. |
|
4628 |
^ self |
|
4629 |
] |
|
4630 |
]. |
|
659 | 4631 |
]. |
4632 |
||
4633 |
super keyRelease:key x:x y:y |
|
4634 |
||
4635 |
"Modified: 8.5.1996 / 23:44:36 / cg" |
|
4636 |
"Created: 8.5.1996 / 23:45:28 / cg" |
|
135 | 4637 |
! |
4638 |
||
269 | 4639 |
mapped |
4640 |
"the view has been mapped (by some outside |
|
4641 |
action - i.e. window manager de-iconified me)" |
|
4642 |
||
4643 |
" |
|
4644 |
the old code was: |
|
4645 |
||
2721 | 4646 |
realized := true. |
4647 |
shown := true. |
|
4648 |
... |
|
269 | 4649 |
|
4650 |
this created a race condition, if the view was |
|
4651 |
realized and shortly after unrealized - before the mapped event |
|
1379 | 4652 |
arrived. This lead to realized being set to true even thought the |
4653 |
view was not. |
|
4654 |
Boy - that was a bad one (hard to reproduce and hard to find). |
|
269 | 4655 |
" |
4656 |
||
4657 |
realized ifTrue:[ |
|
769 | 4658 |
|
2721 | 4659 |
"/ currently, the 'shown ifFalse:' optimization is |
4660 |
"/ not ok, since 'shown' is also modified by visibilityChanges. |
|
4661 |
"/ Also, when remapped, X11 only sends a mapped event for the topView. |
|
4662 |
"/ Therefore, synthetically generate those #superViewMapped messages |
|
4663 |
"/ in any case. |
|
4664 |
||
4665 |
shown := true. |
|
4666 |
" |
|
4667 |
backed views will not get expose events - have |
|
4668 |
to force a redraw here to get things drawn into |
|
4669 |
backing store. |
|
4670 |
" |
|
4671 |
backed ifTrue:[ |
|
4672 |
self redrawX:0 y:0 width:width height:height |
|
4673 |
]. |
|
4674 |
||
4675 |
"/ tell my subViews ... |
|
4676 |
subViews notNil ifTrue:[ |
|
4677 |
subViews do:[:v | v mapped |
|
4678 |
"/ v shown ifFalse:[ |
|
4679 |
"/ v mapped |
|
4680 |
"/ ] |
|
4681 |
] |
|
4682 |
] |
|
269 | 4683 |
] |
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
4684 |
|
1379 | 4685 |
"Modified: 25.2.1997 / 22:41:34 / cg" |
269 | 4686 |
! |
4687 |
||
2719 | 4688 |
mouseWheelMotion:amount state:buttonState deltaTime:dTime |
2701 | 4689 |
"the mouseWheel was turned - handle as a scroll operation. |
4690 |
Specialized application windows may redefine this for any other |
|
2709 | 4691 |
operation. |
4692 |
Here, we scroll some amount which depends upon the views contents height |
|
4693 |
(but never too much); |
|
4694 |
if shift is pressed, always scroll a single scroll-step; |
|
4695 |
if ctrl is pressed, always scroll one page." |
|
4696 |
||
4697 |
|hCont pageScroll amountToScroll sensor factor| |
|
4698 |
||
4699 |
amountToScroll := self verticalScrollStep. |
|
4700 |
pageScroll := false. |
|
4701 |
||
4702 |
(sensor := self sensor) notNil ifTrue:[ |
|
2721 | 4703 |
sensor ctrlDown ifTrue:[ |
4704 |
pageScroll := true |
|
4705 |
] |
|
2709 | 4706 |
]. |
4707 |
||
4708 |
pageScroll ifFalse:[ |
|
2721 | 4709 |
(sensor isNil or:[sensor shiftDown]) ifFalse:[ |
4710 |
hCont := self heightOfContents. |
|
4711 |
hCont > (self innerHeight * 3) ifTrue:[ |
|
4712 |
factor := (hCont // self innerHeight) min:4. |
|
4713 |
amountToScroll := amountToScroll * factor. |
|
4714 |
] |
|
4715 |
] |
|
2709 | 4716 |
]. |
2701 | 4717 |
|
2699 | 4718 |
amount > 0 ifTrue:[ |
2721 | 4719 |
pageScroll ifTrue:[ |
4720 |
self pageUp |
|
4721 |
] ifFalse:[ |
|
4722 |
self scrollUp:amountToScroll |
|
4723 |
] |
|
2699 | 4724 |
] ifFalse:[ |
2721 | 4725 |
pageScroll ifTrue:[ |
4726 |
self pageDown |
|
4727 |
] ifFalse:[ |
|
4728 |
self scrollDown:amountToScroll |
|
4729 |
] |
|
2709 | 4730 |
]. |
4731 |
||
4732 |
"Modified: / 21.5.1999 / 19:58:42 / cg" |
|
2699 | 4733 |
! |
4734 |
||
1381 | 4735 |
pointerEnter:state x:x y:y |
2506 | 4736 |
"got mouse pointer. |
4737 |
Nothing done here" |
|
1381 | 4738 |
|
4739 |
"Modified: 25.2.1997 / 23:43:21 / cg" |
|
4740 |
! |
|
4741 |
||
4742 |
pointerLeave:state |
|
2506 | 4743 |
"got mouse pointer. |
4744 |
Nothing done here" |
|
1381 | 4745 |
|
4746 |
"Modified: 25.2.1997 / 23:43:17 / cg" |
|
4747 |
! |
|
4748 |
||
269 | 4749 |
reparented |
4750 |
"the view has changed its parent by some outside |
|
4751 |
action - i.e. window manager has added a frame. |
|
4752 |
nothing done here" |
|
4753 |
||
4754 |
^ self |
|
4755 |
! |
|
4756 |
||
4757 |
saveAndTerminate |
|
4758 |
"window manager wants me to save and go away; |
|
4759 |
- notice, that not all window managers are nice enough to |
|
4760 |
send this event, but simply destroy the view instead. |
|
4761 |
Can be redefined in subclasses to do whatever is required |
|
4762 |
to prepare for restart." |
|
4763 |
||
2216
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4764 |
self closeRequest |
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4765 |
|
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4766 |
"Modified: / 3.8.1998 / 19:51:26 / cg" |
269 | 4767 |
! |
4768 |
||
4769 |
sizeChanged:how |
|
4770 |
"tell subviews if I change size. |
|
4771 |
How is either #smaller, #larger or nil, and is used to control the order, |
|
4772 |
in which subviews are notified (possibly reducing redraw activity)" |
|
4773 |
||
1290
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
4774 |
|subViews| |
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
4775 |
|
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
4776 |
(subViews := self subViews) notNil ifTrue:[ |
2721 | 4777 |
(how isNil "false" |
4778 |
or:[how == #smaller]) ifTrue:[ |
|
4779 |
subViews do:[:view | |
|
4780 |
view notNil ifTrue:[ |
|
4781 |
view containerChangedSize |
|
4782 |
] |
|
4783 |
] |
|
4784 |
] ifFalse:[ |
|
4785 |
"doing it reverse speeds up resizing - usually subviews |
|
4786 |
are created from top-left to bottom-right; therefore |
|
4787 |
bottom-right views will be moved/resized first, then top-left ones; |
|
4788 |
this avoids multiple redraws of subviews" |
|
4789 |
||
4790 |
subViews reverseDo:[:view | |
|
4791 |
view notNil ifTrue:[ |
|
4792 |
view containerChangedSize |
|
4793 |
] |
|
4794 |
] |
|
4795 |
] |
|
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4796 |
]. |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4797 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4798 |
components notNil ifTrue:[ |
2721 | 4799 |
(how isNil "false" |
4800 |
or:[how == #smaller]) ifTrue:[ |
|
4801 |
components do:[:view | |
|
4802 |
view containerChangedSize |
|
4803 |
] |
|
4804 |
] ifFalse:[ |
|
4805 |
"doing it reverse speeds up resizing - usually subviews |
|
4806 |
are created from top-left to bottom-right; therefore |
|
4807 |
bottom-right views will be moved/resized first, then top-left ones; |
|
4808 |
this avoids multiple redraws of subviews" |
|
4809 |
||
4810 |
components reverseDo:[:view | |
|
4811 |
view containerChangedSize |
|
4812 |
] |
|
4813 |
] |
|
135 | 4814 |
]. |
1290
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
4815 |
|
269 | 4816 |
self changed:#sizeOfView with:how. |
1290
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
4817 |
|
269 | 4818 |
superView notNil ifTrue:[ |
2721 | 4819 |
superView subViewChangedSize |
269 | 4820 |
] |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4821 |
|
2084
e997f6ea54c2
also pass down #larger to sizeCanged: method.
Claus Gittinger <cg@exept.de>
parents:
2061
diff
changeset
|
4822 |
"Modified: / 2.4.1998 / 13:59:59 / cg" |
269 | 4823 |
! |
4824 |
||
4825 |
subViewChangedSize |
|
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
4826 |
"some subview has changed its size; we are not interested |
269 | 4827 |
in that here, but some geometry managers redefine this, to reorganize |
4828 |
components if that happens." |
|
4829 |
||
4830 |
^ self |
|
4831 |
||
4832 |
"Created: 22.9.1995 / 14:44:59 / claus" |
|
4833 |
! |
|
4834 |
||
4835 |
terminate |
|
4836 |
"window manager wants me to go away; |
|
4837 |
- notice, that not all window managers are nice enough to |
|
4838 |
send this event, but simply destroy the view instead. |
|
4839 |
Can be redefined in subclasses to do whatever cleanup is |
|
4840 |
required." |
|
4841 |
||
2216
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4842 |
self closeRequest |
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4843 |
|
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4844 |
"Modified: / 3.8.1998 / 19:51:23 / cg" |
269 | 4845 |
! |
4846 |
||
4847 |
unmapped |
|
4848 |
"the view has been unmapped |
|
4849 |
(either by some outside action - i.e. window manager iconified me, |
|
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
4850 |
or due to unmapping of my parentView)." |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
4851 |
|
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
4852 |
"/ if I was previously shown, tell it to all of |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
4853 |
"/ my subviews (they remember this in the shown instVar) |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
4854 |
|
769 | 4855 |
"/ currently, the 'shown ifTrue:' optimization is |
964 | 4856 |
"/ not ok, since 'shown' is also modified by visibilityChanges. |
4857 |
"/ Also, when remapped, X11 only sends a mapped event for the topView. |
|
769 | 4858 |
"/ Therefore, synthetically generate those #superViewUnmapped messages |
4859 |
"/ in any case. |
|
4860 |
||
1379 | 4861 |
shown := false. |
4862 |
subViews notNil ifTrue:[ |
|
2721 | 4863 |
subViews do:[:v | |
4864 |
v containerUnmapped |
|
4865 |
] |
|
1379 | 4866 |
] |
4867 |
||
4868 |
"Modified: 25.2.1997 / 22:40:52 / cg" |
|
135 | 4869 |
! |
4870 |
||
4871 |
visibilityChange:how |
|
4872 |
"the visibility of the view has changed (by some outside |
|
4873 |
action - i.e. window manager rearranged things). |
|
4874 |
Using this knowledge avoids useless redraw in obsucred views." |
|
4875 |
||
4876 |
how == #fullyObscured ifTrue:[ |
|
2721 | 4877 |
shown := false |
135 | 4878 |
] ifFalse:[ |
2721 | 4879 |
shown := true. |
135 | 4880 |
] |
269 | 4881 |
! ! |
4882 |
||
1302 | 4883 |
!SimpleView methodsFor:'event simulation'! |
4884 |
||
4885 |
pushEvent:aSelector |
|
4886 |
"push some messageSend into my event queue - |
|
4887 |
I will perform the corresponding method when its time |
|
4888 |
to handle events (useful to update low-prio views from |
|
4889 |
a higher prio process, to avoid blocking in the high prio one)" |
|
4890 |
||
2143
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4891 |
^ self pushEvent:aSelector withArguments:#() |
1302 | 4892 |
|
4893 |
" |
|
4894 |
|v| |
|
4895 |
||
4896 |
v := View new openAndWait. |
|
4897 |
v fill:Color red. |
|
4898 |
v pushEvent:#redraw |
|
4899 |
" |
|
4900 |
||
2143
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4901 |
"Modified: / 10.6.1998 / 17:28:40 / cg" |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4902 |
! |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4903 |
|
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4904 |
pushEvent:aSelector with:arg |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4905 |
"push some 1-arg messageSend into my event queue - |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4906 |
I will perform the corresponding method when its time |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4907 |
to handle events (useful to update low-prio views from |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4908 |
a higher prio process, to avoid blocking in the high prio one)" |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4909 |
|
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4910 |
^ self pushEvent:aSelector withArguments:(Array with:arg) |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4911 |
|
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4912 |
"Created: / 10.6.1998 / 17:27:17 / cg" |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4913 |
! |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4914 |
|
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4915 |
pushEvent:aSelector with:arg1 with:arg2 |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4916 |
"push some 1-arg messageSend into my event queue - |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4917 |
I will perform the corresponding method when its time |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4918 |
to handle events (useful to update low-prio views from |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4919 |
a higher prio process, to avoid blocking in the high prio one)" |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4920 |
|
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4921 |
^ self pushEvent:aSelector withArguments:(Array with:arg1 with:arg2) |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4922 |
|
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4923 |
"Created: / 10.6.1998 / 17:27:41 / cg" |
1302 | 4924 |
! |
4925 |
||
4926 |
pushEvent:aSelector withArguments:args |
|
4927 |
"push some messageSend into my event queue - |
|
4928 |
I will perform the corresponding method when its time |
|
4929 |
to handle events (useful to update low-prio views from |
|
4930 |
a higher prio process, to avoid blocking in the high prio one)" |
|
4931 |
||
4932 |
|sensor| |
|
4933 |
||
4934 |
(sensor := self sensor) notNil ifTrue:[ |
|
2721 | 4935 |
sensor pushUserEvent:aSelector for:self withArguments:args |
1302 | 4936 |
] ifFalse:[ |
2721 | 4937 |
self perform:aSelector withArguments:args |
1302 | 4938 |
] |
4939 |
||
4940 |
" |
|
4941 |
|v| |
|
4942 |
||
4943 |
v := (Button label:'hello') openAndWait. |
|
4944 |
Delay waitForSeconds:1. |
|
4945 |
v pushEvent:#buttonPress:x:y: withArguments:#(1 10 10). |
|
4946 |
Delay waitForSeconds:1. |
|
4947 |
v pushEvent:#buttonRelease:x:y: withArguments:#(1 10 10). |
|
4948 |
" |
|
4949 |
||
2143
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
4950 |
"Modified: / 10.6.1998 / 17:28:16 / cg" |
1302 | 4951 |
! ! |
4952 |
||
2506 | 4953 |
!SimpleView methodsFor:'focus handling'! |
4954 |
||
4955 |
requestFocus |
|
4956 |
"request focus from my windowGroup; |
|
4957 |
typically, this is invoked when the mouse pointer enters a |
|
4958 |
widget. The request may or may not be ignored by the wGroup |
|
4959 |
(it will be ignored, if an explicit focus-change is currently |
|
4960 |
active - i.e. if the user tabbed into a widget)" |
|
4961 |
||
4962 |
windowGroup notNil ifTrue:[ |
|
2721 | 4963 |
^ windowGroup focusRequestFrom:self |
2506 | 4964 |
]. |
4965 |
^ true |
|
4966 |
! |
|
4967 |
||
4968 |
showFocus:explicit |
|
4969 |
"highlight myself somehow to tell user that I have the focus. |
|
4970 |
If explicit is true, the focus came via focusStepping (i.e. tabbing); |
|
4971 |
if false, it came via the window manager (i.e. pointer entering). |
|
4972 |
Only change my border, if this is an explicit focusChange." |
|
4973 |
||
4974 |
|delta clrId| |
|
4975 |
||
4976 |
explicit ifTrue:[ |
|
2721 | 4977 |
(drawableId notNil and:[superView notNil]) ifTrue:[ |
4978 |
(styleSheet at:#'focus.showBorder' default:true) ifTrue:[ |
|
4979 |
delta := DefaultFocusBorderWidth - borderWidth. |
|
4980 |
delta ~~ 0 ifTrue:[ |
|
4981 |
device moveWindow:drawableId x:left-delta y:top-delta. |
|
4982 |
device setWindowBorderWidth:DefaultFocusBorderWidth in:drawableId. |
|
4983 |
]. |
|
4984 |
||
4985 |
clrId := (DefaultFocusColor on:device) colorId. |
|
4986 |
clrId isNil ifTrue:[ |
|
4987 |
clrId := device blackpixel |
|
4988 |
]. |
|
4989 |
device setWindowBorderColor:clrId in:drawableId. |
|
4990 |
] |
|
4991 |
] |
|
2506 | 4992 |
] ifFalse:[ |
2560 | 4993 |
"/ superView notNil ifTrue:[ |
4994 |
"/ superView showFocus:explicit |
|
4995 |
"/ ] |
|
2506 | 4996 |
] |
4997 |
||
4998 |
"Modified: / 17.9.1998 / 15:08:34 / cg" |
|
4999 |
! |
|
5000 |
||
5001 |
showNoFocus:explicit |
|
5002 |
"undo the effect of showFocus. |
|
5003 |
Explicit tells if the focus came via focusStepping (i.e. tabbing) |
|
5004 |
or via the window manager (i.e. pointer entering). |
|
5005 |
Only change my border, if this is an explicit focusChange." |
|
5006 |
||
5007 |
|delta| |
|
5008 |
||
5009 |
explicit ifTrue:[ |
|
2510 | 5010 |
(drawableId notNil and:[superView notNil]) ifTrue:[ |
2721 | 5011 |
"/ drawableId notNil ifTrue:[ |
2560 | 5012 |
"/ (windowGroup notNil |
5013 |
"/ and:[windowGroup focusView == self]) ifTrue:[ |
|
2721 | 5014 |
(styleSheet at:#'focus.showBorder' default:true) ifTrue:[ |
5015 |
delta := DefaultFocusBorderWidth - borderWidth. |
|
5016 |
delta ~~ 0 ifTrue:[ |
|
5017 |
device setWindowBorderWidth:borderWidth in:drawableId. |
|
5018 |
device moveWindow:drawableId x:left y:top. |
|
5019 |
]. |
|
5020 |
self setBorderColor. |
|
5021 |
] |
|
2560 | 5022 |
"/ ] |
2721 | 5023 |
] |
2506 | 5024 |
] |
5025 |
||
5026 |
"Modified: / 17.9.1998 / 15:08:02 / cg" |
|
5027 |
! |
|
5028 |
||
5029 |
wantsFocusWithButtonPress |
|
5030 |
"views which like to take the keyboard focus |
|
5031 |
with buttonPress can do so by redefining this |
|
5032 |
to return true" |
|
5033 |
||
2540
1283ca186b55
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
2510
diff
changeset
|
5034 |
^ true "/ false |
2506 | 5035 |
! ! |
5036 |
||
269 | 5037 |
!SimpleView methodsFor:'informing others of changes'! |
5038 |
||
5039 |
contentsChanged |
|
5040 |
"this one is sent, whenever contents changes size - |
|
5041 |
tell dependents about the change (i.e. scrollers)." |
|
5042 |
||
5043 |
self changed:#sizeOfContents |
|
5044 |
! |
|
5045 |
||
5046 |
originChanged:delta |
|
5047 |
"this one is sent, after the origin of my contents has changed - |
|
5048 |
tell dependents (i.e. scrollers) about this" |
|
5049 |
||
5050 |
self changed:#originOfContents with:delta. |
|
5051 |
"/ subViews notNil ifTrue:[ |
|
5052 |
"/ subViews do:[:aSubView | |
|
5053 |
"/ aSubView pixelOrigin:((aSubView left @ aSubView top) - delta) |
|
5054 |
"/ ] |
|
5055 |
"/ ] |
|
5056 |
! |
|
5057 |
||
5058 |
originWillChange |
|
5059 |
"this one is sent, just before viewOrigin changes - |
|
5060 |
gives subclasses a chance to catch scrolls easily |
|
5061 |
(for example to hide cursor before scroll)" |
|
5062 |
||
5063 |
^ self |
|
5064 |
! ! |
|
5065 |
||
2573 | 5066 |
!SimpleView methodsFor:'initialize / release'! |
269 | 5067 |
|
5068 |
defaultControllerClass |
|
5069 |
^ nil "/ Controller |
|
5070 |
! |
|
5071 |
||
483
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
5072 |
defaultExtent |
586 | 5073 |
"return the default extent of my instances." |
5074 |
||
483
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
5075 |
^ self class defaultExtent |
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
5076 |
|
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
5077 |
"Created: 1.3.1996 / 19:20:46 / cg" |
586 | 5078 |
"Modified: 22.4.1996 / 23:38:27 / cg" |
483
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
5079 |
! |
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
5080 |
|
2573 | 5081 |
destroy |
5082 |
"unmap & destroy - make me invisible, destroy subviews then |
|
5083 |
make me unknown to the device" |
|
5084 |
||
5085 |
realized ifTrue:[ |
|
2721 | 5086 |
self unmap. |
2573 | 5087 |
"/ "make it go away immediately |
5088 |
"/ - also, this hides the subview killing" |
|
5089 |
"/ |
|
5090 |
"/ device synchronizeOutput. |
|
5091 |
||
5092 |
]. |
|
5093 |
shown := false. |
|
5094 |
||
5095 |
"/ controller notNil ifTrue:[ |
|
5096 |
"/ controller release. |
|
5097 |
"/ controller := nil. |
|
5098 |
"/ ]. |
|
5099 |
||
5100 |
subViews notNil ifTrue:[ |
|
2721 | 5101 |
self destroySubViews. |
2573 | 5102 |
]. |
5103 |
superView notNil ifTrue:[ |
|
2721 | 5104 |
superView removeSubView:self. |
5105 |
superView := nil |
|
2573 | 5106 |
]. |
5107 |
super destroy. |
|
5108 |
||
5109 |
"/ superView isNil ifTrue:[ |
|
5110 |
"/ device flush |
|
5111 |
"/ ]. |
|
5112 |
||
5113 |
controller notNil ifTrue:[ |
|
2721 | 5114 |
controller release. |
5115 |
controller := nil. |
|
2573 | 5116 |
]. |
5117 |
||
5118 |
windowGroup notNil ifTrue:[ |
|
2721 | 5119 |
windowGroup removeView:self. |
5120 |
windowGroup := nil |
|
2573 | 5121 |
]. |
5122 |
||
5123 |
"Modified: / 3.5.1996 / 23:49:24 / stefan" |
|
5124 |
"Modified: / 18.2.1999 / 22:16:09 / cg" |
|
5125 |
! |
|
5126 |
||
269 | 5127 |
initEvents |
5128 |
"will be sent by create - can be redefined by subclasses to enable |
|
5129 |
view events" |
|
5130 |
||
5131 |
^ self |
|
5132 |
! |
|
5133 |
||
5134 |
initStyle |
|
5135 |
"this method sets up all style dependent things" |
|
5136 |
||
5137 |
self initStyleSheet. |
|
5138 |
||
5139 |
borderWidth := DefaultBorderWidth. |
|
5140 |
borderWidth isNil ifTrue:[borderWidth := 1]. |
|
5141 |
||
5142 |
viewBackground := DefaultViewBackgroundColor. |
|
5143 |
||
5144 |
DefaultLightColor notNil ifTrue:[ |
|
2721 | 5145 |
lightColor := DefaultLightColor. |
269 | 5146 |
] ifFalse:[ |
2721 | 5147 |
device hasGrayscales ifTrue:[ |
5148 |
DefaultLightColor := lightColor := viewBackground lightened. |
|
5149 |
] ifFalse:[ |
|
5150 |
" |
|
5151 |
this seems strange: on B&W screens, we create the light color |
|
5152 |
darker than normal viewBackground (White) - |
|
5153 |
to make the boundary of the view visible |
|
5154 |
" |
|
5155 |
lightColor := Color gray:50 |
|
5156 |
] |
|
269 | 5157 |
]. |
5158 |
DefaultShadowColor notNil ifTrue:[ |
|
2721 | 5159 |
shadowColor := DefaultShadowColor. |
269 | 5160 |
] ifFalse:[ |
2721 | 5161 |
shadowColor := Black |
269 | 5162 |
]. |
5163 |
||
5164 |
lightColor := lightColor. |
|
5165 |
shadowColor := shadowColor. |
|
5166 |
borderColor := DefaultBorderColor. |
|
452
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
5167 |
font := self class defaultFont. |
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
5168 |
font := font on:device. |
747 | 5169 |
|
749 | 5170 |
"Modified: 28.5.1996 / 21:13:58 / cg" |
269 | 5171 |
! |
5172 |
||
5173 |
initStyleSheet |
|
5174 |
"this method gets the styleSheet" |
|
5175 |
||
5176 |
" |
|
5177 |
when coming here the first time, we read the styleSheet |
|
5178 |
and keep the values in fast class variables |
|
5179 |
" |
|
5180 |
StyleSheet isNil ifTrue:[ |
|
2721 | 5181 |
DefaultStyle isNil ifTrue:[ |
5182 |
"/ the very-very first time (no styleSheet yet) |
|
5183 |
View setDefaultStyle. "/ View defaultStyle:#normal. |
|
5184 |
View defaultStyle:DefaultStyle. |
|
5185 |
]. |
|
5186 |
self class updateStyleCache |
|
269 | 5187 |
]. |
5188 |
||
5189 |
styleSheet := StyleSheet. |
|
1005
03041f7fb340
init styleSheet (in case no startup file did it)
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
5190 |
|
03041f7fb340
init styleSheet (in case no startup file did it)
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
5191 |
"Modified: 25.7.1996 / 22:00:06 / cg" |
269 | 5192 |
! |
5193 |
||
5194 |
initialize |
|
5195 |
"initialize all state of the view - usually redefined in subclasses, |
|
5196 |
but always doing a 'super initialize'. Each class should setup its |
|
5197 |
locals - and not forget the others. |
|
5198 |
View setup is separated into two parts, the general setup done here |
|
5199 |
and the style specific setup in initStyle. Each view should be prepared |
|
5200 |
for a stylechange by being sent another initStyle with a new style value. |
|
5201 |
(in this case, it should set all of its style-dependent things, but |
|
5202 |
leave the state and contents as-is)" |
|
5203 |
||
5204 |
|ext myClass controllerClass| |
|
5205 |
||
5206 |
super initialize. |
|
5207 |
||
452
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
5208 |
font := self class defaultFont. |
269 | 5209 |
|
5210 |
shown := hiddenOnRealize := realized := false. |
|
5211 |
||
5212 |
"fill in some defaults - some of them are usually redefined in subclasses |
|
5213 |
initialize methods" |
|
5214 |
||
5215 |
myClass := self class. |
|
5216 |
name := myClass name "asString" asLowercaseFirst. |
|
5217 |
resources := myClass classResources. |
|
5218 |
||
2382 | 5219 |
level := borderWidth := margin := 0. |
269 | 5220 |
|
5221 |
self initStyle. |
|
5222 |
||
483
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
5223 |
ext := self defaultExtent. |
269 | 5224 |
left := top := 0. |
5225 |
width := ext x. |
|
5226 |
height := ext y. |
|
5227 |
||
5228 |
originChanged := extentChanged := false. |
|
2084
e997f6ea54c2
also pass down #larger to sizeCanged: method.
Claus Gittinger <cg@exept.de>
parents:
2061
diff
changeset
|
5229 |
bitGravity := #NorthWest. "/ nil. |
269 | 5230 |
viewGravity := nil. |
5231 |
||
5232 |
controllerClass := self defaultControllerClass. |
|
5233 |
controllerClass notNil ifTrue:[ |
|
2721 | 5234 |
controller := controllerClass new. |
5235 |
controller view:self. |
|
2382 | 5236 |
]. |
5237 |
||
5238 |
"Modified: / 1.10.1998 / 14:31:05 / cg" |
|
269 | 5239 |
! |
5240 |
||
5241 |
initializeMiddleButtonMenu |
|
5242 |
"a place to initialize menu - this one is sent once when the view is |
|
5243 |
first created; usually redefined in subclasses; default here is no menu. |
|
5244 |
Notice, that static middleButtonmenus are a historic thing in ST/X; |
|
5245 |
you may prefer to create the menu dynamically (i.e. the ST-80 way)." |
|
5246 |
||
5247 |
^ self |
|
5248 |
! |
|
5249 |
||
5250 |
prepareForReinit |
|
5251 |
super prepareForReinit. |
|
5252 |
windowGroup notNil ifTrue:[ |
|
2721 | 5253 |
windowGroup reinitialize |
269 | 5254 |
] |
5255 |
! |
|
5256 |
||
5257 |
reinitStyle |
|
5258 |
"this method is called for a style change" |
|
5259 |
||
5260 |
|t| |
|
5261 |
||
5262 |
self initStyle. |
|
5263 |
drawableId notNil ifTrue:[ |
|
2721 | 5264 |
"force a change" |
5265 |
t := borderWidth. borderWidth := nil. self borderWidth:t. |
|
5266 |
t := viewBackground. viewBackground := nil. self viewBackground:t. |
|
5267 |
self clear. self invalidate. |
|
2357
29a966362aad
clear and invalidate in reinitStyle.
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
5268 |
]. |
29a966362aad
clear and invalidate in reinitStyle.
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
5269 |
|
29a966362aad
clear and invalidate in reinitStyle.
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
5270 |
"Modified: / 18.9.1998 / 21:15:33 / cg" |
269 | 5271 |
! |
5272 |
||
5273 |
reinitialize |
|
795 | 5274 |
"this is called right after snapIn" |
269 | 5275 |
|
2649 | 5276 |
|myController sv| |
269 | 5277 |
|
5278 |
"if I have already been reinited - return" |
|
5279 |
drawableId notNil ifTrue:[ |
|
2721 | 5280 |
^ self |
269 | 5281 |
]. |
5282 |
||
5283 |
" |
|
5284 |
superView must be there, first |
|
5285 |
" |
|
5286 |
superView notNil ifTrue:[ |
|
2721 | 5287 |
(sv := superView view) id isNil ifTrue:[ |
5288 |
sv reinitialize |
|
5289 |
] |
|
2452
0c63e21efd57
(re)initCursor in reinitialize (i.e. after snapIn)
Claus Gittinger <cg@exept.de>
parents:
2451
diff
changeset
|
5290 |
]. |
0c63e21efd57
(re)initCursor in reinitialize (i.e. after snapIn)
Claus Gittinger <cg@exept.de>
parents:
2451
diff
changeset
|
5291 |
|
0c63e21efd57
(re)initCursor in reinitialize (i.e. after snapIn)
Claus Gittinger <cg@exept.de>
parents:
2451
diff
changeset
|
5292 |
"reinit cursor" |
0c63e21efd57
(re)initCursor in reinitialize (i.e. after snapIn)
Claus Gittinger <cg@exept.de>
parents:
2451
diff
changeset
|
5293 |
self initCursor. |
269 | 5294 |
|
5295 |
myController := controller. |
|
5296 |
controller := nil. |
|
5297 |
self recreate. |
|
5298 |
||
5299 |
"if I was mapped, do it again" |
|
5300 |
realized ifTrue:[ |
|
2721 | 5301 |
"only remap if I have a superview - otherwise, I might be |
5302 |
a hidden iconView or menu ..." |
|
5303 |
superView notNil ifTrue:[ |
|
269 | 5304 |
"/ shown ifTrue:[ |
2721 | 5305 |
device |
5306 |
mapView:self id:drawableId iconified:false |
|
5307 |
atX:left y:top width:width height:height |
|
5308 |
minExtent:(self minExtent) maxExtent:(self maxExtent) |
|
269 | 5309 |
"/ ]. |
2721 | 5310 |
]. |
269 | 5311 |
]. |
5312 |
||
5313 |
"restore controller" |
|
2452
0c63e21efd57
(re)initCursor in reinitialize (i.e. after snapIn)
Claus Gittinger <cg@exept.de>
parents:
2451
diff
changeset
|
5314 |
controller := myController. |
795 | 5315 |
|
2649 | 5316 |
"Modified: / 6.5.1999 / 13:11:07 / cg" |
135 | 5317 |
! ! |
5318 |
||
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5319 |
!SimpleView methodsFor:'menu handling'! |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5320 |
|
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5321 |
activateMenu |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5322 |
"activate my menu. |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5323 |
This code will move into the controller ASAP |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5324 |
If there is a static middleButtonMenu, that one is taken, |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5325 |
and handled in the superClass (static menus are a historic leftOver). |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5326 |
Otherwise, the follwing steps are performed: |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5327 |
|
2721 | 5328 |
- ask the receiver for the menu (via #yellowButtonMenu) |
5329 |
- ask the receiver for the menuPerformer. |
|
5330 |
- startUp the menu - it is supposed to return an actionSelector |
|
5331 |
- if the menuPerformer responds to the selector, |
|
5332 |
send it to the performer; |
|
5333 |
otherwise send it to the view (the receiver) |
|
5334 |
This is funny, it allows additional menuItems to be added |
|
5335 |
AND still get the views copy/cut/paste functionality. |
|
5336 |
Without this, you had to redefine and forward all of those |
|
5337 |
messages in the performer." |
|
2489
f7ce16896fa1
process exposes when menu closes.
Claus Gittinger <cg@exept.de>
parents:
2465
diff
changeset
|
5338 |
|
f7ce16896fa1
process exposes when menu closes.
Claus Gittinger <cg@exept.de>
parents:
2465
diff
changeset
|
5339 |
|menu menuPerformer actionSelector prevReceiver wg| |
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5340 |
|
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5341 |
middleButtonMenu isNil ifTrue:[ |
2721 | 5342 |
" |
5343 |
try ST-80 style menus first: |
|
5344 |
if there is a model, and a menuMessage is defined, |
|
5345 |
ask model for the menu and launch that if non-nil. |
|
5346 |
" |
|
5347 |
menu := self yellowButtonMenu. |
|
5348 |
menu notNil ifTrue:[ |
|
5349 |
||
5350 |
"/ could be a spec ... |
|
5351 |
menu isArray ifTrue:[ |
|
5352 |
menu := menu decodeAsLiteralArray |
|
5353 |
]. |
|
5354 |
||
5355 |
" |
|
5356 |
got one, launch the menu. It is supposed |
|
5357 |
to return an actionSelector. |
|
5358 |
" |
|
5359 |
menuPerformer := self menuPerformer. |
|
5360 |
||
5361 |
" |
|
5362 |
a temporary kludge: |
|
5363 |
pass myself as receiver, the menuPerformer as performer; |
|
5364 |
the menu will send its messages to either the |
|
5365 |
menuPerformer or me (its receiver). |
|
5366 |
This allows for the ST-80 behavior, where some messages |
|
5367 |
go to the model, others to the view |
|
5368 |
(copy/cut/paste). |
|
5369 |
" |
|
5370 |
(prevReceiver := menu receiver) isNil ifTrue:[ |
|
5371 |
"/ kludge for oldStyle menus (MenuView/PopUpMenu) |
|
5372 |
"/ not req'd for real Menus |
|
5373 |
||
5374 |
(menu respondsTo:#menuPerformer:) ifTrue:[ |
|
5375 |
menu receiver:self. "/ really ? |
|
5376 |
menu menuPerformer:menuPerformer. |
|
5377 |
] ifFalse:[ |
|
5378 |
"/ new style menu |
|
5379 |
menu receiver:menuPerformer. |
|
5380 |
] |
|
5381 |
]. |
|
5382 |
||
5383 |
"/ |
|
5384 |
"/ startup the menu - this returns a selector |
|
5385 |
"/ |
|
5386 |
actionSelector := menu startUp. |
|
5387 |
||
5388 |
"/ before doing anything else, redraw expose area from |
|
5389 |
"/ the menu (in case the action changes my state) |
|
5390 |
(wg := self windowGroup) notNil ifTrue:[ |
|
5391 |
wg processExposeEvents. |
|
5392 |
]. |
|
5393 |
||
5394 |
actionSelector notNil ifTrue:[ |
|
5395 |
self dispatchMenuSelection:actionSelector. |
|
5396 |
]. |
|
5397 |
||
5398 |
menu receiver:prevReceiver. |
|
5399 |
||
5400 |
^ self |
|
5401 |
]. |
|
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5402 |
]. |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5403 |
|
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5404 |
"/ |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5405 |
"/ old style static menu |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5406 |
"/ |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5407 |
super activateMenu |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5408 |
|
2127 | 5409 |
"Created: / 1.3.1996 / 13:24:18 / cg" |
2246
8666105a8750
care for menuPerformer, when using newStyle menu in
Claus Gittinger <cg@exept.de>
parents:
2243
diff
changeset
|
5410 |
"Modified: / 14.8.1998 / 18:09:31 / cg" |
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5411 |
! |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5412 |
|
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5413 |
dispatchMenuSelection:menuSelection |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5414 |
"dispatch a menu message. |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5415 |
This code will move into the controller ASAP" |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5416 |
|
1943 | 5417 |
|actionSelector actionArg1 actionArg2 app menuPerformer| |
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5418 |
|
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5419 |
actionSelector := menuSelection. |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5420 |
|
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5421 |
" |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5422 |
mhmh - kludge for selectors with argument |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5423 |
" |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5424 |
(menuSelection isMemberOf:Array) ifTrue:[ |
2721 | 5425 |
actionArg1 := menuSelection at:2. |
5426 |
actionSelector := menuSelection at:1. |
|
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5427 |
]. |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5428 |
|
1839 | 5429 |
menuPerformer := self menuPerformer. |
5430 |
||
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5431 |
" |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5432 |
mhmh - ST-80 seems to send some to the model and |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5433 |
others (copy/cut/paste) to the controller/view |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5434 |
Simulate this behavior, by looking what the model responds to. |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5435 |
" |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5436 |
actionSelector isSymbol ifTrue:[ |
2721 | 5437 |
(menuPerformer respondsTo:actionSelector) ifFalse:[ |
5438 |
((app := self application) respondsTo:actionSelector) ifTrue:[ |
|
5439 |
menuPerformer := app. |
|
5440 |
actionArg1 := self model. |
|
5441 |
actionArg2 := self controller. |
|
5442 |
] ifFalse:[ |
|
5443 |
(self respondsTo:actionSelector) ifTrue:[ |
|
5444 |
menuPerformer := self |
|
5445 |
] |
|
5446 |
] |
|
5447 |
]. |
|
5448 |
actionSelector numArgs ~~ 0 ifTrue:[ |
|
5449 |
actionSelector numArgs ~~ 1 ifTrue:[ |
|
5450 |
menuPerformer perform:actionSelector with:actionArg1 with:actionArg2 |
|
5451 |
] ifFalse:[ |
|
5452 |
menuPerformer perform:actionSelector with:actionArg1 |
|
5453 |
] |
|
5454 |
] ifFalse:[ |
|
5455 |
menuPerformer perform:actionSelector |
|
5456 |
] |
|
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5457 |
]. |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5458 |
|
1943 | 5459 |
"Created: / 20.6.1997 / 11:47:42 / cg" |
5460 |
"Modified: / 1.11.1997 / 13:45:23 / cg" |
|
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5461 |
! ! |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
5462 |
|
1028 | 5463 |
!SimpleView methodsFor:'misc'! |
5464 |
||
5465 |
grabPointer |
|
5466 |
"grab the pointer - that is: report all motion events relative to |
|
5467 |
myself, even if moved out of myself." |
|
5468 |
||
2583 | 5469 |
self grabPointerWithCursor:nil |
5470 |
! |
|
5471 |
||
5472 |
grabPointerWithCursor:aCursorOrNil |
|
5473 |
"grab the pointer - that is: report all motion events relative to |
|
5474 |
myself, even if moved out of myself. |
|
5475 |
Show aCursor if the aargument is not nil." |
|
5476 |
||
5477 |
|sensor cursorId| |
|
5478 |
||
5479 |
"/ (sensor := self sensor) notNil ifTrue:[ |
|
5480 |
"/ "/ make certain all X events have been received |
|
5481 |
"/ device sync. |
|
5482 |
"/ "/ now all events have been received. |
|
5483 |
"/ "/ now, flush all pointer events |
|
5484 |
"/ sensor flushMotionEventsFor:nil |
|
5485 |
"/ ]. |
|
5486 |
||
5487 |
aCursorOrNil notNil ifTrue:[ |
|
2721 | 5488 |
cursorId := (aCursorOrNil onDevice:device) id. |
2583 | 5489 |
]. |
5490 |
device grabPointerIn:drawableId withCursor:cursorId |
|
1028 | 5491 |
! |
5492 |
||
5493 |
ungrabPointer |
|
5494 |
"ungrab the pointer" |
|
5495 |
||
1736 | 5496 |
|sensor| |
5497 |
||
5498 |
(sensor := self sensor) notNil ifTrue:[ |
|
2721 | 5499 |
"/ make certain all X events have been received |
5500 |
device sync. |
|
5501 |
"/ now all events have been received. |
|
5502 |
"/ now, flush all pointer events |
|
5503 |
sensor flushMotionEventsFor:self |
|
1736 | 5504 |
]. |
5505 |
||
5506 |
device ungrabPointer. |
|
5507 |
||
1028 | 5508 |
! ! |
5509 |
||
140 | 5510 |
!SimpleView methodsFor:'private'! |
5511 |
||
659 | 5512 |
componentsContainingX:x y:y do:aBlock |
5513 |
components notNil ifTrue:[ |
|
2721 | 5514 |
components do:[:aComponent | |
5515 |
|thisFrame| |
|
5516 |
||
5517 |
thisFrame := aComponent bounds. |
|
5518 |
(thisFrame containsPointX:x y:y) ifTrue:[ |
|
5519 |
aBlock value:aComponent |
|
5520 |
value:x - thisFrame left |
|
5521 |
value:y - thisFrame top. |
|
5522 |
] |
|
5523 |
] |
|
659 | 5524 |
]. |
5525 |
||
5526 |
"Created: 8.5.1996 / 23:40:59 / cg" |
|
5527 |
! |
|
5528 |
||
140 | 5529 |
computeInnerClip |
5530 |
"compute, but do not set the inside clip-area" |
|
5531 |
||
5532 |
|m2 nX nY nW nH| |
|
5533 |
||
5534 |
(margin ~~ 0) ifTrue:[ |
|
2721 | 5535 |
m2 := margin + margin. |
5536 |
nX := nY := margin. |
|
5537 |
nW := width - m2. |
|
5538 |
nH := height - m2. |
|
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5539 |
"/ transformation notNil ifTrue:[ |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5540 |
"/ nX := transformation applyInverseToX:nX. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5541 |
"/ nY := transformation applyInverseToY:nY. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5542 |
"/ nW := transformation applyInverseScaleX:nW. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5543 |
"/ nH := transformation applyInverseScaleY:nH. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5544 |
"/ ]. |
2721 | 5545 |
innerClipRect := Rectangle |
5546 |
left:nX |
|
5547 |
top:nY |
|
5548 |
width:nW |
|
5549 |
height:nH |
|
140 | 5550 |
] ifFalse:[ |
2721 | 5551 |
"no clipping" |
5552 |
innerClipRect := nil |
|
140 | 5553 |
] |
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5554 |
|
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5555 |
"Modified: / 22.5.1999 / 16:50:58 / cg" |
140 | 5556 |
! |
5557 |
||
269 | 5558 |
cornerFromRelativeCorner |
5559 |
"compute & return pixel corner from relativeCorner" |
|
5560 |
||
5561 |
^ self cornerFromRelativeCorner:relativeCorner |
|
5562 |
! |
|
5563 |
||
5564 |
cornerFromRelativeCorner:aPoint |
|
5565 |
"compute & return pixel corner from a relativeCorner, aPoint" |
|
5566 |
||
5567 |
|p r b bw| |
|
5568 |
||
5569 |
p := self pointFromRelative:aPoint. |
|
5570 |
||
2382 | 5571 |
bw := borderWidth ? 0. |
269 | 5572 |
insets isNil ifTrue:[ |
2721 | 5573 |
bw == 0 ifTrue:[ |
5574 |
^ p |
|
5575 |
]. |
|
5576 |
^ (p x - bw) @ (p y - bw) |
|
269 | 5577 |
]. |
5578 |
r := (insets at:3) + bw. |
|
5579 |
b := (insets at:4) + bw. |
|
5580 |
||
5581 |
"/ r := b := bw. |
|
5582 |
"/ rightInset notNil ifTrue:[ |
|
5583 |
"/ r := rightInset + bw |
|
5584 |
"/ ]. |
|
5585 |
"/ bottomInset notNil ifTrue:[ |
|
5586 |
"/ b := bottomInset + bw |
|
5587 |
"/ ]. |
|
5588 |
((r ~~ 0) or:[b ~~ 0]) ifTrue:[ |
|
2721 | 5589 |
^ (p x - r) @ (p y - b) |
269 | 5590 |
]. |
5591 |
^ p |
|
2382 | 5592 |
|
5593 |
"Modified: / 1.10.1998 / 13:21:33 / cg" |
|
269 | 5594 |
! |
5595 |
||
5596 |
extentFromRelativeExtent |
|
5597 |
"compute & return pixel extent from relativeExtent" |
|
5598 |
||
5599 |
^ self extentFromRelativeExtent:relativeExtent |
|
5600 |
! |
|
5601 |
||
5602 |
extentFromRelativeExtent:aPoint |
|
5603 |
"compute & return pixel extent from relativeExtent, aPoint" |
|
5604 |
||
5605 |
|rel newX newY inRect bw2 i| |
|
5606 |
||
5607 |
superView isNil ifTrue:[ |
|
2721 | 5608 |
inRect := 0@0 extent:device extent |
269 | 5609 |
] ifFalse:[ |
2721 | 5610 |
inRect := superView viewRectangle. |
269 | 5611 |
]. |
5612 |
||
5613 |
bw2 := borderWidth * 2. |
|
5614 |
||
5615 |
rel := aPoint x. |
|
5616 |
rel isInteger ifFalse:[ |
|
2721 | 5617 |
newX := (rel * (inRect width + bw2)) asInteger + inRect left. |
5618 |
(borderWidth ~~ 0) ifTrue:[ |
|
5619 |
newX := newX - borderWidth |
|
5620 |
]. |
|
269 | 5621 |
] ifTrue:[ |
2721 | 5622 |
newX := rel |
269 | 5623 |
]. |
5624 |
||
5625 |
rel := aPoint y. |
|
5626 |
rel isInteger ifFalse:[ |
|
2721 | 5627 |
newY := (rel * (inRect height + bw2)) asInteger + inRect top. |
5628 |
(borderWidth ~~ 0) ifTrue:[ |
|
5629 |
newY := newY - borderWidth |
|
5630 |
]. |
|
269 | 5631 |
] ifTrue:[ |
2721 | 5632 |
newY := rel |
269 | 5633 |
]. |
5634 |
||
5635 |
insets notNil ifTrue:[ |
|
2721 | 5636 |
i := insets at:1. "top" |
5637 |
(i ~~ 0) ifTrue:[ |
|
5638 |
newX := newX - i |
|
5639 |
]. |
|
5640 |
i := insets at:3. "left" |
|
5641 |
(i ~~ 0) ifTrue:[ |
|
5642 |
newX := newX - i |
|
5643 |
]. |
|
5644 |
i := insets at:2. "right" |
|
5645 |
(i ~~ 0) ifTrue:[ |
|
5646 |
newY := newY - i |
|
5647 |
]. |
|
5648 |
i := insets at:4. "bottom" |
|
5649 |
(i ~~ 0) ifTrue:[ |
|
5650 |
newY := newY - i |
|
5651 |
]. |
|
269 | 5652 |
]. |
5653 |
^ newX @ newY |
|
5654 |
! |
|
5655 |
||
5656 |
originFromRelativeOrigin |
|
5657 |
"compute & return pixel origin from relativeOrigin" |
|
5658 |
||
5659 |
^ self originFromRelativeOrigin:relativeOrigin |
|
5660 |
! |
|
5661 |
||
5662 |
originFromRelativeOrigin:aPoint |
|
5663 |
"compute & return pixel origin from relativeOrigin, aPoint" |
|
5664 |
||
5665 |
|p l t| |
|
5666 |
||
5667 |
p := self pointFromRelative:aPoint. |
|
5668 |
||
5669 |
insets isNil ifTrue:[ |
|
2721 | 5670 |
^ p |
269 | 5671 |
]. |
5672 |
l := insets at:1. |
|
5673 |
t := insets at:2. |
|
5674 |
||
5675 |
"/ l := t := 0. |
|
5676 |
"/ leftInset notNil ifTrue:[ |
|
5677 |
"/ l := leftInset |
|
5678 |
"/ ]. |
|
5679 |
"/ topInset notNil ifTrue:[ |
|
5680 |
"/ t := topInset |
|
5681 |
"/ ]. |
|
5682 |
((l ~~ 0) or:[t ~~ 0]) ifTrue:[ |
|
2721 | 5683 |
^ (p x + l) @ (p y + t) |
269 | 5684 |
]. |
5685 |
^ p |
|
5686 |
! |
|
5687 |
||
5688 |
pixelCorner:corner |
|
5689 |
"set the views corner in pixels" |
|
5690 |
||
5691 |
|w h| |
|
5692 |
||
5693 |
w := corner x - left + 1. |
|
5694 |
h := corner y - top + 1. |
|
5695 |
self pixelOrigin:(left @ top) extent:(w @ h) |
|
5696 |
||
5697 |
"Modified: 31.8.1995 / 18:20:22 / claus" |
|
5698 |
! |
|
5699 |
||
5700 |
pixelExtent:extent |
|
5701 |
"set the views extent in pixels" |
|
5702 |
||
5703 |
self pixelOrigin:(left @ top) extent:extent |
|
5704 |
! |
|
5705 |
||
1363 | 5706 |
pixelOrigin |
5707 |
"return the views origin in pixels. For subviews. the origin is relative |
|
5708 |
to the superviews top-left. For topViews, its the screen origin." |
|
5709 |
||
5710 |
^ self computeOrigin |
|
5711 |
! |
|
5712 |
||
269 | 5713 |
pixelOrigin:origin |
5714 |
"set the views origin in pixels. For subviews. the origin is relative |
|
5715 |
to the superviews top-left. For topViews, its the screen origin." |
|
5716 |
||
5717 |
|newLeft newTop| |
|
5718 |
||
5719 |
newLeft := origin x. |
|
5720 |
newTop := origin y. |
|
5721 |
((newTop ~~ top) or:[newLeft ~~ left]) ifTrue:[ |
|
2721 | 5722 |
top := newTop. |
5723 |
left := newLeft. |
|
5724 |
||
5725 |
" |
|
5726 |
if the receiver is visible, or is a topView, perform the |
|
5727 |
operation right away - otherwise, simply remember that the |
|
5728 |
origin has changed - will tell the display once we get realized |
|
5729 |
" |
|
269 | 5730 |
"/ (shown |
5731 |
"/ or:[superView isNil and:[drawableId notNil]]) ifTrue:[ |
|
5732 |
||
2721 | 5733 |
"/ no, have to do it if drawableId is there |
5734 |
"/ (otherwise, we could not move unmapped views around ... |
|
5735 |
"/ |
|
5736 |
drawableId notNil ifTrue:[ |
|
5737 |
device moveWindow:drawableId x:left y:top |
|
5738 |
] ifFalse:[ |
|
5739 |
originChanged := true |
|
5740 |
] |
|
269 | 5741 |
] |
5742 |
! |
|
5743 |
||
5744 |
pixelOrigin:origin corner:corner |
|
5745 |
"set the views origin and corner in pixels" |
|
5746 |
||
5747 |
|w h| |
|
5748 |
||
5749 |
w := corner x - origin x + 1. |
|
5750 |
h := corner y - origin y + 1. |
|
5751 |
self pixelOrigin:origin extent:(w @ h) |
|
5752 |
||
5753 |
"Modified: 31.8.1995 / 18:24:16 / claus" |
|
5754 |
! |
|
5755 |
||
140 | 5756 |
pixelOrigin:origin extent:extent |
5757 |
"set the views origin and extent in pixels" |
|
5758 |
||
5759 |
|newLeft newTop newWidth newHeight how |
|
5760 |
mustRedrawBottomEdge mustRedrawRightEdge mustRepaintBottom |
|
5761 |
mustRepaintRight sameOrigin oldWidth oldHeight| |
|
5762 |
||
5763 |
newLeft := origin x. |
|
5764 |
newTop := origin y. |
|
5765 |
sameOrigin := ((newTop == top) and:[newLeft == left]). |
|
5766 |
||
5767 |
newWidth := extent x. |
|
5768 |
newHeight := extent y. |
|
5769 |
||
5770 |
" |
|
5771 |
X complains badly if you try to create/resize a view with |
|
5772 |
a dimension <= 0 ... (although I think that 0 maks sense ...) |
|
5773 |
" |
|
5774 |
newWidth < 1 ifTrue:[ |
|
2721 | 5775 |
newWidth := 1. |
140 | 5776 |
]. |
5777 |
newHeight < 1 ifTrue:[ |
|
2721 | 5778 |
newHeight := 1 |
140 | 5779 |
]. |
5780 |
||
5781 |
((newWidth == width) and:[newHeight == height]) ifTrue:[ |
|
2721 | 5782 |
sameOrigin ifTrue:[^ self]. |
5783 |
^ self pixelOrigin:origin |
|
140 | 5784 |
]. |
5785 |
top := newTop. |
|
5786 |
left := newLeft. |
|
5787 |
||
5788 |
"/ shown ifTrue:[ "4-nov-94 actually correct," |
|
5789 |
drawableId notNil ifTrue:[ "but theres a bug in menus when resized while hidden" |
|
2721 | 5790 |
mustRedrawBottomEdge := (level ~~ 0) and:[newHeight < height]. |
5791 |
mustRedrawRightEdge := (level ~~ 0) and:[newWidth < width]. |
|
5792 |
||
5793 |
((newHeight <= height) and:[newWidth <= width]) ifTrue:[ |
|
5794 |
how := #smaller |
|
5795 |
] ifFalse:[ |
|
5796 |
((newHeight >= height) and:[newWidth >= width]) ifTrue:[ |
|
5797 |
how := #larger |
|
5798 |
] |
|
5799 |
]. |
|
5800 |
||
5801 |
mustRepaintRight := false. |
|
5802 |
mustRepaintBottom := false. |
|
5803 |
||
5804 |
shown ifTrue:[ |
|
5805 |
(level ~~ 0) ifTrue:[ |
|
5806 |
"clear the old edges" |
|
5807 |
||
5808 |
newWidth > width ifTrue:[ |
|
5809 |
self clippingRectangle:nil. |
|
5810 |
self paint:viewBackground. |
|
5811 |
self fillDeviceRectangleX:(width - margin) |
|
5812 |
y:0 |
|
5813 |
width:margin |
|
5814 |
height:height. |
|
5815 |
mustRepaintRight := true. |
|
5816 |
oldWidth := width |
|
5817 |
]. |
|
5818 |
newHeight > height ifTrue:[ |
|
5819 |
self clippingRectangle:nil. |
|
5820 |
self paint:viewBackground. |
|
5821 |
self fillDeviceRectangleX:0 |
|
5822 |
y:(height - margin) |
|
5823 |
width:width |
|
5824 |
height:margin. |
|
5825 |
mustRepaintBottom := true. |
|
5826 |
oldHeight := height |
|
5827 |
] |
|
5828 |
] |
|
5829 |
]. |
|
5830 |
||
5831 |
width := newWidth. |
|
5832 |
height := newHeight. |
|
5833 |
||
5834 |
self setInnerClip. |
|
5835 |
||
5836 |
"if view becomes smaller, send sizeChanged first" |
|
5837 |
(how == #smaller) ifTrue:[ |
|
5838 |
self sizeChanged:how |
|
5839 |
]. |
|
5840 |
||
5841 |
"have to tell X, when extent of view is changed" |
|
5842 |
sameOrigin ifTrue:[ |
|
5843 |
device resizeWindow:drawableId width:width height:height. |
|
5844 |
||
5845 |
] ifFalse:[ |
|
5846 |
"claus: some xservers seem to do better when resizing |
|
5847 |
first ...." |
|
140 | 5848 |
" |
2721 | 5849 |
(how == #smaller) ifTrue:[ |
5850 |
device resizeWindow:drawableId width:width height:height. |
|
5851 |
device moveWindow:drawableId x:left y:top |
|
5852 |
] ifFalse:[ |
|
5853 |
device moveResizeWindow:drawableId x:left y:top width:width height:height |
|
5854 |
]. |
|
140 | 5855 |
" |
2721 | 5856 |
device moveResizeWindow:drawableId x:left y:top |
5857 |
width:width height:height. |
|
5858 |
]. |
|
5859 |
||
5860 |
"if view becomes bigger, send sizeChanged after" |
|
5861 |
(how ~~ #smaller) ifTrue:[ |
|
5862 |
self sizeChanged:how |
|
5863 |
]. |
|
5864 |
||
5865 |
shown ifTrue:[ |
|
5866 |
(mustRedrawBottomEdge or:[mustRedrawRightEdge]) ifTrue:[ |
|
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5867 |
self deviceClippingRectangle:nil. |
2721 | 5868 |
mustRedrawBottomEdge ifTrue:[ |
5869 |
self drawBottomEdge |
|
5870 |
]. |
|
5871 |
mustRedrawRightEdge ifTrue:[ |
|
5872 |
self drawRightEdge |
|
5873 |
]. |
|
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5874 |
self deviceClippingRectangle:innerClipRect |
2721 | 5875 |
]. |
5876 |
]. |
|
5877 |
||
5878 |
mustRepaintRight ifTrue:[ |
|
5879 |
self invalidateDeviceRectangle:(((oldWidth - margin) @ 0) |
|
5880 |
extent:margin@height) |
|
5881 |
repairNow:false. |
|
2400
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
5882 |
"/ self redrawDeviceX:(oldWidth - margin) |
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
5883 |
"/ y:0 |
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
5884 |
"/ width:margin |
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
5885 |
"/ height:height. |
2721 | 5886 |
]. |
5887 |
mustRepaintBottom ifTrue:[ |
|
5888 |
self invalidateDeviceRectangle:((0 @ (oldHeight - margin)) |
|
5889 |
extent:width@margin) |
|
5890 |
repairNow:false. |
|
2400
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
5891 |
"/ self redrawDeviceX:0 |
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
5892 |
"/ y:(oldHeight - margin) |
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
5893 |
"/ width:width |
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
5894 |
"/ height:margin. |
2721 | 5895 |
]. |
140 | 5896 |
] ifFalse:[ |
2721 | 5897 |
"otherwise memorize the need for a sizeChanged message" |
5898 |
||
5899 |
width := newWidth. |
|
5900 |
height := newHeight. |
|
5901 |
sameOrigin ifFalse:[ |
|
5902 |
originChanged := true. |
|
5903 |
]. |
|
5904 |
extentChanged := true |
|
140 | 5905 |
] |
739 | 5906 |
|
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5907 |
"Modified: / 25.5.1999 / 14:49:56 / cg" |
140 | 5908 |
! |
5909 |
||
5910 |
pointFromRelative:p |
|
5911 |
"compute absolute coordinate from p" |
|
5912 |
||
5913 |
|newX newY rel inRect bw superWidth superHeight superLeft superTop | |
|
5914 |
||
2382 | 5915 |
bw := borderWidth ? 0. |
140 | 5916 |
|
5917 |
superView isNil ifTrue:[ |
|
2721 | 5918 |
superWidth := device width + bw. |
5919 |
superHeight := device height + bw. |
|
5920 |
superLeft := superTop := 0. |
|
140 | 5921 |
] ifFalse:[ |
2721 | 5922 |
inRect := superView viewRectangle. |
5923 |
superWidth := inRect width. |
|
5924 |
superHeight := inRect height. |
|
5925 |
superLeft := inRect left. |
|
5926 |
superTop := inRect top. |
|
140 | 5927 |
]. |
5928 |
||
5929 |
rel := p x. |
|
5930 |
rel isInteger ifTrue:[ |
|
2721 | 5931 |
newX := rel |
140 | 5932 |
] ifFalse:[ |
2721 | 5933 |
newX := (rel * superWidth) asInteger + superLeft. |
5934 |
(bw ~~ 0) ifTrue:[ |
|
5935 |
rel ~= 1.0 ifTrue:[ |
|
5936 |
newX := newX - bw |
|
5937 |
] |
|
5938 |
] |
|
140 | 5939 |
]. |
5940 |
||
5941 |
rel := p y. |
|
5942 |
rel isInteger ifTrue:[ |
|
2721 | 5943 |
newY := rel |
140 | 5944 |
] ifFalse:[ |
2721 | 5945 |
newY := (rel * superHeight) asInteger + superTop. |
5946 |
(bw ~~ 0) ifTrue:[ |
|
5947 |
rel ~= 1.0 ifTrue:[ |
|
5948 |
newY := newY - bw |
|
5949 |
] |
|
5950 |
] |
|
140 | 5951 |
]. |
5952 |
^ newX @ newY |
|
2382 | 5953 |
|
5954 |
"Modified: / 1.10.1998 / 13:21:14 / cg" |
|
140 | 5955 |
! |
5956 |
||
5957 |
setBorderColor |
|
5958 |
"set my borderColor" |
|
5959 |
||
5960 |
|id dither| |
|
5961 |
||
5962 |
drawableId notNil ifTrue:[ |
|
2721 | 5963 |
borderColor := borderColor on:device. |
5964 |
id := borderColor colorId. |
|
5965 |
id notNil ifTrue:[ |
|
5966 |
device setWindowBorderColor:id in:drawableId |
|
5967 |
] ifFalse:[ |
|
5968 |
dither := borderColor ditherForm. |
|
5969 |
dither notNil ifTrue:[ |
|
5970 |
device setWindowBorderPixmap:(dither id) in:drawableId |
|
5971 |
] ifFalse:[ |
|
5972 |
'SimpleView [warning]: bad borderColor' errorPrintCR |
|
5973 |
] |
|
5974 |
] |
|
135 | 5975 |
] |
1172
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
5976 |
|
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
5977 |
"Modified: 10.1.1997 / 18:06:34 / cg" |
135 | 5978 |
! |
5979 |
||
269 | 5980 |
setInnerClip |
5981 |
"compute, and set the inside clip-area" |
|
5982 |
||
5983 |
self computeInnerClip. |
|
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5984 |
self deviceClippingRectangle:innerClipRect. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5985 |
|
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5986 |
"Modified: / 25.5.1999 / 14:45:53 / cg" |
1903 | 5987 |
! |
5988 |
||
5989 |
setViewShape |
|
5990 |
|form| |
|
5991 |
||
5992 |
(form := viewShape borderShapeForm) notNil ifTrue:[ |
|
2721 | 5993 |
device setWindowBorderShape:(form id) in:drawableId |
1903 | 5994 |
]. |
5995 |
(form := viewShape viewShapeForm) notNil ifTrue:[ |
|
2721 | 5996 |
device setWindowShape:(form id) in:drawableId |
1903 | 5997 |
]. |
5998 |
||
5999 |
"Created: 18.9.1997 / 11:09:00 / cg" |
|
140 | 6000 |
! ! |
6001 |
||
269 | 6002 |
!SimpleView methodsFor:'queries'! |
6003 |
||
6004 |
buttonMotionEventPending |
|
6005 |
"return true, if a button motion event is pending. |
|
6006 |
Normally, you dont want to use this, since no polling is needed |
|
6007 |
(not even for mouse-tracking). |
|
6008 |
Dont use it, since it does not honor the windowGroup, but |
|
6009 |
goes directly to the device instead. |
|
6010 |
Actually, its a historical leftover" |
|
6011 |
||
6012 |
windowGroup notNil ifTrue:[ |
|
2721 | 6013 |
^ windowGroup sensor hasButtonMotionEventFor:self |
140 | 6014 |
]. |
269 | 6015 |
^ super buttonMotionEventPending |
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
6016 |
|
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
6017 |
"Modified: 1.11.1996 / 17:04:38 / cg" |
269 | 6018 |
! |
6019 |
||
6020 |
canHandle:aKey |
|
6021 |
"return true, if I like to handle the key (from a keyPress event). |
|
6022 |
OBSOLETE: do not use & depend on this method, it is a historic |
|
6023 |
leftOver and will be removed. Use the delegation mechanism for this." |
|
6024 |
||
6025 |
^ false |
|
6026 |
! |
|
6027 |
||
6028 |
canHandle:aKey from:aView |
|
6029 |
"return true, if I like to handle the key (from a keyPress event) |
|
6030 |
in aView. |
|
6031 |
OBSOLETE: do not use & depend on this method, it is a historic |
|
6032 |
leftOver and will be removed. Use the delegation mechanism for this." |
|
6033 |
||
6034 |
^ self canHandle:aKey |
|
6035 |
! |
|
6036 |
||
6037 |
delegatesTo:someone |
|
6038 |
"return true, if I delegate events to someone" |
|
6039 |
||
6040 |
delegate isNil ifTrue:[^ false]. |
|
6041 |
^ delegate delegatesTo:someone |
|
6042 |
! |
|
6043 |
||
1748 | 6044 |
focusSequence |
6045 |
"return nil - for compatibility with StdSysView & SubCanvas. |
|
6046 |
In the future, subviews which want to slice their components into the |
|
6047 |
focusSequence may redefine this to return a list of their components." |
|
6048 |
||
6049 |
^ nil |
|
6050 |
! |
|
6051 |
||
269 | 6052 |
hasFocus |
6053 |
"return true, if the receiver has the keyboard focus |
|
6054 |
(either via the focusView mechanism in the windowGroup, |
|
6055 |
or via delegation)" |
|
6056 |
||
6057 |
|focusView delegate| |
|
6058 |
||
6059 |
windowGroup isNil ifTrue:[^ false]. |
|
6060 |
||
6061 |
(focusView := windowGroup focusView) == self ifTrue:[^ true]. |
|
2506 | 6062 |
|
269 | 6063 |
focusView notNil ifTrue:[ |
2721 | 6064 |
"mhmh - is there a delegation to me ?" |
6065 |
(delegate := focusView delegate) notNil ifTrue:[ |
|
6066 |
delegate == self ifTrue:[^ true]. |
|
6067 |
^ delegate delegatesTo:self |
|
6068 |
] |
|
135 | 6069 |
]. |
269 | 6070 |
^ false |
6071 |
! |
|
6072 |
||
370 | 6073 |
is3D |
6074 |
"return true, if my style is some kind of 3D style |
|
6075 |
This is OBSOLETE and will be removed." |
|
6076 |
||
6077 |
^ styleSheet is3D |
|
6078 |
! |
|
6079 |
||
794 | 6080 |
isBorderedWrapper |
6081 |
^ false |
|
6082 |
||
6083 |
"Created: 5.6.1996 / 14:11:15 / cg" |
|
6084 |
! |
|
6085 |
||
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
6086 |
isComponentOf:aViewOrComponent |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
6087 |
"return true, if I am a (direct or indirect) component of aViewOrComponent" |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
6088 |
|
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
6089 |
aViewOrComponent == self isNil ifTrue:[^ true]. |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
6090 |
superView isNil ifTrue:[^ false]. |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
6091 |
superView == aViewOrComponent ifTrue:[^ true]. |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
6092 |
^ superView isComponentOf:aViewOrComponent |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
6093 |
|
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
6094 |
"Created: 5.6.1996 / 14:23:57 / cg" |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
6095 |
"Modified: 5.6.1996 / 14:26:14 / cg" |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
6096 |
! |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
6097 |
|
2496 | 6098 |
isDefault |
6099 |
"return true, if I am a default widget; |
|
6100 |
Used with autoAccept. Currently only default buttons are supposed to return |
|
6101 |
true here" |
|
6102 |
||
6103 |
^ false |
|
6104 |
! |
|
6105 |
||
2430
fbce2378d686
added isExternalTopView query.
Claus Gittinger <cg@exept.de>
parents:
2425
diff
changeset
|
6106 |
isExternalTopView |
2454 | 6107 |
"return true, if this is an external topView - always false here" |
6108 |
||
2430
fbce2378d686
added isExternalTopView query.
Claus Gittinger <cg@exept.de>
parents:
2425
diff
changeset
|
6109 |
^ false |
fbce2378d686
added isExternalTopView query.
Claus Gittinger <cg@exept.de>
parents:
2425
diff
changeset
|
6110 |
|
fbce2378d686
added isExternalTopView query.
Claus Gittinger <cg@exept.de>
parents:
2425
diff
changeset
|
6111 |
|
fbce2378d686
added isExternalTopView query.
Claus Gittinger <cg@exept.de>
parents:
2425
diff
changeset
|
6112 |
! |
fbce2378d686
added isExternalTopView query.
Claus Gittinger <cg@exept.de>
parents:
2425
diff
changeset
|
6113 |
|
497 | 6114 |
isInputField |
6115 |
"return true, if the receiver is some kind of input view, |
|
6116 |
i.e. it should (can) be part of an enterGroup. |
|
6117 |
Return false here, this is redefined in EnterField." |
|
6118 |
||
6119 |
^ false |
|
6120 |
||
6121 |
"Created: 4.3.1996 / 11:34:07 / cg" |
|
6122 |
! |
|
6123 |
||
2410 | 6124 |
isJavaView |
6125 |
^ false |
|
6126 |
||
6127 |
"Created: / 4.12.1998 / 14:10:06 / cg" |
|
6128 |
! |
|
6129 |
||
2588 | 6130 |
isKeyboardConsumer |
6131 |
"return true, if the receiver is akeyboard consumer; |
|
6132 |
i.e. it can handle (non-shortkey) keyboard input, |
|
6133 |
keyboardConsumer are potential candidates for getting the keyboard |
|
6134 |
focus initially within dialogBoxes, or when the focus-follows-pointer |
|
6135 |
mode is off. |
|
6136 |
Return false here, this is redefined in EditTextView and EditField." |
|
6137 |
||
6138 |
^ false |
|
6139 |
! |
|
6140 |
||
964 | 6141 |
isLayoutWrapper |
6142 |
^ false |
|
6143 |
||
6144 |
"Created: 19.7.1996 / 17:51:04 / cg" |
|
6145 |
! |
|
6146 |
||
2161
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
6147 |
isScrollWrapper |
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
6148 |
^ false |
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
6149 |
|
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
6150 |
"Created: / 5.6.1996 / 14:11:15 / cg" |
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
6151 |
"Modified: / 20.6.1998 / 14:15:29 / cg" |
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
6152 |
! |
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
6153 |
|
269 | 6154 |
isSubViewOf:aView |
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
6155 |
"return true, if I am a (direct or indirect) subview of aView" |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
6156 |
|
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
6157 |
self obsoleteMethodWarning:'use #isComponentOf:'. |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
6158 |
^ self isComponentOf:aView. |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
6159 |
|
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
6160 |
"Modified: 5.6.1996 / 14:25:35 / cg" |
269 | 6161 |
! |
6162 |
||
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
6163 |
isWrapper |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
6164 |
^ false |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
6165 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
6166 |
"Created: 5.6.1996 / 01:05:06 / cg" |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
6167 |
! |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
6168 |
|
269 | 6169 |
preferredBounds |
6170 |
"ST-80 compatibility." |
|
6171 |
||
971 | 6172 |
^ 0@0 extent:(self preferredExtent) |
6173 |
||
6174 |
"Modified: 19.7.1996 / 20:41:36 / cg" |
|
269 | 6175 |
! |
6176 |
||
6177 |
preferredExtent |
|
6178 |
"return my preferred extent - this is the minimum size I would like to have. |
|
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6179 |
If the preferredExtent has been set, that one is returned. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6180 |
Otherwise, if there are any components, a rectangle enclosing them |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6181 |
is returned. Otherwise, the actual extent is returned." |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6182 |
|
1063 | 6183 |
|maxX maxY| |
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6184 |
|
971 | 6185 |
"/ If I have an explicit preferredExtent .. |
6186 |
||
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6187 |
preferredExtent notNil ifTrue:[ |
2721 | 6188 |
^ preferredExtent |
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6189 |
]. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6190 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6191 |
"/ mhmh - if I have subViews, collect their |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6192 |
"/ preferred bounds ... |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6193 |
|
269 | 6194 |
subViews notNil ifTrue:[ |
2721 | 6195 |
maxX := maxY := 0. |
6196 |
subViews do:[:aSubView | |
|
6197 |
|org corn| |
|
6198 |
||
6199 |
org := aSubView computeOrigin. |
|
6200 |
corn := org + aSubView preferredExtent. |
|
6201 |
maxX := maxX max:corn x. |
|
6202 |
maxY := maxY max:corn y. |
|
6203 |
] |
|
140 | 6204 |
]. |
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6205 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6206 |
"/ mhmh - if I have components, collect their |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6207 |
"/ preferred bounds ... |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6208 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6209 |
components notNil ifTrue:[ |
2721 | 6210 |
maxX isNil ifTrue:[ |
6211 |
maxX := maxY := 0. |
|
6212 |
]. |
|
6213 |
components do:[:aComponent | |
|
6214 |
|bounds org corn| |
|
6215 |
||
6216 |
bounds := aComponent preferredBounds. |
|
6217 |
corn := bounds corner. |
|
6218 |
maxX := maxX max:corn x. |
|
6219 |
maxY := maxY max:corn y. |
|
6220 |
] |
|
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6221 |
]. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6222 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6223 |
"/ nothing found - return the actual size |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6224 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6225 |
maxX isNil ifTrue:[ |
2721 | 6226 |
^ self extent. |
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6227 |
]. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6228 |
|
269 | 6229 |
^ maxX @ maxY. |
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
6230 |
|
971 | 6231 |
"Modified: 19.7.1996 / 20:43:32 / cg" |
269 | 6232 |
! |
6233 |
||
2130
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
6234 |
resources |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
6235 |
^ resources |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
6236 |
|
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
6237 |
"Created: / 25.5.1998 / 13:00:02 / cg" |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
6238 |
! |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
6239 |
|
269 | 6240 |
sizeFixed |
6241 |
"return true, if this vew wants its size to remain unchanged. |
|
6242 |
Used by panels, to check if their components want to keep their size." |
|
6243 |
||
6244 |
^ false |
|
6245 |
||
6246 |
"Created: 17.9.1995 / 20:29:20 / claus" |
|
1699
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
6247 |
! ! |
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
6248 |
|
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
6249 |
!SimpleView methodsFor:'queries - internal'! |
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
6250 |
|
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
6251 |
nativeWindowType |
1702 | 6252 |
"return a symbol describing my native window type - here, nil is returned |
6253 |
(may be used internally by the device as a native window creation hint)" |
|
6254 |
||
1699
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
6255 |
^ nil |
1354 | 6256 |
! |
6257 |
||
6258 |
specClass |
|
1943 | 6259 |
"fallback - heuristics to get a specClass for some viewClass. |
6260 |
Based upon my className, look for a corresponding Spec-class. |
|
6261 |
If there is none, return ArbiraryComponentSpec as a fallBack" |
|
6262 |
||
6263 |
|myClass myName cls| |
|
6264 |
||
6265 |
((myClass := self class) == View |
|
6266 |
or:[myClass == SimpleView]) ifTrue:[ |
|
2721 | 6267 |
^ ViewSpec "/ CompositeSpecCollection |
1943 | 6268 |
]. |
6269 |
||
6270 |
"/ try: appending 'Spec' to my classes name |
|
1409
3818a8a85c16
use CompositeSpecCollection as specClass for
Claus Gittinger <cg@exept.de>
parents:
1402
diff
changeset
|
6271 |
|
1354 | 6272 |
myName := self class name. |
6273 |
cls := Smalltalk classNamed:(myName , 'Spec'). |
|
1943 | 6274 |
cls notNil ifTrue:[ |
2721 | 6275 |
cls isLoaded ifFalse:[ |
6276 |
cls autoload |
|
6277 |
]. |
|
6278 |
(cls notNil and:[cls isSubclassOf:UISpecification]) ifTrue:[^ cls]. |
|
1943 | 6279 |
]. |
1354 | 6280 |
|
6281 |
(myName endsWith:'View') ifTrue:[ |
|
1943 | 6282 |
"/ "/ try name without 'View' |
6283 |
"/ cls := Smalltalk classNamed:(myName copyWithoutLast:4). |
|
6284 |
"/ (cls notNil and:[cls isLoaded not]) ifTrue:[ |
|
6285 |
"/ cls autoload |
|
6286 |
"/ ]. |
|
6287 |
"/ (cls notNil and:[cls isSubclassOf:UISpecification]) ifTrue:[^ cls]. |
|
6288 |
||
2721 | 6289 |
"/ try with 'View' replaced by 'Spec' |
6290 |
cls := Smalltalk classNamed:((myName copyWithoutLast:4) , 'View'). |
|
6291 |
cls notNil ifTrue:[ |
|
6292 |
cls isLoaded ifFalse:[ |
|
6293 |
cls autoload |
|
6294 |
]. |
|
6295 |
(cls notNil and:[cls isSubclassOf:UISpecification]) ifTrue:[^ cls]. |
|
6296 |
] |
|
1943 | 6297 |
]. |
6298 |
||
6299 |
"/ fallBack for all others |
|
1356 | 6300 |
^ ArbitraryComponentSpec |
6301 |
||
6302 |
"/ self error:'no spec class (subclassResponsibility)' |
|
1354 | 6303 |
|
6304 |
" |
|
6305 |
FramedBox new specClass |
|
6306 |
" |
|
1409
3818a8a85c16
use CompositeSpecCollection as specClass for
Claus Gittinger <cg@exept.de>
parents:
1402
diff
changeset
|
6307 |
|
1943 | 6308 |
"Modified: / 31.10.1997 / 19:44:55 / cg" |
1699
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
6309 |
! |
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
6310 |
|
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
6311 |
windowStyle |
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
6312 |
"return a symbol describing my style" |
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
6313 |
|
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
6314 |
self isPopUpView ifTrue:[ |
2721 | 6315 |
^ #popUp |
1699
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
6316 |
]. |
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
6317 |
|
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
6318 |
^ #normal |
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
6319 |
|
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
6320 |
"Created: 2.5.1997 / 14:29:48 / cg" |
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
6321 |
"Modified: 2.5.1997 / 14:30:14 / cg" |
140 | 6322 |
! ! |
6323 |
||
6324 |
!SimpleView methodsFor:'realization'! |
|
6325 |
||
269 | 6326 |
create |
6327 |
"create (i.e. tell my device about me) if not already created. |
|
6328 |
This does not make the view visible (needs a #map for that)" |
|
6329 |
||
6330 |
drawableId isNil ifTrue:[ |
|
2721 | 6331 |
" |
6332 |
make certain that superview is created also |
|
6333 |
" |
|
6334 |
superView notNil ifTrue:[ |
|
6335 |
superView view create. |
|
269 | 6336 |
|
6337 |
"/ "and put my controller into the superviews controller list" |
|
6338 |
"/ controller notNil ifTrue:[ |
|
6339 |
"/ superView controller notNil ifTrue:[ |
|
6340 |
"/ controller manager:(superView controller manager) |
|
6341 |
"/ ] |
|
6342 |
"/ ] |
|
2721 | 6343 |
] ifFalse:[ |
6344 |
"/ |
|
6345 |
"/ if the display is not already dispatching events, |
|
6346 |
"/ this starts the event process. |
|
6347 |
"/ |
|
6348 |
device startDispatch |
|
6349 |
]. |
|
6350 |
||
6351 |
cursor notNil ifTrue:[ |
|
6352 |
cursor := cursor onDevice:device. |
|
6353 |
]. |
|
6354 |
||
6355 |
explicitExtent ~~ true ifTrue:[ |
|
6356 |
self resize |
|
6357 |
]. |
|
6358 |
||
6359 |
self physicalCreate. |
|
6360 |
||
6361 |
viewBackground notNil ifTrue:[ |
|
6362 |
self setViewBackground |
|
6363 |
]. |
|
6364 |
||
6365 |
self initializeMiddleButtonMenu. |
|
6366 |
self initEvents. |
|
6367 |
||
6368 |
" |
|
6369 |
this is the first create, |
|
6370 |
force sizechange messages to be sent to the view |
|
6371 |
" |
|
6372 |
extentChanged := true. |
|
6373 |
originChanged := true |
|
151 | 6374 |
] |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
6375 |
|
1494
4faf11deec70
cursor #on: is obsoleted by #onDevice:.
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
6376 |
"Modified: 28.3.1997 / 13:50:17 / cg" |
151 | 6377 |
! |
6378 |
||
269 | 6379 |
createWithAllSubViews |
6380 |
"create, then create all subviews" |
|
6381 |
||
6382 |
drawableId isNil ifTrue:[self create]. |
|
6383 |
subViews notNil ifTrue:[ |
|
2721 | 6384 |
subViews do:[:subView | subView createWithAllSubViews] |
269 | 6385 |
] |
6386 |
! |
|
6387 |
||
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6388 |
fetchDeviceResources |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6389 |
"fetch all device specific resources. This is invoked, |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6390 |
when the view is made visible on some device for the very first |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6391 |
time, to allocate device specific colors, fonts, bitmaps etc. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6392 |
The view may keep those in instance variables, to avoid reallocating |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6393 |
those with every redraw. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6394 |
If you ommit to do this, the views will still be able to display themself, |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6395 |
but possibly slower, since resources are reallocated over and over. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6396 |
If you redefine this method, make certain that 'super fetchDeviceResources' |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6397 |
is always sent." |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6398 |
|
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6399 |
shadowColor notNil ifTrue:[shadowColor := shadowColor on:device]. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6400 |
lightColor notNil ifTrue:[lightColor := lightColor on:device]. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6401 |
|
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6402 |
"Created: 13.1.1997 / 21:51:59 / cg" |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6403 |
! |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6404 |
|
140 | 6405 |
fixSize |
6406 |
"This is called right before the view is made visible. |
|
6407 |
Adjust the size of the view according to either relative/abs or |
|
6408 |
block extent; also set origin. Also, subclasses may redefine this |
|
6409 |
method to adjust the size based on some extent (for example, PopUpMenus |
|
6410 |
do so to take care of changed number of menu entries)." |
|
6411 |
||
151 | 6412 |
|org ext r| |
6413 |
||
6414 |
" |
|
6415 |
slowly migrating to use layoutObjects ... |
|
6416 |
" |
|
6417 |
layout notNil ifTrue:[ |
|
2721 | 6418 |
(originChanged or:[extentChanged or:[cornerChanged]]) ifTrue:[ |
6419 |
r := (layout rectangleRelativeTo:(superView viewRectangle) |
|
6420 |
preferred:(self preferredBounds)). |
|
6421 |
org := r origin rounded. |
|
6422 |
ext := r extent rounded. |
|
6423 |
self pixelOrigin:org extent:ext. |
|
6424 |
]. |
|
6425 |
^ self. |
|
151 | 6426 |
]. |
6427 |
||
140 | 6428 |
"if the extent is not the one we created the window with ..." |
890
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
6429 |
"/ extentChanged ifTrue:[ |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
6430 |
"/ self sizeChanged:nil. |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
6431 |
"/ extentChanged := false |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
6432 |
"/ ]. |
140 | 6433 |
|
6434 |
originChanged ifTrue:[ |
|
6435 |
"/ org := self computeOrigin. |
|
6436 |
"/ self pixelOrigin:org. |
|
2721 | 6437 |
originRule notNil ifTrue:[ |
6438 |
self pixelOrigin:self computeOrigin |
|
6439 |
] ifFalse:[ |
|
6440 |
relativeOrigin notNil ifTrue:[ |
|
6441 |
self originFromRelativeOrigin:relativeOrigin |
|
6442 |
] ifFalse:[ |
|
6443 |
shown ifTrue:[ |
|
6444 |
device moveWindow:drawableId x:left y:top. |
|
6445 |
] ifFalse:[ |
|
6446 |
self pixelOrigin:left@top |
|
6447 |
]. |
|
6448 |
]. |
|
6449 |
]. |
|
6450 |
originChanged := false |
|
140 | 6451 |
] |
890
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
6452 |
|
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
6453 |
"Modified: 18.6.1996 / 21:44:03 / cg" |
140 | 6454 |
! |
6455 |
||
393
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
6456 |
hide |
1356 | 6457 |
"only useful with modal views: hide the view and return control |
6458 |
back to the suspended main view. Ignored for non-modal views." |
|
6459 |
||
2579 | 6460 |
|masterGroup| |
1356 | 6461 |
|
6462 |
realized ifFalse:[^ self]. |
|
6463 |
windowGroup isNil ifTrue:[^ self]. |
|
6464 |
windowGroup isModal ifFalse:[^ self]. |
|
2579 | 6465 |
masterGroup := windowGroup previousGroup. |
1356 | 6466 |
|
6467 |
windowGroup notNil ifTrue:[windowGroup focusView:nil]. |
|
6468 |
||
6469 |
self unmap. |
|
6470 |
device flush. |
|
6471 |
||
2579 | 6472 |
masterGroup notNil ifTrue:[ |
2721 | 6473 |
" |
6474 |
this is a kludge for IRIS and others which do not provide backingstore: |
|
6475 |
when we hide a modalbox (such as a searchbox) which covered |
|
6476 |
a scrollbar, the scrollbars bitblt-method will copy from the |
|
6477 |
not-yet redrawn area - effectively clearing the scroller. |
|
6478 |
We need a short delay here, since at this time, the expose event has |
|
6479 |
not yet arrived. |
|
6480 |
" |
|
6481 |
Delay waitForSeconds:0.05. |
|
6482 |
masterGroup processExposeEvents |
|
2576 | 6483 |
]. |
6484 |
||
6485 |
"/ WindowGroup leaveSignal raise. |
|
6486 |
"/ "/ not reached |
|
6487 |
"/ ^ self |
|
393
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
6488 |
! |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
6489 |
|
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
6490 |
hideRequest |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
6491 |
"for protocol compatibility with modal dialogs; |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
6492 |
ignored here." |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
6493 |
|
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
6494 |
^ self |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
6495 |
! |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
6496 |
|
269 | 6497 |
map |
1827 | 6498 |
"make the view visible on the screen. |
6499 |
For topViews, the windowManager will choose (or ask for) the |
|
2103
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
6500 |
views position on the screen. |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
6501 |
Notice: |
2721 | 6502 |
Actually, this method is only valid for topViews; |
6503 |
however, it is defined here to allow things like 'Button new realize'" |
|
1827 | 6504 |
|
6505 |
self mapAt:nil iconified:false |
|
6506 |
||
6507 |
"Modified: 24.7.1997 / 13:44:25 / cg" |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6508 |
! |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6509 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6510 |
mapAt:aPoint |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6511 |
"make the view visible on the screen. |
1827 | 6512 |
For topViews, if aPoint is nonNil, the views origin is located there |
2103
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
6513 |
(unless you have a dictator as windowManager ;-) |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
6514 |
Notice: |
2721 | 6515 |
Actually, this method is only valid for topViews; |
6516 |
however, it is defined here to allow things like 'Button new realize'" |
|
1827 | 6517 |
|
6518 |
self mapAt:aPoint iconified:false |
|
6519 |
||
6520 |
"Modified: 24.7.1997 / 13:45:02 / cg" |
|
6521 |
! |
|
6522 |
||
6523 |
mapAt:aPoint iconified:iconified |
|
6524 |
"make the view visible on the screen. |
|
6525 |
For topViews, if aPoint is nonNil, the views origin is located there |
|
6526 |
(unless you have a dictator as windowManager ;-). |
|
2103
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
6527 |
If the iconified argument is true, the window is created as icon initially. |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
6528 |
Notice: |
2721 | 6529 |
Actually, this method is only valid for topViews; |
6530 |
however, it is defined here to allow things like 'Button new realize'" |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6531 |
|
1809
fec93025e9e7
mapping trouble fixed (see mswindows scrollBar remap)
Claus Gittinger <cg@exept.de>
parents:
1808
diff
changeset
|
6532 |
|subs| |
fec93025e9e7
mapping trouble fixed (see mswindows scrollBar remap)
Claus Gittinger <cg@exept.de>
parents:
1808
diff
changeset
|
6533 |
|
269 | 6534 |
realized ifFalse:[ |
2721 | 6535 |
drawableId isNil ifTrue:[ |
6536 |
" |
|
6537 |
first time ? |
|
6538 |
yes, realize (implies a map) |
|
6539 |
" |
|
6540 |
self realizeKeepingGroup:false at:aPoint iconified:iconified |
|
6541 |
] ifFalse:[ |
|
6542 |
" |
|
6543 |
no, map only |
|
6544 |
" |
|
6545 |
realized := true. |
|
6546 |
aPoint isNil ifTrue:[ |
|
6547 |
iconified ifTrue:[ |
|
6548 |
device |
|
6549 |
mapView:self id:drawableId iconified:iconified |
|
6550 |
atX:0 y:0 |
|
6551 |
width:width height:height |
|
6552 |
minExtent:(self minExtent) maxExtent:(self maxExtent). |
|
6553 |
] ifFalse:[ |
|
6554 |
device mapWindow:drawableId. |
|
6555 |
] |
|
6556 |
] ifFalse:[ |
|
6557 |
left := aPoint x. |
|
6558 |
top := aPoint y. |
|
6559 |
device |
|
6560 |
mapView:self id:drawableId iconified:iconified |
|
6561 |
atX:left y:top |
|
6562 |
width:width height:height |
|
6563 |
minExtent:(self minExtent) maxExtent:(self maxExtent). |
|
6564 |
]. |
|
6565 |
||
6566 |
"/ |
|
6567 |
"/ implies that all realized subviews |
|
6568 |
"/ are now also mapped |
|
6569 |
"/ |
|
6570 |
"/ not needed for topViews - the mapped event does exactly the same |
|
6571 |
"/ however, X does not generate mapped events for non-topViews |
|
6572 |
"/ when a view gets deiconified. |
|
6573 |
||
6574 |
superView notNil ifTrue:[ |
|
6575 |
(subs := self subViews) notNil ifTrue:[ |
|
6576 |
subs do:[:v | |
|
6577 |
v shown ifFalse:[ |
|
6578 |
v mapped |
|
6579 |
] |
|
6580 |
] |
|
6581 |
] |
|
6582 |
] |
|
6583 |
]. |
|
140 | 6584 |
] |
654 | 6585 |
|
1039
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
6586 |
"Modified: 23.8.1996 / 14:53:55 / stefan" |
1827 | 6587 |
"Created: 24.7.1997 / 13:43:23 / cg" |
6588 |
"Modified: 24.7.1997 / 13:46:21 / cg" |
|
6589 |
! |
|
6590 |
||
6591 |
mapIconified |
|
6592 |
"make the view visible on the screen. |
|
6593 |
For topViews, the view is created in iconified state" |
|
6594 |
||
6595 |
self mapAt:nil iconified:true |
|
6596 |
||
6597 |
"Modified: 24.7.1997 / 13:44:25 / cg" |
|
6598 |
"Created: 24.7.1997 / 13:47:03 / cg" |
|
140 | 6599 |
! |
6600 |
||
269 | 6601 |
physicalCreate |
6602 |
"common code for create & recreate: |
|
6603 |
physically create (but do not map) the view on the device." |
|
6604 |
||
2088 | 6605 |
|sv org listener ret isInputOnly| |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
6606 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
6607 |
sv := superView isNil ifTrue:[superView] ifFalse:[superView view]. |
269 | 6608 |
|
1716
d6bf8f0deb18
added werners eventListener hook for view creation
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6609 |
org := (left @ top). |
d6bf8f0deb18
added werners eventListener hook for view creation
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6610 |
|
d6bf8f0deb18
added werners eventListener hook for view creation
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6611 |
"/ if there is a global eventListener, |
d6bf8f0deb18
added werners eventListener hook for view creation
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6612 |
"/ give it a chance to intercept windowCreation |
d6bf8f0deb18
added werners eventListener hook for view creation
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6613 |
"/ and provide another origin. |
d6bf8f0deb18
added werners eventListener hook for view creation
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6614 |
|
d6bf8f0deb18
added werners eventListener hook for view creation
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6615 |
(listener := WindowSensor eventListener) notNil ifTrue:[ |
2721 | 6616 |
ret := listener preCreateView:self origin:org. |
6617 |
ret isPoint ifTrue:[ |
|
6618 |
org := ret |
|
6619 |
] |
|
1716
d6bf8f0deb18
added werners eventListener hook for view creation
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6620 |
]. |
d6bf8f0deb18
added werners eventListener hook for view creation
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6621 |
|
2088 | 6622 |
isInputOnly := self isInputOnly. |
6623 |
||
269 | 6624 |
drawableId := device |
2721 | 6625 |
createWindowFor:self |
6626 |
type:nil |
|
6627 |
origin:org |
|
6628 |
extent:(width @ height) |
|
6629 |
minExtent:nil |
|
6630 |
maxExtent:nil |
|
6631 |
borderWidth:borderWidth |
|
6632 |
subViewOf:sv |
|
6633 |
style:(self windowStyle) |
|
6634 |
inputOnly:isInputOnly |
|
6635 |
label:nil |
|
6636 |
owner:nil |
|
6637 |
icon:nil iconMask:nil |
|
6638 |
iconView:nil. |
|
269 | 6639 |
|
6640 |
Lobby registerChange:self. |
|
1716
d6bf8f0deb18
added werners eventListener hook for view creation
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6641 |
|
d6bf8f0deb18
added werners eventListener hook for view creation
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6642 |
"/ if there is a global eventListener, |
d6bf8f0deb18
added werners eventListener hook for view creation
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6643 |
"/ give it a chance to track views |
d6bf8f0deb18
added werners eventListener hook for view creation
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6644 |
|
d6bf8f0deb18
added werners eventListener hook for view creation
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6645 |
listener notNil ifTrue:[ |
2721 | 6646 |
listener postCreateView:self. |
1716
d6bf8f0deb18
added werners eventListener hook for view creation
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6647 |
]. |
d6bf8f0deb18
added werners eventListener hook for view creation
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
6648 |
|
269 | 6649 |
extentChanged := false. |
6650 |
originChanged := false. |
|
6651 |
||
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
6652 |
(borderColor notNil and:[borderColor ~= Black]) ifTrue:[ |
2721 | 6653 |
isInputOnly ifFalse:[ |
2088 | 6654 |
"/ borderColor := borderColor on:device. |
2721 | 6655 |
self setBorderColor |
6656 |
] |
|
269 | 6657 |
]. |
6658 |
(viewGravity notNil "and:[viewGravity ~~ #NorthWest]") ifTrue:[ |
|
2721 | 6659 |
device setWindowGravity:viewGravity in:drawableId |
269 | 6660 |
]. |
6661 |
(bitGravity notNil "and:[bitGravity ~~ #NorthWest]") ifTrue:[ |
|
2721 | 6662 |
isInputOnly ifFalse:[ |
6663 |
device setBitGravity:bitGravity in:drawableId |
|
6664 |
] |
|
269 | 6665 |
]. |
6666 |
viewShape notNil ifTrue:[ |
|
2721 | 6667 |
self setViewShape |
269 | 6668 |
]. |
6669 |
(backed notNil and:[backed ~~ false]) ifTrue:[ |
|
2721 | 6670 |
device setBackingStore:backed in:drawableId |
269 | 6671 |
]. |
6672 |
saveUnder ifTrue:[ |
|
2721 | 6673 |
device setSaveUnder:true in:drawableId |
1903 | 6674 |
]. |
1960 | 6675 |
cursor notNil ifTrue:[ |
2721 | 6676 |
self setCursor |
2088 | 6677 |
]. |
6678 |
||
6679 |
"Modified: / 9.4.1998 / 20:18:12 / cg" |
|
269 | 6680 |
! |
6681 |
||
1827 | 6682 |
postRealize |
6683 |
"invoked after a view was realized. |
|
6684 |
Can be redefined in subclasses to perform delayed actions." |
|
6685 |
||
6686 |
"/ nothing done here |
|
6687 |
||
6688 |
"Created: 24.7.1997 / 14:35:36 / cg" |
|
6689 |
! |
|
6690 |
||
269 | 6691 |
realize |
6692 |
"realize - make visible; |
|
6693 |
realizing is done very late (after layout is fixed) to avoid |
|
6694 |
visible rearranging of windows on the screen" |
|
6695 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6696 |
self realizeKeepingGroup:false at:nil iconified:false |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6697 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6698 |
"Modified: 24.7.1997 / 13:14:28 / cg" |
269 | 6699 |
! |
6700 |
||
6701 |
realizeAllSubViews |
|
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6702 |
"realize all my subviews - but not myself." |
269 | 6703 |
|
6704 |
subViews notNil ifTrue:[ |
|
2721 | 6705 |
subViews do:[:subView | |
6706 |
subView realize |
|
6707 |
] |
|
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
6708 |
]. |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
6709 |
components notNil ifTrue:[ |
2721 | 6710 |
components do:[:component | |
6711 |
component realize |
|
6712 |
] |
|
269 | 6713 |
]. |
6714 |
||
6715 |
"Modified: 5.9.1995 / 23:30:47 / claus" |
|
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6716 |
"Modified: 13.1.1997 / 21:25:49 / cg" |
269 | 6717 |
! |
6718 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6719 |
realizeAt:aPoint |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6720 |
"realize - make visible; |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6721 |
realizing is done very late (after layout is fixed) to avoid |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6722 |
visible rearranging of windows on the screen" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6723 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6724 |
self realizeKeepingGroup:false at:aPoint iconified:false |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6725 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6726 |
"Modified: 24.7.1997 / 13:14:28 / cg" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6727 |
"Created: 24.7.1997 / 13:21:04 / cg" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6728 |
! |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6729 |
|
269 | 6730 |
realizeInGroup |
6731 |
"special realize - leave windowgroup as is; |
|
6732 |
This allows a view to be realized in any windowgroup; |
|
6733 |
for special applications, like the kill button in the Filebrowser which has |
|
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6734 |
a windowGroup different from its superview's and is handled as a separate process." |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6735 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6736 |
windowGroup isForModalSubview:true. |
1877 | 6737 |
"/ self realize. |
6738 |
||
6739 |
self realizeKeepingGroup:true at:nil iconified:false |
|
6740 |
||
6741 |
"Modified: 20.8.1997 / 14:56:20 / cg" |
|
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6742 |
! |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6743 |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6744 |
realizeKeepingGroup:keepGroupAsIs at:position iconified:iconified |
151 | 6745 |
"common helper for realize and realizeInGroup. |
1877 | 6746 |
Create the view; if the keepGroupAsIs argument is not true, |
6747 |
assign my windowGroup." |
|
140 | 6748 |
|
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6749 |
|superGroup groupChange keep| |
140 | 6750 |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6751 |
"/ fetch device colors, to avoid reallocation at redraw time |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6752 |
self fetchDeviceResources. |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6753 |
|
2189
86284985c4c0
care for non-creatable views.
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
6754 |
drawableId isNil ifTrue:[ |
2721 | 6755 |
self create. |
6756 |
drawableId isNil ifTrue:[ |
|
6757 |
('SimpleView [warning]: could not create view: ' , self class name) errorPrintCR. |
|
6758 |
^ self |
|
6759 |
] |
|
2189
86284985c4c0
care for non-creatable views.
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
6760 |
]. |
140 | 6761 |
|
372 | 6762 |
groupChange := false. |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6763 |
|
1877 | 6764 |
(windowGroup notNil |
6765 |
and:[superView isNil |
|
6766 |
and:[windowGroup isForModalSubview]]) ifTrue:[ |
|
2721 | 6767 |
keep := true. |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6768 |
] ifFalse:[ |
2721 | 6769 |
keep := keepGroupAsIs |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6770 |
]. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6771 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6772 |
keep ifFalse:[ |
2721 | 6773 |
" |
6774 |
put myself into superviews windowgroup if there is a superview |
|
6775 |
This is the default behavior, which may be suppressed by |
|
6776 |
passing true as keepGroupAsIs-argument. |
|
6777 |
(it may be useful to assign a separate windowGroup to |
|
6778 |
a childView to have it execute independent of the parent |
|
6779 |
-> an example is found in the fileBrowsers kill-button) |
|
6780 |
" |
|
6781 |
superView notNil ifTrue:[ |
|
6782 |
superGroup := superView windowGroup. |
|
6783 |
(windowGroup notNil and:[superGroup ~~ windowGroup]) ifTrue:[ |
|
6784 |
" |
|
6785 |
mhmh - seems that the windowgroup has changed .... |
|
6786 |
" |
|
145 | 6787 |
"/ 'oops - wgroup change on realize' printNL. |
2721 | 6788 |
groupChange := true. |
6789 |
||
6790 |
"/ |
|
6791 |
"/ recursively change the windowGroup of |
|
6792 |
"/ myself and all of my children |
|
6793 |
"/ |
|
6794 |
self windowGroup:superGroup. |
|
6795 |
] ifFalse:[ |
|
6796 |
windowGroup isNil ifTrue:[ |
|
6797 |
"/ |
|
6798 |
"/ only change the group of myself - |
|
6799 |
"/ subviews will fetch it when realized. |
|
6800 |
"/ |
|
6801 |
windowGroup := superGroup. |
|
6802 |
superGroup notNil ifTrue:[superGroup addView:self]. |
|
6803 |
] |
|
6804 |
]. |
|
6805 |
]. |
|
140 | 6806 |
]. |
6807 |
||
1039
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
6808 |
(originChanged or:[extentChanged]) ifTrue:[ |
2721 | 6809 |
self fixSize. |
6810 |
self sizeChanged:nil. "/ new 29-aug-1995 |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6811 |
]. |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6812 |
position notNil ifTrue:[ |
2721 | 6813 |
self origin:position. |
1039
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
6814 |
]. |
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
6815 |
|
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
6816 |
(subViews notNil or:[components notNil]) ifTrue:[ |
2721 | 6817 |
(realized not or:[groupChange]) ifTrue:[ |
2558 | 6818 |
hiddenOnRealize ifFalse:[ |
2721 | 6819 |
self realizeAllSubViews. |
2558 | 6820 |
]. |
2721 | 6821 |
]. |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6822 |
]. |
1874
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
6823 |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6824 |
iconified ifTrue:[ |
2721 | 6825 |
realized ifFalse:[ |
6826 |
self mapIconified |
|
6827 |
] |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
6828 |
] ifFalse:[ |
2721 | 6829 |
hiddenOnRealize ifFalse:[ |
6830 |
self setInnerClip. |
|
6831 |
||
6832 |
realized ifFalse:[ |
|
6833 |
" |
|
6834 |
now, make the view visible |
|
6835 |
" |
|
6836 |
self mapAt:position |
|
6837 |
] |
|
6838 |
] |
|
140 | 6839 |
]. |
6840 |
||
6841 |
controller notNil ifTrue:[ |
|
2721 | 6842 |
controller startUp |
1827 | 6843 |
]. |
6844 |
||
6845 |
self postRealize |
|
654 | 6846 |
|
2189
86284985c4c0
care for non-creatable views.
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
6847 |
"Modified: / 23.8.1996 / 15:07:16 / stefan" |
86284985c4c0
care for non-creatable views.
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
6848 |
"Created: / 24.7.1997 / 13:10:17 / cg" |
86284985c4c0
care for non-creatable views.
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
6849 |
"Modified: / 27.7.1998 / 20:01:02 / cg" |
140 | 6850 |
! |
6851 |
||
6852 |
recreate |
|
6853 |
"recreate (i.e. tell X about me) after a snapin" |
|
6854 |
||
6855 |
drawableId isNil ifTrue:[ |
|
2721 | 6856 |
super recreate. |
6857 |
self physicalCreate. |
|
6858 |
||
6859 |
viewBackground notNil ifTrue:[ |
|
6860 |
self setViewBackground |
|
6861 |
]. |
|
6862 |
||
6863 |
" |
|
6864 |
XXX has to be changed: eventmasks are device specific - |
|
6865 |
XXX will not allow restart on another Workstation-type. |
|
6866 |
XXX event masks must become symbolic |
|
6867 |
" |
|
6868 |
device setEventMask:eventMask in:drawableId |
|
140 | 6869 |
] |
6870 |
! |
|
6871 |
||
654 | 6872 |
remap |
6873 |
"make the view visible on the screen at its previous position. |
|
6874 |
In contrast to map, this asks the windowManager to show the view |
|
6875 |
immediately (instead of asking for a frame). However, some windowManagers |
|
6876 |
are known to ignore this ..." |
|
6877 |
||
6878 |
realized ifFalse:[ |
|
2721 | 6879 |
" |
6880 |
now, make the view visible |
|
6881 |
" |
|
6882 |
realized := true. |
|
6883 |
device |
|
6884 |
mapView:self id:drawableId iconified:false |
|
6885 |
atX:left y:top width:width height:height |
|
6886 |
minExtent:(self minExtent) maxExtent:(self maxExtent) |
|
654 | 6887 |
] |
6888 |
||
6889 |
"Created: 8.5.1996 / 09:33:06 / cg" |
|
1379 | 6890 |
"Modified: 25.2.1997 / 22:44:33 / cg" |
654 | 6891 |
! |
6892 |
||
1109 | 6893 |
rerealize |
6894 |
"rerealize at old position in (a possibly different) windowGroup." |
|
6895 |
||
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6896 |
self fetchDeviceResources. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6897 |
|
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6898 |
self rerealizeInGroup:windowGroup. |
1109 | 6899 |
|
6900 |
"Created: 7.11.1996 / 16:27:09 / cg" |
|
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
6901 |
"Modified: 13.1.1997 / 21:53:18 / cg" |
1109 | 6902 |
! |
6903 |
||
269 | 6904 |
rerealizeInGroup:aWindowGroup |
6905 |
"rerealize at old position in (a possibly different) windowGroup." |
|
6906 |
||
1837 | 6907 |
drawableId isNil ifTrue:[self create]. |
269 | 6908 |
drawableId notNil ifTrue:[ |
2721 | 6909 |
aWindowGroup ~~ windowGroup ifTrue:[ |
6910 |
windowGroup notNil ifTrue:[ |
|
6911 |
windowGroup removeView:self |
|
6912 |
]. |
|
6913 |
windowGroup := aWindowGroup. |
|
6914 |
aWindowGroup addTopView:self. |
|
6915 |
]. |
|
6916 |
self remap. |
|
269 | 6917 |
] |
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
6918 |
|
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
6919 |
"Modified: 3.5.1996 / 23:59:30 / stefan" |
1837 | 6920 |
"Modified: 28.7.1997 / 18:53:01 / cg" |
140 | 6921 |
! |
6922 |
||
6923 |
rerealizeWithAllSubViews |
|
6924 |
"rerealize myself with all subviews" |
|
6925 |
||
6926 |
drawableId notNil ifTrue:[ |
|
2721 | 6927 |
realized := true. |
6928 |
self realizeAllSubViews. |
|
6929 |
device |
|
6930 |
mapView:self id:drawableId iconified:false |
|
6931 |
atX:left y:top width:width height:height |
|
6932 |
minExtent:(self minExtent) maxExtent:(self maxExtent) |
|
140 | 6933 |
] |
1290
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
6934 |
|
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
6935 |
"Modified: 28.1.1997 / 17:59:28 / cg" |
180 | 6936 |
! |
6937 |
||
269 | 6938 |
resize |
6939 |
"resize myself to make everything fit into me. |
|
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
6940 |
Here, nothing special is done (except for setting my extent to the |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
6941 |
preferredExtent), but may be redefined in some subclasses." |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
6942 |
|
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
6943 |
explicitExtent ~~ true ifTrue:[ |
2721 | 6944 |
self extent:(self preferredExtent). |
6945 |
explicitExtent := false. |
|
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
6946 |
] |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
6947 |
|
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
6948 |
"Modified: 15.7.1996 / 11:20:27 / cg" |
269 | 6949 |
! |
6950 |
||
6951 |
unmap |
|
2576 | 6952 |
"unmap the view - the view stays created (but invisible), and can be remapped again later." |
269 | 6953 |
|
6954 |
realized ifTrue:[ |
|
2721 | 6955 |
realized := false. |
6956 |
drawableId notNil ifTrue:[ |
|
6957 |
device unmapWindow:drawableId |
|
6958 |
]. |
|
6959 |
||
6960 |
"/ cg: used to clear shown here, |
|
6961 |
"/ but this is not correct with X, where the |
|
6962 |
"/ unmap is an asyncronous operation. |
|
6963 |
"/ (must wait for unmapped event to clear shown) |
|
6964 |
||
6965 |
shown := false. |
|
269 | 6966 |
]. |
190 | 6967 |
|
6968 |
" |
|
269 | 6969 |
|top sub| |
6970 |
||
6971 |
top := StandardSystemView new. |
|
6972 |
top extent:200@200. |
|
6973 |
||
6974 |
sub := View |
|
2721 | 6975 |
origin:0.2@0.2 |
6976 |
corner:0.8@0.8 |
|
6977 |
in:top. |
|
269 | 6978 |
|
6979 |
sub viewBackground:Color red. |
|
6980 |
sub hiddenOnRealize:true. |
|
6981 |
||
6982 |
top open. |
|
6983 |
(Delay forSeconds:5) wait. |
|
6984 |
sub map. |
|
6985 |
(Delay forSeconds:3) wait. |
|
6986 |
sub unmap. |
|
6987 |
sub viewBackground:(Color green). |
|
6988 |
(Delay forSeconds:3) wait. |
|
6989 |
sub map. |
|
151 | 6990 |
" |
1379 | 6991 |
|
2465
193a96bd94d7
clear shown when unmapped notification arrives
Claus Gittinger <cg@exept.de>
parents:
2454
diff
changeset
|
6992 |
"Modified: / 22.2.1999 / 20:10:58 / cg" |
269 | 6993 |
! |
6994 |
||
6995 |
unrealize |
|
6996 |
"alias for unmap, for historic reasons" |
|
6997 |
||
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
6998 |
self obsoleteMethodWarning:'use unmap'. |
269 | 6999 |
self unmap. |
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
7000 |
|
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
7001 |
"Modified: 4.5.1996 / 00:07:48 / stefan" |
151 | 7002 |
! ! |
7003 |
||
7004 |
!SimpleView methodsFor:'redrawing'! |
|
7005 |
||
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7006 |
flash |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7007 |
"flash the view - fill it black, then white, finally |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7008 |
redraw completely. |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7009 |
Can be used to wakeup the user :-) |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7010 |
when problem or warning conditions arise. |
2174 | 7011 |
Someone may redefine this to flash its contents (instead of black/white)." |
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7012 |
|
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7013 |
self fill:Black. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7014 |
Delay waitForSeconds:0.1. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7015 |
self fill:White. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7016 |
Delay waitForSeconds:0.1. |
2173 | 7017 |
self fill:viewBackground. |
7018 |
"/ self clear. |
|
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7019 |
self invalidate |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7020 |
|
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7021 |
" |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7022 |
|v| |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7023 |
|
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7024 |
v := View new openAndWait. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7025 |
Delay waitForSeconds:2. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7026 |
v flash. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7027 |
Delay waitForSeconds:2. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7028 |
v destroy |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7029 |
" |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7030 |
|
2174 | 7031 |
"Modified: / 16.7.1998 / 18:46:48 / cg" |
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7032 |
! |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
7033 |
|
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
7034 |
invalidate |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
7035 |
"add a damage to redraw the recevier to its input event queue. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
7036 |
This is preferable to calling redraw directly, in that the drawing is done by |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
7037 |
the views process itself, and there is a possibilty to merge |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7038 |
multiple damage rectangles into single redraws. |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7039 |
However, be aware, that the redrawing may be delayed for some time, |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7040 |
intil the receivers windowGroupProcess gets rescheduled." |
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
7041 |
|
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
7042 |
|sensor| |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
7043 |
|
2489
f7ce16896fa1
process exposes when menu closes.
Claus Gittinger <cg@exept.de>
parents:
2465
diff
changeset
|
7044 |
"/ not needed - event queue does it anyway |
f7ce16896fa1
process exposes when menu closes.
Claus Gittinger <cg@exept.de>
parents:
2465
diff
changeset
|
7045 |
"/ (sensor := self sensor) notNil ifTrue:[ |
f7ce16896fa1
process exposes when menu closes.
Claus Gittinger <cg@exept.de>
parents:
2465
diff
changeset
|
7046 |
"/ sensor flushExposeEventsFor:self. |
f7ce16896fa1
process exposes when menu closes.
Claus Gittinger <cg@exept.de>
parents:
2465
diff
changeset
|
7047 |
"/ ]. |
2451 | 7048 |
self |
2721 | 7049 |
invalidateDeviceRectangle:(Rectangle |
7050 |
left:0 |
|
7051 |
top:0 |
|
7052 |
width:width |
|
7053 |
height:height) |
|
7054 |
repairNow:false |
|
2394
cfb6434f1a9c
oops - invalidate must add deviceRectangles to the damage-list.
Claus Gittinger <cg@exept.de>
parents:
2382
diff
changeset
|
7055 |
|
cfb6434f1a9c
oops - invalidate must add deviceRectangles to the damage-list.
Claus Gittinger <cg@exept.de>
parents:
2382
diff
changeset
|
7056 |
"Modified: / 9.11.1998 / 21:04:16 / cg" |
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
7057 |
! |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
7058 |
|
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
7059 |
invalidate:aRectangle |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
7060 |
"add a damage to redraw part of the recevier, to its input event queue. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
7061 |
This is preferable to calling redraw directly, |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
7062 |
in that the drawing is done by the views process itself, |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
7063 |
and there is a possibilty to merge multiple damage rectangles into |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7064 |
single redraws. |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7065 |
However, be aware, that the redrawing may be delayed for some time, |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7066 |
intil the receivers windowGroupProcess gets rescheduled." |
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
7067 |
|
2394
cfb6434f1a9c
oops - invalidate must add deviceRectangles to the damage-list.
Claus Gittinger <cg@exept.de>
parents:
2382
diff
changeset
|
7068 |
self invalidate:aRectangle repairNow:false |
cfb6434f1a9c
oops - invalidate must add deviceRectangles to the damage-list.
Claus Gittinger <cg@exept.de>
parents:
2382
diff
changeset
|
7069 |
|
cfb6434f1a9c
oops - invalidate must add deviceRectangles to the damage-list.
Claus Gittinger <cg@exept.de>
parents:
2382
diff
changeset
|
7070 |
"Modified: / 9.11.1998 / 21:03:14 / cg" |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7071 |
! |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7072 |
|
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7073 |
invalidate:aRectangle repairNow:doRepair |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7074 |
"add a damage to redraw part of the receiver, to its input event queue. |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7075 |
and (if repairNow is true), force the receiver to repair all of its |
2451 | 7076 |
damaged areas right now. |
7077 |
The given rectangle is in logical coordinate space." |
|
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7078 |
|
2394
cfb6434f1a9c
oops - invalidate must add deviceRectangles to the damage-list.
Claus Gittinger <cg@exept.de>
parents:
2382
diff
changeset
|
7079 |
|sensor r| |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7080 |
|
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1839
diff
changeset
|
7081 |
(sensor := self sensor) notNil ifTrue:[ |
2721 | 7082 |
r := aRectangle. |
7083 |
transformation notNil ifTrue:[ |
|
7084 |
r := transformation applyTo:r. |
|
7085 |
]. |
|
7086 |
sensor addDamage:r view:self. |
|
7087 |
(shown and:[doRepair]) ifTrue:[ |
|
7088 |
self repairDamage |
|
7089 |
] |
|
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1839
diff
changeset
|
7090 |
] ifFalse:[ |
2721 | 7091 |
shown ifTrue:[ |
7092 |
self redrawX:aRectangle left y:aRectangle top |
|
7093 |
width:aRectangle width height:aRectangle height |
|
7094 |
]. |
|
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7095 |
] |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7096 |
|
2395 | 7097 |
"Modified: / 10.11.1998 / 01:55:03 / cg" |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7098 |
! |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7099 |
|
2396
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
7100 |
invalidateDeviceRectangle:aRectangle repairNow:doRepair |
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
7101 |
"add a damage to redraw part of the receiver, to its input event queue. |
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
7102 |
and (if repairNow is true), force the receiver to repair all of its |
2451 | 7103 |
damaged areas right now. |
7104 |
The given rectangle is in device coordinate space." |
|
2396
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
7105 |
|
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
7106 |
|sensor| |
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
7107 |
|
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
7108 |
(sensor := self sensor) notNil ifTrue:[ |
2721 | 7109 |
sensor addDamage:aRectangle view:self. |
7110 |
(shown and:[doRepair]) ifTrue:[ |
|
7111 |
self repairDamage |
|
7112 |
] |
|
2396
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
7113 |
] ifFalse:[ |
2721 | 7114 |
shown ifTrue:[ |
7115 |
self redrawDeviceX:aRectangle left y:aRectangle top |
|
7116 |
width:aRectangle width height:aRectangle height |
|
7117 |
]. |
|
2396
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
7118 |
] |
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
7119 |
|
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
7120 |
"Modified: / 10.11.1998 / 01:55:03 / cg" |
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
7121 |
"Created: / 10.11.1998 / 19:02:01 / cg" |
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
7122 |
! |
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
7123 |
|
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7124 |
invalidateRepairNow:doRepair |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7125 |
"add a damage to redraw all of the receiver, to its input event queue. |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7126 |
and (if repairNow is true), force the receiver to repair all of its |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7127 |
damaged areas right now." |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7128 |
|
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7129 |
self |
2721 | 7130 |
invalidateDeviceRectangle:(Rectangle left:0 top:0 width:width height:height) |
7131 |
repairNow:doRepair |
|
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7132 |
|
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7133 |
"Created: 19.4.1997 / 11:58:04 / cg" |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7134 |
"Modified: 19.4.1997 / 12:00:00 / cg" |
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
7135 |
! |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
7136 |
|
269 | 7137 |
redraw |
782 | 7138 |
"redraw myself completely - this is sent by redrawX:y:width:height: |
7139 |
as a fallback. |
|
7140 |
Cannot do much here - is redefined in subclasses which dont care for |
|
7141 |
updating regions but instead update everything." |
|
7142 |
||
7143 |
"Modified: 29.5.1996 / 18:02:52 / cg" |
|
269 | 7144 |
! |
7145 |
||
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7146 |
redraw:aRectangle |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7147 |
"redraw a part of the view immediately." |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7148 |
|
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7149 |
self |
2721 | 7150 |
redrawX:(aRectangle left) |
7151 |
y:(aRectangle top) |
|
7152 |
width:(aRectangle width) |
|
7153 |
height:(aRectangle height) |
|
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7154 |
|
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7155 |
"Modified: 19.4.1997 / 11:54:23 / cg" |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7156 |
! |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7157 |
|
269 | 7158 |
redrawDeviceX:x y:y width:w height:h |
7159 |
"have to redraw part of the view. |
|
7160 |
The coordinates are in device space - if there is a transformation, |
|
7161 |
must inverse-transform back to logical coordinates. (since the view thinks |
|
7162 |
in its coordinate space)" |
|
7163 |
||
7164 |
|lx ly lw lh| |
|
7165 |
||
7166 |
lx := x. |
|
7167 |
ly := y. |
|
7168 |
lw := w. |
|
7169 |
lh := h. |
|
7170 |
||
7171 |
transformation notNil ifTrue:[ |
|
2721 | 7172 |
lx := transformation applyInverseToX:lx. |
7173 |
ly := transformation applyInverseToY:ly. |
|
7174 |
lw := transformation applyInverseScaleX:lw. |
|
7175 |
lh := transformation applyInverseScaleY:lh. |
|
269 | 7176 |
]. |
7177 |
self redrawX:lx y:ly width:lw height:lh |
|
7178 |
! |
|
7179 |
||
151 | 7180 |
redrawX:x y:y width:w height:h |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7181 |
"redraw part of myself immediately, given logical coordinates |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7182 |
(if transformation is nonNil) |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7183 |
The default here is to redraw everything |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7184 |
- subclasses usually redefine this, adding more intelligence" |
151 | 7185 |
|
738 | 7186 |
|area oldClip| |
151 | 7187 |
|
7188 |
shown ifFalse:[^ self]. |
|
7189 |
||
7190 |
area := Rectangle left:x top:y width:w height:h. |
|
738 | 7191 |
oldClip := clipRect. |
7192 |
self clippingRectangle:area. |
|
7193 |
||
7194 |
components notNil ifTrue:[ |
|
2721 | 7195 |
self clearRectangleX:x y:y width:w height:h. |
7196 |
components do:[:aComponent | |
|
7197 |
|thisFrame is| |
|
7198 |
||
7199 |
thisFrame := aComponent bounds. |
|
7200 |
(thisFrame intersects:area) ifTrue:[ |
|
7201 |
aComponent displayOn:self |
|
7202 |
] |
|
7203 |
] |
|
738 | 7204 |
] ifFalse:[ |
2721 | 7205 |
"/ redraw everything - a fallBack for lazy views. |
7206 |
self redraw |
|
738 | 7207 |
]. |
7208 |
||
7209 |
self clippingRectangle:oldClip. |
|
7210 |
||
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7211 |
"Modified: 19.4.1997 / 11:55:08 / cg" |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7212 |
! |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7213 |
|
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7214 |
repairDamage |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7215 |
"force the receiver to repair all of its |
2095 | 7216 |
damaged areas right now." |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7217 |
|
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7218 |
|wg| |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7219 |
|
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7220 |
shown ifTrue:[ |
2721 | 7221 |
(wg := self windowGroup) notNil ifTrue:[ |
7222 |
"/ wg processRealExposeEventsFor:self. "/ this ignores map/unmap |
|
7223 |
wg processExposeEventsFor:self. "/ this handles map/unmap |
|
7224 |
] |
|
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7225 |
] |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
7226 |
|
2138
1800e9b5afe3
also handle map/unmap events in repairDamage.
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
7227 |
"Created: / 19.4.1997 / 12:01:13 / cg" |
2406 | 7228 |
"Modified: / 3.12.1998 / 14:02:06 / cg" |
151 | 7229 |
! |
7230 |
||
269 | 7231 |
showActive |
7232 |
"redraw myself as active (i.e. busy). |
|
7233 |
Nothing done here, but redefined in some classes." |
|
7234 |
||
7235 |
^ self |
|
135 | 7236 |
! |
7237 |
||
7238 |
showPassive |
|
7239 |
"redraw myself as inactive (i.e. nonbusy). |
|
151 | 7240 |
Nothing done here, but redefined in some classes." |
135 | 7241 |
|
7242 |
^ self |
|
7243 |
! ! |
|
7244 |
||
269 | 7245 |
!SimpleView methodsFor:'scrolling'! |
7246 |
||
2559
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
7247 |
halfPageDown |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
7248 |
"scroll down half a page |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
7249 |
" |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
7250 |
self scrollDown:(self innerHeight // 2) |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
7251 |
|
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
7252 |
|
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
7253 |
! |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
7254 |
|
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
7255 |
halfPageUp |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
7256 |
"scroll up half a page |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
7257 |
" |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
7258 |
self scrollUp:(self innerHeight // 2) |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
7259 |
|
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
7260 |
! |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
7261 |
|
269 | 7262 |
horizontalScrollStep |
7263 |
"return the amount to scroll when stepping left/right. |
|
7264 |
Subclasses may want to redefine this." |
|
7265 |
||
7266 |
^ (device horizontalPixelPerMillimeter * 20) asInteger |
|
7267 |
! |
|
7268 |
||
1052
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7269 |
pageDown |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7270 |
self scrollDown:(self innerHeight) |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7271 |
|
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7272 |
"Created: 13.9.1996 / 14:06:54 / cg" |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7273 |
! |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7274 |
|
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7275 |
pageUp |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7276 |
self scrollUp:(self innerHeight) |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7277 |
|
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7278 |
"Created: 13.9.1996 / 14:07:01 / cg" |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7279 |
! |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7280 |
|
269 | 7281 |
scrollDown |
7282 |
"scroll down by some amount; this is called when the scrollbars |
|
7283 |
scroll-step down button is pressed." |
|
7284 |
||
7285 |
self scrollDown:(self verticalScrollStep) |
|
7286 |
! |
|
7287 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7288 |
scrollDown:nPixels |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7289 |
"change origin to scroll down some pixels" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7290 |
|
1035
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
7291 |
|viewOrigin| |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
7292 |
|
2703 | 7293 |
nPixels ~~ 0 ifTrue:[ |
2721 | 7294 |
viewOrigin := self viewOrigin. |
7295 |
self scrollTo:(viewOrigin x @ (viewOrigin y + nPixels)) |
|
2703 | 7296 |
] |
7297 |
||
7298 |
"Modified: / 20.8.1996 / 17:34:36 / stefan" |
|
7299 |
"Modified: / 21.5.1999 / 15:57:56 / cg" |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7300 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7301 |
|
269 | 7302 |
scrollHorizontalTo:aPixelOffset |
7303 |
"change origin to make aPixelOffset be the left col" |
|
7304 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7305 |
|orgY| |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7306 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7307 |
orgY := self viewOrigin y. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7308 |
^ self scrollTo:(aPixelOffset @ orgY). |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7309 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7310 |
"Modified: 8.7.1996 / 15:34:54 / stefan" |
140 | 7311 |
! |
7312 |
||
269 | 7313 |
scrollHorizontalToPercent:percent |
7314 |
"scroll to a position given in percent of total" |
|
7315 |
||
7316 |
|wCont| |
|
7317 |
||
7318 |
wCont := self widthOfContents. |
|
7319 |
transformation notNil ifTrue:[ |
|
2721 | 7320 |
wCont := transformation applyScaleX:wCont. |
269 | 7321 |
]. |
7322 |
self scrollHorizontalTo: |
|
2721 | 7323 |
((((wCont * percent) / 100.0) + 0.5) asInteger) |
269 | 7324 |
! |
7325 |
||
7326 |
scrollLeft |
|
7327 |
"scroll left by some amount; this is called when the scrollbars |
|
7328 |
scroll-step left button is pressed." |
|
7329 |
||
7330 |
self scrollLeft:(self horizontalScrollStep) |
|
7331 |
! |
|
7332 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7333 |
scrollLeft:nPixels |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7334 |
"change origin to scroll left some pixels" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7335 |
|
1035
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
7336 |
|viewOrigin| |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
7337 |
|
2703 | 7338 |
nPixels ~~ 0 ifTrue:[ |
2721 | 7339 |
viewOrigin := self viewOrigin. |
7340 |
self scrollTo:((viewOrigin x - nPixels) @ viewOrigin y). |
|
2703 | 7341 |
] |
7342 |
||
7343 |
"Modified: / 20.8.1996 / 17:35:09 / stefan" |
|
7344 |
"Modified: / 21.5.1999 / 15:58:03 / cg" |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7345 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7346 |
|
269 | 7347 |
scrollRight |
7348 |
"scroll right by some amount; this is called when the scrollbars |
|
7349 |
scroll-step right button is pressed." |
|
7350 |
||
7351 |
self scrollRight:(self horizontalScrollStep) |
|
7352 |
! |
|
7353 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7354 |
scrollRight:nPixels |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7355 |
"change origin to scroll right some pixels" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7356 |
|
1035
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
7357 |
|viewOrigin| |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
7358 |
|
2703 | 7359 |
nPixels ~~ 0 ifTrue:[ |
2721 | 7360 |
viewOrigin := self viewOrigin. |
7361 |
self scrollTo:((viewOrigin x + nPixels) @ viewOrigin y) |
|
2703 | 7362 |
] |
7363 |
||
7364 |
"Modified: / 20.8.1996 / 17:35:37 / stefan" |
|
7365 |
"Modified: / 21.5.1999 / 15:58:08 / cg" |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7366 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7367 |
|
1052
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7368 |
scrollToBottom |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7369 |
self scrollTo:0 @ (self heightOfContents - self innerHeight) |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7370 |
|
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7371 |
"Created: 13.9.1996 / 14:08:03 / cg" |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7372 |
"Modified: 13.9.1996 / 14:09:32 / cg" |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7373 |
! |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7374 |
|
2371
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
7375 |
scrollToLeft |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
7376 |
"move viewOrigin to the left" |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
7377 |
|
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
7378 |
self scrollHorizontalTo:0 |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
7379 |
! |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
7380 |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7381 |
scrollToPercent:originAsPercent |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7382 |
"scroll to a position given in percent of total (x and y as a Point)" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7383 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7384 |
|wCont hCont percent| |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7385 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7386 |
percent := originAsPercent asPoint. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7387 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7388 |
wCont := self widthOfContents. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7389 |
hCont := self heightOfContents. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7390 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7391 |
transformation notNil ifTrue:[ |
2721 | 7392 |
wCont := transformation applyScaleX:wCont. |
7393 |
hCont := transformation applyScaleY:hCont. |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7394 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7395 |
self scrollTo: |
2721 | 7396 |
((((wCont * percent x) / 100.0) + 0.5) asInteger) @ |
7397 |
((((hCont * percent y) / 100.0) + 0.5) asInteger) |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7398 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7399 |
"Created: 5.8.1996 / 12:15:53 / stefan" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7400 |
"Modified: 5.8.1996 / 12:42:57 / stefan" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7401 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7402 |
|
2371
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
7403 |
scrollToRight |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
7404 |
"move viewOrigin to the right" |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
7405 |
|
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
7406 |
|wCont| |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
7407 |
|
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
7408 |
wCont := self widthOfContents. |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
7409 |
transformation notNil ifTrue:[ |
2721 | 7410 |
wCont := transformation applyScaleX:wCont. |
2371
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
7411 |
]. |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
7412 |
self scrollHorizontalTo:((wCont - self innerWidth) max:0) |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
7413 |
|
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
7414 |
! |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
7415 |
|
269 | 7416 |
scrollToTop |
7417 |
"move viewOrigin to top" |
|
7418 |
||
7419 |
self scrollVerticalTo:0 |
|
7420 |
! |
|
7421 |
||
7422 |
scrollToTopLeft |
|
7423 |
"move viewOrigin to top/left" |
|
7424 |
||
7425 |
self scrollTo:(0 @ 0). |
|
7426 |
! |
|
7427 |
||
7428 |
scrollUp |
|
7429 |
"scroll up by some amount; this is called when the scrollbars |
|
7430 |
scroll-step up button is pressed." |
|
7431 |
||
7432 |
self scrollUp:(self verticalScrollStep) |
|
7433 |
! |
|
7434 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7435 |
scrollUp:nPixels |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7436 |
"change origin to scroll up (towards the origin) by some pixels" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7437 |
|
1035
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
7438 |
|viewOrigin| |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
7439 |
|
2703 | 7440 |
nPixels ~~ 0 ifTrue:[ |
2721 | 7441 |
viewOrigin := self viewOrigin. |
7442 |
self scrollTo:(viewOrigin x @ (viewOrigin y - nPixels)). |
|
2703 | 7443 |
] |
7444 |
||
7445 |
"Modified: / 20.8.1996 / 17:36:16 / stefan" |
|
7446 |
"Modified: / 21.5.1999 / 15:58:21 / cg" |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7447 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7448 |
|
269 | 7449 |
scrollVerticalTo:aPixelOffset |
7450 |
"change origin to make aPixelOffset be the top line" |
|
7451 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7452 |
|orgX| |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7453 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7454 |
orgX := self viewOrigin x. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7455 |
^ self scrollTo:(orgX @ aPixelOffset). |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7456 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7457 |
"Modified: 8.7.1996 / 15:35:40 / stefan" |
135 | 7458 |
! |
7459 |
||
269 | 7460 |
scrollVerticalToPercent:percent |
7461 |
"scroll to a position given in percent of total" |
|
7462 |
||
7463 |
|hCont| |
|
7464 |
||
7465 |
hCont := self heightOfContents. |
|
7466 |
transformation notNil ifTrue:[ |
|
2721 | 7467 |
hCont := transformation applyScaleY:hCont. |
140 | 7468 |
]. |
269 | 7469 |
self scrollVerticalTo: |
2721 | 7470 |
((((hCont * percent) / 100.0) + 0.5) asInteger) |
269 | 7471 |
! |
7472 |
||
7473 |
verticalScrollStep |
|
7474 |
"return the amount to scroll when stepping up/down. |
|
7475 |
Subclasses may want to redefine this." |
|
7476 |
||
7477 |
^ (device verticalPixelPerMillimeter * 20) asInteger |
|
7478 |
! |
|
7479 |
||
7480 |
widthForScrollBetween:yStart and:yEnd |
|
7481 |
"return the width in pixels for a scroll between yStart and yEnd |
|
7482 |
- return full width here since we do not know how wide contents is. |
|
7483 |
Views which only use part of their space (short lists, text) may redefine |
|
7484 |
this method and return the number of pixels that have to be scrolled. |
|
7485 |
On slow displays, this may make a difference; on fast ones you will probably |
|
7486 |
not notice any difference." |
|
7487 |
||
7488 |
^ (width - margin - margin) |
|
135 | 7489 |
! ! |
7490 |
||
7491 |
!SimpleView methodsFor:'scrolling-basic'! |
|
7492 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7493 |
scrollTo:newOrigin |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7494 |
"change origin to have newOrigin be visible at the top-left. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7495 |
The argument defines the integer device coordinates of the new top-left |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7496 |
point." |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7497 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7498 |
^ self scrollTo:newOrigin redraw:true |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7499 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7500 |
"Modified: 15.7.1996 / 11:35:08 / stefan" |
1052
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7501 |
"Modified: 13.9.1996 / 14:09:19 / cg" |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7502 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7503 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7504 |
scrollTo:newOrigin redraw:doRedraw |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7505 |
"change origin to have newOrigin be visible at the top-left. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7506 |
The argument defines the integer device coordinates of the new top-left |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7507 |
point." |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7508 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7509 |
|dX "{ Class:SmallInteger }" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7510 |
dY "{ Class:SmallInteger }" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7511 |
orgX "{ Class:SmallInteger }" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7512 |
orgY "{ Class:SmallInteger }" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7513 |
x y iw ih |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7514 |
hCont wCont fromX toX fromY toY copyWidth copyHeight |
2649 | 7515 |
redrawX redrawY wg| |
135 | 7516 |
|
7517 |
hCont := self heightOfContents. |
|
7518 |
wCont := self widthOfContents. |
|
7519 |
transformation isNil ifTrue:[ |
|
2721 | 7520 |
orgY := orgX := 0 |
135 | 7521 |
] ifFalse:[ |
2721 | 7522 |
wCont := (transformation applyScaleX:wCont) rounded. |
7523 |
hCont := (transformation applyScaleY:hCont) rounded. |
|
7524 |
orgY := transformation translation y negated. |
|
7525 |
orgX := transformation translation x negated |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7526 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7527 |
|
135 | 7528 |
iw := self innerWidth. |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7529 |
ih := self innerHeight. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7530 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7531 |
"don't scroll outside of displayed area" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7532 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7533 |
x := newOrigin x. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7534 |
y := newOrigin y. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7535 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7536 |
x + iw > wCont ifTrue:[ |
2721 | 7537 |
x := wCont - iw. |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7538 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7539 |
x < 0 ifTrue:[ |
2721 | 7540 |
x := 0 |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7541 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7542 |
y + ih > hCont ifTrue:[ |
2721 | 7543 |
y := hCont - ih. |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7544 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7545 |
y < 0 ifTrue:[ |
2721 | 7546 |
y := 0. |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7547 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7548 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7549 |
dX := x - orgX. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7550 |
dY := y - orgY. |
135 | 7551 |
|
1066 | 7552 |
(dX == 0 and:[dY == 0]) ifTrue:[ |
7553 |
^ self |
|
7554 |
]. |
|
7555 |
||
2649 | 7556 |
(wg := self windowGroup) notNil ifTrue:[ |
2721 | 7557 |
wg processRealExposeEventsFor:self. |
2649 | 7558 |
]. |
2405
95e4a8e563d8
precess expose events before scroll
Claus Gittinger <cg@exept.de>
parents:
2400
diff
changeset
|
7559 |
|
135 | 7560 |
self originWillChange. |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
7561 |
(shown and:[doRedraw]) ifTrue:[ |
2721 | 7562 |
copyWidth := iw - dX abs. |
7563 |
copyHeight := ih - dY abs. |
|
7564 |
((copyWidth > 0) and:[copyHeight > 0]) ifTrue:[ |
|
7565 |
"/ some of the currently displayed pixels |
|
7566 |
"/ remain visible. Copy them |
|
7567 |
||
7568 |
dX < 0 ifTrue:[ |
|
7569 |
fromX := margin. |
|
7570 |
toX := margin - dX. |
|
7571 |
redrawX := margin |
|
7572 |
] ifFalse:[ |
|
7573 |
fromX := margin + dX. |
|
7574 |
toX := margin. |
|
7575 |
redrawX := margin + copyWidth. |
|
7576 |
]. |
|
7577 |
dY < 0 ifTrue:[ |
|
7578 |
fromY := margin. |
|
7579 |
toY := margin - dY. |
|
7580 |
redrawY := margin. |
|
7581 |
] ifFalse:[ |
|
7582 |
fromY := margin + dY. |
|
7583 |
toY := margin. |
|
7584 |
redrawY := margin + copyHeight. |
|
7585 |
]. |
|
7586 |
self catchExpose. |
|
7587 |
self setViewOrigin:(x @ y). |
|
7588 |
self |
|
7589 |
copyFrom:self |
|
7590 |
x:fromX y:fromY |
|
7591 |
toX:toX y:toY |
|
7592 |
width:copyWidth |
|
7593 |
height:copyHeight |
|
7594 |
async:true. |
|
7595 |
||
7596 |
self setInnerClip. |
|
7597 |
||
7598 |
"first redraw the rectangle above/below the |
|
7599 |
copied area (with full width)." |
|
7600 |
||
7601 |
copyHeight < ih ifTrue:[ |
|
7602 |
self invalidateDeviceRectangle:((margin@redrawY) extent:(iw@(ih - copyHeight))) repairNow:false. |
|
2381
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
7603 |
"/ self |
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
7604 |
"/ redrawDeviceX:margin y:redrawY |
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
7605 |
"/ width:iw height:(ih - copyHeight). |
2721 | 7606 |
]. |
7607 |
||
7608 |
"second redraw the rectangle left/right of the |
|
7609 |
copied area" |
|
7610 |
||
7611 |
copyWidth < iw ifTrue:[ |
|
7612 |
self invalidateDeviceRectangle:((redrawX@toY) extent:((iw-copyWidth)@copyHeight)) repairNow:false. |
|
2381
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
7613 |
"/ self redrawDeviceX:redrawX y:toY |
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
7614 |
"/ |
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
7615 |
"/ width:iw - copyWidth |
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
7616 |
"/ height:copyHeight. |
2721 | 7617 |
]. |
7618 |
self waitForExpose. |
|
7619 |
] ifFalse:[ |
|
7620 |
"redraw everything" |
|
7621 |
||
7622 |
self setViewOrigin:(x @ y). |
|
7623 |
self invalidateDeviceRectangle:((margin@margin) extent:(iw@ih)) repairNow:false. |
|
2381
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
7624 |
"/ self redrawDeviceX:margin y:margin |
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
7625 |
"/ width:iw |
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
7626 |
"/ height:ih. |
2721 | 7627 |
]. |
269 | 7628 |
] ifFalse:[ |
2721 | 7629 |
self setViewOrigin:(x @ y). |
269 | 7630 |
]. |
709 | 7631 |
self originChanged:(dX negated @ dY negated). |
7632 |
||
2381
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
7633 |
"Modified: / 5.8.1996 / 11:57:09 / stefan" |
2405
95e4a8e563d8
precess expose events before scroll
Claus Gittinger <cg@exept.de>
parents:
2400
diff
changeset
|
7634 |
"Modified: / 1.12.1998 / 22:35:18 / cg" |
135 | 7635 |
! ! |
7636 |
||
269 | 7637 |
!SimpleView methodsFor:'startup'! |
7638 |
||
7639 |
open |
|
7640 |
"open up the view - for normal views, this is a modeless open |
|
7641 |
(i.e. the new view comes up as independent process). |
|
7642 |
Although #open is only to be sent to topviews (i.e. it could have been |
|
7643 |
implemented in TopView), it is implemented here - therefore, every view |
|
7644 |
can be opened as a topView. |
|
7645 |
This is redefined in ModalBox, which comes up modal (i.e. |
|
7646 |
control is under the current process, so that interaction with the |
|
7647 |
current group is blocked while the modalBox is active)." |
|
7648 |
||
7649 |
^ self openModeless |
|
7650 |
||
7651 |
" |
|
7652 |
View new open |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7653 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7654 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7655 |
" |
269 | 7656 |
(Button label:'hello') open |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7657 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7658 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7659 |
" |
269 | 7660 |
|top| |
7661 |
top := StandardSystemView new. |
|
7662 |
top extent:200@200. |
|
7663 |
Button label:'hello' in:top. |
|
7664 |
top open |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7665 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7666 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7667 |
" |
269 | 7668 |
YesNoBox new open |
7669 |
" |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7670 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7671 |
"Modified: 24.7.1997 / 13:26:42 / cg" |
269 | 7672 |
! |
7673 |
||
7674 |
openAndWait |
|
7675 |
"open up the view - wait until it is visible. |
|
7676 |
In normal applications, you do not need to wait till the view is |
|
7677 |
open - it should do all of its drawing itself when it gets the |
|
7678 |
first expose event. |
|
7679 |
However, if you want to 'manually' draw into the view (for example, |
|
7680 |
in doIt expressions) the view must be visible (realized) before doing so. |
|
7681 |
Use this open in those situations." |
|
7682 |
||
7683 |
self open. |
|
7684 |
self waitUntilVisible. |
|
7685 |
||
7686 |
"does not work: |
|
7687 |
||
2721 | 7688 |
|v| |
7689 |
||
7690 |
v := View new open. |
|
7691 |
v displayLineFrom:0@0 to:50@50 |
|
269 | 7692 |
|
7693 |
does work: |
|
7694 |
||
2721 | 7695 |
|v| |
7696 |
||
7697 |
v := View new openAndWait. |
|
7698 |
v displayLineFrom:0@0 to:50@50 |
|
269 | 7699 |
" |
7700 |
! |
|
7701 |
||
7702 |
openAt:aPoint |
|
7703 |
"open up the view modeless - positions the view" |
|
7704 |
||
7705 |
^self openModelessAt:aPoint |
|
7706 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7707 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7708 |
(Button label:'hello') open |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7709 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7710 |
(Button label:'hello') openAt:(100@100) |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7711 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7712 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7713 |
"Modified: 24.7.1997 / 13:26:23 / cg" |
269 | 7714 |
! |
7715 |
||
7716 |
openAtCenter |
|
7717 |
"open up the view modeless - positions the view" |
|
7718 |
||
7719 |
^self openModelessAtCenter |
|
7720 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7721 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7722 |
(Button label:'hello') open |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7723 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7724 |
(Button label:'hello') openAtCenter |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7725 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7726 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7727 |
"Modified: 24.7.1997 / 13:01:12 / cg" |
269 | 7728 |
! |
7729 |
||
7730 |
openAutonomous |
|
7731 |
"create and schedule a new windowgroup for me and open the view. |
|
7732 |
The view will be handled by its own process, effectively running in |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7733 |
parallel. |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7734 |
Notice: |
2721 | 7735 |
This entry is for NON-topviews, which want to be served |
7736 |
autonomous from their real topview. |
|
7737 |
(see the fileBrowsers kill-button |
|
7738 |
when executing unix commands as an example)" |
|
269 | 7739 |
|
1877 | 7740 |
|wg mainGroup| |
269 | 7741 |
|
763 | 7742 |
wg := WindowGroup new. |
7743 |
self windowGroup:wg. |
|
1877 | 7744 |
|
7745 |
mainGroup := WindowGroup activeGroup. |
|
7746 |
mainGroup notNil ifTrue:[ |
|
2721 | 7747 |
mainGroup := mainGroup mainGroup. |
1877 | 7748 |
]. |
7749 |
||
7750 |
wg isForModalSubview:true. "/ make it handle update events for the main group |
|
7751 |
wg startupWith:[wg mainGroup:mainGroup. self realizeInGroup]. |
|
7752 |
||
7753 |
"/ wg startupModal:[true] forGroup:mainGroup |
|
7754 |
"/ self realizeInGroup. |
|
7755 |
||
7756 |
"Modified: 20.8.1997 / 17:57:38 / cg" |
|
269 | 7757 |
! |
7758 |
||
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
7759 |
openInGroup:aGroup |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
7760 |
"special open within another windowGroup. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
7761 |
This allows a view to be realized in any windowgroup; |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
7762 |
for applications where multiple views act as a group |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
7763 |
(i.e. close and iconify together)." |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
7764 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
7765 |
self windowGroup:aGroup. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
7766 |
aGroup addTopView:self. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
7767 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
7768 |
"/ self realizeKeepingGroup:true |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
7769 |
aGroup isForModalSubview:true. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
7770 |
self realize. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
7771 |
! |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
7772 |
|
269 | 7773 |
openModal |
7774 |
"create a new windowgroup, but start processing in the current process |
|
7775 |
actually suspending event processing for the currently active group. |
|
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
7776 |
Stay in the modalLoop while the view is visible. |
269 | 7777 |
(i.e. control is returned to the sender when the receiver is closed)" |
7778 |
||
7779 |
self openModal:[true] |
|
7780 |
||
7781 |
" |
|
7782 |
the same: |
|
2721 | 7783 |
YesNoBox new open |
7784 |
||
7785 |
YesNoBox new openModal |
|
269 | 7786 |
|
7787 |
different: |
|
2721 | 7788 |
(Button label:'hello') open |
7789 |
||
7790 |
(Button label:'hello') openModal |
|
269 | 7791 |
" |
7792 |
! |
|
7793 |
||
7794 |
openModal:aBlock |
|
7795 |
"create a new windowgroup, but start processing in the current process - |
|
7796 |
actually suspending event processing for the currently active group. |
|
7797 |
Stay in this modal loop while aBlock evaluates to true AND the receiver is |
|
7798 |
visible. |
|
7799 |
(i.e. control is returned to the sender when the receiver is closed) |
|
7800 |
This makes any interaction with the current window impossible - |
|
7801 |
however, other views (in other windowgroups) still work." |
|
7802 |
||
2167
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
7803 |
|mainGroup masterGroup| |
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
7804 |
|
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
7805 |
"/ mainGroup := WindowGroup activeGroup. |
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
7806 |
"/ mainGroup notNil ifTrue:[mainGroup := mainGroup mainGroup]. |
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
7807 |
|
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
7808 |
masterGroup := WindowGroup activeGroup. |
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
7809 |
[masterGroup notNil and:[masterGroup isPopUp]] whileTrue:[ |
2721 | 7810 |
masterGroup := masterGroup previousGroup. |
2167
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
7811 |
]. |
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
7812 |
^ self openModal:aBlock inGroup:masterGroup "/ mainGroup. |
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
7813 |
|
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
7814 |
"Created: / 10.12.1995 / 14:06:45 / cg" |
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
7815 |
"Modified: / 9.7.1998 / 01:20:57 / cg" |
299
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
7816 |
! |
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
7817 |
|
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
7818 |
openModal:aBlock inGroup:mainGroup |
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
7819 |
"create a new windowgroup, but start processing in the current process - |
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
7820 |
actually suspending event processing for the main group. |
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
7821 |
Stay in this modal loop while aBlock evaluates to true AND the receiver is |
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
7822 |
visible. |
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
7823 |
(i.e. control is returned to the sender when the receiver is closed) |
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
7824 |
This makes any interaction with the current window impossible - |
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
7825 |
however, other views (in other windowgroups) still work." |
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
7826 |
|
1397
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
7827 |
|tops mainView mainViewID| |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
7828 |
|
1736 | 7829 |
self isPopUpView ifFalse:[ |
2721 | 7830 |
ModalBox usingTransientViews ifTrue:[ |
7831 |
mainGroup notNil ifTrue:[ |
|
7832 |
(tops := mainGroup topViews) notNil ifTrue:[ |
|
7833 |
tops notEmpty ifTrue:[ |
|
7834 |
mainView := tops first. |
|
7835 |
mainView notNil ifTrue:[ |
|
7836 |
mainViewID := mainView id. |
|
7837 |
] |
|
7838 |
] |
|
7839 |
]. |
|
7840 |
]. |
|
7841 |
||
7842 |
mainViewID isNil ifTrue:[ |
|
7843 |
self origin:(device center - (self extent//2)) |
|
7844 |
]. |
|
7845 |
||
7846 |
drawableId isNil ifTrue:[self create]. |
|
7847 |
device setTransient:drawableId for:mainViewID. |
|
7848 |
]. |
|
1397
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
7849 |
]. |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
7850 |
|
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
7851 |
self raise. |
299
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
7852 |
|
269 | 7853 |
Processor activeProcessIsSystemProcess ifTrue:[ |
2721 | 7854 |
" |
7855 |
put myself into the modal group, let it handle events for |
|
7856 |
me as well. This is only a half way solution, since the view |
|
7857 |
is not modal at all ... however, the only situation |
|
7858 |
where this happens is with modal boxes popped while in a |
|
7859 |
modal browser. You will forgive me for that inconvenience. |
|
7860 |
" |
|
7861 |
windowGroup := mainGroup. |
|
7862 |
mainGroup notNil ifTrue:[mainGroup addTopView:self]. |
|
7863 |
self realize |
|
135 | 7864 |
] ifFalse:[ |
2721 | 7865 |
" |
7866 |
show a stop-cursor in the main group |
|
7867 |
" |
|
7868 |
mainGroup notNil ifTrue:[ |
|
7869 |
self isPopUpView ifFalse:[ |
|
7870 |
mainGroup showCursor:(Cursor stop). |
|
7871 |
] |
|
7872 |
]. |
|
7873 |
||
7874 |
" |
|
7875 |
create a new window group and put myself into it |
|
7876 |
" |
|
7877 |
windowGroup := WindowGroup new. |
|
7878 |
windowGroup addTopView:self. |
|
7879 |
||
7880 |
superView notNil ifTrue:[ |
|
7881 |
"/ |
|
7882 |
"/ special: this is a modal subview, |
|
7883 |
"/ prevent the view from reassigning its windowGroup when realized |
|
7884 |
"/ (subviews normally place themself into the superviews group) |
|
7885 |
"/ |
|
7886 |
windowGroup isForModalSubview:true. |
|
7887 |
]. |
|
7888 |
||
7889 |
" |
|
7890 |
go dispatch events in this new group |
|
7891 |
(thus current windowgroup is blocked from interaction) |
|
7892 |
" |
|
7893 |
AbortSignal handle:[:ex | |
|
7894 |
self hide. |
|
7895 |
ex return. |
|
7896 |
] do:[ |
|
7897 |
[ |
|
7898 |
[ |
|
7899 |
windowGroup startupModal:[realized and:aBlock] forGroup:mainGroup |
|
7900 |
] valueOnUnwindDo:[ |
|
7901 |
self hide |
|
7902 |
] |
|
7903 |
] valueNowOrOnUnwindDo:[ |
|
7904 |
mainGroup notNil ifTrue:[ |
|
7905 |
ReturnFocusWhenClosingModalBoxes ifTrue:[ |
|
7906 |
" |
|
7907 |
return input focus to previously active groups top. |
|
7908 |
This helps with windowmanagers which need an explicit click |
|
7909 |
on the view for the focus. |
|
7910 |
" |
|
7911 |
tops := mainGroup topViews. |
|
7912 |
(tops notNil and:[tops notEmpty]) ifTrue:[ |
|
7913 |
tops first getKeyboardFocus |
|
7914 |
] |
|
7915 |
]. |
|
7916 |
||
7917 |
" |
|
7918 |
restore cursors in the main group & flush its buffered key & mouse events |
|
7919 |
" |
|
7920 |
mainGroup restoreCursors. |
|
1329 | 7921 |
"/ mainGroup sensor flushUserEvents. |
2721 | 7922 |
] |
7923 |
] |
|
7924 |
]. |
|
135 | 7925 |
] |
299
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
7926 |
|
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
7927 |
"Created: 10.12.1995 / 14:06:14 / cg" |
1877 | 7928 |
"Modified: 20.8.1997 / 15:14:44 / cg" |
135 | 7929 |
! |
7930 |
||
269 | 7931 |
openModalAt:aPoint |
7932 |
"open up the view modeless - positions the view |
|
7933 |
(i.e. circumvents window managers positioning)" |
|
7934 |
||
7935 |
self origin:aPoint. |
|
1837 | 7936 |
drawableId isNil ifTrue:[self create]. |
560
968d062c79cb
oops - openAt did set transient; definitely wrong ...
Claus Gittinger <cg@exept.de>
parents:
527
diff
changeset
|
7937 |
"/ device setTransient:drawableId for:0. |
269 | 7938 |
^ self openModal |
7939 |
||
7940 |
" |
|
7941 |
View new openModal |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7942 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7943 |
" |
269 | 7944 |
View new openModalAt:100@100 |
7945 |
" |
|
7946 |
||
7947 |
"Created: 18.9.1995 / 23:21:42 / claus" |
|
7948 |
"Modified: 18.9.1995 / 23:32:26 / claus" |
|
1837 | 7949 |
"Modified: 28.7.1997 / 18:52:29 / cg" |
269 | 7950 |
! |
7951 |
||
7952 |
openModalAtCenter |
|
7953 |
"open up the view modeless - positions the view |
|
7954 |
(i.e. circumvents window managers positioning)" |
|
7955 |
||
7956 |
^ self openModalAt:(device center - (self extent//2)). |
|
7957 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7958 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7959 |
View new openModal |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7960 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7961 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7962 |
View new openModalAtCenter |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7963 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7964 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7965 |
"Modified: 24.7.1997 / 13:27:37 / cg" |
269 | 7966 |
! |
7967 |
||
7968 |
openModeless |
|
7969 |
"create and schedule a new windowgroup for me and open the view. |
|
7970 |
The view will be handled by its own process, effectively running in |
|
7971 |
parallel (i.e. control is returned to the sender immediately)." |
|
7972 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7973 |
self openModelessAt:nil |
269 | 7974 |
|
7975 |
" |
|
7976 |
the same: |
|
2721 | 7977 |
(Button label:'hello') open |
7978 |
||
7979 |
(Button label:'hello') openModeless |
|
269 | 7980 |
|
7981 |
different: |
|
2721 | 7982 |
YesNoBox new open |
7983 |
||
7984 |
YesNoBox new openModeless |
|
269 | 7985 |
" |
7986 |
" |
|
7987 |
(almost) the same: |
|
2721 | 7988 |
YesNoBox new open |
7989 |
||
7990 |
YesNoBox new openModal |
|
269 | 7991 |
|
7992 |
different: |
|
2721 | 7993 |
(Button label:'hello') open |
7994 |
||
7995 |
(Button label:'hello') openModal |
|
269 | 7996 |
" |
503
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
7997 |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7998 |
"Modified: 24.7.1997 / 13:17:49 / cg" |
269 | 7999 |
! |
8000 |
||
8001 |
openModelessAt:aPoint |
|
8002 |
"open up the view modeless - positions the view |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8003 |
(i.e. tries to circumvent the window managers positioning) |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8004 |
Notice: some windowManagers seem to ignore this and always |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8005 |
ask the user to position the view." |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8006 |
|
1827 | 8007 |
self openModelessAt:aPoint iconified:false |
8008 |
||
8009 |
" |
|
8010 |
View new openModeless |
|
8011 |
||
8012 |
View new openModelessAt:100@100 |
|
8013 |
" |
|
8014 |
||
8015 |
"Created: 18.9.1995 / 23:21:42 / claus" |
|
8016 |
"Modified: 24.7.1997 / 13:48:52 / cg" |
|
8017 |
! |
|
8018 |
||
8019 |
openModelessAt:aPoint iconified:iconified |
|
8020 |
"open up the view modeless - positions the view |
|
8021 |
(i.e. tries to circumvent the window managers positioning) |
|
8022 |
Notice: some windowManagers seem to ignore this and always |
|
8023 |
ask the user to position the view." |
|
8024 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8025 |
|newGroup| |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8026 |
|
1837 | 8027 |
drawableId isNil ifTrue:[self create]. |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8028 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8029 |
windowGroup isNil ifTrue:[ |
2721 | 8030 |
newGroup := true. |
8031 |
windowGroup := WindowGroup new. |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8032 |
] ifFalse:[ |
2721 | 8033 |
newGroup := false. |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8034 |
]. |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8035 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8036 |
windowGroup addTopView:self. |
1827 | 8037 |
(aPoint isNil and:[iconified not]) ifTrue:[ |
2721 | 8038 |
windowGroup startupWith:[self realize]. |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8039 |
] ifFalse:[ |
2721 | 8040 |
windowGroup startupWith:[self realizeKeepingGroup:false at:aPoint iconified:iconified]. |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8041 |
]. |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8042 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8043 |
newGroup ifFalse:[ |
2721 | 8044 |
self realizeInGroup. |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8045 |
]. |
269 | 8046 |
|
8047 |
" |
|
1827 | 8048 |
StandardSystemView new openModeless |
8049 |
||
8050 |
StandardSystemView new openModelessAt:100@100 |
|
8051 |
||
8052 |
StandardSystemView new openModelessAt:100@100 iconified:true |
|
269 | 8053 |
" |
8054 |
||
8055 |
"Created: 18.9.1995 / 23:21:42 / claus" |
|
1837 | 8056 |
"Modified: 28.7.1997 / 18:52:26 / cg" |
269 | 8057 |
! |
8058 |
||
8059 |
openModelessAtCenter |
|
8060 |
"open up the view modeless - positions the view |
|
8061 |
(i.e. circumvents window managers positioning)" |
|
8062 |
||
8063 |
^ self openModelessAt:(device center - (self extent//2)). |
|
8064 |
||
8065 |
" |
|
8066 |
View new openModeless |
|
8067 |
||
8068 |
View new openModelessAtCenter |
|
8069 |
" |
|
8070 |
||
8071 |
"Created: 18.9.1995 / 23:21:42 / claus" |
|
8072 |
! |
|
8073 |
||
8074 |
waitUntilVisible |
|
8075 |
"wait until the receiver visible. |
|
8076 |
In normal applications, you do not need to wait till a view is |
|
8077 |
open - it should do all of its drawing itself when it gets the |
|
8078 |
first expose event. |
|
8079 |
However, if you want to 'manually' draw into the view (for example, |
|
8080 |
in doIt expressions), or subsequent views depend on some state of |
|
8081 |
another view (which is only available once visible), |
|
8082 |
use this to suspend the current process until the receiver is shown. |
|
8083 |
Caveat: |
|
2721 | 8084 |
we poll here for the view to be shown - we need a semaphore |
8085 |
which is raised by the view in order to do it right." |
|
269 | 8086 |
|
8087 |
[self shown] whileFalse:[ |
|
2721 | 8088 |
Delay waitForSeconds:0.05. |
269 | 8089 |
]. |
8090 |
||
8091 |
"does not work (the view is in its opening phase, |
|
8092 |
when we attempt to draw a line - this gives an error, since |
|
8093 |
its internals are not yet correctly setup): |
|
8094 |
||
2721 | 8095 |
|v| |
8096 |
||
8097 |
v := View new open. |
|
8098 |
v displayLineFrom:0@0 to:50@50 |
|
269 | 8099 |
|
8100 |
does work (since we wait until the view has completely finished |
|
8101 |
its startup phase): |
|
8102 |
||
2721 | 8103 |
|v| |
8104 |
||
8105 |
v := View new open. |
|
8106 |
v waitUntilVisible. |
|
8107 |
v displayLineFrom:0@0 to:50@50 |
|
269 | 8108 |
" |
135 | 8109 |
! ! |
8110 |
||
8111 |
!SimpleView methodsFor:'user notification'! |
|
8112 |
||
8113 |
warn:aString |
|
8114 |
"like Objects warn, but translates the string via the |
|
8115 |
resourcePack, thus giving a translated string automatically" |
|
8116 |
||
151 | 8117 |
super warn:(resources string:aString) withCRs |
135 | 8118 |
! |
8119 |
||
8120 |
warn:aString with:argument |
|
8121 |
"like Objects warn, but translates the string via the |
|
8122 |
resourcePack, thus giving a translated string automatically" |
|
8123 |
||
151 | 8124 |
super warn:(resources string:aString with:argument) withCRs |
8125 |
! |
|
8126 |
||
8127 |
warn:aString with:arg1 with:arg2 |
|
8128 |
"like Objects warn, but translates the string via the |
|
8129 |
resourcePack, thus giving a translated string automatically" |
|
8130 |
||
8131 |
super warn:(resources string:aString with:arg1 with:arg2) withCRs |
|
135 | 8132 |
! ! |
8133 |
||
1903 | 8134 |
!SimpleView::ViewShape methodsFor:'accessing'! |
8135 |
||
8136 |
borderShapeForm |
|
8137 |
"return the value of the instance variable 'borderShapeForm' (automatically generated)" |
|
8138 |
||
8139 |
^ borderShapeForm |
|
8140 |
||
8141 |
"Created: 18.9.1997 / 11:04:29 / cg" |
|
8142 |
! |
|
8143 |
||
8144 |
borderShapeForm:something |
|
8145 |
"set the value of the instance variable 'borderShapeForm' (automatically generated)" |
|
8146 |
||
8147 |
borderShapeForm := something. |
|
8148 |
||
8149 |
"Created: 18.9.1997 / 11:04:29 / cg" |
|
8150 |
! |
|
8151 |
||
8152 |
viewShapeForm |
|
8153 |
"return the value of the instance variable 'viewShapeForm' (automatically generated)" |
|
8154 |
||
8155 |
^ viewShapeForm |
|
8156 |
||
8157 |
"Created: 18.9.1997 / 11:04:29 / cg" |
|
8158 |
! |
|
8159 |
||
8160 |
viewShapeForm:something |
|
8161 |
"set the value of the instance variable 'viewShapeForm' (automatically generated)" |
|
8162 |
||
8163 |
viewShapeForm := something. |
|
8164 |
||
8165 |
"Created: 18.9.1997 / 11:04:29 / cg" |
|
8166 |
! ! |
|
8167 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
8168 |
!SimpleView class methodsFor:'documentation'! |
269 | 8169 |
|
8170 |
version |
|
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
8171 |
^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.324 1999-05-25 13:11:50 cg Exp $' |
135 | 8172 |
! ! |
8173 |
SimpleView initialize! |