author | ca |
Wed, 05 Mar 1997 17:08:45 +0100 | |
changeset 1427 | 35214ddde67c |
parent 1425 | c6963c38dcd8 |
child 1432 | 23fa07be585a |
permissions | -rw-r--r-- |
135 | 1 |
" |
2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
1356 | 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 |
1363 | 14 |
instanceVariableNames:'superView subViews components styleSheet resources borderColor |
15 |
borderWidth borderShape viewShape top left extentChanged |
|
16 |
originChanged cornerChanged relativeOrigin relativeExtent |
|
17 |
relativeCorner originRule extentRule cornerRule insets layout |
|
18 |
shown hiddenOnRealize name level margin innerClipRect shadowColor |
|
19 |
lightColor bitGravity viewGravity controller windowGroup |
|
20 |
preferredExtent explicitExtent' |
|
21 |
classVariableNames:'Grey CentPoint ViewSpacing DefaultStyle StyleSheet |
|
22 |
DefaultViewBackgroundColor DefaultBorderColor DefaultLightColor |
|
23 |
DefaultShadowColor DefaultBorderWidth DefaultFocusColor |
|
24 |
DefaultFocusBorderWidth ReturnFocusWhenClosingModalBoxes' |
|
25 |
poolDictionaries:'' |
|
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 |
||
1363 | 34 |
DisplaySurface - |
35 |
GraphicsMedium - |
|
36 |
DeviceGraphicsContext - |
|
37 |
GraphicsContext - |
|
38 |
Object - |
|
734 | 39 |
" |
140 | 40 |
! |
135 | 41 |
|
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
42 |
!SimpleView class methodsFor:'documentation'! |
135 | 43 |
|
44 |
copyright |
|
45 |
" |
|
46 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
1356 | 47 |
All Rights Reserved |
135 | 48 |
|
49 |
This software is furnished under a license and may be used |
|
50 |
only in accordance with the terms of that license and with the |
|
51 |
inclusion of the above copyright notice. This software may not |
|
52 |
be provided or otherwise made available to, or used by, any |
|
53 |
other person. No title to or ownership of the software is |
|
54 |
hereby transferred. |
|
55 |
" |
|
56 |
! |
|
57 |
||
58 |
documentation |
|
59 |
" |
|
60 |
this class implements functions common to all Views which do not work on / show a model. |
|
61 |
Previously, all of this functionality used to be in the old View class, but has been |
|
62 |
separated into this new SimpleView (which does not know about models) and the new View, which |
|
63 |
does so. |
|
484 | 64 |
I'd prefer to call this class View and the current View class a ModelView, |
65 |
but for backward compatibility its better to leave things the way they are |
|
66 |
(there are simply too many subclasses of View around ...). |
|
67 |
||
135 | 68 |
Instances of SimpleView are seldom used, most views in the system inherit |
69 |
from this class. |
|
70 |
However, sometimes a view is used to create a dummy view for framing |
|
71 |
or layout purposes. |
|
72 |
||
616 | 73 |
[Instance variables:] |
135 | 74 |
|
484 | 75 |
superView <View> my superview i.e. the view I am in |
76 |
||
77 |
subViews <Collection> the collection of subviews |
|
78 |
||
79 |
components <Collection> collection of gadgets (will be merged with subViews, soon) |
|
80 |
||
81 |
borderColor <Color> color of border |
|
82 |
||
83 |
borderWidth <Number> borderWidth in pixels (device dep.) |
|
84 |
||
85 |
borderShape <Form> shape of border (if device supports it) |
|
86 |
||
87 |
viewShape <Form> shape of view (if device supports it) |
|
88 |
||
89 |
top <Number> actual top coordinate (pixels) in superview |
|
90 |
||
91 |
left <Number> actual left coordinate (pixels) in superview |
|
92 |
||
93 |
extendChanged <Boolean> true if extend changed during setup |
|
94 |
||
95 |
originChanged <Boolean> true if origin changed during setup |
|
96 |
||
97 |
relativeOrigin <Number> relative origin in percent within superview |
|
98 |
||
99 |
relativeExtent <Number> relative extent in percent within superview |
|
100 |
||
101 |
relativeCorner <Number> relative corner in percent within superview |
|
102 |
||
103 |
originRule <Block> rule to compute origin if superview changes size |
|
104 |
||
105 |
extentRule <Block> rule to compute extent if superview changes size |
|
106 |
||
107 |
cornerRule <Block> rule to compute corner if superview changes size |
|
108 |
||
109 |
insets <Array> array with top, left, bottom & right insets (or nil) |
|
110 |
||
111 |
layout <LayoutObject> not yet implemented - will replace the above layout |
|
112 |
variables. |
|
113 |
||
114 |
shown <Boolean> true if visible (false if iconified, unmapped or covered) |
|
115 |
||
116 |
hiddenOnRealize <Boolean> dont show automatically when superview is realized |
|
117 |
||
118 |
name <String> my name (future use for resources) |
|
119 |
||
120 |
level <Number> 3D level relative to superview |
|
121 |
||
122 |
margin <Number> convenient margin |
|
123 |
||
124 |
innerClipRect <Rectangle> convenient inner clip (minus margin) |
|
125 |
||
126 |
shadowColor <Color> color used to draw 3D shadowed edges |
|
127 |
||
128 |
lightColor <Color> color used to draw 3D lighted edges |
|
129 |
||
130 |
bitGravity <nil | Symbol> gravity of contents (if device supports it) |
|
131 |
||
132 |
viewGravity <nil | Symbol> gravity of view (if device supports it) |
|
133 |
||
134 |
controller <nil | Controller> the controller (if any) |
|
135 |
||
136 |
windowGroup <WindowGroup> the windowGroup |
|
137 |
||
135 | 138 |
|
139 |
||
616 | 140 |
[Class variables:] |
135 | 141 |
|
484 | 142 |
Grey <Color> the color grey - its used so often |
143 |
||
144 |
ViewSpacing <Number> preferred spacing between views; 1mm |
|
145 |
||
146 |
CentPoint <Point> 100 @ 100 - its used so often |
|
147 |
||
148 |
StyleSheet <ResourcePack> contains all view-style specifics |
|
149 |
||
150 |
ReturnFocusWhenClosingModalBoxes if true, a closing modalBox returns |
|
151 |
<Boolean> the keyboard focus to the view which was |
|
152 |
active when the box was opened. |
|
153 |
If false (the default), it is left to |
|
154 |
window manager to assign a new focus. |
|
155 |
If running on olwm/olvwm (which requires an |
|
156 |
explicit click to reassign a focus), it is |
|
157 |
better to turn this on in a private.rc file. |
|
135 | 158 |
|
616 | 159 |
[styleSheet parameters:] |
135 | 160 |
|
484 | 161 |
popupShadow <Boolean> if true, popupViews show a shadow below |
162 |
||
163 |
popupLevel <nil | Integer> 3D level |
|
164 |
||
165 |
borderWidth <nil | Integer> borderWidth (ignored in 3D styles) |
|
166 |
||
167 |
borderColor <nil | Color> borderColor (ignored in 3D styles) |
|
168 |
||
169 |
viewBackground <nil | Color> views background |
|
170 |
||
171 |
shadowColor <nil | Color> color for shadow edges (ignored in 2D styles) |
|
172 |
||
173 |
lightColor <nil | Color> color for light edges (ignored in 2D styles) |
|
174 |
||
175 |
font <nil | Font> font to use |
|
135 | 176 |
|
177 |
||
178 |
TODO: |
|
484 | 179 |
get rid of relativeOrigin, relativeCorner, originRule, extentRule, |
180 |
and insets; replace by a single object which defines the size |
|
181 |
(mhmh - ST-80 seems to call this LayoutFrame ?) |
|
182 |
-> be prepared for a change here in the near future and ONLY use |
|
183 |
access methods to get those instance variables' values |
|
184 |
||
185 |
get rid of 3D level & margin, move it to extra wrappers |
|
186 |
(although this will make view setup more complicated, it will remove |
|
187 |
complexity from the internals of view. Also, it will allow for more |
|
188 |
varieties of borders.) |
|
151 | 189 |
|
484 | 190 |
add components (could also call them gadgets or lightweight views) |
191 |
- views are expensive in terms of X resources. This would make all |
|
192 |
framing/edge and panel helper views become cheap ST objects, instead |
|
193 |
of views. |
|
616 | 194 |
|
195 |
||
196 |
[see also:] |
|
621 | 197 |
StandardSystemView DialogBox |
616 | 198 |
WindowGroup WindowEvent |
621 | 199 |
Layout |
616 | 200 |
( introduction to view programming :html: programming/viewintro.html ) |
201 |
||
202 |
[author:] |
|
203 |
Claus Gittinger |
|
135 | 204 |
" |
151 | 205 |
! |
206 |
||
207 |
examples |
|
208 |
" |
|
209 |
(all examples below use different viewBackgrounds, |
|
210 |
to make the individual subviews visible) |
|
211 |
||
616 | 212 |
a subView in a topView: |
621 | 213 |
[exBegin] |
616 | 214 |
|top v| |
215 |
||
216 |
topView := StandardSystemView new. |
|
217 |
v := View new. |
|
218 |
v origin:0.25 @ 0.25 corner:0.75 @ 0.75. |
|
219 |
top addSubView:v. |
|
220 |
top open |
|
621 | 221 |
[exEnd] |
616 | 222 |
|
223 |
||
224 |
the same, a bit more compact: |
|
621 | 225 |
[exBegin] |
616 | 226 |
|top v| |
227 |
||
228 |
topView := StandardSystemView new. |
|
229 |
v := View origin:0.25 @ 0.25 corner:0.75 @ 0.75 in:topView. |
|
230 |
top open |
|
621 | 231 |
[exEnd] |
616 | 232 |
|
233 |
||
151 | 234 |
fixed position/size: |
621 | 235 |
[exBegin] |
151 | 236 |
|top v1 v2| |
237 |
||
238 |
top := StandardSystemView new. |
|
239 |
top extent:300@300. |
|
240 |
||
241 |
v1 := View origin:10@10 |
|
616 | 242 |
corner:50@50 |
243 |
in:top. |
|
151 | 244 |
v2 := View origin:60@10 |
616 | 245 |
corner:150@100 |
246 |
in:top. |
|
151 | 247 |
|
248 |
v1 viewBackground:(Color red). |
|
249 |
v2 viewBackground:(Color yellow). |
|
250 |
||
251 |
top open |
|
621 | 252 |
[exEnd] |
151 | 253 |
|
254 |
same, using ST-80 way of bulding up view hierarchies |
|
255 |
(recommended, if you plan to port applications later) |
|
621 | 256 |
[exBegin] |
151 | 257 |
|top v1 v2| |
258 |
||
259 |
top := StandardSystemView new. |
|
260 |
top extent:300@300. |
|
261 |
||
262 |
v1 := View new. |
|
263 |
v1 origin:10@10 corner:50@50. |
|
264 |
||
265 |
v2 := View new. |
|
266 |
v2 origin:60@10 corner:150@100. |
|
267 |
||
268 |
v1 viewBackground:(Color red). |
|
269 |
v2 viewBackground:(Color yellow). |
|
270 |
||
271 |
top add:v1. |
|
272 |
top add:v2. |
|
273 |
||
274 |
v1 viewBackground:(Color red). |
|
275 |
v2 viewBackground:(Color yellow). |
|
276 |
||
277 |
top open |
|
621 | 278 |
[exEnd] |
151 | 279 |
|
280 |
fixed origin, variable size: |
|
621 | 281 |
[exBegin] |
151 | 282 |
|top v1 v2| |
283 |
||
284 |
top := StandardSystemView new. |
|
285 |
top extent:300@300. |
|
286 |
||
287 |
v1 := View new. |
|
288 |
v1 origin:10@10 corner:50@0.5. |
|
289 |
||
290 |
v2 := View new. |
|
291 |
v2 origin:60@10 corner:150@0.5. |
|
292 |
||
293 |
v1 viewBackground:(Color red). |
|
294 |
v2 viewBackground:(Color yellow). |
|
295 |
||
296 |
top add:v1. |
|
297 |
top add:v2. |
|
298 |
||
299 |
top open |
|
621 | 300 |
[exEnd] |
151 | 301 |
|
302 |
fixed origin, variable size, |
|
303 |
bottomInset for constant distance from bottom: |
|
621 | 304 |
[exBegin] |
151 | 305 |
|top v1 v2| |
306 |
||
307 |
top := StandardSystemView new. |
|
308 |
top extent:300@300. |
|
309 |
||
310 |
v1 := View new. |
|
311 |
v1 origin:10@10 corner:50@1.0. |
|
312 |
v1 bottomInset:10. |
|
313 |
||
314 |
v2 := View new. |
|
315 |
v2 origin:60@10 corner:150@1.0. |
|
316 |
v2 bottomInset:10. |
|
317 |
||
318 |
v1 viewBackground:(Color red). |
|
319 |
v2 viewBackground:(Color yellow). |
|
320 |
||
321 |
top add:v1. |
|
322 |
top add:v2. |
|
323 |
||
324 |
top open |
|
621 | 325 |
[exEnd] |
151 | 326 |
|
327 |
variable origin, variable size, |
|
621 | 328 |
[exBegin] |
151 | 329 |
|top v1 v2| |
330 |
||
331 |
top := StandardSystemView new. |
|
332 |
top extent:300@300. |
|
333 |
||
334 |
v1 := View new. |
|
335 |
v1 origin:0.0@0.0 corner:0.5@0.5. |
|
336 |
||
337 |
v2 := View new. |
|
338 |
v2 origin:0.5@0.0 corner:1.0@0.5. |
|
339 |
||
340 |
v1 viewBackground:(Color red). |
|
341 |
v2 viewBackground:(Color yellow). |
|
342 |
||
343 |
top add:v1. |
|
344 |
top add:v2. |
|
345 |
||
346 |
top open |
|
621 | 347 |
[exEnd] |
151 | 348 |
|
349 |
variable origin, variable size, |
|
350 |
insets for some constant distance |
|
621 | 351 |
[exBegin] |
151 | 352 |
|top v1 v2| |
353 |
||
354 |
top := StandardSystemView new. |
|
355 |
top extent:300@300. |
|
356 |
||
357 |
v1 := View new. |
|
358 |
v1 origin:0.0@0.0 corner:0.5@0.5. |
|
359 |
v1 rightInset:5. |
|
360 |
||
361 |
v2 := View new. |
|
362 |
v2 origin:0.5@0.0 corner:1.0@0.5. |
|
363 |
v2 leftInset:5. |
|
364 |
||
365 |
v1 viewBackground:(Color red). |
|
366 |
v2 viewBackground:(Color yellow). |
|
367 |
||
368 |
top add:v1. |
|
369 |
top add:v2. |
|
370 |
||
371 |
top open |
|
621 | 372 |
[exEnd] |
151 | 373 |
|
374 |
using layout objects (ST-80 style): |
|
375 |
fully specifying the frame |
|
621 | 376 |
[exBegin] |
151 | 377 |
|top v1 v2| |
378 |
||
379 |
top := StandardSystemView new. |
|
380 |
top extent:300@300. |
|
381 |
||
382 |
v1 := View new. |
|
383 |
v2 := View new. |
|
384 |
||
385 |
v1 viewBackground:(Color red). |
|
386 |
v2 viewBackground:(Color yellow). |
|
387 |
||
388 |
top add:v1 in:(LayoutFrame new |
|
616 | 389 |
leftFraction:0.25; |
390 |
rightFraction:0.75; |
|
391 |
topFraction:0.0; |
|
392 |
bottomFraction:0.5). |
|
151 | 393 |
top add:v2 in:(LayoutFrame new |
616 | 394 |
leftFraction:0.5; |
395 |
rightFraction:1.0; |
|
396 |
topFraction:0.5; |
|
397 |
bottomFraction:0.75). |
|
151 | 398 |
|
399 |
top open |
|
621 | 400 |
[exEnd] |
151 | 401 |
|
402 |
another one, with offsets: |
|
621 | 403 |
[exBegin] |
151 | 404 |
|top v1 v2| |
405 |
||
406 |
top := StandardSystemView new. |
|
407 |
top extent:300@300. |
|
408 |
||
409 |
v1 := View new. |
|
410 |
v2 := View new. |
|
411 |
||
412 |
v1 viewBackground:(Color red). |
|
413 |
v2 viewBackground:(Color yellow). |
|
414 |
||
415 |
top add:v1 in:(LayoutFrame new |
|
616 | 416 |
leftFraction:0.0 offset:10; |
417 |
rightFraction:1.0 offset:-10; |
|
418 |
topFraction:0.0 offset:10; |
|
419 |
bottomFraction:0.5). |
|
151 | 420 |
top add:v2 in:(LayoutFrame new |
616 | 421 |
leftFraction:0.0 offset:30; |
422 |
rightFraction:1.0 offset:-30; |
|
423 |
topFraction:0.5 offset:10; |
|
424 |
bottomFraction:0.75). |
|
151 | 425 |
|
426 |
top open |
|
621 | 427 |
[exEnd] |
151 | 428 |
|
429 |
specifying origin only. Extent is views preferred |
|
430 |
(notice, that plain views have some defaultExtent of 100@100) |
|
621 | 431 |
[exBegin] |
151 | 432 |
|top v1 v2| |
433 |
||
434 |
top := StandardSystemView new. |
|
435 |
top extent:300@300. |
|
436 |
||
437 |
v1 := View new. |
|
438 |
v2 := View new. |
|
439 |
||
440 |
v1 viewBackground:(Color red). |
|
441 |
v2 viewBackground:(Color yellow). |
|
442 |
||
443 |
top add:v1 in:(LayoutOrigin new |
|
616 | 444 |
leftFraction:0.25; |
445 |
topFraction:0.0). |
|
151 | 446 |
top add:v2 in:(LayoutOrigin new |
616 | 447 |
leftFraction:0.5; |
448 |
topFraction:0.5). |
|
151 | 449 |
|
450 |
top open |
|
621 | 451 |
[exEnd] |
151 | 452 |
|
453 |
same example, using buttons which compute their preferredBounds: |
|
621 | 454 |
[exBegin] |
151 | 455 |
|top v1 v2| |
456 |
||
457 |
top := StandardSystemView new. |
|
458 |
top extent:300@300. |
|
459 |
||
460 |
v1 := Button label:'foo'. |
|
461 |
v2 := Button label:'a very long buttonLabel'. |
|
462 |
||
463 |
v1 backgroundColor:(Color red). |
|
464 |
v2 backgroundColor:(Color yellow). |
|
465 |
||
466 |
top add:v1 in:(LayoutOrigin new |
|
616 | 467 |
leftFraction:0.25; |
468 |
topFraction:0.0). |
|
151 | 469 |
top add:v2 in:(LayoutOrigin new |
616 | 470 |
leftFraction:0.5; |
471 |
topFraction:0.5). |
|
151 | 472 |
|
473 |
top open |
|
621 | 474 |
[exEnd] |
151 | 475 |
" |
269 | 476 |
! |
477 |
||
478 |
layoutComputation |
|
479 |
" |
|
480 |
Due to historic reasons, there are 2 mechanisms to resize a view: |
|
1356 | 481 |
- (old, to be eliminated mechanism) |
482 |
based upon info found in |
|
483 |
relativeOrigin / relativeCorner / relativeExtent |
|
484 |
originRule / cornerRule / extentRule |
|
485 |
||
486 |
- (new, will migrate to that one) |
|
487 |
letting a layoutObject compute things |
|
269 | 488 |
|
489 |
Actually, the old mechanism is just as powerful, as the new (layoutObject |
|
490 |
based) mechanism; with the help of block=rules, you can compute whatever |
|
491 |
geometry is desired. |
|
492 |
However, having 6 instance variables in every view creates some overhead, |
|
493 |
which can be avoided in most cases (most views are either fixed-size or |
|
494 |
relative-sized). |
|
495 |
Therefore (and also to make porting of ST-80 apps easier), ST/X will migrate |
|
496 |
to use layoutObjects. |
|
497 |
You will not see a difference at the views protocol level, since |
|
498 |
existing interfaces will (silently) create layoutObjects as appropriate. |
|
499 |
However, you should remove all direct accesses to the above mentioned |
|
500 |
instance variables, to be prepared for that change. |
|
501 |
||
502 |
Notice, that a view recomputes its size whenever its superview |
|
503 |
changes size. This is done via: |
|
1356 | 504 |
sizeChanged |
505 |
-> allSubviews: superViewChangedSize |
|
269 | 506 |
|
507 |
If the geometry computation as performed in superViewChangedSize |
|
508 |
is not powerful enough for your application, you can either: |
|
1356 | 509 |
- redefine superViewChangedSize |
510 |
- create a special layoutObject which computes a new layout. |
|
269 | 511 |
" |
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
512 |
! |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
513 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
514 |
popupMenus |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
515 |
" |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
516 |
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
|
517 |
definition: |
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 |
- static menus |
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 |
- dynamic menus from the view |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
522 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
523 |
- dynamic menus from the model / menuHolder |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
524 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
525 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
526 |
static menus |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
527 |
------------ |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
528 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
529 |
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
|
530 |
has a constant menu which never changes. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
531 |
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
|
532 |
The menu is defined with: |
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 |
someView middleButtonMenu:<aPopUpMenu> |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
535 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
536 |
Compatibility note: |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
537 |
static menus should no longer be used - their operation |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
538 |
is incompatible with ST-80 and ST/X's dynamic menus. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
539 |
Do not use them if you care for compatibility. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
540 |
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
|
541 |
(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
|
542 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
543 |
example: |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
544 |
|top v1 v2| |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
545 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
546 |
top := StandardSystemView new. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
547 |
top extent:300@300. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
548 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
549 |
v1 := View origin:0.0@0.0 corner:0.5@1.0 in:top. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
550 |
v1 viewBackground:Color red. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
551 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
552 |
v2 := View origin:0.5@0.0 corner:1.0@1.0 in:top. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
553 |
v2 viewBackground:Color yellow. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
554 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
555 |
v1 middleButtonMenu:( |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
556 |
PopUpMenu |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
557 |
labels:#('foo' 'bar') |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
558 |
selectors:#(foo bar) |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
559 |
receiver:v1 |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
560 |
). |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
561 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
562 |
top open. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
563 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
564 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
565 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
566 |
dynamic menus |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
567 |
------------- |
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 |
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
|
570 |
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
|
571 |
(i.e. it may be different from the model). |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
572 |
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
|
573 |
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
|
574 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
575 |
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
|
576 |
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
|
577 |
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
|
578 |
by textViews. |
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 |
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
|
581 |
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
|
582 |
- so the textView still performs the copy-function correctly |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
583 |
(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
|
584 |
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
|
585 |
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
|
586 |
(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
|
587 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
588 |
|top v1 v2 holder| |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
589 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
590 |
holder := Plug new. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
591 |
holder respondTo:#menu1 |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
592 |
with:[ |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
593 |
v1 menuMessage:#otherMenu1. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
594 |
PopUpMenu |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
595 |
labels:#('foo' 'bar') |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
596 |
selectors:#(foo bar). |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
597 |
]. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
598 |
holder respondTo:#otherMenu1 |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
599 |
with:[ |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
600 |
v1 menuMessage:#menu1. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
601 |
PopUpMenu |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
602 |
labels:#('other foo' 'other bar') |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
603 |
selectors:#(foo bar). |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
604 |
]. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
605 |
holder respondTo:#menu2 |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
606 |
with:[ PopUpMenu |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
607 |
labels:#('copy' 'bar2') |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
608 |
selectors:#(copySelection bar2) |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
609 |
]. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
610 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
611 |
top := StandardSystemView new. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
612 |
top extent:300@300. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
613 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
614 |
v1 := View origin:0.0@0.0 corner:0.5@1.0 in:top. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
615 |
v1 viewBackground:Color red. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
616 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
617 |
v2 := TextView origin:0.5@0.0 corner:1.0@1.0 in:top. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
618 |
v2 contents:'pop me up'. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
619 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
620 |
v1 model:holder; menuMessage:#menu1. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
621 |
v2 menuHolder:holder; menuMessage:#menu2. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
622 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
623 |
top open. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
624 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
625 |
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
|
626 |
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
|
627 |
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
|
628 |
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
|
629 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
630 |
example: |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
631 |
(Notice: the executor understands the #copySelection message - therefore, the |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
632 |
views built-in copy is NOT performed |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
633 |
- it could be forwarded to the view, though. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
634 |
This could be useful to intercept/filter things). |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
635 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
636 |
|top v menuProvider menuExecutor | |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
637 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
638 |
menuProvider := Plug new. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
639 |
menuProvider respondTo:#menu |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
640 |
with:[ PopUpMenu |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
641 |
labels:#('copy' 'foo') |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
642 |
selectors:#(copySelection foo) |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
643 |
]. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
644 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
645 |
menuExecutor := Plug new. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
646 |
menuExecutor respondTo:#copySelection |
697 | 647 |
with:[Transcript showCR:'copy function']. |
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
648 |
menuExecutor respondTo:#foo |
697 | 649 |
with:[Transcript showCR:'foo function']. |
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
650 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
651 |
top := StandardSystemView new. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
652 |
top extent:300@300. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
653 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
654 |
v := TextView origin:0.0@0.0 corner:1.0@1.0 in:top. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
655 |
v contents:'pop me up'. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
656 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
657 |
v menuHolder:menuProvider; menuMessage:#menu. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
658 |
v menuPerformer:menuExecutor. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
659 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
660 |
top open. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
661 |
" |
135 | 662 |
! ! |
663 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
664 |
!SimpleView class methodsFor:'initialization'! |
135 | 665 |
|
666 |
initialize |
|
667 |
DefaultStyle isNil ifTrue:[ |
|
696 | 668 |
Font initialize. |
669 |
Form initialize. |
|
670 |
Color initialize. |
|
671 |
||
672 |
"/ Display notNil ifTrue:[ |
|
673 |
"/ self defaultStyle:#normal. |
|
674 |
"/ ]. |
|
135 | 675 |
|
676 |
"/ self updateStyleCache. |
|
696 | 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 |
|
1356 | 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 |
|
1356 | 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 |
|
1356 | 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:. |
|
718 |
If realized and no superview has ever been set, it will come |
|
719 |
up as a topview." |
|
720 |
||
721 |
|newView| |
|
722 |
||
723 |
newView := self basicNew. |
|
724 |
aView notNil ifTrue:[ |
|
743 | 725 |
newView device:(aView graphicsDevice). |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
726 |
newView container:aView. |
135 | 727 |
] ifFalse:[ |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
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 |
|
1356 | 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 |
|
1356 | 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:[ |
|
743 | 780 |
device := anotherView graphicsDevice. |
269 | 781 |
] ifFalse:[ |
743 | 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 |
1356 | 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:[ |
|
743 | 800 |
newView := self basicNew. |
801 |
newView device:(aView graphicsDevice). |
|
802 |
newView initialize. |
|
803 |
aView addSubView:newView. |
|
135 | 804 |
] ifFalse:[ |
743 | 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 |
|
1356 | 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 |
|
1356 | 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 |
|
1356 | 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 |
|
1356 | 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:[ |
|
743 | 849 |
newView := self basicNew. |
850 |
newView device:(aView graphicsDevice). |
|
851 |
newView initialize. |
|
852 |
aView addSubView:newView. |
|
140 | 853 |
] ifFalse:[ |
743 | 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 |
|
1356 | 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 |
|
1356 | 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 |
|
1356 | 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 |
|
1356 | 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 |
|
1356 | 895 |
font:nil label:label in:nil |
135 | 896 |
! |
897 |
||
898 |
origin:anOrigin extent:anExtent |
|
1356 | 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 |
|
1356 | 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:[ |
867 | 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:[ |
467 | 950 |
self == SimpleView ifFalse:[ |
990 | 951 |
f := self superclass defaultFont. |
467 | 952 |
] ifTrue:[ |
997 | 953 |
f := super defaultFont |
467 | 954 |
]. |
452
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
955 |
]. |
997 | 956 |
|
990 | 957 |
f notNil ifTrue:[ |
1356 | 958 |
DefaultFont := f. |
959 |
f := f on:Display. |
|
990 | 960 |
f notNil ifTrue:[ |
1356 | 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:[ |
997 | 976 |
f := aFont on:Display. |
1356 | 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:[ |
1356 | 999 |
DefaultStyle := aStyle. |
1000 |
self updateAllStyleCaches. |
|
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 |
" |
|
1010 |
! |
|
1011 |
||
362 | 1012 |
returnFocusWhenClosingModalBoxes |
364
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1013 |
"return the current focus-return behavior. |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1014 |
See #returnFocusWhenClosingModalBoxes: for a description." |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1015 |
|
362 | 1016 |
^ ReturnFocusWhenClosingModalBoxes |
1017 |
! |
|
1018 |
||
1019 |
returnFocusWhenClosingModalBoxes:aBoolean |
|
364
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1020 |
"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
|
1021 |
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
|
1022 |
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
|
1023 |
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
|
1024 |
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
|
1025 |
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
|
1026 |
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
|
1027 |
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
|
1028 |
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
|
1029 |
display.rc file." |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1030 |
|
362 | 1031 |
ReturnFocusWhenClosingModalBoxes := aBoolean |
364
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1032 |
|
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1033 |
" |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1034 |
Dialog returnFocusWhenClosingModalBoxes:false |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1035 |
Dialog returnFocusWhenClosingModalBoxes:true |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1036 |
" |
362 | 1037 |
! |
1038 |
||
1161
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1039 |
styleSheet |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1040 |
"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
|
1041 |
|
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1042 |
^ StyleSheet |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1043 |
|
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1044 |
" |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1045 |
View styleSheet |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1046 |
" |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1047 |
|
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1048 |
"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
|
1049 |
! |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1050 |
|
269 | 1051 |
styleSheet:aViewStyle |
1052 |
"set the view style from a style-sheet" |
|
1053 |
||
1054 |
StyleSheet := aViewStyle. |
|
1055 |
DefaultStyle := (StyleSheet at:'name' ifAbsent:'unknown') asSymbol. |
|
1056 |
self updateAllStyleCaches. |
|
1057 |
! |
|
1058 |
||
1059 |
updateAllStyleCaches |
|
1060 |
"reload all style caches in all view classes. |
|
1061 |
Needed after a style change or when a style file has been changed" |
|
1062 |
||
1063 |
StyleSheet := ViewStyle fromFile:(DefaultStyle , '.style'). |
|
1064 |
StyleSheet fileReadFailed ifTrue:[ |
|
1172
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
1065 |
('***** WARNING: no styleSheet for ' , DefaultStyle , '-style.') errorPrintCR. |
527
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1066 |
DefaultStyle ~~ #normal ifTrue:[ |
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1067 |
DefaultStyle := #normal. |
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1068 |
StyleSheet := ViewStyle fromFile:(DefaultStyle , '.style'). |
269 | 1069 |
|
527
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1070 |
StyleSheet fileReadFailed ifTrue:[ |
1172
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
1071 |
'***** WARNING: not even a styleSheet for normal-style (using defaults).' errorPrintCR. |
527
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1072 |
] |
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1073 |
] |
269 | 1074 |
]. |
1075 |
||
1076 |
" |
|
1077 |
tell all view classes to flush any |
|
1078 |
cached style-data |
|
1079 |
" |
|
1080 |
self changed:#style. |
|
1081 |
SimpleView updateStyleCache. |
|
1082 |
SimpleView allSubclassesDo:[:aClass | |
|
527
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1083 |
aClass defaultFont:nil. |
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1084 |
(aClass class implements:#updateStyleCache) ifTrue:[ |
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1085 |
aClass updateStyleCache |
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1086 |
]. |
269 | 1087 |
] |
1088 |
||
1089 |
" |
|
1090 |
View updateAllStyleCaches |
|
1091 |
" |
|
527
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1092 |
|
1172
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
1093 |
"Modified: 10.1.1997 / 18:06:25 / cg" |
269 | 1094 |
! |
1095 |
||
135 | 1096 |
updateStyleCache |
1097 |
"this method gets some heavily used style stuff and keeps |
|
1098 |
it in class-variables for faster access. |
|
1099 |
Subclasses should redefine this to load any cached style-values |
|
1100 |
into faster class variables as well. These should NOT do a |
|
1101 |
super updateStyleCache, since this method is called for all view-classes |
|
1102 |
anyway." |
|
1103 |
||
484 | 1104 |
<resource: #style (#viewSpacing #font #borderWidth |
1105 |
#viewBackground #shadowColor #lightColor |
|
1106 |
#focusColor #focusBorderWidth)> |
|
1107 |
||
135 | 1108 |
|bgGrey| |
1109 |
||
1110 |
" |
|
1111 |
when coming here the first time, we read the styleSheet |
|
1112 |
and keep the values in fast class variables |
|
1113 |
" |
|
1114 |
StyleSheet isNil ifTrue:[ |
|
484 | 1115 |
DefaultStyle := #normal. |
1116 |
StyleSheet := ViewStyle fromFile:'normal.style'. |
|
135 | 1117 |
]. |
1118 |
||
1119 |
Grey := StyleSheet viewGrey. |
|
1120 |
Grey isNil ifTrue:[ |
|
484 | 1121 |
Grey := Color grey |
135 | 1122 |
]. |
1123 |
Grey := Grey on:Display. |
|
1124 |
||
151 | 1125 |
StyleSheet fileReadFailed ifTrue:[ |
484 | 1126 |
bgGrey := White |
135 | 1127 |
] ifFalse:[ |
749 | 1128 |
Display hasGrayscales ifTrue:[ |
484 | 1129 |
bgGrey := Grey |
1130 |
] ifFalse:[ |
|
1131 |
bgGrey := White |
|
1132 |
] |
|
135 | 1133 |
]. |
151 | 1134 |
bgGrey := bgGrey on:Display. |
135 | 1135 |
|
1136 |
ViewSpacing := StyleSheet at:'viewSpacing'. |
|
1137 |
ViewSpacing isNil ifTrue:[ |
|
484 | 1138 |
ViewSpacing := Display verticalPixelPerMillimeter rounded. |
135 | 1139 |
]. |
1140 |
||
1141 |
DefaultBorderColor := StyleSheet colorAt:'borderColor' default:Black. |
|
151 | 1142 |
|
1143 |
StyleSheet fileReadFailed ifTrue:[ |
|
484 | 1144 |
DefaultBorderWidth := 1. |
1145 |
DefaultShadowColor := Black. |
|
1146 |
DefaultLightColor := White. |
|
1147 |
DefaultFocusColor := Black. |
|
1148 |
DefaultFocusBorderWidth := 2. |
|
1149 |
DefaultViewBackgroundColor := bgGrey. |
|
151 | 1150 |
] ifFalse:[ |
484 | 1151 |
DefaultBorderWidth := StyleSheet at:'borderWidth' default:0. |
1152 |
DefaultViewBackgroundColor := StyleSheet colorAt:'viewBackground' default:bgGrey. |
|
1153 |
DefaultShadowColor := StyleSheet colorAt:'shadowColor'. |
|
1154 |
DefaultLightColor := StyleSheet colorAt:'lightColor'. |
|
1155 |
DefaultFocusColor := StyleSheet colorAt:'focusColor' default:Color red. |
|
1156 |
DefaultFocusBorderWidth := StyleSheet at:'focusBorderWidth' default:2. |
|
151 | 1157 |
]. |
135 | 1158 |
|
526 | 1159 |
self == SimpleView ifTrue:[ |
1160 |
DefaultFont := StyleSheet at:'font'. |
|
1161 |
DefaultFont isNil ifTrue:[ |
|
1162 |
DefaultFont := Font family:'courier' face:'medium' style:'roman' size:12. |
|
1163 |
]. |
|
1164 |
DefaultFont := DefaultFont on:Display. |
|
527
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1165 |
] ifFalse:[ |
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1166 |
DefaultFont := nil |
135 | 1167 |
]. |
1168 |
||
1169 |
DefaultViewBackgroundColor isNil ifTrue:[ |
|
1172
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
1170 |
'SimpleView [warning]: bad viewBackground in style - using white' errorPrintCR. |
484 | 1171 |
DefaultViewBackgroundColor := White |
135 | 1172 |
]. |
484 | 1173 |
|
1172
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
1174 |
"Modified: 10.1.1997 / 18:06:18 / cg" |
135 | 1175 |
! |
1176 |
||
269 | 1177 |
viewSpacing |
1178 |
"return a convenient number of pixels used to separate views (usually 1mm). |
|
1179 |
Having this value here at a common place makes certain that all views |
|
1180 |
get a common look" |
|
1181 |
||
1182 |
^ ViewSpacing |
|
1183 |
! ! |
|
1184 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
1185 |
!SimpleView class methodsFor:'resources'! |
269 | 1186 |
|
1187 |
classResources |
|
1188 |
"if not already loaded, get the classes resourcePack |
|
1189 |
and return it" |
|
1190 |
||
1191 |
ClassResources isNil ifTrue:[ |
|
1356 | 1192 |
ClassResources := ResourcePack for:self. |
140 | 1193 |
]. |
269 | 1194 |
^ ClassResources |
1195 |
! |
|
1196 |
||
1197 |
classResources:aResourcePack |
|
1198 |
"allow setting of the classResources" |
|
1199 |
||
1200 |
ClassResources := aResourcePack |
|
1201 |
! |
|
1202 |
||
1203 |
flushAllClassResources |
|
1204 |
"flush all classes resource translations. |
|
1205 |
Needed after a resource file has changed." |
|
1206 |
||
1207 |
ResourcePack flushCachedResourcePacks. |
|
1208 |
SimpleView flushClassResources. |
|
1209 |
SimpleView allSubclasses do:[:aClass | |
|
1356 | 1210 |
aClass flushClassResources. |
140 | 1211 |
] |
1212 |
||
1213 |
" |
|
269 | 1214 |
View flushAllClassResources |
140 | 1215 |
" |
269 | 1216 |
"to change the language: |
1356 | 1217 |
Language := #english. |
1218 |
Smalltalk changed:#Language. |
|
1219 |
View flushAllClassResources |
|
269 | 1220 |
or: |
1356 | 1221 |
Language := #german. |
1222 |
Smalltalk changed:#Language. |
|
1223 |
View flushAllClassResources |
|
269 | 1224 |
" |
1225 |
! |
|
1226 |
||
1227 |
flushClassResources |
|
1228 |
"flush classes resource string translations. |
|
1229 |
Needed whenever a resource file or language has changed" |
|
1230 |
||
1231 |
ClassResources := nil. |
|
1232 |
! |
|
1233 |
||
1234 |
updateClassResources |
|
1235 |
"flush classes resource string translations and reload them. |
|
1236 |
Needed whenever a resource file or language has changed" |
|
1237 |
||
1238 |
ClassResources := nil. |
|
1239 |
self classResources |
|
135 | 1240 |
! ! |
1241 |
||
269 | 1242 |
!SimpleView methodsFor:'ST-80 compatibility'! |
1243 |
||
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1244 |
bounds |
1182 | 1245 |
"ST-80 compatibility: return my bounds" |
1246 |
||
971 | 1247 |
^ (self origin) corner:(self corner) |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1248 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1249 |
"Created: 4.6.1996 / 21:23:27 / cg" |
1182 | 1250 |
"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
|
1251 |
! |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1252 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1253 |
bounds:aRectangle |
1182 | 1254 |
"ST-80 compatibility: change my bounds" |
1255 |
||
971 | 1256 |
explicitExtent := true. |
1257 |
self pixelOrigin:aRectangle origin |
|
1258 |
corner:aRectangle corner |
|
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1259 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1260 |
"Created: 4.6.1996 / 21:44:27 / cg" |
1182 | 1261 |
"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
|
1262 |
! |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1263 |
|
269 | 1264 |
checkForEvents |
1182 | 1265 |
"ST-80 compatibility: |
1266 |
check for any pending events and process them" |
|
1267 |
||
269 | 1268 |
(shown and:[windowGroup notNil]) ifTrue:[windowGroup processEvents]. |
1182 | 1269 |
|
1270 |
"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
|
1271 |
! |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1272 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1273 |
displayOn:aGC |
1182 | 1274 |
"ST-80 compatibility: (re-)display myself" |
1275 |
||
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1276 |
self redraw |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1277 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1278 |
"Created: 4.6.1996 / 21:25:59 / cg" |
1182 | 1279 |
"Modified: 10.1.1997 / 19:46:58 / cg" |
1363 | 1280 |
! |
1281 |
||
1282 |
isEnabled |
|
1283 |
"return true, if this view is enabled (i.e. accepts user interaction). |
|
1284 |
Most views are enabled - only a few (buttons, SelectionInList etc.) can |
|
1285 |
be disabled. |
|
1286 |
#isEnabled is ST-80's equivalent of #enabled" |
|
1287 |
||
1288 |
^ self enabled |
|
1413 | 1289 |
! |
1290 |
||
1291 |
newLayout:aLayoutObject |
|
1292 |
"set the layout object which controls my geometry. |
|
1293 |
ST80-compatibility." |
|
1294 |
||
1295 |
here layout:aLayoutObject. |
|
1296 |
||
1297 |
"Created: 3.3.1997 / 18:54:53 / cg" |
|
1427 | 1298 |
! |
1299 |
||
1300 |
refresh |
|
1301 |
self invalidate |
|
151 | 1302 |
! ! |
1303 |
||
269 | 1304 |
!SimpleView methodsFor:'accessing-bg & border'! |
1305 |
||
955 | 1306 |
allViewBackground:something |
1307 |
"set the viewBackground to something, a color, image or form, |
|
1308 |
in myself and recursively in all of my subviews" |
|
1309 |
||
1310 |
self viewBackground:something. |
|
1311 |
subViews notNil ifTrue:[ |
|
1312 |
subViews do:[:v| |
|
1313 |
v allViewBackground:something |
|
1314 |
] |
|
1315 |
] |
|
1316 |
||
1317 |
"Created: 17.7.1996 / 14:59:08 / cg" |
|
1318 |
"Modified: 18.7.1996 / 13:34:26 / cg" |
|
1319 |
! |
|
1320 |
||
269 | 1321 |
borderColor |
1322 |
"return my borderColor" |
|
1323 |
||
794 | 1324 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
1325 |
^ superView borderColor |
|
1326 |
]. |
|
1327 |
||
269 | 1328 |
^ borderColor |
794 | 1329 |
|
1330 |
"Modified: 5.6.1996 / 14:11:44 / cg" |
|
269 | 1331 |
! |
1332 |
||
1333 |
borderColor:aColor |
|
1334 |
"set my borderColor" |
|
1335 |
||
794 | 1336 |
"/ backward compatibility |
1337 |
"/ superView will be renamed to container soon. |
|
1338 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
|
1339 |
^ superView borderColor:aColor |
|
1340 |
]. |
|
1341 |
||
269 | 1342 |
(aColor ~~ borderColor) ifTrue:[ |
794 | 1343 |
borderColor := aColor. |
1344 |
drawableId notNil ifTrue:[ |
|
1345 |
self setBorderColor |
|
1346 |
] |
|
269 | 1347 |
] |
794 | 1348 |
|
1349 |
"Modified: 5.6.1996 / 14:11:50 / cg" |
|
269 | 1350 |
! |
1351 |
||
1352 |
borderShape:aForm |
|
1353 |
"set the borderShape to aForm" |
|
1354 |
||
1355 |
borderShape := aForm. |
|
1356 |
drawableId notNil ifTrue:[ |
|
1356 | 1357 |
device setWindowBorderShape:(aForm id) in:drawableId |
269 | 1358 |
] |
1359 |
! |
|
1360 |
||
1361 |
borderWidth |
|
1362 |
"return my borderWidth" |
|
1363 |
||
794 | 1364 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
1365 |
^ superView borderWidth |
|
1366 |
]. |
|
1367 |
||
269 | 1368 |
^ borderWidth |
794 | 1369 |
|
1370 |
"Modified: 5.6.1996 / 14:11:57 / cg" |
|
269 | 1371 |
! |
1372 |
||
1373 |
borderWidth:aNumber |
|
1374 |
"set my borderWidth" |
|
1375 |
||
794 | 1376 |
"/ backward compatibility |
1377 |
"/ superView will be renamed to container soon. |
|
1378 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
|
1379 |
^ superView borderWidth:aNumber |
|
1380 |
]. |
|
1381 |
||
269 | 1382 |
(aNumber ~~ borderWidth) ifTrue:[ |
794 | 1383 |
borderWidth := aNumber. |
1384 |
drawableId notNil ifTrue:[ |
|
1385 |
device setWindowBorderWidth:aNumber in:drawableId |
|
1386 |
] |
|
269 | 1387 |
] |
794 | 1388 |
|
1389 |
"Modified: 5.6.1996 / 14:12:05 / cg" |
|
269 | 1390 |
! |
1391 |
||
1392 |
level |
|
1393 |
"return my level relative to superView (3D)" |
|
1394 |
||
794 | 1395 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
1396 |
^ superView level |
|
1397 |
]. |
|
1398 |
||
269 | 1399 |
^ level |
794 | 1400 |
|
1401 |
"Modified: 5.6.1996 / 14:12:10 / cg" |
|
269 | 1402 |
! |
1403 |
||
1404 |
level:aNumber |
|
1405 |
"set my level relative to superView (3D)" |
|
1406 |
||
1407 |
|oldMargin how| |
|
1408 |
||
794 | 1409 |
"/ backward compatibility |
1410 |
"/ superView will be renamed to container soon. |
|
1411 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
|
1412 |
^ superView level:aNumber |
|
1413 |
]. |
|
1414 |
||
269 | 1415 |
(aNumber ~~ level and:[aNumber notNil]) ifTrue:[ |
433 | 1416 |
self is3D ifTrue:[ |
1417 |
level := aNumber. |
|
1418 |
oldMargin := margin. |
|
1419 |
margin := level abs. |
|
1420 |
||
1421 |
realized ifTrue:[ |
|
1422 |
margin ~~ oldMargin ifTrue:[ |
|
1423 |
(margin > oldMargin) ifTrue:[ |
|
1424 |
how := #smaller |
|
1425 |
] ifFalse:[ |
|
1426 |
how := #larger |
|
1427 |
]. |
|
1428 |
self sizeChanged:how. |
|
1429 |
self setInnerClip. |
|
1430 |
]. |
|
1431 |
shown ifTrue:[ |
|
1432 |
margin ~~ oldMargin ifTrue:[ |
|
1433 |
self clear. |
|
1434 |
self redrawX:margin y:margin |
|
1435 |
width:width-(margin*2) |
|
1436 |
height:height-(margin*2) |
|
1437 |
]. |
|
1438 |
self redrawEdges. |
|
1439 |
] |
|
1440 |
] |
|
1441 |
] |
|
135 | 1442 |
] |
794 | 1443 |
|
1444 |
"Modified: 5.6.1996 / 14:12:17 / cg" |
|
269 | 1445 |
! |
1446 |
||
1447 |
lightColor:aColorOrImage |
|
1448 |
"set the color to be used for lighted edges (3D only)" |
|
1449 |
||
1450 |
lightColor := aColorOrImage |
|
1451 |
! |
|
1452 |
||
1453 |
margin |
|
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1454 |
"return my inner margin - this is usually the level, |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1455 |
but can be more for some views |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1456 |
(textViews which add more margin between the border and the text)" |
269 | 1457 |
|
1458 |
^ margin |
|
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1459 |
|
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1460 |
"Modified: 5.6.1996 / 14:37:54 / cg" |
269 | 1461 |
! |
1462 |
||
1463 |
shadowColor:aColorOrImage |
|
1464 |
"set the color to be used for shadowed edges (3D only)" |
|
1465 |
||
1466 |
shadowColor := aColorOrImage |
|
1467 |
! |
|
1468 |
||
1469 |
viewBackground:something |
|
1470 |
"set the viewBackground to something, a color, image or form. |
|
1471 |
If its a color and we run on a color display, also set shadow and light |
|
1472 |
colors - this means, that a red view will get light-red and dark-red |
|
1473 |
edges." |
|
1474 |
||
1475 |
something isColor ifTrue:[ |
|
749 | 1476 |
device hasGrayscales ifTrue:[ |
754 | 1477 |
shadowColor := something darkened "on:device". |
1478 |
lightColor := something lightened "on:device". |
|
749 | 1479 |
] |
135 | 1480 |
]. |
269 | 1481 |
super viewBackground:something |
749 | 1482 |
|
754 | 1483 |
"Modified: 28.5.1996 / 22:33:03 / cg" |
269 | 1484 |
! |
1485 |
||
1486 |
viewShape:aForm |
|
1487 |
"set the viewShape to aForm" |
|
1488 |
||
1489 |
viewShape := aForm. |
|
1490 |
drawableId notNil ifTrue:[ |
|
1356 | 1491 |
device setWindowShape:(aForm id) in:drawableId |
135 | 1492 |
] |
269 | 1493 |
! ! |
1494 |
||
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1495 |
!SimpleView methodsFor:'accessing-contents'! |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1496 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1497 |
heightOfContents |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1498 |
"return the height of the contents in logical units |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1499 |
- defaults to views visible area here. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1500 |
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
|
1501 |
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
|
1502 |
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
|
1503 |
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
|
1504 |
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
|
1505 |
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
|
1506 |
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
|
1507 |
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
|
1508 |
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
|
1509 |
of this will scale as appropriate." |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1510 |
|
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1511 |
^ (self innerHeight max:(self maxSubViewBottom)) max:self maxComponentBottom |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1512 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1513 |
"Modified: 26.5.1996 / 12:44:21 / cg" |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1514 |
! |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1515 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1516 |
widthOfContents |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1517 |
"return the width of the contents in logical units |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1518 |
- defaults to views visible area here. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1519 |
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
|
1520 |
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
|
1521 |
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
|
1522 |
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
|
1523 |
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
|
1524 |
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
|
1525 |
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
|
1526 |
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
|
1527 |
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
|
1528 |
of this will scale as appropriate." |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1529 |
|
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1530 |
^ (self innerWidth max:(self maxSubViewRight)) max:self maxComponentRight |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1531 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1532 |
"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
|
1533 |
! ! |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1534 |
|
269 | 1535 |
!SimpleView methodsFor:'accessing-dimensions'! |
1536 |
||
1537 |
allInset:aNumber |
|
1538 |
"set all insets; positive makes the view smaller, |
|
1539 |
negative makes it larger." |
|
1540 |
||
1541 |
insets isNil ifTrue:[ |
|
964 | 1542 |
insets := Array new:4. |
269 | 1543 |
]. |
1544 |
insets atAllPut:aNumber. |
|
1545 |
||
1546 |
"force recomputation" |
|
1547 |
"/ drawableId isNil ifTrue:[ |
|
1548 |
"/ originChanged := true |
|
1549 |
"/ ] ifFalse:[ |
|
964 | 1550 |
self containerChangedSize. |
269 | 1551 |
"/ ] |
964 | 1552 |
|
1553 |
"Modified: 19.7.1996 / 17:30:18 / cg" |
|
269 | 1554 |
! |
1555 |
||
1556 |
bottom |
|
1557 |
"return the y position of the actual bottom edge (in pixels)" |
|
1558 |
||
1559 |
^ top + height - 1 |
|
1560 |
! |
|
1561 |
||
1562 |
bottom:aNumber |
|
1563 |
"set the corners y position" |
|
1564 |
||
1565 |
self corner:(self corner x @ aNumber) |
|
1566 |
! |
|
1567 |
||
1568 |
bottomInset |
|
1569 |
"return the inset of the bottom edge; positive is to the top, |
|
1570 |
negative to the bottom" |
|
1571 |
||
1572 |
insets isNil ifTrue:[^ 0]. |
|
1573 |
^ insets at:4 |
|
1574 |
! |
|
1575 |
||
1576 |
bottomInset:aNumber |
|
1577 |
"set the inset of the bottom edge; |
|
1578 |
positive is to the top (view becomes smaller), |
|
1579 |
negative to the bottom (becomes larger)" |
|
1580 |
||
1581 |
insets isNil ifTrue:[ |
|
964 | 1582 |
insets := Array with:0 with:0 with:0 with:0 |
269 | 1583 |
]. |
1584 |
insets at:4 put:aNumber. |
|
1585 |
||
1586 |
"force recomputation" |
|
1587 |
"/ drawableId isNil ifTrue:[ |
|
1588 |
"/ originChanged := true |
|
1589 |
"/ ] ifFalse:[ |
|
964 | 1590 |
self containerChangedSize |
269 | 1591 |
"/ ] |
964 | 1592 |
|
1593 |
"Modified: 19.7.1996 / 17:30:22 / cg" |
|
269 | 1594 |
! |
1595 |
||
1596 |
center |
|
1597 |
"return the point at the center of the receiver (in pixels)" |
|
1598 |
||
1599 |
^ (left + (width // 2)) @ (top + (height // 2)) |
|
1600 |
! |
|
1601 |
||
1602 |
center:newCenter |
|
1603 |
"move the receiver so that newCenter, aPoint becomes the center point" |
|
1604 |
||
1605 |
self origin:(newCenter - ((width // 2) @ (height // 2))) |
|
1606 |
! |
|
1607 |
||
1608 |
computeCorner |
|
1609 |
"compute my corner; if I have a layoutObject, |
|
1610 |
relative origins or blocks to evaluate, compute it now .. |
|
1611 |
Blocks may return relative values or nil; nil means: take current value. |
|
1612 |
Returns the corner point in device coordinates (pixels)." |
|
1613 |
||
1614 |
|org newCorner newExt x y| |
|
1615 |
||
1616 |
" |
|
1617 |
slowly migrating to use layoutObjects ... |
|
1618 |
" |
|
1619 |
layout notNil ifTrue:[ |
|
1356 | 1620 |
^ (layout rectangleRelativeTo:(superView viewRectangle) |
1621 |
preferred:(self preferredBounds)) corner rounded |
|
269 | 1622 |
]. |
1623 |
||
1624 |
(cornerRule notNil) ifTrue:[ |
|
1356 | 1625 |
newCorner := cornerRule value. |
1626 |
" |
|
1627 |
allow return of relative values ... |
|
1628 |
" |
|
1629 |
x := newCorner x. |
|
1630 |
y := newCorner y. |
|
1631 |
x isNil ifTrue:[x := self corner x]. |
|
1632 |
y isNil ifTrue:[y := self corner y]. |
|
1633 |
((x isInteger not) or:[y isInteger not]) ifTrue:[ |
|
1634 |
newCorner := self cornerFromRelativeCorner:x@y |
|
1635 |
] |
|
269 | 1636 |
] ifFalse:[ |
1356 | 1637 |
(relativeCorner notNil) ifTrue:[ |
1638 |
newCorner := self cornerFromRelativeCorner:relativeCorner |
|
1639 |
] ifFalse:[ |
|
1640 |
org := self computeOrigin. |
|
1641 |
(extentRule notNil) ifTrue:[ |
|
1642 |
newExt := extentRule value |
|
1643 |
] ifFalse:[ |
|
1644 |
(relativeExtent notNil) ifTrue:[ |
|
1645 |
newExt := self extentFromRelativeExtent:relativeExtent |
|
1389 | 1646 |
] ifFalse:[ |
1647 |
newExt := self extent. |
|
1356 | 1648 |
] |
1649 |
]. |
|
1650 |
newCorner := org + newExt |
|
1651 |
] |
|
269 | 1652 |
]. |
1653 |
^ newCorner |
|
1389 | 1654 |
|
1655 |
"Modified: 28.2.1997 / 10:33:39 / cg" |
|
269 | 1656 |
! |
1657 |
||
1658 |
computeExtent |
|
1659 |
"compute my extent; if I have a layoutObject, a relative extent |
|
1660 |
or blocks to evaluate, compute it now .. |
|
1661 |
There is one catch here, if the dimension was defined |
|
1662 |
by origin/corner, compute them here and take that value. |
|
1663 |
I.e. origin/corner definition has precedence over extent definition. |
|
1664 |
Returns the extent in device coordinates (pixels)." |
|
1665 |
||
1666 |
|newOrg newExt newCorner x y| |
|
1667 |
||
1668 |
" |
|
1669 |
slowly migrating to use layoutObjects ... |
|
1670 |
" |
|
1671 |
layout notNil ifTrue:[ |
|
1356 | 1672 |
^ (layout rectangleRelativeTo:(superView viewRectangle) |
1673 |
preferred:(self preferredBounds)) extent rounded |
|
135 | 1674 |
]. |
269 | 1675 |
|
1676 |
(cornerRule notNil) ifTrue:[ |
|
1356 | 1677 |
newCorner := cornerRule value. |
1678 |
" |
|
1679 |
allow return of relative values ... |
|
1680 |
" |
|
1681 |
x := newCorner x. |
|
1682 |
y := newCorner y. |
|
1683 |
x isNil ifTrue:[x := self corner x]. |
|
1684 |
y isNil ifTrue:[y := self corner y]. |
|
1685 |
((x isInteger not) or:[y isInteger not]) ifTrue:[ |
|
1686 |
newCorner := self cornerFromRelativeCorner:x@y |
|
1687 |
] |
|
269 | 1688 |
] ifFalse:[ |
1356 | 1689 |
(relativeCorner notNil) ifTrue:[ |
1690 |
newCorner := self cornerFromRelativeCorner:relativeCorner |
|
1691 |
] ifFalse:[ |
|
1692 |
(extentRule notNil) ifTrue:[ |
|
1693 |
newExt := extentRule value. |
|
1694 |
" |
|
1695 |
allow return of relative values ... |
|
1696 |
" |
|
1697 |
x := newExt x. |
|
1698 |
y := newExt y. |
|
1699 |
x isNil ifTrue:[x := width]. |
|
1700 |
y isNil ifTrue:[y := height]. |
|
1701 |
((x isInteger not) or:[y isInteger not]) ifTrue:[ |
|
1702 |
newExt := self extentFromRelativeExtent:x@y |
|
1703 |
] |
|
1704 |
] ifFalse:[ |
|
1705 |
(relativeExtent notNil) ifTrue:[ |
|
1706 |
newExt := self extentFromRelativeExtent:relativeExtent |
|
1707 |
] ifFalse:[ |
|
1708 |
newExt := (width @ height). |
|
1709 |
]. |
|
1710 |
]. |
|
1711 |
]. |
|
269 | 1712 |
]. |
1713 |
||
1714 |
newCorner notNil ifTrue:[ |
|
1356 | 1715 |
newOrg := self computeOrigin. |
1716 |
^ newCorner - newOrg. |
|
269 | 1717 |
]. |
1718 |
^ newExt. |
|
1719 |
! |
|
1720 |
||
1721 |
computeOrigin |
|
1722 |
"compute my origin; if I have a layoutObject, a relative origin |
|
1723 |
or blocks to evaluate, compute it now .. |
|
1724 |
Blocks may return relative values or nil; nil means: take current value. |
|
1725 |
Returns the origin point in device coordinates (pixels)." |
|
1726 |
||
1727 |
|newOrg x y| |
|
1728 |
||
1729 |
" |
|
1730 |
slowly migrating to use layoutObjects ... |
|
1731 |
" |
|
1732 |
layout notNil ifTrue:[ |
|
1356 | 1733 |
^ (layout rectangleRelativeTo:(superView viewRectangle) |
1734 |
preferred:(self preferredBounds)) origin rounded |
|
269 | 1735 |
]. |
1736 |
||
1737 |
(originRule notNil) ifTrue:[ |
|
1356 | 1738 |
newOrg := originRule value. |
1739 |
" |
|
1740 |
allow return of relative values ... |
|
1741 |
" |
|
1742 |
x := newOrg x. |
|
1743 |
y := newOrg y. |
|
1744 |
x isNil ifTrue:[x := self origin x]. |
|
1745 |
y isNil ifTrue:[y := self origin y]. |
|
1746 |
((x isInteger not) or:[y isInteger not]) ifTrue:[ |
|
1747 |
newOrg := self originFromRelativeOrigin:x@y. |
|
1748 |
] |
|
269 | 1749 |
] ifFalse:[ |
1356 | 1750 |
(relativeOrigin notNil) ifTrue:[ |
1751 |
newOrg := self originFromRelativeOrigin:relativeOrigin. |
|
1752 |
] ifFalse:[ |
|
1753 |
^ (left @ top). |
|
1754 |
]. |
|
269 | 1755 |
]. |
1756 |
^ newOrg |
|
1757 |
! |
|
1758 |
||
1759 |
corner |
|
1760 |
"return the lower right corner-point (in pixels)" |
|
1761 |
||
1762 |
"/ ^ (left + width "- 1") @ (top + height "- 1") |
|
1763 |
^ (left + width - 1) @ (top + height - 1) |
|
1764 |
||
1765 |
"Modified: 31.8.1995 / 16:51:40 / claus" |
|
1766 |
! |
|
1767 |
||
1768 |
corner:corner |
|
1769 |
"set the views corner; |
|
1770 |
the corner argument may be: |
|
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1771 |
a point |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1772 |
where integer fields mean 'pixel-values' |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1773 |
and float values mean 'relative-to-superview' |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1774 |
and nil means 'take current value'; |
269 | 1775 |
or a block returning a point which is interpreted as above. |
1776 |
Please migrate to use layoutObjects, if possible." |
|
1777 |
||
1778 |
|x y pixelCorner c| |
|
1779 |
||
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1780 |
explicitExtent := true. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1781 |
|
269 | 1782 |
corner isBlock ifTrue:[ |
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1783 |
cornerRule := corner. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1784 |
drawableId notNil ifTrue:[ |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1785 |
pixelCorner := corner value |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1786 |
] ifFalse:[ |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1787 |
extentChanged := true |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1788 |
] |
269 | 1789 |
] ifFalse:[ |
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1790 |
x := corner x. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1791 |
y := corner y. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1792 |
x isNil ifTrue:[x := self corner x]. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1793 |
y isNil ifTrue:[y := self corner y]. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1794 |
c := x @ y. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1795 |
((x isInteger not) or:[y isInteger not]) ifTrue:[ |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1796 |
relativeCorner := c. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1797 |
pixelCorner := self cornerFromRelativeCorner. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1798 |
pixelCorner isNil ifTrue:[ |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1799 |
extentChanged := true |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1800 |
] |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1801 |
] ifFalse:[ |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1802 |
pixelCorner := c |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1803 |
] |
269 | 1804 |
]. |
1805 |
||
1806 |
pixelCorner notNil ifTrue:[ |
|
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1807 |
self pixelCorner:pixelCorner |
269 | 1808 |
] |
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1809 |
|
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1810 |
"Modified: 15.7.1996 / 09:51:06 / cg" |
269 | 1811 |
! |
1812 |
||
1327 | 1813 |
cornerRule |
1814 |
"return the corner block - non public; this will vanish without notice" |
|
1815 |
||
1816 |
^ cornerRule |
|
1817 |
! |
|
1818 |
||
269 | 1819 |
extent:extent |
1820 |
"set the views extent; |
|
1821 |
extent may be: |
|
573
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1822 |
a point |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1823 |
where integer fields mean 'pixel-values' |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1824 |
and float values mean 'relative-to-superview' |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1825 |
and nil means 'leave current value'; |
269 | 1826 |
or a block returning a point which is interpreted as above. |
1827 |
Be careful when using relative extents: rounding errors may |
|
1828 |
accumulate. Better use origin/corner. |
|
1048
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1829 |
Best: migrate to use layour objects. |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1830 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1831 |
Notice: this sets the views explicitExtent flag, which prevents it normally |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1832 |
from resizing itself to its preferredExtent. |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1833 |
See initialExtent: for a variation." |
269 | 1834 |
|
1835 |
|w h pixelExtent e| |
|
1836 |
||
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1837 |
explicitExtent := true. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1838 |
|
269 | 1839 |
extent isBlock ifTrue:[ |
573
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1840 |
extentRule := extent. |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1841 |
drawableId notNil ifTrue:[ |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1842 |
pixelExtent := extent value |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1843 |
] ifFalse:[ |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1844 |
extentChanged := true |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1845 |
] |
135 | 1846 |
] ifFalse:[ |
573
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1847 |
w := extent x. |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1848 |
h := extent y. |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1849 |
w isNil ifTrue:[w := width]. |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1850 |
h isNil ifTrue:[h := height]. |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1851 |
e := w@h. |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1852 |
((w isInteger not) or:[h isInteger not]) ifTrue:[ |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1853 |
relativeExtent := e. |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1854 |
pixelExtent := self extentFromRelativeExtent. |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1855 |
pixelExtent isNil ifTrue:[ |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1856 |
extentChanged := true |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1857 |
] |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1858 |
] ifFalse:[ |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1859 |
relativeExtent := nil. |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1860 |
pixelExtent := e |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1861 |
] |
269 | 1862 |
]. |
1863 |
pixelExtent notNil ifTrue:[ |
|
573
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1864 |
self pixelExtent:pixelExtent |
269 | 1865 |
] |
573
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
1866 |
|
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
1867 |
"Modified: 15.7.1996 / 09:51:21 / cg" |
269 | 1868 |
! |
1869 |
||
1327 | 1870 |
extentRule |
1871 |
"return the extent block - non public; this will vanish without notice" |
|
1872 |
||
1873 |
^ extentRule |
|
1874 |
! |
|
1875 |
||
269 | 1876 |
geometryLayout |
1877 |
"this method will vanish, as soon as all implementations of |
|
1878 |
#layout: are removed ... |
|
1879 |
(conflict for example in label>>layout:). |
|
1880 |
DO NOT USE #geometryLayout: in your code; it will be removed without |
|
1881 |
notice." |
|
1882 |
||
1883 |
^ here layout |
|
1884 |
! |
|
1885 |
||
1886 |
geometryLayout:aLayoutObject |
|
1887 |
"this method will vanish, as soon as all implementations of |
|
1888 |
#layout: are removed ... |
|
1889 |
(conflict for example in label>>layout:). |
|
1890 |
DO NOT USE #geometryLayout: in your code; it will be removed without |
|
1891 |
notice." |
|
1892 |
||
1893 |
here layout:aLayoutObject |
|
1894 |
! |
|
1895 |
||
1896 |
height:aNumber |
|
1897 |
"set the views height in pixels" |
|
1898 |
||
1899 |
self extent:(width @ aNumber) |
|
1900 |
! |
|
1901 |
||
1902 |
heightIncludingBorder |
|
1903 |
"return my height including border |
|
1904 |
(this is my height as seen from the outside view; |
|
1905 |
while #height returns the height as seen by myself)" |
|
1906 |
||
1907 |
^ height + (2*borderWidth) |
|
1908 |
! |
|
1909 |
||
1910 |
horizontalInset:aNumber |
|
1911 |
"set the insets of the left/right edge; |
|
1912 |
positive makes it smaller, negative makes it larger" |
|
1913 |
||
1914 |
insets isNil ifTrue:[ |
|
964 | 1915 |
insets := Array with:0 with:0 with:0 with:0 |
135 | 1916 |
]. |
269 | 1917 |
insets at:1 put:aNumber. |
1918 |
insets at:3 put:aNumber. |
|
1919 |
||
1920 |
"force recomputation" |
|
1921 |
"/ drawableId isNil ifTrue:[ |
|
1922 |
"/ originChanged := true |
|
1923 |
"/ ] ifFalse:[ |
|
964 | 1924 |
self containerChangedSize. |
269 | 1925 |
"/ ] |
964 | 1926 |
|
1927 |
"Modified: 19.7.1996 / 17:30:25 / cg" |
|
269 | 1928 |
! |
1929 |
||
1048
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1930 |
initialExtent:extent |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1931 |
"set the views extent, but dont change its explicitExtent setting. |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1932 |
a variant of #extent." |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1933 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1934 |
|expl| |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1935 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1936 |
expl := explicitExtent. |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1937 |
self extent:extent. |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1938 |
explicitExtent := expl |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1939 |
! |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1940 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1941 |
initialHeight:aNumber |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1942 |
"set the views height in pixels, but dont change its explicitExtent setting" |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1943 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1944 |
self initialExtent:(width @ aNumber) |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1945 |
! |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1946 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1947 |
initialWidth:aNumber |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1948 |
"set the views width in pixels, but dont change its explicitExtent setting" |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1949 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1950 |
self initialExtent:(aNumber @ height) |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1951 |
! |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
1952 |
|
269 | 1953 |
innerHeight |
1954 |
"return the height of the view minus any 3D-shadow-borders" |
|
1955 |
||
1956 |
(margin == 0) ifTrue:[^ height]. |
|
1957 |
^ height - (2 * margin) |
|
1958 |
! |
|
1959 |
||
369 | 1960 |
innerHeight:pixels |
1961 |
"set the height of the view plus any 3D-shadow-borders. |
|
1962 |
This does not work with a relative size." |
|
1963 |
||
1964 |
^ self height:( pixels + (margin + self innerVerticalMargin * 2) ). |
|
1965 |
! |
|
1966 |
||
1967 |
innerHorizontalMargin |
|
1968 |
"return any additional inner margin (i.e. contents margin). |
|
1969 |
This should be redefined by views which do add margins |
|
1970 |
(for example: textViews do this)" |
|
1971 |
||
1972 |
^ 0 |
|
1973 |
! |
|
1974 |
||
1975 |
innerVerticalMargin |
|
1976 |
"return any additional inner margin (i.e. contents margin). |
|
1977 |
This should be redefined by views which do add margins |
|
1978 |
(for example: textViews do this)" |
|
1979 |
||
1980 |
^ 0 |
|
1981 |
! |
|
1982 |
||
269 | 1983 |
innerWidth |
1984 |
"return the width of the view minus any 3D-shadow-borders" |
|
1985 |
||
1986 |
(level == 0) ifTrue:[^ width]. |
|
1987 |
^ width - (2 * margin) |
|
1988 |
! |
|
1989 |
||
369 | 1990 |
innerWidth:pixels |
1991 |
"set the width of the view plus any 3D-shadow-borders. |
|
1992 |
This does not work with a relative size." |
|
1993 |
||
1994 |
^ self width:( pixels + (margin + self innerHorizontalMargin * 2) ). |
|
1995 |
! |
|
1996 |
||
269 | 1997 |
inset:aNumber |
1998 |
"set all insets; positive makes the view smaller, |
|
1999 |
negative makes it larger." |
|
2000 |
||
2001 |
self allInset:aNumber |
|
2002 |
! |
|
2003 |
||
2004 |
layout |
|
2005 |
"return the layout object which controls my geometry. |
|
2006 |
Currently, this is nil in most cases, and my geometry is |
|
2007 |
defined by relativeOrigin/relativeCorner/relativeExtent, |
|
2008 |
originRule/extentRule/cornerRule and inset. |
|
2009 |
Applications should be changed to use layoutObjects, |
|
2010 |
since the above listed instance variables will vanish." |
|
2011 |
||
2012 |
^ layout |
|
2013 |
! |
|
2014 |
||
2015 |
layout:aLayoutObject |
|
2016 |
"set the layout object which controls my geometry. |
|
2017 |
Currently, this is almost nowhere used but views will be |
|
2018 |
incrementally changed to use this new geometry management." |
|
2019 |
||
2020 |
layout := aLayoutObject. |
|
2021 |
superView isNil ifTrue:[ |
|
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2022 |
originChanged := cornerChanged := extentChanged := true |
269 | 2023 |
] ifFalse:[ |
964 | 2024 |
self containerChangedSize. |
269 | 2025 |
] |
2026 |
||
2027 |
"Modified: 19.9.1995 / 16:17:25 / claus" |
|
964 | 2028 |
"Modified: 19.7.1996 / 17:30:27 / cg" |
269 | 2029 |
! |
2030 |
||
2031 |
left |
|
2032 |
"return the x position of the left border (in pixels)" |
|
2033 |
||
2034 |
^ left |
|
2035 |
! |
|
2036 |
||
2037 |
left:aNumber |
|
2038 |
"set the x position" |
|
2039 |
||
2040 |
self origin:(aNumber @ top) |
|
2041 |
! |
|
2042 |
||
2043 |
left:newLeft top:newTop width:newWidth height:newHeight |
|
2044 |
"another way of specifying origin and extent" |
|
2045 |
||
2046 |
self origin:(newLeft @ newTop) extent:(newWidth @ newHeight) |
|
2047 |
! |
|
2048 |
||
2049 |
leftInset |
|
2050 |
"return the inset of the left edge; positive is to the right, |
|
2051 |
negative to the left" |
|
2052 |
||
2053 |
insets isNil ifTrue:[^ 0]. |
|
2054 |
^ insets at:1 |
|
2055 |
! |
|
2056 |
||
2057 |
leftInset:aNumber |
|
2058 |
"set the inset of the left edge; |
|
2059 |
positive is to the right (view becomes smaller), |
|
2060 |
negative to the left (becomes larger)" |
|
2061 |
||
2062 |
insets isNil ifTrue:[ |
|
964 | 2063 |
insets := Array with:0 with:0 with:0 with:0 |
269 | 2064 |
]. |
2065 |
insets at:1 put:aNumber. |
|
2066 |
||
2067 |
"force recomputation" |
|
2068 |
"/ drawableId isNil ifTrue:[ |
|
2069 |
"/ originChanged := true |
|
2070 |
"/ ] ifFalse:[ |
|
964 | 2071 |
self containerChangedSize. |
269 | 2072 |
"/ ] |
964 | 2073 |
|
2074 |
"Modified: 19.7.1996 / 17:30:30 / cg" |
|
269 | 2075 |
! |
2076 |
||
2077 |
makeFullyVisible |
|
2078 |
"make sure, that the view is fully visible by shifting it |
|
2079 |
into the visible screen area if nescessary. |
|
2080 |
This method will be moved to StandardSystemView ..." |
|
2081 |
||
2082 |
|devBot devRight newTop newLeft| |
|
2083 |
||
2084 |
newTop := top. |
|
2085 |
newLeft := left. |
|
2086 |
||
2087 |
((top + height) > (devBot := device height)) ifTrue:[ |
|
1356 | 2088 |
newTop := devBot - height |
269 | 2089 |
]. |
2090 |
((left + width) > (devRight := device width)) ifTrue:[ |
|
1356 | 2091 |
newLeft := devRight - width |
269 | 2092 |
]. |
2093 |
(newTop < 0) ifTrue:[ |
|
1356 | 2094 |
newTop := 0. |
269 | 2095 |
]. |
2096 |
(newLeft < 0) ifTrue:[ |
|
1356 | 2097 |
newLeft := 0 |
269 | 2098 |
]. |
2099 |
((newTop ~~ top) or:[newLeft ~~ left]) ifTrue:[ |
|
1356 | 2100 |
self origin:newLeft @ newTop |
269 | 2101 |
] |
2102 |
! |
|
2103 |
||
2104 |
origin |
|
2105 |
"return the origin (in pixels)" |
|
2106 |
||
2107 |
^ left@top |
|
2108 |
! |
|
2109 |
||
2110 |
origin:origin |
|
2111 |
"set the views origin; |
|
2112 |
origin may be: |
|
573
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2113 |
a point |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2114 |
where integer fields mean 'pixel-values' |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2115 |
and float values mean 'relative-to-superview' |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2116 |
and nil means 'take current value'; |
269 | 2117 |
or a block returning a point which is interpreted as above. |
2118 |
Please migrate to use layout objects." |
|
2119 |
||
2120 |
|newLeft newTop pixelOrigin o| |
|
2121 |
||
2122 |
origin isBlock ifTrue:[ |
|
573
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2123 |
originRule := origin. |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2124 |
drawableId notNil ifTrue:[ |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2125 |
pixelOrigin := origin value |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2126 |
] ifFalse:[ |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2127 |
originChanged := true |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2128 |
] |
269 | 2129 |
] ifFalse:[ |
573
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2130 |
o := origin. |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2131 |
newLeft := origin x. |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2132 |
newTop := origin y. |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2133 |
newLeft isNil ifTrue:[newLeft := left]. |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2134 |
newTop isNil ifTrue:[newTop := top]. |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2135 |
o := newLeft @ newTop. |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2136 |
((newLeft isInteger not) or:[newTop isInteger not]) ifTrue:[ |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2137 |
relativeOrigin := o. |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2138 |
pixelOrigin := self originFromRelativeOrigin. |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2139 |
pixelOrigin isNil ifTrue:[ |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2140 |
originChanged := true |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2141 |
] |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2142 |
] ifFalse:[ |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2143 |
relativeOrigin := nil. |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2144 |
pixelOrigin := o |
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2145 |
] |
269 | 2146 |
]. |
2147 |
pixelOrigin notNil ifTrue:[ |
|
573
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2148 |
self pixelOrigin:pixelOrigin |
269 | 2149 |
]. |
573
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2150 |
|
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2151 |
"Modified: 19.4.1996 / 15:12:36 / cg" |
269 | 2152 |
! |
2153 |
||
2154 |
origin:origin corner:corner |
|
2155 |
"set both origin and extent" |
|
2156 |
||
2157 |
|newLeft newTop newRight newBot| |
|
2158 |
||
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2159 |
explicitExtent := true. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2160 |
|
269 | 2161 |
"do it as one operation if possible" |
2162 |
||
2163 |
origin isBlock ifFalse:[ |
|
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2164 |
corner isBlock ifFalse:[ |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2165 |
newLeft := origin x. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2166 |
newLeft isInteger ifTrue:[ |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2167 |
newTop := origin y. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2168 |
newTop isInteger ifTrue:[ |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2169 |
newRight := corner x. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2170 |
newRight isInteger ifTrue:[ |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2171 |
newBot := corner y. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2172 |
newBot isInteger ifTrue:[ |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2173 |
self pixelOrigin:origin corner:corner |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2174 |
] |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2175 |
] |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2176 |
] |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2177 |
] |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2178 |
] |
135 | 2179 |
]. |
269 | 2180 |
self origin:origin. |
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2181 |
self corner:corner |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2182 |
|
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2183 |
"Modified: 15.7.1996 / 09:52:43 / cg" |
269 | 2184 |
! |
2185 |
||
2186 |
origin:origin extent:extent |
|
2187 |
"set both origin and extent" |
|
2188 |
||
2189 |
|newLeft newTop newWidth newHeight| |
|
2190 |
||
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2191 |
explicitExtent := true. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2192 |
|
269 | 2193 |
"do it as one operation if possible" |
2194 |
||
2195 |
origin isBlock ifFalse:[ |
|
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2196 |
extent isBlock ifFalse:[ |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2197 |
newLeft := origin x. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2198 |
newLeft isInteger ifTrue:[ |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2199 |
newTop := origin y. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2200 |
newTop isInteger ifTrue:[ |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2201 |
newWidth := extent x. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2202 |
newWidth isInteger ifTrue:[ |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2203 |
newHeight := extent y. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2204 |
newHeight isInteger ifTrue:[ |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2205 |
self pixelOrigin:origin extent:extent |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2206 |
] |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2207 |
] |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2208 |
] |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2209 |
] |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2210 |
] |
269 | 2211 |
]. |
2212 |
self extent:extent. |
|
2213 |
self origin:origin |
|
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2214 |
|
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2215 |
"Modified: 15.7.1996 / 09:52:39 / cg" |
269 | 2216 |
! |
2217 |
||
2218 |
originRelativeTo:aView |
|
2219 |
"return the origin (in pixels) relative to a superView, |
|
2220 |
or relative to the rootView (if the aView argument is nil). |
|
2221 |
If the receiver is nonNil and not a subview of aView, return nil." |
|
2222 |
||
2223 |
|currentView |
|
2224 |
org "{ Class: Point }" |
|
2225 |
sumX "{ Class: SmallInteger }" |
|
2226 |
sumY "{ Class: SmallInteger }" | |
|
2227 |
||
2228 |
currentView := self. |
|
2229 |
sumX := 0. |
|
2230 |
sumY := 0. |
|
2231 |
[currentView notNil] whileTrue:[ |
|
1356 | 2232 |
(currentView == aView) ifTrue:[ |
2233 |
^ (sumX @ sumY) |
|
2234 |
]. |
|
2235 |
org := currentView origin. |
|
2236 |
sumX := sumX + org x. |
|
2237 |
sumY := sumY + org y. |
|
2238 |
currentView := currentView superView |
|
269 | 2239 |
]. |
729
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
2240 |
(aView isNil or:[aView == device rootView]) ifTrue:[ |
1356 | 2241 |
"return relative to screen ..." |
2242 |
^ (sumX @ sumY) |
|
269 | 2243 |
]. |
2244 |
^ nil |
|
2245 |
||
2246 |
" |
|
2247 |
|top sub1 sub2| |
|
2248 |
||
2249 |
top := StandardSystemView new. |
|
2250 |
top extent:200@200. |
|
2251 |
sub1 := View origin:0.2 @ 0.2 corner:0.8 @ 0.8 in:top. |
|
2252 |
sub2 := Button origin:0.3 @ 0.3 corner:0.7 @ 0.7 in:sub1. |
|
2253 |
top openAndWait. |
|
697 | 2254 |
Transcript show:'button in top:'; showCR:(sub2 originRelativeTo:top). |
2255 |
Transcript show:'button on screen:'; showCR:(sub2 originRelativeTo:nil). |
|
269 | 2256 |
" |
2257 |
! |
|
2258 |
||
1327 | 2259 |
originRule |
2260 |
"return the origin block - non public; this will vanish without notice" |
|
2261 |
||
2262 |
^ originRule |
|
2263 |
! |
|
2264 |
||
763 | 2265 |
preferredExtent:anExtentPoint |
2266 |
"override the views own preferredExtent computation, |
|
2267 |
and let it prefer the size given by the argument." |
|
2268 |
||
2269 |
preferredExtent := anExtentPoint. |
|
1038
fb193cba16b6
#preferredExtent: no longer changes the extent
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
2270 |
|
fb193cba16b6
#preferredExtent: no longer changes the extent
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
2271 |
"Modified: 22.8.1996 / 13:41:47 / cg" |
763 | 2272 |
! |
2273 |
||
269 | 2274 |
relativeCorner |
2275 |
"return the relative corner or nil" |
|
2276 |
||
2277 |
^ relativeCorner |
|
2278 |
! |
|
2279 |
||
2280 |
relativeCorner:aPoint |
|
2281 |
"set the relative corner" |
|
2282 |
||
2283 |
relativeCorner := aPoint |
|
2284 |
! |
|
2285 |
||
2286 |
relativeExtent |
|
2287 |
"return the relative extent or nil" |
|
2288 |
||
2289 |
^ relativeExtent |
|
2290 |
! |
|
2291 |
||
2292 |
relativeExtent:aPoint |
|
2293 |
"set the relative extent" |
|
2294 |
||
2295 |
relativeExtent := aPoint |
|
2296 |
! |
|
2297 |
||
2298 |
relativeOrigin |
|
2299 |
"return the relative origin or nil" |
|
2300 |
||
2301 |
^ relativeOrigin |
|
2302 |
! |
|
2303 |
||
2304 |
relativeOrigin:aPoint |
|
2305 |
"set the relative origin" |
|
2306 |
||
2307 |
relativeOrigin := aPoint |
|
2308 |
! |
|
2309 |
||
2310 |
right |
|
2311 |
"return the x position of the right edge (in pixels)" |
|
2312 |
||
2313 |
^ left + width - 1 |
|
2314 |
||
2315 |
"Modified: 31.8.1995 / 19:31:10 / claus" |
|
2316 |
! |
|
2317 |
||
2318 |
right:aNumber |
|
2319 |
"set the corners x position" |
|
2320 |
||
2321 |
self corner:(aNumber @ self corner y) |
|
2322 |
! |
|
2323 |
||
2324 |
rightInset |
|
2325 |
"return the inset of the right edge; positive is to the left, |
|
2326 |
negative to the right" |
|
2327 |
||
2328 |
insets isNil ifTrue:[^ 0]. |
|
2329 |
^ insets at:3 |
|
2330 |
! |
|
2331 |
||
2332 |
rightInset:aNumber |
|
2333 |
"set the inset of the right edge; |
|
2334 |
positive is to the left (view becomes smaller), |
|
2335 |
negative to the right (becomes larger)" |
|
2336 |
||
2337 |
insets isNil ifTrue:[ |
|
964 | 2338 |
insets := Array with:0 with:0 with:0 with:0 |
269 | 2339 |
]. |
2340 |
insets at:3 put:aNumber. |
|
2341 |
||
2342 |
"force recomputation" |
|
2343 |
"/ drawableId isNil ifTrue:[ |
|
2344 |
"/ originChanged := true |
|
2345 |
"/ ] ifFalse:[ |
|
964 | 2346 |
self containerChangedSize. |
135 | 2347 |
"/ ] |
964 | 2348 |
|
2349 |
"Modified: 19.7.1996 / 17:30:32 / cg" |
|
269 | 2350 |
! |
2351 |
||
2352 |
sizeFixed:aBoolean |
|
2353 |
"set/clear the fix-size attribute, if supported by concrete subclasses. |
|
2354 |
Views which want to resize themselfes as appropriate to their contents |
|
2355 |
should cease to do so and take their current size if sizeFixed is set to |
|
2356 |
true. Currently, only supported by Labels. |
|
2357 |
This does NOT prevent the window manager from resizing the view, |
|
2358 |
instead it tell the view to NOT resize ITSELF. |
|
2359 |
Added here to provide a common protocol for all views." |
|
2360 |
||
2361 |
^ self |
|
2362 |
! |
|
2363 |
||
2364 |
top |
|
2365 |
"return the y position of the top border" |
|
2366 |
||
2367 |
^ top |
|
2368 |
! |
|
2369 |
||
2370 |
top:aNumber |
|
2371 |
"set the y position" |
|
2372 |
||
2373 |
self origin:(left @ aNumber) |
|
2374 |
! |
|
2375 |
||
2376 |
topInset |
|
2377 |
"return the inset of the top edge; positive is to the bottom, |
|
2378 |
negative to the top" |
|
2379 |
||
2380 |
insets isNil ifTrue:[^ 0]. |
|
2381 |
^ insets at:2 |
|
2382 |
! |
|
2383 |
||
2384 |
topInset:aNumber |
|
2385 |
"set the inset of the top edge; |
|
2386 |
positive is to the bottom (view becomes smaller), |
|
2387 |
negative to the top (becomes larger)" |
|
2388 |
||
2389 |
insets isNil ifTrue:[ |
|
964 | 2390 |
insets := Array with:0 with:0 with:0 with:0 |
269 | 2391 |
]. |
2392 |
insets at:2 put:aNumber. |
|
2393 |
||
2394 |
"force recomputation" |
|
2395 |
"/ drawableId isNil ifTrue:[ |
|
2396 |
"/ originChanged := true |
|
2397 |
"/ ] ifFalse:[ |
|
964 | 2398 |
self containerChangedSize. |
269 | 2399 |
"/ ] |
964 | 2400 |
|
2401 |
"Modified: 19.7.1996 / 17:30:45 / cg" |
|
269 | 2402 |
! |
2403 |
||
2404 |
verticalInset:aNumber |
|
2405 |
"set the insets of the top/bottom edge; |
|
2406 |
positive makes it smaller, negative makes it larger" |
|
2407 |
||
2408 |
insets isNil ifTrue:[ |
|
964 | 2409 |
insets := Array with:0 with:0 with:0 with:0 |
269 | 2410 |
]. |
2411 |
insets at:2 put:aNumber. |
|
2412 |
insets at:4 put:aNumber. |
|
2413 |
||
2414 |
"force recomputation" |
|
2415 |
"/ drawableId isNil ifTrue:[ |
|
2416 |
"/ originChanged := true |
|
2417 |
"/ ] ifFalse:[ |
|
964 | 2418 |
self containerChangedSize. |
269 | 2419 |
"/ ] |
964 | 2420 |
|
2421 |
"Modified: 19.7.1996 / 17:30:50 / cg" |
|
269 | 2422 |
! |
2423 |
||
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2424 |
viewRectangle |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2425 |
"return the inside area. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2426 |
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
|
2427 |
to base relative coordinates on. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2428 |
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
|
2429 |
margins required for 3D levels) is ok. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2430 |
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
|
2431 |
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
|
2432 |
(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
|
2433 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2434 |
|m2| |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2435 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2436 |
m2 := margin + margin. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2437 |
^ (margin @ margin) extent:((width - m2) @ (height - m2)) |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2438 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2439 |
"Modified: 8.2.1996 / 20:05:00 / cg" |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2440 |
! |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2441 |
|
269 | 2442 |
width:aNumber |
2443 |
"set the views width in pixels" |
|
2444 |
||
2445 |
self extent:(aNumber @ height) |
|
2446 |
! |
|
2447 |
||
2448 |
widthIncludingBorder |
|
2449 |
"return my width including border |
|
2450 |
(this is my width as seen from the outside view; |
|
2451 |
while #width returns the width as seen by myself)" |
|
2452 |
||
2453 |
^ width + (2*borderWidth) |
|
2454 |
! ! |
|
2455 |
||
2456 |
!SimpleView methodsFor:'accessing-hierarchy'! |
|
2457 |
||
756 | 2458 |
components |
2459 |
"return the collection of non-view components" |
|
2460 |
||
2461 |
^ components |
|
2462 |
||
2463 |
"Created: 28.5.1996 / 23:59:37 / cg" |
|
2464 |
! |
|
2465 |
||
1182 | 2466 |
container |
2467 |
"return my container" |
|
2468 |
||
2469 |
^ superView |
|
2470 |
||
2471 |
"Created: 5.6.1996 / 01:08:36 / cg" |
|
2472 |
"Modified: 10.1.1997 / 19:47:59 / cg" |
|
2473 |
! |
|
2474 |
||
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2475 |
container:aContainer |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2476 |
"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
|
2477 |
|
1296 | 2478 |
(superView notNil and:[superView ~~ aContainer]) ifTrue:[ |
2479 |
"/ actually, this is worth an exception |
|
1297 | 2480 |
('View [warning]: ' , self printString , ' already has a container') errorPrintCR. |
1296 | 2481 |
superView removeComponent:self. |
2482 |
]. |
|
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2483 |
superView := aContainer |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2484 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2485 |
"Created: 9.5.1996 / 00:40:56 / cg" |
1297 | 2486 |
"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
|
2487 |
! |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2488 |
|
269 | 2489 |
lower |
2490 |
"bring to back" |
|
2491 |
||
2492 |
drawableId isNil ifTrue:[self create]. |
|
2493 |
device lowerWindow:drawableId |
|
2494 |
||
2495 |
" |
|
2496 |
Transcript topView lower |
|
2497 |
" |
|
2498 |
! |
|
2499 |
||
2500 |
raise |
|
2501 |
"bring to front" |
|
2502 |
||
2503 |
drawableId isNil ifTrue:[self create]. |
|
2504 |
device raiseWindow:drawableId |
|
2505 |
||
2506 |
" |
|
2507 |
Transcript topView raise |
|
2508 |
" |
|
2509 |
! |
|
2510 |
||
2511 |
subViews |
|
2512 |
"return the collection of subviews" |
|
2513 |
||
2514 |
^ subViews |
|
2515 |
! |
|
2516 |
||
2517 |
subViews:aListOfViews |
|
2518 |
"set the collection of subviews" |
|
2519 |
||
2520 |
subViews := aListOfViews. |
|
135 | 2521 |
subViews notNil ifTrue:[ |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2522 |
subViews do:[:view | |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2523 |
view container:self |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2524 |
] |
135 | 2525 |
] |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2526 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2527 |
"Modified: 9.5.1996 / 00:42:28 / cg" |
135 | 2528 |
! |
2529 |
||
269 | 2530 |
superView |
2531 |
"return my superView" |
|
2532 |
||
2533 |
^ superView |
|
2534 |
! |
|
2535 |
||
2536 |
superView:aView |
|
2537 |
"set my superView to be aView" |
|
2538 |
||
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2539 |
self obsoleteMethodWarning:'use #container:'. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2540 |
self container:aView. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2541 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
2542 |
"Modified: 9.5.1996 / 00:46:24 / cg" |
269 | 2543 |
! |
2544 |
||
662
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
2545 |
topComponent |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
2546 |
"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
|
2547 |
For ST-80 compatibility." |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
2548 |
|
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
2549 |
^ self topView |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
2550 |
|
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
2551 |
"Modified: 9.5.1996 / 01:40:24 / cg" |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
2552 |
! |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
2553 |
|
269 | 2554 |
topView |
2555 |
"return the topView - thats the one with no superview" |
|
2556 |
||
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2557 |
|v next| |
269 | 2558 |
|
2559 |
v := self. |
|
2560 |
[v notNil] whileTrue:[ |
|
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2561 |
(next := v container) isNil ifTrue:[^ v]. |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2562 |
v := next |
135 | 2563 |
]. |
2564 |
||
269 | 2565 |
^ nil |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2566 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2567 |
"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
|
2568 |
! |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2569 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2570 |
view |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2571 |
"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
|
2572 |
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
|
2573 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2574 |
^ self |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2575 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2576 |
"Created: 4.6.1996 / 21:32:11 / cg" |
269 | 2577 |
! ! |
2578 |
||
2579 |
!SimpleView methodsFor:'accessing-menus'! |
|
2580 |
||
2581 |
menuHolder |
|
2582 |
"who has the menu ? |
|
2583 |
By default, I have it." |
|
2584 |
||
2585 |
^ self |
|
2586 |
! |
|
2587 |
||
2588 |
menuMessage |
|
2589 |
"Return the symbol sent to myself to aquire the menu" |
|
2590 |
||
2591 |
^ #middleButtonMenu |
|
2592 |
! |
|
2593 |
||
2594 |
menuPerformer |
|
2595 |
"who should perform the menu actions ? |
|
2596 |
By default, I do it." |
|
2597 |
||
2598 |
^ self |
|
2599 |
! |
|
2600 |
||
2601 |
yellowButtonMenu |
|
2602 |
"actually, this should be called 'middleButtonMenu'. |
|
2603 |
But for ST-80 compatibility .... |
|
2604 |
This method will vanish, once all views have controllers |
|
2605 |
associated with them; for now, duplicate some code also found in |
|
2606 |
controller." |
|
2607 |
||
2608 |
|sym menuHolder| |
|
2609 |
||
2610 |
"/ middleButtonMenu notNil ifTrue:[ |
|
2611 |
"/ "/ |
|
2612 |
"/ "/ has been assigned a static middleButtonMenu |
|
2613 |
"/ "/ (or a cached menu) |
|
2614 |
"/ "/ |
|
2615 |
"/ ^ middleButtonMenu |
|
2616 |
"/ ]. |
|
2617 |
||
2618 |
menuHolder := self menuHolder. |
|
2619 |
||
2620 |
menuHolder notNil ifTrue:[ |
|
1356 | 2621 |
sym := self menuMessage. |
2622 |
sym notNil ifTrue:[ |
|
2623 |
" |
|
2624 |
mhmh - for backward compatibility, try to ask |
|
2625 |
the model first, then use the views menu. |
|
2626 |
" |
|
2627 |
(menuHolder respondsTo:sym) ifFalse:[ |
|
2628 |
(self respondsTo:sym) ifTrue:[ |
|
2629 |
menuHolder := self |
|
2630 |
] |
|
2631 |
]. |
|
2632 |
" |
|
2633 |
ask the menuHolder for the menu |
|
2634 |
" |
|
2635 |
^ menuHolder perform:sym. |
|
2636 |
]. |
|
269 | 2637 |
]. |
2638 |
||
2639 |
^ nil |
|
135 | 2640 |
! ! |
2641 |
||
2642 |
!SimpleView methodsFor:'accessing-misc'! |
|
2643 |
||
2644 |
bitGravity |
|
2645 |
"return the bitGravity - thats the direction where the contents will move |
|
2646 |
when the the view is resized." |
|
2647 |
||
2648 |
^ bitGravity |
|
2649 |
! |
|
2650 |
||
2651 |
bitGravity:gravity |
|
2652 |
"set the bitGravity - thats the direction where the contents will move |
|
2653 |
when the view is resized." |
|
2654 |
||
2655 |
bitGravity ~~ gravity ifTrue:[ |
|
1356 | 2656 |
bitGravity := gravity. |
2657 |
drawableId notNil ifTrue:[ |
|
2658 |
device setBitGravity:gravity in:drawableId |
|
2659 |
] |
|
135 | 2660 |
] |
2661 |
! |
|
2662 |
||
737 | 2663 |
clippingRectangle:aRectangle |
153 | 2664 |
"set the clipping rectangle for drawing (in logical coordinates); |
754 | 2665 |
a nil argument turns off clipping (i.e. whole view is drawable). |
153 | 2666 |
Redefined to care for any margin." |
2667 |
||
2668 |
|x y w h| |
|
2669 |
||
2670 |
aRectangle isNil ifTrue:[ |
|
737 | 2671 |
clipRect isNil ifTrue:[^ self]. |
2672 |
gcId notNil ifTrue:[ |
|
2673 |
device noClipIn:gcId |
|
2674 |
] |
|
153 | 2675 |
] ifFalse:[ |
737 | 2676 |
clipRect notNil ifTrue:[ |
2677 |
(clipRect = aRectangle) ifTrue:[^ self] |
|
2678 |
]. |
|
2679 |
gcId notNil ifTrue:[ |
|
2680 |
x := aRectangle left. |
|
2681 |
y := aRectangle top. |
|
2682 |
w := aRectangle width. |
|
2683 |
h := aRectangle height. |
|
2684 |
transformation notNil ifTrue:[ |
|
2685 |
x := transformation applyToX:x. |
|
2686 |
y := transformation applyToY:y. |
|
2687 |
w := transformation applyScaleX:w. |
|
2688 |
h := transformation applyScaleY:h. |
|
2689 |
]. |
|
2690 |
(x isMemberOf:SmallInteger) ifFalse:[ |
|
2691 |
w := w + (x - x truncated). |
|
2692 |
x := x truncated |
|
2693 |
]. |
|
2694 |
(y isMemberOf:SmallInteger) ifFalse:[ |
|
2695 |
h := h + (y - y truncated). |
|
2696 |
y := y truncated |
|
2697 |
]. |
|
2698 |
(w isMemberOf:SmallInteger) ifFalse:[ |
|
2699 |
w := w truncated + 1 |
|
2700 |
]. |
|
2701 |
(h isMemberOf:SmallInteger) ifFalse:[ |
|
2702 |
h := h truncated + 1 |
|
2703 |
]. |
|
2704 |
x < margin ifTrue:[ |
|
2705 |
x := margin. |
|
2706 |
]. |
|
2707 |
y < margin ifTrue:[ |
|
2708 |
y := margin. |
|
2709 |
]. |
|
2710 |
x + w - 1 >= (width-margin) ifTrue:[ |
|
2711 |
w := width - margin - x |
|
2712 |
]. |
|
2713 |
y + h - 1 >= (height-margin) ifTrue:[ |
|
2714 |
h := height - margin - y |
|
2715 |
]. |
|
2716 |
device setClipX:x y:y width:w height:h in:gcId |
|
2717 |
] |
|
153 | 2718 |
]. |
2719 |
clipRect := aRectangle |
|
737 | 2720 |
|
2721 |
"Created: 28.5.1996 / 19:50:03 / cg" |
|
754 | 2722 |
"Modified: 28.5.1996 / 22:32:15 / cg" |
153 | 2723 |
! |
2724 |
||
2725 |
fullName |
|
2726 |
"return my full name to be used for resource-access" |
|
2727 |
||
2728 |
superView notNil ifTrue:[ |
|
1356 | 2729 |
^ superView fullName , '.' , name |
153 | 2730 |
]. |
2731 |
^ name |
|
2732 |
! |
|
2733 |
||
269 | 2734 |
name |
2735 |
"return my name component to be used for resource-access" |
|
2736 |
||
2737 |
^ name |
|
2738 |
! |
|
2739 |
||
2740 |
name:aString |
|
2741 |
"set my name component to be used for resource-access" |
|
2742 |
||
2743 |
name := aString |
|
2744 |
! |
|
2745 |
||
153 | 2746 |
processName |
2747 |
"return a string to be shown in the process monitor" |
|
2748 |
||
2749 |
^ self name |
|
269 | 2750 |
! |
2751 |
||
2752 |
styleSheet |
|
2753 |
"return the styleSheet. This is set at early view-creation time, |
|
2754 |
from the defaultStyleSheet which is valid at that time. |
|
2755 |
It is not affected by later defaultStyle changes" |
|
2756 |
||
2757 |
^ styleSheet |
|
2758 |
||
2759 |
"Created: 10.9.1995 / 11:02:20 / claus" |
|
2760 |
! |
|
2761 |
||
2762 |
viewGravity |
|
2763 |
"return the viewGravity - thats the direction where the view will move |
|
2764 |
when the superView is resized." |
|
2765 |
||
2766 |
^ viewGravity |
|
2767 |
! |
|
2768 |
||
2769 |
viewGravity:gravity |
|
2770 |
"set the viewGravity - thats the direction where the view will move |
|
2771 |
when the superView is resized." |
|
2772 |
||
2773 |
viewGravity ~~ gravity ifTrue:[ |
|
1356 | 2774 |
viewGravity := gravity. |
2775 |
drawableId notNil ifTrue:[ |
|
2776 |
device setWindowGravity:gravity in:drawableId |
|
2777 |
] |
|
269 | 2778 |
] |
140 | 2779 |
! ! |
2780 |
||
2781 |
!SimpleView methodsFor:'accessing-mvc'! |
|
2782 |
||
1187
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
2783 |
application |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
2784 |
"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
|
2785 |
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
|
2786 |
|
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
2787 |
|top| |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
2788 |
|
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
2789 |
(top := self topView) notNil ifTrue:[ |
1190 | 2790 |
top ~~ self ifTrue:[ |
2791 |
^ top application |
|
2792 |
] |
|
1187
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
2793 |
]. |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
2794 |
^ nil |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
2795 |
|
1190 | 2796 |
"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
|
2797 |
! |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
2798 |
|
269 | 2799 |
aspect:aspectSymbol |
2800 |
"ST-80 style updating: If a views aspectSymbol is nonNil, |
|
2801 |
it will respond to changes of this aspect from the model. |
|
2802 |
Alias for aspectMessage: for ST-80 compatibility." |
|
2803 |
||
2804 |
self aspectMessage:aspectSymbol |
|
2805 |
! |
|
2806 |
||
140 | 2807 |
controller |
2808 |
"return the controller. For non MVC views, return nil" |
|
2809 |
||
2810 |
^ controller |
|
2811 |
! |
|
2812 |
||
2813 |
controller:aController |
|
2814 |
"set the controller" |
|
2815 |
||
2816 |
controller := aController. |
|
2817 |
controller notNil ifTrue:[ |
|
1356 | 2818 |
controller view:self. |
135 | 2819 |
] |
2820 |
! |
|
2821 |
||
140 | 2822 |
model |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2823 |
"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
|
2824 |
|
135 | 2825 |
^ nil |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2826 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
2827 |
"Modified: 5.6.1996 / 14:17:29 / cg" |
135 | 2828 |
! |
2829 |
||
1182 | 2830 |
sensor |
2831 |
"return the views sensor" |
|
2832 |
||
2833 |
windowGroup notNil ifTrue:[ |
|
2834 |
^ windowGroup sensor. |
|
2835 |
]. |
|
2836 |
^ nil |
|
2837 |
||
2838 |
"Modified: 10.1.1997 / 19:47:13 / cg" |
|
2839 |
! |
|
2840 |
||
954 | 2841 |
setController:aController |
2842 |
"set the controller but do not affect the model/view releationship" |
|
2843 |
||
2844 |
controller := aController. |
|
2845 |
||
2846 |
"Created: 18.7.1996 / 11:43:40 / cg" |
|
2847 |
! |
|
2848 |
||
269 | 2849 |
windowGroup |
2850 |
"return the window group. For old style views, return nil" |
|
2851 |
||
2852 |
^ windowGroup |
|
2853 |
! |
|
2854 |
||
140 | 2855 |
windowGroup:aGroup |
2856 |
"set the window group." |
|
2857 |
||
2858 |
windowGroup := aGroup |
|
269 | 2859 |
! ! |
2860 |
||
2861 |
!SimpleView methodsFor:'accessing-transformation'! |
|
2862 |
||
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2863 |
maxComponentBottom |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2864 |
"return the maximum of all components bottom" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2865 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2866 |
components isNil ifTrue:[^ 0]. |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2867 |
^ components inject:0 into:[:maxSoFar :sub |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2868 |
| (sub bottom) max:maxSoFar]. |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2869 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2870 |
"Created: 26.5.1996 / 12:44:05 / cg" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2871 |
"Modified: 26.5.1996 / 12:56:39 / cg" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2872 |
! |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2873 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2874 |
maxComponentRight |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2875 |
"return the maximum of all components rights" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2876 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2877 |
components isNil ifTrue:[^ 0]. |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2878 |
^ components inject:0 into:[:maxSoFar :sub |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2879 |
| (sub right) max:maxSoFar]. |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2880 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2881 |
"Modified: 26.5.1996 / 12:56:39 / cg" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2882 |
"Created: 26.5.1996 / 13:02:19 / cg" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2883 |
! |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2884 |
|
269 | 2885 |
maxSubViewBottom |
2886 |
"/ subViews isNil ifTrue:[^ 0]. |
|
2887 |
"/ ^ subViews inject:0 into:[:maxSoFar :sub | (sub top + sub height) max:maxSoFar]. |
|
2888 |
^ 0 |
|
2889 |
! |
|
2890 |
||
2891 |
maxSubViewRight |
|
2892 |
"/ subViews isNil ifTrue:[^ 0]. |
|
2893 |
"/ ^ subViews inject:0 into:[:maxSoFar :sub | (sub left + sub width) max:maxSoFar]. |
|
2894 |
^ 0 |
|
2895 |
! |
|
2896 |
||
2897 |
scale:aPoint |
|
2898 |
"set the scale factor of the transformation" |
|
2899 |
||
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2900 |
super scale:aPoint. |
269 | 2901 |
self computeInnerClip |
2902 |
! |
|
2903 |
||
2904 |
setViewOrigin:aPoint |
|
2905 |
"set the viewOrigin - i.e. virtually scroll without redrawing" |
|
2906 |
||
2907 |
|p| |
|
2908 |
||
2909 |
p := aPoint negated. |
|
2910 |
transformation isNil ifTrue:[ |
|
1356 | 2911 |
transformation := WindowingTransformation scale:1 translation:p |
269 | 2912 |
] ifFalse:[ |
1356 | 2913 |
transformation translation:p |
269 | 2914 |
]. |
2915 |
clipRect notNil ifTrue:[ |
|
1356 | 2916 |
self setInnerClip. |
269 | 2917 |
]. |
2918 |
! |
|
2919 |
||
2920 |
viewOrigin |
|
2921 |
"return the viewOrigin; thats the coordinate of the contents |
|
2922 |
which is shown topLeft in the view |
|
2923 |
(i.e. the origin of the visible part of the contents)." |
|
2924 |
||
2925 |
transformation isNil ifTrue:[ |
|
1356 | 2926 |
^ 0@0 |
269 | 2927 |
]. |
2928 |
^ transformation translation negated |
|
2929 |
! |
|
2930 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
2931 |
visibleArea |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
2932 |
"return the rectangle that contains the visible part |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
2933 |
of the view in user coordinates." |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
2934 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
2935 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
2936 |
transformation isNil ifTrue:[ |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
2937 |
^ Rectangle left:0 top:0 width:width height:height. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
2938 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
2939 |
^ Rectangle origin:(transformation translation negated) |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
2940 |
extent:((width @ height) scaledBy:(transformation scale)). |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
2941 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
2942 |
"Created: 12.7.1996 / 11:57:04 / stefan" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
2943 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
2944 |
|
269 | 2945 |
xOriginOfContents |
2946 |
"return the x coordinate of the viewOrigin in pixels; |
|
2947 |
used by scrollBars to compute thumb position within the document." |
|
2948 |
||
2949 |
^ self viewOrigin x |
|
2950 |
! |
|
2951 |
||
2952 |
yOriginOfContents |
|
2953 |
"return the y coordinate of the viewOrigin in pixels; |
|
2954 |
used by scrollBars to compute thumb position within the document." |
|
2955 |
||
2956 |
^ self viewOrigin y |
|
2957 |
! ! |
|
2958 |
||
370 | 2959 |
!SimpleView methodsFor:'accessing-visibility'! |
2960 |
||
2961 |
beInvisible |
|
2962 |
self hiddenOnRealize:true. |
|
2963 |
realized ifTrue:[ |
|
1379 | 2964 |
(superView isNil "/ I am a topView |
2965 |
or:[superView realized]) "/ superview already shown |
|
711
8aa1b1a9536f
fixed beVisible, to remap topViews at old position
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
2966 |
ifTrue:[ |
8aa1b1a9536f
fixed beVisible, to remap topViews at old position
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
2967 |
self unmap |
8aa1b1a9536f
fixed beVisible, to remap topViews at old position
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
2968 |
] |
370 | 2969 |
] |
2970 |
||
2971 |
"Created: 22.9.1995 / 15:29:01 / claus" |
|
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
2972 |
"Modified: 3.5.1996 / 23:49:12 / stefan" |
1379 | 2973 |
"Modified: 25.2.1997 / 22:43:09 / cg" |
370 | 2974 |
! |
2975 |
||
2976 |
beVisible |
|
2977 |
self hiddenOnRealize:false. |
|
2978 |
realized ifFalse:[ |
|
711
8aa1b1a9536f
fixed beVisible, to remap topViews at old position
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
2979 |
superView isNil "/ I am a topView |
574 | 2980 |
ifTrue:[ |
711
8aa1b1a9536f
fixed beVisible, to remap topViews at old position
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
2981 |
self remap |
8aa1b1a9536f
fixed beVisible, to remap topViews at old position
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
2982 |
] ifFalse:[ |
8aa1b1a9536f
fixed beVisible, to remap topViews at old position
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
2983 |
superView realized "/ superview already shown |
8aa1b1a9536f
fixed beVisible, to remap topViews at old position
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
2984 |
ifTrue:[ |
8aa1b1a9536f
fixed beVisible, to remap topViews at old position
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
2985 |
self realize |
8aa1b1a9536f
fixed beVisible, to remap topViews at old position
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
2986 |
] |
574 | 2987 |
] |
370 | 2988 |
] |
2989 |
||
2990 |
" |
|
2991 |
|top topFrame check list| |
|
2992 |
||
2993 |
top := StandardSystemView new. |
|
2994 |
top extent:150@400. |
|
2995 |
topFrame := VerticalPanelView origin:0.0@0.0 corner:1.0@0.4 in:top. |
|
2996 |
topFrame horizontalLayout:#leftSpace. |
|
2997 |
||
2998 |
topFrame add:(check := CheckBox label:'hidden'). |
|
2999 |
check pressAction:[list beInvisible]. |
|
3000 |
check releaseAction:[list beVisible]. |
|
3001 |
||
3002 |
list := ScrollableView for:SelectionInListView. |
|
3003 |
list origin:0.0@0.4 corner:1.0@1.0. |
|
3004 |
list list:#('foo' 'bar' 'baz'). |
|
3005 |
top add:list. |
|
3006 |
||
3007 |
check turnOn. |
|
3008 |
list beInvisible. |
|
3009 |
||
3010 |
top open |
|
3011 |
" |
|
3012 |
||
3013 |
"Created: 22.9.1995 / 15:50:33 / claus" |
|
711
8aa1b1a9536f
fixed beVisible, to remap topViews at old position
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
3014 |
"Modified: 25.5.1996 / 12:05:28 / cg" |
370 | 3015 |
! |
3016 |
||
3017 |
hidden |
|
3018 |
"return true, if the view does not want to be realized |
|
3019 |
automatically when superview is realized" |
|
3020 |
||
3021 |
self obsoleteMethodWarning:'use #isHiddenOnRealize'. |
|
3022 |
^ hiddenOnRealize |
|
3023 |
||
3024 |
"Modified: 17.1.1996 / 11:44:47 / cg" |
|
3025 |
! |
|
3026 |
||
3027 |
hidden:aBoolean |
|
3028 |
"if the argument is true, the receiver view will not |
|
3029 |
be realized automatically when superview is realized" |
|
3030 |
||
3031 |
self obsoleteMethodWarning:'use #beVisible / #beInvisible'. |
|
3032 |
hiddenOnRealize := aBoolean |
|
3033 |
||
3034 |
"Modified: 17.1.1996 / 11:45:06 / cg" |
|
3035 |
! |
|
3036 |
||
3037 |
hiddenOnRealize:aBoolean |
|
3038 |
"if the argument is true, the receiver view will not |
|
3039 |
be mapped automatically when the superview is realized. |
|
3040 |
The hiddenOnRealize flag is useful to create views which are |
|
3041 |
to be made visible conditionally or later." |
|
3042 |
||
3043 |
hiddenOnRealize := aBoolean |
|
3044 |
! |
|
3045 |
||
3046 |
isHiddenOnRealize:aBoolean |
|
3047 |
"return true, if the receiver will NOT be mapped when |
|
3048 |
realized. False otherwise. |
|
3049 |
The hiddenOnRealize flag is useful to create views which are |
|
3050 |
to be made visible conditionally or later." |
|
3051 |
||
3052 |
^ hiddenOnRealize |
|
3053 |
! |
|
3054 |
||
3055 |
shown |
|
3056 |
"return true if the view is shown; false if not. |
|
3057 |
Shown means: the view is mapped and is not completely covered." |
|
3058 |
||
3059 |
^ shown |
|
3060 |
! ! |
|
3061 |
||
269 | 3062 |
!SimpleView methodsFor:'adding & removing components'! |
3063 |
||
3064 |
add:aComponent |
|
3065 |
"add a component (either a view or gadget) to the collection of |
|
3066 |
subComponents." |
|
3067 |
||
3068 |
self addComponent:aComponent |
|
3069 |
! |
|
3070 |
||
1335 | 3071 |
add:aComponent at:anOrigin |
3072 |
"for ST-80 compatibility. |
|
3073 |
add a component at some origin" |
|
3074 |
||
3075 |
|l comp| |
|
3076 |
||
3077 |
(aComponent isWrapper not |
|
3078 |
or:[aComponent isLayoutWrapper not]) ifTrue:[ |
|
3079 |
comp := LayoutWrapper on:aComponent |
|
3080 |
] ifFalse:[ |
|
3081 |
comp := aComponent |
|
3082 |
]. |
|
3083 |
||
3084 |
l := anOrigin asLayout. |
|
3085 |
comp layout:l. |
|
3086 |
||
3087 |
self addComponent:comp |
|
3088 |
||
3089 |
"Modified: 12.2.1997 / 11:55:33 / cg" |
|
3090 |
! |
|
3091 |
||
269 | 3092 |
add:aComponent in:aRectangleOrLayoutFrame |
3093 |
"for ST-80 compatibility. |
|
3094 |
add a component in some frame; the argument may be either a rectangle |
|
3095 |
with relative coordinates, or an instance of LayoutFrame, specifying |
|
3096 |
both relative coordinates and the insets." |
|
3097 |
||
3098 |
|l| |
|
3099 |
||
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
3100 |
l := aRectangleOrLayoutFrame asLayout. |
269 | 3101 |
|
3102 |
"/ will soon be replaced by: |
|
3103 |
"/ aComponent layout:l. |
|
3104 |
aComponent geometryLayout:l. |
|
3105 |
||
3106 |
self addComponent:aComponent |
|
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
3107 |
|
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
3108 |
"Modified: 29.5.1996 / 15:12:50 / cg" |
269 | 3109 |
! |
3110 |
||
3111 |
addComponent:aComponent |
|
3112 |
"components (i.e. gadgets or lightweight views) are being prepared. |
|
3113 |
Dont use this right now for non-views" |
|
3114 |
||
3115 |
aComponent isView ifTrue:[ |
|
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3116 |
self addSubView:aComponent |
269 | 3117 |
] ifFalse:[ |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3118 |
components isNil ifTrue:[ |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3119 |
components := OrderedCollection new |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3120 |
]. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3121 |
components add:aComponent. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3122 |
aComponent container:self. |
683
ecc5d13f22b2
redraw new components if already visible
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
3123 |
shown ifTrue:[ |
ecc5d13f22b2
redraw new components if already visible
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
3124 |
aComponent displayOn:self |
ecc5d13f22b2
redraw new components if already visible
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
3125 |
] |
269 | 3126 |
] |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3127 |
|
683
ecc5d13f22b2
redraw new components if already visible
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
3128 |
"Modified: 13.5.1996 / 21:19:51 / cg" |
269 | 3129 |
! |
3130 |
||
3131 |
addSubView:newView |
|
3132 |
"add a view to the collection of subviews" |
|
3133 |
||
3134 |
subViews isNil ifTrue:[ |
|
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3135 |
subViews := OrderedCollection with:newView |
269 | 3136 |
] ifFalse:[ |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3137 |
subViews add:newView. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3138 |
]. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3139 |
self setContainerIn:newView. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3140 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3141 |
"Modified: 9.5.1996 / 00:47:16 / cg" |
269 | 3142 |
! |
3143 |
||
3144 |
addSubView:newView after:aView |
|
3145 |
"add a view to the collection of subviews after another view. |
|
3146 |
This makes sense, in Panels and other layout views, to enter a new |
|
3147 |
element at some defined place." |
|
3148 |
||
3149 |
subViews isNil ifTrue:[ |
|
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3150 |
subViews := OrderedCollection with:newView |
269 | 3151 |
] ifFalse:[ |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3152 |
aView isNil ifTrue:[ |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3153 |
subViews add:newView |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3154 |
] ifFalse:[ |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3155 |
subViews add:newView after:aView. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3156 |
] |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3157 |
]. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3158 |
self setContainerIn:newView. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3159 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3160 |
"Modified: 9.5.1996 / 00:47:20 / cg" |
269 | 3161 |
! |
3162 |
||
3163 |
addSubView:newView before:aView |
|
3164 |
"add a view to the collection of subviews before another view. |
|
3165 |
This makes sense, in Panels and other layout views, to enter a new |
|
3166 |
element at some defined place." |
|
3167 |
||
3168 |
subViews isNil ifTrue:[ |
|
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3169 |
subViews := OrderedCollection with:newView |
269 | 3170 |
] ifFalse:[ |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3171 |
aView isNil ifTrue:[ |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3172 |
subViews addFirst:newView |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3173 |
] ifFalse:[ |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3174 |
subViews add:newView before:aView. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3175 |
] |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3176 |
]. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3177 |
self setContainerIn:newView. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3178 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3179 |
"Modified: 9.5.1996 / 00:47:23 / cg" |
269 | 3180 |
! |
3181 |
||
3182 |
addSubView:aView in:bounds borderWidth:bw |
|
3183 |
"for ST-80 V2.x compatibility" |
|
3184 |
||
3185 |
aView borderWidth:bw. |
|
3186 |
self add:aView in:bounds. |
|
3187 |
! |
|
3188 |
||
3189 |
component:aComponent |
|
3190 |
"components (i.e. gadgets or lightweight views) are being prepared. |
|
3191 |
Dont use this right now for non-views" |
|
3192 |
||
3193 |
aComponent origin:0.0@0.0 corner:1.0@1.0. |
|
3194 |
aComponent isView ifTrue:[ |
|
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3195 |
self addSubView:aComponent |
269 | 3196 |
] ifFalse:[ |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3197 |
components := OrderedCollection with:aComponent. |
683
ecc5d13f22b2
redraw new components if already visible
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
3198 |
aComponent container:self. |
ecc5d13f22b2
redraw new components if already visible
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
3199 |
|
ecc5d13f22b2
redraw new components if already visible
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
3200 |
shown ifTrue:[ |
ecc5d13f22b2
redraw new components if already visible
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
3201 |
aComponent displayOn:self |
ecc5d13f22b2
redraw new components if already visible
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
3202 |
] |
269 | 3203 |
] |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3204 |
|
683
ecc5d13f22b2
redraw new components if already visible
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
3205 |
"Modified: 13.5.1996 / 21:20:29 / cg" |
269 | 3206 |
! |
3207 |
||
3208 |
destroySubViews |
|
3209 |
"remove all subviews" |
|
3210 |
||
3211 |
subViews notNil ifTrue:[ |
|
1296 | 3212 |
subViews copy do:[:aSubView | |
3213 |
aSubView destroy. |
|
3214 |
]. |
|
3215 |
||
3216 |
"/ paranoia ;-) |
|
3217 |
subViews size ~~ 0 ifTrue:[ |
|
3218 |
('View [warning]: some subView(s) did not destroy: ' , subViews printString) infoPrintCR. |
|
3219 |
subViews := nil |
|
3220 |
]. |
|
269 | 3221 |
] |
3222 |
||
3223 |
"Modified: 5.9.1995 / 22:35:36 / claus" |
|
1296 | 3224 |
"Modified: 29.1.1997 / 17:07:45 / cg" |
269 | 3225 |
! |
3226 |
||
3227 |
removeComponent:aComponent |
|
3228 |
"components (i.e. gadgets or lightweight views) are being prepared. |
|
3229 |
Dont use this right now for non-views" |
|
3230 |
||
3231 |
aComponent isView ifTrue:[ |
|
1304 | 3232 |
self removeSubView:aComponent |
269 | 3233 |
] ifFalse:[ |
1304 | 3234 |
components isNil ifTrue:[^self]. |
1327 | 3235 |
components remove:aComponent ifAbsent:[]. |
1304 | 3236 |
aComponent parent:nil |
269 | 3237 |
] |
3238 |
! |
|
3239 |
||
3240 |
removeSubView:aView |
|
3241 |
"remove a view from the collection of subviews" |
|
3242 |
||
3243 |
subViews notNil ifTrue:[ |
|
1327 | 3244 |
subViews remove:aView ifAbsent:[nil]. |
1304 | 3245 |
(subViews size == 0) ifTrue:[ |
3246 |
subViews := nil |
|
3247 |
] |
|
269 | 3248 |
] |
3249 |
! |
|
3250 |
||
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3251 |
setContainerIn:aView |
269 | 3252 |
"common code for addSubView* methods" |
3253 |
||
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3254 |
aView container:self. |
743 | 3255 |
(aView graphicsDevice ~~ device) ifTrue:[ |
1172
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
3256 |
'SimpleView [warning]: subview (' errorPrint. aView class name errorPrint. |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3257 |
') has different device than me (' errorPrint. |
1172
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
3258 |
self class name errorPrint. ').' errorPrintCR. |
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
3259 |
|
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3260 |
aView device:device |
269 | 3261 |
] |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3262 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3263 |
"Created: 9.5.1996 / 00:46:59 / cg" |
1172
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
3264 |
"Modified: 10.1.1997 / 18:06:49 / cg" |
269 | 3265 |
! ! |
3266 |
||
3267 |
!SimpleView methodsFor:'change & update'! |
|
3268 |
||
3269 |
update:aspect with:aParameter from:changedObject |
|
3270 |
"an update request" |
|
3271 |
||
3272 |
aspect == #sizeOfView ifTrue:[ |
|
964 | 3273 |
"one of the views we depend on changed its size" |
3274 |
^ self containerChangedSize. |
|
269 | 3275 |
]. |
3276 |
^super update:aspect with:aParameter from:changedObject |
|
964 | 3277 |
|
3278 |
"Modified: 19.7.1996 / 17:30:48 / cg" |
|
269 | 3279 |
! ! |
3280 |
||
3281 |
!SimpleView methodsFor:'cursor animation'! |
|
3282 |
||
3283 |
showBusyWhile:aBlock |
|
3284 |
"evaluate some time consuming block, while doing this, |
|
3285 |
show a spinning wheel cursor" |
|
3286 |
||
3287 |
|ok bitmaps cursors mask process oldCursor| |
|
3288 |
||
3289 |
oldCursor := cursor. |
|
3290 |
||
3291 |
ok := true. |
|
3292 |
bitmaps := #('wheel1' 'wheel2' 'wheel3' 'wheel4') |
|
1141 | 3293 |
collect:[:name | |
3294 |
|f| |
|
3295 |
||
3296 |
f := Image fromFile:('bitmaps/' , name , '.xbm'). |
|
3297 |
f isNil ifTrue:[ |
|
1172
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
3298 |
('SimpleView [warning]: no bitmap file: ' , name , '.xbm') errorPrintCR. |
1141 | 3299 |
ok := false |
3300 |
]. |
|
3301 |
f |
|
3302 |
]. |
|
3303 |
||
3304 |
mask := Image fromFile:'bitmaps/wheelm.xbm'. |
|
269 | 3305 |
mask isNil ifTrue:[ |
1172
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
3306 |
('SimpleView [warning]: no bitmap file: wheelm.xbm') errorPrintCR. |
1141 | 3307 |
ok := false |
269 | 3308 |
]. |
3309 |
||
3310 |
ok ifFalse:[ |
|
1141 | 3311 |
self cursor:Cursor wait. |
3312 |
aBlock valueNowOrOnUnwindDo:[ |
|
3313 |
self cursor:oldCursor |
|
3314 |
] |
|
269 | 3315 |
] ifTrue:[ |
1141 | 3316 |
cursors := bitmaps collect:[:form | (Cursor sourceForm:form |
3317 |
maskForm:mask |
|
3318 |
hotX:8 |
|
3319 |
hotY:8) on:device]. |
|
3320 |
||
3321 |
process := [ |
|
3322 |
Delay waitForSeconds:0.25. |
|
3323 |
[true] whileTrue:[ |
|
3324 |
cursors do:[:curs | |
|
3325 |
self cursor:curs. |
|
3326 |
Delay waitForSeconds:0.05 |
|
3327 |
] |
|
3328 |
] |
|
3329 |
] fork. |
|
3330 |
||
3331 |
Processor activeProcess priority:7. |
|
3332 |
aBlock valueNowOrOnUnwindDo:[ |
|
3333 |
Processor activeProcess priority:8. |
|
3334 |
process terminate. |
|
3335 |
self cursor:oldCursor |
|
3336 |
] |
|
269 | 3337 |
]. |
3338 |
||
3339 |
" |
|
3340 |
View new realize showBusyWhile:[10 timesRepeat:[3000 factorial]] |
|
3341 |
" |
|
1141 | 3342 |
|
1172
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
3343 |
"Modified: 10.1.1997 / 18:07:23 / cg" |
269 | 3344 |
! ! |
3345 |
||
1308 | 3346 |
!SimpleView methodsFor:'drag & drop'! |
3347 |
||
3348 |
canDrop:anObjectOrCollection |
|
3349 |
"return true, if anObjectOrCollection can be |
|
3350 |
dropped in the receiver. This method should be |
|
3351 |
redefined in views which can take objects" |
|
3352 |
||
3353 |
|app| |
|
3354 |
||
3355 |
(app := self application) notNil ifTrue:[ |
|
3356 |
^ app canDrop:anObjectOrCollection in:self |
|
3357 |
]. |
|
3358 |
^ false |
|
3359 |
! |
|
3360 |
||
3361 |
drop:anObjectOrCollection at:aPoint |
|
3362 |
"drop manager wants to drop. |
|
3363 |
If I have an application, forward the request. |
|
3364 |
Otherwise, ignore it. This is only sent, if #canDrop: returned true; |
|
3365 |
if you redefined #canDrop: in a subclass, #drop:at: must also be redefined." |
|
3366 |
||
3367 |
|app| |
|
3368 |
||
3369 |
(app := self application) notNil ifTrue:[ |
|
3370 |
^ app drop:anObjectOrCollection in:self at:aPoint |
|
3371 |
]. |
|
3372 |
self subclassResponsibility |
|
3373 |
! ! |
|
3374 |
||
269 | 3375 |
!SimpleView methodsFor:'edge drawing'! |
3376 |
||
3377 |
drawBottomEdge |
|
3378 |
"draw bottom 3D edge into window frame" |
|
3379 |
||
3380 |
self drawBottomEdgeLevel:level |
|
1356 | 3381 |
shadow:shadowColor |
3382 |
light:lightColor |
|
3383 |
halfShadow:nil |
|
3384 |
halfLight:nil |
|
3385 |
style:nil. |
|
269 | 3386 |
! |
3387 |
||
3388 |
drawBottomEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle |
|
3389 |
|botFg |
|
3390 |
count "{ Class: SmallInteger }" |
|
3391 |
b r| |
|
3392 |
||
3393 |
count := level. |
|
3394 |
count == 0 ifTrue:[^ self]. |
|
3395 |
||
3396 |
(count < 0) ifTrue:[ |
|
1356 | 3397 |
botFg := lightColor. |
3398 |
count := count negated |
|
269 | 3399 |
] ifFalse:[ |
1356 | 3400 |
((edgeStyle == #soft) and:[level > 1]) ifTrue:[ |
3401 |
botFg := halfShadowColor |
|
3402 |
] ifFalse:[ |
|
3403 |
botFg := shadowColor |
|
3404 |
]. |
|
269 | 3405 |
]. |
3406 |
super paint:botFg. |
|
3407 |
super lineWidth:0. |
|
3408 |
||
3409 |
r := width - 1. |
|
3410 |
0 to:(count - 1) do:[:i | |
|
1356 | 3411 |
b := height - 1 - i. |
3412 |
super displayDeviceLineFromX:i y:b toX:(r - i) y:b |
|
269 | 3413 |
]. |
3414 |
||
3415 |
((edgeStyle == #soft) and:[level > 1]) ifTrue:[ |
|
1356 | 3416 |
b := height - 1. |
3417 |
super paint:shadowColor. |
|
3418 |
super displayDeviceLineFromX:1 y:b toX:r y:b. |
|
269 | 3419 |
] |
3420 |
! |
|
3421 |
||
3422 |
drawEdges |
|
3423 |
"draw all of my 3D edges" |
|
3424 |
||
3425 |
self drawEdgesForX:0 y:0 width:width height:height level:level |
|
1356 | 3426 |
shadow:shadowColor |
3427 |
light:lightColor |
|
3428 |
halfShadow:nil |
|
3429 |
halfLight:nil |
|
3430 |
style:nil |
|
269 | 3431 |
! |
3432 |
||
3433 |
drawEdgesForX:x y:y width:w height:h level:l |
|
3434 |
"draw 3D edges into a rectangle" |
|
3435 |
||
3436 |
self drawEdgesForX:x y:y width:w height:h level:l |
|
1356 | 3437 |
shadow:shadowColor |
3438 |
light:lightColor |
|
3439 |
halfShadow:nil |
|
3440 |
halfLight:nil |
|
3441 |
style:nil |
|
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3442 |
! |
269 | 3443 |
|
3444 |
drawLeftEdge |
|
3445 |
"draw left 3D edge into window frame" |
|
3446 |
||
3447 |
self drawLeftEdgeLevel:level |
|
1356 | 3448 |
shadow:shadowColor |
3449 |
light:lightColor |
|
3450 |
halfShadow:nil |
|
3451 |
halfLight:nil |
|
3452 |
style:nil. |
|
269 | 3453 |
! |
3454 |
||
3455 |
drawLeftEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle |
|
3456 |
|leftFg leftHalfFg paint b |
|
3457 |
count "{ Class: SmallInteger }" | |
|
3458 |
||
3459 |
count := level. |
|
3460 |
count == 0 ifTrue:[^ self]. |
|
3461 |
||
3462 |
(count < 0) ifTrue:[ |
|
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3463 |
leftFg := shadowColor. |
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3464 |
leftHalfFg := halfShadowColor. |
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3465 |
count := count negated. |
269 | 3466 |
] ifFalse:[ |
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3467 |
leftFg := lightColor. |
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3468 |
leftHalfFg := halfLightColor. |
269 | 3469 |
]. |
3470 |
leftHalfFg isNil ifTrue:[ |
|
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3471 |
leftHalfFg := leftFg |
269 | 3472 |
]. |
3473 |
||
3474 |
((edgeStyle == #soft) and:[level > 0]) ifTrue:[ |
|
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3475 |
paint := leftHalfFg |
269 | 3476 |
] ifFalse:[ |
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3477 |
paint := leftFg |
269 | 3478 |
]. |
3479 |
super paint:paint. |
|
3480 |
super lineWidth:0. |
|
3481 |
||
3482 |
b := height - 1. |
|
3483 |
0 to:(count - 1) do:[:i | |
|
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3484 |
super displayDeviceLineFromX:i y:i toX:i y:(b - i) |
269 | 3485 |
]. |
3486 |
||
3487 |
((edgeStyle == #soft) and:[level > 2]) ifTrue:[ |
|
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3488 |
super paint:(device blackColor). |
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3489 |
super displayDeviceLineFromX:0 y:0 toX:0 y:b. |
269 | 3490 |
] |
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3491 |
|
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3492 |
"Modified: 13.1.1997 / 23:09:59 / cg" |
269 | 3493 |
! |
3494 |
||
3495 |
drawRightEdge |
|
3496 |
"draw right 3D edge into window frame" |
|
3497 |
||
3498 |
self drawRightEdgeLevel:level |
|
1356 | 3499 |
shadow:shadowColor |
3500 |
light:lightColor |
|
3501 |
halfShadow:nil |
|
3502 |
halfLight:nil |
|
3503 |
style:nil. |
|
269 | 3504 |
! |
3505 |
||
3506 |
drawRightEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle |
|
3507 |
|rightFg |
|
3508 |
count "{ Class: SmallInteger }" |
|
3509 |
r b| |
|
3510 |
||
3511 |
count := level. |
|
3512 |
count == 0 ifTrue:[^ self]. |
|
3513 |
||
3514 |
(count < 0) ifTrue:[ |
|
1356 | 3515 |
rightFg := lightColor. |
3516 |
count := count negated |
|
269 | 3517 |
] ifFalse:[ |
1356 | 3518 |
((edgeStyle == #soft) and:[level > 1]) ifTrue:[ |
3519 |
rightFg := halfShadowColor |
|
3520 |
] ifFalse:[ |
|
3521 |
rightFg := shadowColor |
|
3522 |
]. |
|
269 | 3523 |
]. |
3524 |
super paint:rightFg. |
|
3525 |
super lineWidth:0. |
|
3526 |
||
3527 |
b := height - 1. |
|
3528 |
0 to:(count - 1) do:[:i | |
|
1356 | 3529 |
r := width - 1 - i. |
3530 |
super displayDeviceLineFromX:r y:i toX:r y:(b - i) |
|
269 | 3531 |
]. |
3532 |
((edgeStyle == #soft) and:[level > 1]) ifTrue:[ |
|
1356 | 3533 |
r := width - 1. |
3534 |
super paint:shadowColor. |
|
3535 |
super displayDeviceLineFromX:r y:1 toX:r y:b. |
|
269 | 3536 |
] |
3537 |
! |
|
3538 |
||
3539 |
drawTopEdge |
|
3540 |
"draw top 3D edge into window frame" |
|
3541 |
||
3542 |
self drawTopEdgeLevel:level |
|
1356 | 3543 |
shadow:shadowColor |
3544 |
light:lightColor |
|
3545 |
halfShadow:nil |
|
3546 |
halfLight:nil |
|
3547 |
style:nil. |
|
269 | 3548 |
! |
3549 |
||
3550 |
drawTopEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle |
|
3551 |
|topFg topHalfFg paint r |
|
3552 |
count "{ Class: SmallInteger }" | |
|
3553 |
||
3554 |
count := level. |
|
3555 |
count == 0 ifTrue:[^ self]. |
|
3556 |
||
3557 |
(count < 0) ifTrue:[ |
|
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3558 |
topFg := shadowColor. |
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3559 |
topHalfFg := halfShadowColor. |
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3560 |
count := count negated |
269 | 3561 |
] ifFalse:[ |
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3562 |
topFg := lightColor. |
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3563 |
topHalfFg := halfLightColor. |
269 | 3564 |
]. |
3565 |
topHalfFg isNil ifTrue:[ |
|
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3566 |
topHalfFg := topFg |
269 | 3567 |
]. |
3568 |
||
3569 |
((edgeStyle == #soft) and:[level > 0]) ifTrue:[ |
|
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3570 |
paint := topHalfFg |
269 | 3571 |
] ifFalse:[ |
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3572 |
paint := topFg |
269 | 3573 |
]. |
3574 |
super paint:paint. |
|
3575 |
super lineWidth:0. |
|
3576 |
||
3577 |
r := width - 1. |
|
3578 |
0 to:(count - 1) do:[:i | |
|
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3579 |
super displayDeviceLineFromX:i y:i toX:(r - i) y:i |
269 | 3580 |
]. |
3581 |
((edgeStyle == #soft) and:[level > 2]) ifTrue:[ |
|
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3582 |
super paint:(device blackColor). |
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3583 |
super displayDeviceLineFromX:0 y:0 toX:r y:0. |
269 | 3584 |
] |
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3585 |
|
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
3586 |
"Modified: 13.1.1997 / 23:10:06 / cg" |
269 | 3587 |
! |
3588 |
||
3589 |
redrawEdges |
|
3590 |
"redraw my edges (if any)" |
|
3591 |
||
3592 |
(level ~~ 0) ifTrue:[ |
|
739 | 3593 |
shown ifTrue:[ |
3594 |
self clippingRectangle:nil. |
|
3595 |
self drawEdges. |
|
3596 |
self clippingRectangle:innerClipRect |
|
3597 |
] |
|
3598 |
] |
|
3599 |
||
3600 |
"Modified: 28.5.1996 / 20:04:51 / cg" |
|
269 | 3601 |
! ! |
3602 |
||
3603 |
!SimpleView methodsFor:'enumerating subviews'! |
|
3604 |
||
3605 |
allSubViewsDo:aBlock |
|
3606 |
"evaluate aBlock for all subviews (recursively)" |
|
3607 |
||
1335 | 3608 |
subViews notNil ifTrue:[ |
3609 |
subViews do:[:aSubview | |
|
3610 |
aSubview withAllSubViewsDo:aBlock |
|
3611 |
] |
|
269 | 3612 |
] |
1335 | 3613 |
|
3614 |
"Modified: 12.2.1997 / 12:23:38 / cg" |
|
269 | 3615 |
! |
3616 |
||
1363 | 3617 |
changeSequenceOrderFor:aSubView to:anIndex |
3618 |
"change a subview's position into subviews collection |
|
3619 |
" |
|
3620 |
|aView| |
|
3621 |
||
3622 |
||
3623 |
(subViews notNil and:[subViews size >= anIndex]) ifTrue:[ |
|
3624 |
aView := subViews remove:aSubView ifAbsent:nil. |
|
3625 |
||
3626 |
aView notNil ifTrue:[ |
|
3627 |
subViews add:aView beforeIndex:anIndex. |
|
3628 |
^ true |
|
3629 |
] |
|
3630 |
]. |
|
3631 |
^ false |
|
3632 |
! |
|
3633 |
||
269 | 3634 |
withAllSubViewsDo:aBlock |
3635 |
"evaluate aBlock for the receiver and all subviews (recursively)" |
|
3636 |
||
3637 |
aBlock value:self. |
|
3638 |
self allSubViewsDo:aBlock |
|
135 | 3639 |
! ! |
3640 |
||
3641 |
!SimpleView methodsFor:'event handling'! |
|
3642 |
||
489
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3643 |
activateMenu |
520
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3644 |
"activate my menu. |
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3645 |
If there is a static middleButtonMenu, that one is taken, |
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3646 |
and handled in the superClass (static menus are a historic leftOver). |
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3647 |
Otherwise, the follwing steps are performed: |
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3648 |
|
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3649 |
- ask the receiver for the menu (via #yellowButtonMenu) |
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3650 |
- ask the receiver for the menuPerformer. |
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3651 |
- startUp the menu - it is supposed to return an actionSelector |
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3652 |
- if the menuPerformer responds to the selector, |
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3653 |
send it to the performer; |
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3654 |
otherwise send it to the view (the receiver) |
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3655 |
This is funny, it allows additional menuItems to be added |
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3656 |
AND still get the views copy/cut/paste functionality. |
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3657 |
Without this, you had to redefine and forward all of those |
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3658 |
messages in the performer." |
489
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3659 |
|
1113 | 3660 |
|menu menuPerformer actionSelector actionArg haveArg prevReceiver| |
489
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3661 |
|
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3662 |
middleButtonMenu isNil ifTrue:[ |
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3663 |
|
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3664 |
haveArg := false. |
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3665 |
|
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3666 |
" |
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3667 |
try ST-80 style menus first: |
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3668 |
if there is a model, and a menuMessage is defined, |
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3669 |
ask model for the menu and launch that if non-nil. |
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3670 |
" |
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3671 |
menu := self yellowButtonMenu. |
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3672 |
menu notNil ifTrue:[ |
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3673 |
" |
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3674 |
got one, launch the menu. It is supposed |
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3675 |
to return an actionSelector. |
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3676 |
" |
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3677 |
menuPerformer := self menuPerformer. |
520
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3678 |
|
489
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3679 |
" |
1259
60af09384d13
pass myself AND the menuPerformer to the popupMenu.
Claus Gittinger <cg@exept.de>
parents:
1201
diff
changeset
|
3680 |
a temporary kludge: |
60af09384d13
pass myself AND the menuPerformer to the popupMenu.
Claus Gittinger <cg@exept.de>
parents:
1201
diff
changeset
|
3681 |
pass myself as receiver, the menuPerformer as performer; |
60af09384d13
pass myself AND the menuPerformer to the popupMenu.
Claus Gittinger <cg@exept.de>
parents:
1201
diff
changeset
|
3682 |
the menu will send its messages to either the |
60af09384d13
pass myself AND the menuPerformer to the popupMenu.
Claus Gittinger <cg@exept.de>
parents:
1201
diff
changeset
|
3683 |
menuPerformer or me (its receiver). |
60af09384d13
pass myself AND the menuPerformer to the popupMenu.
Claus Gittinger <cg@exept.de>
parents:
1201
diff
changeset
|
3684 |
This allows for the ST-80 behavior, where some messages |
60af09384d13
pass myself AND the menuPerformer to the popupMenu.
Claus Gittinger <cg@exept.de>
parents:
1201
diff
changeset
|
3685 |
go to the model, others to the view |
60af09384d13
pass myself AND the menuPerformer to the popupMenu.
Claus Gittinger <cg@exept.de>
parents:
1201
diff
changeset
|
3686 |
(copy/cut/paste). |
489
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3687 |
" |
1113 | 3688 |
(prevReceiver := menu receiver) isNil ifTrue:[ |
1259
60af09384d13
pass myself AND the menuPerformer to the popupMenu.
Claus Gittinger <cg@exept.de>
parents:
1201
diff
changeset
|
3689 |
"/ menu receiver:menuPerformer. |
60af09384d13
pass myself AND the menuPerformer to the popupMenu.
Claus Gittinger <cg@exept.de>
parents:
1201
diff
changeset
|
3690 |
menu menuPerformer:menuPerformer. |
60af09384d13
pass myself AND the menuPerformer to the popupMenu.
Claus Gittinger <cg@exept.de>
parents:
1201
diff
changeset
|
3691 |
menu receiver:self. |
489
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3692 |
]. |
520
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3693 |
|
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3694 |
"/ |
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3695 |
"/ startup the menu - this returns a selector |
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3696 |
"/ |
489
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3697 |
actionSelector := menu startUp. |
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3698 |
|
1113 | 3699 |
actionSelector notNil ifTrue:[ |
3700 |
" |
|
3701 |
mhmh - kludge for selectors with argument |
|
3702 |
" |
|
3703 |
(actionSelector isMemberOf:Array) ifTrue:[ |
|
3704 |
actionArg := actionSelector at:2. |
|
3705 |
actionSelector := actionSelector at:1. |
|
3706 |
haveArg := true. |
|
3707 |
]. |
|
3708 |
||
3709 |
" |
|
3710 |
mhmh - ST-80 seems to send some to the model and |
|
3711 |
others (copy/cut/paste) to the controller/view |
|
3712 |
Simulate this behavior, by looking what the model responds to. |
|
3713 |
" |
|
3714 |
actionSelector isSymbol ifTrue:[ |
|
3715 |
(menuPerformer respondsTo:actionSelector) ifFalse:[ |
|
3716 |
(self respondsTo:actionSelector) ifTrue:[ |
|
3717 |
menuPerformer := self |
|
3718 |
] |
|
3719 |
]. |
|
3720 |
actionSelector numArgs ~~ 0 ifTrue:[ |
|
3721 |
menuPerformer perform:actionSelector with:actionArg |
|
3722 |
] ifFalse:[ |
|
3723 |
menuPerformer perform:actionSelector |
|
489
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3724 |
] |
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3725 |
]. |
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3726 |
]. |
1113 | 3727 |
|
3728 |
menu receiver:prevReceiver. |
|
3729 |
||
489
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3730 |
^ self |
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3731 |
]. |
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3732 |
]. |
520
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3733 |
|
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3734 |
"/ |
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3735 |
"/ old style static menu |
3e947f34a2af
describe menuPerformer detection in #activateMenu
Claus Gittinger <cg@exept.de>
parents:
517
diff
changeset
|
3736 |
"/ |
489
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3737 |
super activateMenu |
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3738 |
|
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3739 |
"Created: 1.3.1996 / 13:24:18 / cg" |
1259
60af09384d13
pass myself AND the menuPerformer to the popupMenu.
Claus Gittinger <cg@exept.de>
parents:
1201
diff
changeset
|
3740 |
"Modified: 21.1.1997 / 15:33:47 / cg" |
489
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3741 |
! |
97c51a9ec661
moved menu activation into separate method
Claus Gittinger <cg@exept.de>
parents:
484
diff
changeset
|
3742 |
|
269 | 3743 |
buttonPress:button x:x y:y |
659 | 3744 |
"button was pressed - check my components for a hit." |
269 | 3745 |
|
3746 |
components notNil ifTrue:[ |
|
659 | 3747 |
self componentsContainingX:x y:y do:[:comp :cx :cy | |
3748 |
comp buttonPress:button x:cx y:cy. |
|
3749 |
^ self |
|
472
621c17076f00
static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents:
468
diff
changeset
|
3750 |
] |
140 | 3751 |
]. |
3752 |
||
269 | 3753 |
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
|
3754 |
|
659 | 3755 |
"Modified: 8.5.1996 / 23:43:41 / cg" |
3756 |
! |
|
3757 |
||
3758 |
buttonRelease:button x:x y:y |
|
3759 |
"button was released - check my components for a hit." |
|
3760 |
||
3761 |
components notNil ifTrue:[ |
|
3762 |
self componentsContainingX:x y:y do:[:comp :cx :cy | |
|
3763 |
comp buttonRelease:button x:cx y:cy. |
|
3764 |
^ self |
|
3765 |
] |
|
3766 |
]. |
|
3767 |
||
3768 |
super buttonRelease:button x:x y:y |
|
3769 |
||
3770 |
"Modified: 8.5.1996 / 23:41:58 / cg" |
|
3771 |
"Created: 8.5.1996 / 23:43:25 / cg" |
|
193 | 3772 |
! |
3773 |
||
140 | 3774 |
configureX:x y:y width:newWidth height:newHeight |
3775 |
"my size has changed by window manager action" |
|
3776 |
||
180 | 3777 |
|how anyEdge mustRedrawBottomEdge mustRedrawRightEdge p| |
3778 |
||
3779 |
(superView isNil |
|
3780 |
and:[drawableId notNil]) ifTrue:[ |
|
739 | 3781 |
"/ have to be careful - some window managers (motif) wrap another |
3782 |
"/ view around and the reported origin is relative to that. |
|
3783 |
"/ not relative to the screen. |
|
3784 |
p := device translatePoint:0@0 from:drawableId to:device rootWindowId. |
|
3785 |
left := p x. |
|
3786 |
top := p y. |
|
180 | 3787 |
] ifFalse:[ |
739 | 3788 |
left := x. |
3789 |
top := y. |
|
180 | 3790 |
]. |
140 | 3791 |
((width ~~ newWidth) or:[height ~~ newHeight]) ifTrue:[ |
739 | 3792 |
realized ifFalse:[ |
3793 |
width := newWidth. |
|
3794 |
height := newHeight. |
|
3795 |
extentChanged := true. |
|
3796 |
^ self |
|
3797 |
]. |
|
3798 |
||
3799 |
((newWidth <= width) and:[newHeight <= height]) ifTrue:[ |
|
3800 |
how := #smaller |
|
3801 |
]. |
|
3802 |
||
3803 |
level ~~ 0 ifTrue:[ |
|
3804 |
mustRedrawBottomEdge := newHeight < height. |
|
3805 |
mustRedrawRightEdge := newWidth < width. |
|
3806 |
anyEdge := mustRedrawBottomEdge or:[mustRedrawRightEdge] |
|
3807 |
] ifFalse:[ |
|
3808 |
anyEdge := false |
|
3809 |
]. |
|
3810 |
||
3811 |
width := newWidth. |
|
3812 |
height := newHeight. |
|
3813 |
||
3814 |
"recompute inner-clip if needed" |
|
3815 |
self setInnerClip. |
|
3816 |
||
3817 |
" |
|
3818 |
must first process pending exposes; |
|
3819 |
otherwise, those may be drawn at a wrong position |
|
3820 |
" |
|
971 | 3821 |
"/ claus: no; expose events are in the same queue as configure events; |
3822 |
"/ which is exactly for that reason ... |
|
3823 |
||
3824 |
"/ windowGroup notNil ifTrue:[ |
|
3825 |
"/ windowGroup processExposeEvents |
|
3826 |
"/ ]. |
|
739 | 3827 |
self sizeChanged:how. |
3828 |
||
3829 |
(anyEdge and:[shown]) ifTrue:[ |
|
3830 |
self clippingRectangle:nil. |
|
3831 |
mustRedrawBottomEdge ifTrue:[ |
|
3832 |
self drawBottomEdge |
|
3833 |
]. |
|
3834 |
mustRedrawRightEdge ifTrue:[ |
|
3835 |
self drawRightEdge |
|
3836 |
]. |
|
3837 |
self clippingRectangle:innerClipRect |
|
3838 |
] |
|
140 | 3839 |
] |
739 | 3840 |
|
971 | 3841 |
"Modified: 19.7.1996 / 21:28:47 / cg" |
138 | 3842 |
! |
3843 |
||
964 | 3844 |
containerChangedSize |
3845 |
"my container has changed size; if I have relative |
|
3846 |
origin/extent or blocks to evaluate, do it now .." |
|
3847 |
||
1063 | 3848 |
|oldWidth oldHeight oldTop oldLeft newExt newOrg r| |
964 | 3849 |
|
3850 |
oldWidth := width. |
|
3851 |
oldHeight := height. |
|
3852 |
oldTop := top. |
|
3853 |
oldLeft := left. |
|
3854 |
||
3855 |
" |
|
3856 |
slowly migrating to use layoutObjects ... |
|
3857 |
" |
|
3858 |
layout isNil ifTrue:[ |
|
3859 |
newOrg := self computeOrigin. |
|
3860 |
newExt := self computeExtent. |
|
3861 |
] ifFalse:[ |
|
3862 |
r := (layout rectangleRelativeTo:(superView viewRectangle) |
|
3863 |
preferred:(self preferredBounds)). |
|
3864 |
newOrg := r origin rounded. |
|
3865 |
newExt := r extent rounded. |
|
3866 |
"/ newOrg printNL. |
|
3867 |
"/ newExt printNL. |
|
3868 |
]. |
|
3869 |
||
3870 |
newOrg notNil ifTrue:[ |
|
3871 |
((newOrg x == oldLeft) and:[newOrg y == oldTop]) ifTrue:[ |
|
3872 |
newOrg := nil |
|
3873 |
] |
|
3874 |
]. |
|
3875 |
newExt notNil ifTrue:[ |
|
3876 |
((newExt x == width) and:[newExt y == height]) ifTrue:[ |
|
3877 |
newExt := nil |
|
3878 |
] |
|
3879 |
]. |
|
3880 |
||
3881 |
newExt isNil ifTrue:[ |
|
3882 |
newOrg notNil ifTrue:[ |
|
3883 |
self pixelOrigin:newOrg |
|
3884 |
] |
|
3885 |
] ifFalse:[ |
|
3886 |
newOrg isNil ifTrue:[ |
|
3887 |
self pixelExtent:newExt |
|
3888 |
] ifFalse:[ |
|
3889 |
self pixelOrigin:newOrg extent:newExt |
|
3890 |
] |
|
3891 |
] |
|
3892 |
||
3893 |
"Modified: 19.7.1996 / 17:32:50 / cg" |
|
3894 |
! |
|
3895 |
||
3896 |
containerMapped |
|
3897 |
"my container was mapped (became visible). |
|
3898 |
If I was previously realized, this implies that I myself |
|
3899 |
am now mapped as well." |
|
3900 |
||
3901 |
"/ if I was not previously shown, tell it to all of |
|
3902 |
"/ my subviews (they remember this in the shown instVar) |
|
3903 |
||
3904 |
realized ifTrue:[ |
|
3905 |
shown ifFalse:[ |
|
3906 |
"/ old: |
|
3907 |
"/ shown := true. |
|
3908 |
"/ subViews notNil ifTrue:[ |
|
3909 |
"/ subViews do:[:v | |
|
3910 |
"/ v containerMapped |
|
3911 |
"/ ] |
|
3912 |
"/ ] |
|
3913 |
||
3914 |
"/ which is equivalent to: |
|
3915 |
self mapped. |
|
3916 |
] |
|
3917 |
]. |
|
3918 |
||
3919 |
"Modified: 30.5.1996 / 11:41:02 / cg" |
|
3920 |
"Created: 19.7.1996 / 17:41:10 / cg" |
|
3921 |
! |
|
3922 |
||
3923 |
containerUnmapped |
|
3924 |
"my container was unmapped |
|
3925 |
- this implies that the recevier is now also unmapped." |
|
3926 |
||
3927 |
"/ if I was previously shown, tell it to all of |
|
3928 |
"/ my subviews (they remember this in the shown instVar) |
|
3929 |
||
3930 |
realized ifTrue:[ |
|
3931 |
shown ifTrue:[ |
|
3932 |
self unmapped |
|
3933 |
] |
|
3934 |
] |
|
3935 |
||
3936 |
"Modified: 30.5.1996 / 11:41:25 / cg" |
|
3937 |
"Created: 19.7.1996 / 17:43:50 / cg" |
|
3938 |
! |
|
3939 |
||
269 | 3940 |
coveredBy:aView |
3941 |
"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
|
3942 |
we are not interested in that here (but see modalBox for more)." |
269 | 3943 |
! |
3944 |
||
3945 |
destroyed |
|
3946 |
"view has been destroyed by someone else (usually window system)" |
|
3947 |
||
3948 |
shown := false. |
|
3949 |
super destroyed |
|
3950 |
! |
|
3951 |
||
135 | 3952 |
exposeX:x y:y width:w height:h |
3953 |
"a low level redraw event from device |
|
3954 |
- let subclass handle the redraw and take care of edges here" |
|
3955 |
||
754 | 3956 |
|leftEdge topEdge rightEdge botEdge anyEdge nx ny nw nh old| |
135 | 3957 |
|
3958 |
nw := w. |
|
3959 |
nh := h. |
|
3960 |
nx := x. |
|
3961 |
ny := y. |
|
3962 |
||
3963 |
anyEdge := false. |
|
3964 |
||
3965 |
" |
|
3966 |
check if there is a need to draw an edge (i.e. if margin is hit) |
|
3967 |
" |
|
3968 |
(margin ~~ 0) ifTrue:[ |
|
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3969 |
leftEdge := false. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3970 |
topEdge := false. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3971 |
rightEdge := false. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3972 |
botEdge := false. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3973 |
transformation notNil ifTrue:[ |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3974 |
" |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3975 |
need device coordinates for this test |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3976 |
" |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3977 |
nx := transformation applyToX:nx. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3978 |
ny := transformation applyToY:ny. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3979 |
nw := transformation applyScaleX:nw. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3980 |
nh := transformation applyScaleY:nh. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3981 |
]. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3982 |
" |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3983 |
adjust expose rectangle, to exclude the margin. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3984 |
Care for rounding errors ... |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3985 |
" |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3986 |
(nx isMemberOf:SmallInteger) ifFalse:[ |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3987 |
old := nx. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3988 |
nx := nx truncated. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3989 |
nw := nw + (nx - old). |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3990 |
]. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3991 |
(ny isMemberOf:SmallInteger) ifFalse:[ |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3992 |
old := ny. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3993 |
ny := ny truncated. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3994 |
nh := nh + (ny - old). |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3995 |
]. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3996 |
(nw isMemberOf:SmallInteger) ifFalse:[ |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3997 |
nw := nw truncated + 1 |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3998 |
]. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
3999 |
(nh isMemberOf:SmallInteger) ifFalse:[ |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4000 |
nh := nh truncated + 1 |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4001 |
]. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4002 |
(nx < margin) ifTrue:[ |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4003 |
old := nx. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4004 |
nx := margin. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4005 |
nw := nw - (nx - old). |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4006 |
leftEdge := anyEdge := true. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4007 |
]. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4008 |
((nx + nw - 1) >= (width - margin)) ifTrue:[ |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4009 |
nw := (width - margin - nx). |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4010 |
rightEdge := anyEdge := true. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4011 |
]. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4012 |
(ny < margin) ifTrue:[ |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4013 |
old := ny. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4014 |
ny := margin. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4015 |
nh := nh - (ny - old). |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4016 |
topEdge := anyEdge := true. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4017 |
]. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4018 |
((ny + nh - 1) >= (height - margin)) ifTrue:[ |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4019 |
nh := (height - margin - ny). |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4020 |
botEdge := anyEdge := true. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4021 |
]. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4022 |
transformation notNil ifTrue:[ |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4023 |
" |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4024 |
need logical coordinates for redraw |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4025 |
" |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4026 |
nx := transformation applyInverseToX:nx. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4027 |
ny := transformation applyInverseToY:ny. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4028 |
nw := transformation applyInverseScaleX:nw. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4029 |
nh := transformation applyInverseScaleY:nh. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4030 |
]. |
135 | 4031 |
]. |
4032 |
||
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4033 |
(nw > 0 and:[nh > 0]) ifTrue:[ |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4034 |
" |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4035 |
redraw inside area |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4036 |
" |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4037 |
self redrawX:nx y:ny width:nw height:nh. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4038 |
]. |
135 | 4039 |
|
4040 |
" |
|
4041 |
redraw edge(s) |
|
4042 |
" |
|
4043 |
anyEdge ifTrue:[ |
|
738 | 4044 |
self clippingRectangle:nil. |
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4045 |
(topEdge and:[leftEdge and:[botEdge and:[rightEdge]]]) ifTrue:[ |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4046 |
self drawEdges |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4047 |
] ifFalse:[ |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4048 |
topEdge ifTrue:[ |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4049 |
self drawTopEdge |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4050 |
]. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4051 |
leftEdge ifTrue:[ |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4052 |
self drawLeftEdge |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4053 |
]. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4054 |
botEdge ifTrue:[ |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4055 |
self drawBottomEdge |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4056 |
]. |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4057 |
rightEdge ifTrue:[ |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4058 |
self drawRightEdge |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4059 |
] |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4060 |
]. |
754 | 4061 |
self clippingRectangle:innerClipRect |
135 | 4062 |
] |
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
4063 |
|
754 | 4064 |
"Modified: 28.5.1996 / 22:31:49 / cg" |
135 | 4065 |
! |
4066 |
||
269 | 4067 |
focusIn |
385
15fd1c806d2a
pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents:
376
diff
changeset
|
4068 |
"got keyboard focus (via the window manager)" |
15fd1c806d2a
pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents:
376
diff
changeset
|
4069 |
|
1381 | 4070 |
delegate notNil ifTrue:[ |
1402 | 4071 |
(delegate respondsTo:#handlesKeyPress:inView:) ifTrue:[ |
4072 |
(delegate handlesKeyPress:#Any inView:self) ifTrue:[ |
|
4073 |
delegate showFocus:false. |
|
4074 |
^ self |
|
4075 |
] |
|
1381 | 4076 |
] |
4077 |
]. |
|
385
15fd1c806d2a
pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents:
376
diff
changeset
|
4078 |
self showFocus:false |
1381 | 4079 |
|
1402 | 4080 |
"Modified: 28.2.1997 / 23:29:12 / cg" |
269 | 4081 |
! |
4082 |
||
4083 |
focusOut |
|
385
15fd1c806d2a
pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents:
376
diff
changeset
|
4084 |
"lost keyboard focus (via the window manager)" |
15fd1c806d2a
pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents:
376
diff
changeset
|
4085 |
|
1381 | 4086 |
delegate notNil ifTrue:[ |
1402 | 4087 |
(delegate respondsTo:#handlesKeyPress:inView:) ifTrue:[ |
4088 |
(delegate handlesKeyPress:#Any inView:self) ifTrue:[ |
|
4089 |
delegate showNoFocus:false. |
|
4090 |
^ self |
|
4091 |
] |
|
1381 | 4092 |
] |
4093 |
]. |
|
385
15fd1c806d2a
pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents:
376
diff
changeset
|
4094 |
self showNoFocus:false |
1381 | 4095 |
|
1402 | 4096 |
"Modified: 28.2.1997 / 23:29:23 / cg" |
269 | 4097 |
! |
4098 |
||
4099 |
hasKeyboardFocus:aBoolean |
|
140 | 4100 |
^ self |
4101 |
! |
|
4102 |
||
4103 |
keyPress:key x:x y:y |
|
4104 |
"a key has been pressed. If there are components, |
|
4105 |
pass it to the corresponding one. |
|
4106 |
Otherwise, forward it to the superview, if there is any." |
|
4107 |
||
510 | 4108 |
<resource: #keyboard ( #Menu ) > |
4109 |
||
140 | 4110 |
components notNil ifTrue:[ |
659 | 4111 |
components notNil ifTrue:[ |
4112 |
self componentsContainingX:x y:y do:[:comp :cx :cy | |
|
4113 |
comp keyPress:key x:cx y:cy. |
|
490
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4114 |
^ self |
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4115 |
] |
659 | 4116 |
]. |
490
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4117 |
]. |
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4118 |
|
494 | 4119 |
key == #Menu ifTrue:[ |
490
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4120 |
^ self activateMenu. |
135 | 4121 |
]. |
4122 |
||
490
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4123 |
x isNil ifTrue:[ |
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4124 |
"/ already redelegated, but nowhere handled |
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4125 |
superView notNil ifTrue:[ |
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4126 |
superView keyPress:key x:nil y:nil. |
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4127 |
]. |
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4128 |
^ self |
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4129 |
]. |
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4130 |
|
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4131 |
superView notNil ifTrue:[ |
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4132 |
WindowEvent |
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4133 |
sendEvent:#keyPress:x:y: |
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4134 |
arguments:(Array with:key with:0 with:0) |
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4135 |
view:superView |
411
2d5deb02d8f8
if not already forwarded, let keyEvents be handled by superView
Claus Gittinger <cg@exept.de>
parents:
393
diff
changeset
|
4136 |
] ifFalse:[ |
490
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
4137 |
super keyPress:key x:x y:y |
135 | 4138 |
] |
411
2d5deb02d8f8
if not already forwarded, let keyEvents be handled by superView
Claus Gittinger <cg@exept.de>
parents:
393
diff
changeset
|
4139 |
|
954 | 4140 |
"Modified: 18.7.1996 / 11:47:03 / cg" |
659 | 4141 |
! |
4142 |
||
4143 |
keyRelease:key x:x y:y |
|
4144 |
"a key has been released. If there are components, |
|
4145 |
pass it to the corresponding one. |
|
4146 |
Otherwise, do whatever my superclass would do." |
|
4147 |
||
4148 |
components notNil ifTrue:[ |
|
4149 |
components notNil ifTrue:[ |
|
4150 |
self componentsContainingX:x y:y do:[:comp :cx :cy | |
|
4151 |
comp keyRelease:key x:cx y:cy. |
|
4152 |
^ self |
|
4153 |
] |
|
4154 |
]. |
|
4155 |
]. |
|
4156 |
||
4157 |
super keyRelease:key x:x y:y |
|
4158 |
||
4159 |
"Modified: 8.5.1996 / 23:44:36 / cg" |
|
4160 |
"Created: 8.5.1996 / 23:45:28 / cg" |
|
135 | 4161 |
! |
4162 |
||
269 | 4163 |
mapped |
4164 |
"the view has been mapped (by some outside |
|
4165 |
action - i.e. window manager de-iconified me)" |
|
4166 |
||
4167 |
" |
|
4168 |
the old code was: |
|
4169 |
||
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
4170 |
realized := true. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
4171 |
shown := true. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
4172 |
... |
269 | 4173 |
|
4174 |
this created a race condition, if the view was |
|
4175 |
realized and shortly after unrealized - before the mapped event |
|
1379 | 4176 |
arrived. This lead to realized being set to true even thought the |
4177 |
view was not. |
|
4178 |
Boy - that was a bad one (hard to reproduce and hard to find). |
|
269 | 4179 |
" |
4180 |
||
4181 |
realized ifTrue:[ |
|
769 | 4182 |
|
4183 |
"/ currently, the 'shown ifFalse:' optimization is |
|
964 | 4184 |
"/ not ok, since 'shown' is also modified by visibilityChanges. |
4185 |
"/ Also, when remapped, X11 only sends a mapped event for the topView. |
|
769 | 4186 |
"/ Therefore, synthetically generate those #superViewMapped messages |
4187 |
"/ in any case. |
|
4188 |
||
1379 | 4189 |
shown := true. |
4190 |
" |
|
4191 |
backed views will not get expose events - have |
|
4192 |
to force a redraw here to get things drawn into |
|
4193 |
backing store. |
|
4194 |
" |
|
4195 |
backed ifTrue:[ |
|
4196 |
self redrawX:0 y:0 width:width height:height |
|
4197 |
]. |
|
4198 |
subViews notNil ifTrue:[ |
|
4199 |
subViews do:[:v | |
|
4200 |
v containerMapped |
|
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
4201 |
] |
1379 | 4202 |
] |
269 | 4203 |
] |
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
4204 |
|
1379 | 4205 |
"Modified: 25.2.1997 / 22:41:34 / cg" |
269 | 4206 |
! |
4207 |
||
1381 | 4208 |
pointerEnter:state x:x y:y |
4209 |
"got mouse pointer" |
|
4210 |
||
4211 |
self focusIn |
|
4212 |
||
4213 |
"Modified: 25.2.1997 / 23:43:21 / cg" |
|
4214 |
! |
|
4215 |
||
4216 |
pointerLeave:state |
|
4217 |
"got mouse pointer" |
|
4218 |
||
4219 |
self focusOut |
|
4220 |
||
4221 |
"Modified: 25.2.1997 / 23:43:17 / cg" |
|
4222 |
! |
|
4223 |
||
269 | 4224 |
reparented |
4225 |
"the view has changed its parent by some outside |
|
4226 |
action - i.e. window manager has added a frame. |
|
4227 |
nothing done here" |
|
4228 |
||
4229 |
^ self |
|
4230 |
! |
|
4231 |
||
4232 |
saveAndTerminate |
|
4233 |
"window manager wants me to save and go away; |
|
4234 |
- notice, that not all window managers are nice enough to |
|
4235 |
send this event, but simply destroy the view instead. |
|
4236 |
Can be redefined in subclasses to do whatever is required |
|
4237 |
to prepare for restart." |
|
4238 |
||
4239 |
^ self destroy |
|
4240 |
! |
|
4241 |
||
4242 |
sizeChanged:how |
|
4243 |
"tell subviews if I change size. |
|
4244 |
How is either #smaller, #larger or nil, and is used to control the order, |
|
4245 |
in which subviews are notified (possibly reducing redraw activity)" |
|
4246 |
||
1290
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
4247 |
|subViews| |
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
4248 |
|
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
4249 |
(subViews := self subViews) notNil ifTrue:[ |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4250 |
(how isNil "false" |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4251 |
or:[how == #smaller]) ifTrue:[ |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4252 |
subViews do:[:view | |
964 | 4253 |
view containerChangedSize |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4254 |
] |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4255 |
] ifFalse:[ |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4256 |
"doing it reverse speeds up resizing - usually subviews |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4257 |
are created from top-left to bottom-right; therefore |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4258 |
bottom-right views will be moved/resized first, then top-left ones; |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4259 |
this avoids multiple redraws of subviews" |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4260 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4261 |
subViews reverseDo:[:view | |
964 | 4262 |
view containerChangedSize |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4263 |
] |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4264 |
] |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4265 |
]. |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4266 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4267 |
components notNil ifTrue:[ |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4268 |
(how isNil "false" |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4269 |
or:[how == #smaller]) ifTrue:[ |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4270 |
components do:[:view | |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4271 |
view containerChangedSize |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4272 |
] |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4273 |
] ifFalse:[ |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4274 |
"doing it reverse speeds up resizing - usually subviews |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4275 |
are created from top-left to bottom-right; therefore |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4276 |
bottom-right views will be moved/resized first, then top-left ones; |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4277 |
this avoids multiple redraws of subviews" |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4278 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4279 |
components reverseDo:[:view | |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4280 |
view containerChangedSize |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4281 |
] |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4282 |
] |
135 | 4283 |
]. |
1290
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
4284 |
|
269 | 4285 |
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
|
4286 |
|
269 | 4287 |
superView notNil ifTrue:[ |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4288 |
superView subViewChangedSize |
269 | 4289 |
] |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
4290 |
|
1290
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
4291 |
"Modified: 28.1.1997 / 17:58:53 / cg" |
269 | 4292 |
! |
4293 |
||
4294 |
subViewChangedSize |
|
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
4295 |
"some subview has changed its size; we are not interested |
269 | 4296 |
in that here, but some geometry managers redefine this, to reorganize |
4297 |
components if that happens." |
|
4298 |
||
4299 |
^ self |
|
4300 |
||
4301 |
"Created: 22.9.1995 / 14:44:59 / claus" |
|
4302 |
! |
|
4303 |
||
4304 |
terminate |
|
4305 |
"window manager wants me to go away; |
|
4306 |
- notice, that not all window managers are nice enough to |
|
4307 |
send this event, but simply destroy the view instead. |
|
4308 |
Can be redefined in subclasses to do whatever cleanup is |
|
4309 |
required." |
|
4310 |
||
4311 |
^ self destroy |
|
4312 |
! |
|
4313 |
||
4314 |
unmapped |
|
4315 |
"the view has been unmapped |
|
4316 |
(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
|
4317 |
or due to unmapping of my parentView)." |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
4318 |
|
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
4319 |
"/ 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
|
4320 |
"/ my subviews (they remember this in the shown instVar) |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
4321 |
|
769 | 4322 |
"/ currently, the 'shown ifTrue:' optimization is |
964 | 4323 |
"/ not ok, since 'shown' is also modified by visibilityChanges. |
4324 |
"/ Also, when remapped, X11 only sends a mapped event for the topView. |
|
769 | 4325 |
"/ Therefore, synthetically generate those #superViewUnmapped messages |
4326 |
"/ in any case. |
|
4327 |
||
1379 | 4328 |
shown := false. |
4329 |
subViews notNil ifTrue:[ |
|
4330 |
subViews do:[:v | |
|
4331 |
v containerUnmapped |
|
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
4332 |
] |
1379 | 4333 |
] |
4334 |
||
4335 |
"Modified: 25.2.1997 / 22:40:52 / cg" |
|
135 | 4336 |
! |
4337 |
||
4338 |
visibilityChange:how |
|
4339 |
"the visibility of the view has changed (by some outside |
|
4340 |
action - i.e. window manager rearranged things). |
|
4341 |
Using this knowledge avoids useless redraw in obsucred views." |
|
4342 |
||
4343 |
how == #fullyObscured ifTrue:[ |
|
1356 | 4344 |
shown := false |
135 | 4345 |
] ifFalse:[ |
1356 | 4346 |
shown := true. |
135 | 4347 |
] |
269 | 4348 |
! ! |
4349 |
||
1302 | 4350 |
!SimpleView methodsFor:'event simulation'! |
4351 |
||
4352 |
pushEvent:aSelector |
|
4353 |
"push some messageSend into my event queue - |
|
4354 |
I will perform the corresponding method when its time |
|
4355 |
to handle events (useful to update low-prio views from |
|
4356 |
a higher prio process, to avoid blocking in the high prio one)" |
|
4357 |
||
4358 |
|sensor| |
|
4359 |
||
4360 |
(sensor := self sensor) notNil ifTrue:[ |
|
4361 |
sensor pushUserEvent:aSelector for:self |
|
4362 |
] ifFalse:[ |
|
4363 |
self perform:aSelector |
|
4364 |
] |
|
4365 |
||
4366 |
" |
|
4367 |
|v| |
|
4368 |
||
4369 |
v := View new openAndWait. |
|
4370 |
v fill:Color red. |
|
4371 |
v pushEvent:#redraw |
|
4372 |
" |
|
4373 |
||
4374 |
"Modified: 31.1.1997 / 16:09:27 / cg" |
|
4375 |
! |
|
4376 |
||
4377 |
pushEvent:aSelector withArguments:args |
|
4378 |
"push some messageSend into my event queue - |
|
4379 |
I will perform the corresponding method when its time |
|
4380 |
to handle events (useful to update low-prio views from |
|
4381 |
a higher prio process, to avoid blocking in the high prio one)" |
|
4382 |
||
4383 |
|sensor| |
|
4384 |
||
4385 |
(sensor := self sensor) notNil ifTrue:[ |
|
4386 |
sensor pushUserEvent:aSelector for:self withArguments:args |
|
4387 |
] ifFalse:[ |
|
4388 |
self perform:aSelector |
|
4389 |
] |
|
4390 |
||
4391 |
" |
|
4392 |
|v| |
|
4393 |
||
4394 |
v := (Button label:'hello') openAndWait. |
|
4395 |
Delay waitForSeconds:1. |
|
4396 |
v pushEvent:#buttonPress:x:y: withArguments:#(1 10 10). |
|
4397 |
Delay waitForSeconds:1. |
|
4398 |
v pushEvent:#buttonRelease:x:y: withArguments:#(1 10 10). |
|
4399 |
" |
|
4400 |
||
4401 |
"Modified: 31.1.1997 / 16:10:40 / cg" |
|
4402 |
! ! |
|
4403 |
||
269 | 4404 |
!SimpleView methodsFor:'informing others of changes'! |
4405 |
||
4406 |
contentsChanged |
|
4407 |
"this one is sent, whenever contents changes size - |
|
4408 |
tell dependents about the change (i.e. scrollers)." |
|
4409 |
||
4410 |
self changed:#sizeOfContents |
|
4411 |
! |
|
4412 |
||
4413 |
originChanged:delta |
|
4414 |
"this one is sent, after the origin of my contents has changed - |
|
4415 |
tell dependents (i.e. scrollers) about this" |
|
4416 |
||
4417 |
self changed:#originOfContents with:delta. |
|
4418 |
"/ subViews notNil ifTrue:[ |
|
4419 |
"/ subViews do:[:aSubView | |
|
4420 |
"/ aSubView pixelOrigin:((aSubView left @ aSubView top) - delta) |
|
4421 |
"/ ] |
|
4422 |
"/ ] |
|
4423 |
! |
|
4424 |
||
4425 |
originWillChange |
|
4426 |
"this one is sent, just before viewOrigin changes - |
|
4427 |
gives subclasses a chance to catch scrolls easily |
|
4428 |
(for example to hide cursor before scroll)" |
|
4429 |
||
4430 |
^ self |
|
4431 |
! ! |
|
4432 |
||
4433 |
!SimpleView methodsFor:'initialization'! |
|
4434 |
||
4435 |
defaultControllerClass |
|
4436 |
^ nil "/ Controller |
|
4437 |
! |
|
4438 |
||
483
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
4439 |
defaultExtent |
586 | 4440 |
"return the default extent of my instances." |
4441 |
||
483
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
4442 |
^ self class defaultExtent |
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
4443 |
|
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
4444 |
"Created: 1.3.1996 / 19:20:46 / cg" |
586 | 4445 |
"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
|
4446 |
! |
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
4447 |
|
269 | 4448 |
initEvents |
4449 |
"will be sent by create - can be redefined by subclasses to enable |
|
4450 |
view events" |
|
4451 |
||
4452 |
^ self |
|
4453 |
! |
|
4454 |
||
4455 |
initStyle |
|
4456 |
"this method sets up all style dependent things" |
|
4457 |
||
4458 |
self initStyleSheet. |
|
4459 |
||
4460 |
borderWidth := DefaultBorderWidth. |
|
4461 |
borderWidth isNil ifTrue:[borderWidth := 1]. |
|
4462 |
||
4463 |
viewBackground := DefaultViewBackgroundColor. |
|
4464 |
||
4465 |
DefaultLightColor notNil ifTrue:[ |
|
747 | 4466 |
lightColor := DefaultLightColor. |
269 | 4467 |
] ifFalse:[ |
749 | 4468 |
device hasGrayscales ifTrue:[ |
747 | 4469 |
DefaultLightColor := lightColor := viewBackground lightened. |
4470 |
] ifFalse:[ |
|
4471 |
" |
|
4472 |
this seems strange: on B&W screens, we create the light color |
|
4473 |
darker than normal viewBackground (White) - |
|
4474 |
to make the boundary of the view visible |
|
4475 |
" |
|
4476 |
lightColor := Color gray:50 |
|
4477 |
] |
|
269 | 4478 |
]. |
4479 |
DefaultShadowColor notNil ifTrue:[ |
|
747 | 4480 |
shadowColor := DefaultShadowColor. |
269 | 4481 |
] ifFalse:[ |
747 | 4482 |
shadowColor := Black |
269 | 4483 |
]. |
4484 |
||
4485 |
lightColor := lightColor. |
|
4486 |
shadowColor := shadowColor. |
|
4487 |
borderColor := DefaultBorderColor. |
|
452
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
4488 |
font := self class defaultFont. |
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
4489 |
font := font on:device. |
747 | 4490 |
|
749 | 4491 |
"Modified: 28.5.1996 / 21:13:58 / cg" |
269 | 4492 |
! |
4493 |
||
4494 |
initStyleSheet |
|
4495 |
"this method gets the styleSheet" |
|
4496 |
||
4497 |
" |
|
4498 |
when coming here the first time, we read the styleSheet |
|
4499 |
and keep the values in fast class variables |
|
4500 |
" |
|
4501 |
StyleSheet isNil ifTrue:[ |
|
1005
03041f7fb340
init styleSheet (in case no startup file did it)
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
4502 |
DefaultStyle isNil ifTrue:[ |
03041f7fb340
init styleSheet (in case no startup file did it)
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
4503 |
"/ the very-very first time (no styleSheet yet) |
03041f7fb340
init styleSheet (in case no startup file did it)
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
4504 |
View defaultStyle:#normal. |
03041f7fb340
init styleSheet (in case no startup file did it)
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
4505 |
]. |
03041f7fb340
init styleSheet (in case no startup file did it)
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
4506 |
self class updateStyleCache |
269 | 4507 |
]. |
4508 |
||
4509 |
styleSheet := StyleSheet. |
|
1005
03041f7fb340
init styleSheet (in case no startup file did it)
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
4510 |
|
03041f7fb340
init styleSheet (in case no startup file did it)
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
4511 |
"Modified: 25.7.1996 / 22:00:06 / cg" |
269 | 4512 |
! |
4513 |
||
4514 |
initialize |
|
4515 |
"initialize all state of the view - usually redefined in subclasses, |
|
4516 |
but always doing a 'super initialize'. Each class should setup its |
|
4517 |
locals - and not forget the others. |
|
4518 |
View setup is separated into two parts, the general setup done here |
|
4519 |
and the style specific setup in initStyle. Each view should be prepared |
|
4520 |
for a stylechange by being sent another initStyle with a new style value. |
|
4521 |
(in this case, it should set all of its style-dependent things, but |
|
4522 |
leave the state and contents as-is)" |
|
4523 |
||
4524 |
|ext myClass controllerClass| |
|
4525 |
||
4526 |
super initialize. |
|
4527 |
||
452
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
4528 |
font := self class defaultFont. |
269 | 4529 |
|
4530 |
shown := hiddenOnRealize := realized := false. |
|
4531 |
||
4532 |
"fill in some defaults - some of them are usually redefined in subclasses |
|
4533 |
initialize methods" |
|
4534 |
||
4535 |
myClass := self class. |
|
4536 |
name := myClass name "asString" asLowercaseFirst. |
|
4537 |
resources := myClass classResources. |
|
4538 |
||
4539 |
level := margin := 0. |
|
4540 |
margin := 0. |
|
4541 |
||
4542 |
self initStyle. |
|
4543 |
||
483
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
4544 |
ext := self defaultExtent. |
269 | 4545 |
left := top := 0. |
4546 |
width := ext x. |
|
4547 |
height := ext y. |
|
4548 |
||
4549 |
originChanged := extentChanged := false. |
|
4550 |
bitGravity := nil. |
|
4551 |
viewGravity := nil. |
|
4552 |
||
4553 |
controllerClass := self defaultControllerClass. |
|
4554 |
controllerClass notNil ifTrue:[ |
|
483
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
4555 |
controller := controllerClass new. |
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
4556 |
controller view:self. |
269 | 4557 |
]. |
483
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
4558 |
|
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
4559 |
"Modified: 1.3.1996 / 19:21:24 / cg" |
269 | 4560 |
! |
4561 |
||
4562 |
initializeMiddleButtonMenu |
|
4563 |
"a place to initialize menu - this one is sent once when the view is |
|
4564 |
first created; usually redefined in subclasses; default here is no menu. |
|
4565 |
Notice, that static middleButtonmenus are a historic thing in ST/X; |
|
4566 |
you may prefer to create the menu dynamically (i.e. the ST-80 way)." |
|
4567 |
||
4568 |
^ self |
|
4569 |
! |
|
4570 |
||
4571 |
prepareForReinit |
|
4572 |
super prepareForReinit. |
|
4573 |
windowGroup notNil ifTrue:[ |
|
1356 | 4574 |
windowGroup reinitialize |
269 | 4575 |
] |
4576 |
! |
|
4577 |
||
4578 |
reinitStyle |
|
4579 |
"this method is called for a style change" |
|
4580 |
||
4581 |
|t| |
|
4582 |
||
4583 |
self initStyle. |
|
4584 |
drawableId notNil ifTrue:[ |
|
782 | 4585 |
"force a change" |
4586 |
t := borderWidth. borderWidth := nil. self borderWidth:t. |
|
4587 |
t := viewBackground. viewBackground := nil. self viewBackground:t. |
|
1329 | 4588 |
self invalidate. |
4589 |
]. |
|
4590 |
||
4591 |
"Modified: 29.5.1996 / 18:03:45 / cg" |
|
269 | 4592 |
! |
4593 |
||
4594 |
reinitialize |
|
795 | 4595 |
"this is called right after snapIn" |
269 | 4596 |
|
4597 |
|myController| |
|
4598 |
||
4599 |
"if I have already been reinited - return" |
|
4600 |
drawableId notNil ifTrue:[ |
|
795 | 4601 |
^ self |
269 | 4602 |
]. |
4603 |
||
4604 |
" |
|
4605 |
superView must be there, first |
|
4606 |
" |
|
4607 |
superView notNil ifTrue:[ |
|
795 | 4608 |
superView view id isNil ifTrue:[ |
4609 |
superView view reinitialize |
|
4610 |
] |
|
269 | 4611 |
]. |
4612 |
||
4613 |
myController := controller. |
|
4614 |
controller := nil. |
|
4615 |
self recreate. |
|
4616 |
||
4617 |
"if I was mapped, do it again" |
|
4618 |
realized ifTrue:[ |
|
795 | 4619 |
"only remap if I have a superview - otherwise, I might be |
4620 |
a hidden iconView or menu ..." |
|
4621 |
superView notNil ifTrue:[ |
|
269 | 4622 |
"/ shown ifTrue:[ |
795 | 4623 |
device mapView:self id:drawableId iconified:false |
4624 |
atX:left y:top width:width height:height |
|
269 | 4625 |
"/ ]. |
795 | 4626 |
]. |
269 | 4627 |
]. |
4628 |
||
4629 |
"restore controller" |
|
4630 |
controller := myController |
|
795 | 4631 |
|
4632 |
"Modified: 5.6.1996 / 19:38:22 / cg" |
|
135 | 4633 |
! ! |
4634 |
||
1028 | 4635 |
!SimpleView methodsFor:'misc'! |
4636 |
||
4637 |
grabPointer |
|
4638 |
"grab the pointer - that is: report all motion events relative to |
|
4639 |
myself, even if moved out of myself." |
|
4640 |
||
4641 |
device grabPointerIn:drawableId |
|
4642 |
! |
|
4643 |
||
4644 |
ungrabPointer |
|
4645 |
"ungrab the pointer" |
|
4646 |
||
4647 |
device ungrabPointer |
|
4648 |
! ! |
|
4649 |
||
140 | 4650 |
!SimpleView methodsFor:'private'! |
4651 |
||
659 | 4652 |
componentsContainingX:x y:y do:aBlock |
4653 |
components notNil ifTrue:[ |
|
4654 |
components do:[:aComponent | |
|
4655 |
|thisFrame| |
|
4656 |
||
4657 |
thisFrame := aComponent bounds. |
|
4658 |
(thisFrame containsPointX:x y:y) ifTrue:[ |
|
4659 |
aBlock value:aComponent |
|
4660 |
value:x - thisFrame left |
|
4661 |
value:y - thisFrame top. |
|
4662 |
] |
|
4663 |
] |
|
4664 |
]. |
|
4665 |
||
4666 |
"Created: 8.5.1996 / 23:40:59 / cg" |
|
4667 |
! |
|
4668 |
||
140 | 4669 |
computeInnerClip |
4670 |
"compute, but do not set the inside clip-area" |
|
4671 |
||
4672 |
|m2 nX nY nW nH| |
|
4673 |
||
4674 |
(margin ~~ 0) ifTrue:[ |
|
1356 | 4675 |
m2 := margin + margin. |
4676 |
nX := nY := margin. |
|
4677 |
nW := width - m2. |
|
4678 |
nH := height - m2. |
|
4679 |
transformation notNil ifTrue:[ |
|
4680 |
nX := transformation applyInverseToX:nX. |
|
4681 |
nY := transformation applyInverseToY:nY. |
|
4682 |
nW := transformation applyInverseScaleX:nW. |
|
4683 |
nH := transformation applyInverseScaleY:nH. |
|
4684 |
]. |
|
4685 |
innerClipRect := Rectangle |
|
4686 |
left:nX |
|
4687 |
top:nY |
|
4688 |
width:nW |
|
4689 |
height:nH |
|
140 | 4690 |
] ifFalse:[ |
1356 | 4691 |
"no clipping" |
4692 |
innerClipRect := nil |
|
140 | 4693 |
] |
4694 |
! |
|
4695 |
||
269 | 4696 |
cornerFromRelativeCorner |
4697 |
"compute & return pixel corner from relativeCorner" |
|
4698 |
||
4699 |
^ self cornerFromRelativeCorner:relativeCorner |
|
4700 |
! |
|
4701 |
||
4702 |
cornerFromRelativeCorner:aPoint |
|
4703 |
"compute & return pixel corner from a relativeCorner, aPoint" |
|
4704 |
||
4705 |
|p r b bw| |
|
4706 |
||
4707 |
p := self pointFromRelative:aPoint. |
|
4708 |
||
4709 |
bw := borderWidth. |
|
4710 |
insets isNil ifTrue:[ |
|
1356 | 4711 |
bw == 0 ifTrue:[ |
4712 |
^ p |
|
4713 |
]. |
|
4714 |
^ (p x - bw) @ (p y - bw) |
|
269 | 4715 |
]. |
4716 |
r := (insets at:3) + bw. |
|
4717 |
b := (insets at:4) + bw. |
|
4718 |
||
4719 |
"/ r := b := bw. |
|
4720 |
"/ rightInset notNil ifTrue:[ |
|
4721 |
"/ r := rightInset + bw |
|
4722 |
"/ ]. |
|
4723 |
"/ bottomInset notNil ifTrue:[ |
|
4724 |
"/ b := bottomInset + bw |
|
4725 |
"/ ]. |
|
4726 |
((r ~~ 0) or:[b ~~ 0]) ifTrue:[ |
|
1356 | 4727 |
^ (p x - r) @ (p y - b) |
269 | 4728 |
]. |
4729 |
^ p |
|
4730 |
! |
|
4731 |
||
4732 |
extentFromRelativeExtent |
|
4733 |
"compute & return pixel extent from relativeExtent" |
|
4734 |
||
4735 |
^ self extentFromRelativeExtent:relativeExtent |
|
4736 |
! |
|
4737 |
||
4738 |
extentFromRelativeExtent:aPoint |
|
4739 |
"compute & return pixel extent from relativeExtent, aPoint" |
|
4740 |
||
4741 |
|rel newX newY inRect bw2 i| |
|
4742 |
||
4743 |
superView isNil ifTrue:[ |
|
1356 | 4744 |
inRect := 0@0 extent:device extent |
269 | 4745 |
] ifFalse:[ |
1356 | 4746 |
inRect := superView viewRectangle. |
269 | 4747 |
]. |
4748 |
||
4749 |
bw2 := borderWidth * 2. |
|
4750 |
||
4751 |
rel := aPoint x. |
|
4752 |
rel isInteger ifFalse:[ |
|
1356 | 4753 |
newX := (rel * (inRect width + bw2)) asInteger + inRect left. |
4754 |
(borderWidth ~~ 0) ifTrue:[ |
|
4755 |
newX := newX - borderWidth |
|
4756 |
]. |
|
269 | 4757 |
] ifTrue:[ |
1356 | 4758 |
newX := rel |
269 | 4759 |
]. |
4760 |
||
4761 |
rel := aPoint y. |
|
4762 |
rel isInteger ifFalse:[ |
|
1356 | 4763 |
newY := (rel * (inRect height + bw2)) asInteger + inRect top. |
4764 |
(borderWidth ~~ 0) ifTrue:[ |
|
4765 |
newY := newY - borderWidth |
|
4766 |
]. |
|
269 | 4767 |
] ifTrue:[ |
1356 | 4768 |
newY := rel |
269 | 4769 |
]. |
4770 |
||
4771 |
insets notNil ifTrue:[ |
|
1356 | 4772 |
i := insets at:1. "top" |
4773 |
(i ~~ 0) ifTrue:[ |
|
4774 |
newX := newX - i |
|
4775 |
]. |
|
4776 |
i := insets at:3. "left" |
|
4777 |
(i ~~ 0) ifTrue:[ |
|
4778 |
newX := newX - i |
|
4779 |
]. |
|
4780 |
i := insets at:2. "right" |
|
4781 |
(i ~~ 0) ifTrue:[ |
|
4782 |
newY := newY - i |
|
4783 |
]. |
|
4784 |
i := insets at:4. "bottom" |
|
4785 |
(i ~~ 0) ifTrue:[ |
|
4786 |
newY := newY - i |
|
4787 |
]. |
|
269 | 4788 |
]. |
4789 |
^ newX @ newY |
|
4790 |
! |
|
4791 |
||
4792 |
originFromRelativeOrigin |
|
4793 |
"compute & return pixel origin from relativeOrigin" |
|
4794 |
||
4795 |
^ self originFromRelativeOrigin:relativeOrigin |
|
4796 |
! |
|
4797 |
||
4798 |
originFromRelativeOrigin:aPoint |
|
4799 |
"compute & return pixel origin from relativeOrigin, aPoint" |
|
4800 |
||
4801 |
|p l t| |
|
4802 |
||
4803 |
p := self pointFromRelative:aPoint. |
|
4804 |
||
4805 |
insets isNil ifTrue:[ |
|
1356 | 4806 |
^ p |
269 | 4807 |
]. |
4808 |
l := insets at:1. |
|
4809 |
t := insets at:2. |
|
4810 |
||
4811 |
"/ l := t := 0. |
|
4812 |
"/ leftInset notNil ifTrue:[ |
|
4813 |
"/ l := leftInset |
|
4814 |
"/ ]. |
|
4815 |
"/ topInset notNil ifTrue:[ |
|
4816 |
"/ t := topInset |
|
4817 |
"/ ]. |
|
4818 |
((l ~~ 0) or:[t ~~ 0]) ifTrue:[ |
|
1356 | 4819 |
^ (p x + l) @ (p y + t) |
269 | 4820 |
]. |
4821 |
^ p |
|
4822 |
! |
|
4823 |
||
4824 |
pixelCorner:corner |
|
4825 |
"set the views corner in pixels" |
|
4826 |
||
4827 |
|w h| |
|
4828 |
||
4829 |
w := corner x - left + 1. |
|
4830 |
h := corner y - top + 1. |
|
4831 |
self pixelOrigin:(left @ top) extent:(w @ h) |
|
4832 |
||
4833 |
"Modified: 31.8.1995 / 18:20:22 / claus" |
|
4834 |
! |
|
4835 |
||
4836 |
pixelExtent:extent |
|
4837 |
"set the views extent in pixels" |
|
4838 |
||
4839 |
self pixelOrigin:(left @ top) extent:extent |
|
4840 |
! |
|
4841 |
||
1363 | 4842 |
pixelOrigin |
4843 |
"return the views origin in pixels. For subviews. the origin is relative |
|
4844 |
to the superviews top-left. For topViews, its the screen origin." |
|
4845 |
||
4846 |
^ self computeOrigin |
|
4847 |
! |
|
4848 |
||
269 | 4849 |
pixelOrigin:origin |
4850 |
"set the views origin in pixels. For subviews. the origin is relative |
|
4851 |
to the superviews top-left. For topViews, its the screen origin." |
|
4852 |
||
4853 |
|newLeft newTop| |
|
4854 |
||
4855 |
newLeft := origin x. |
|
4856 |
newTop := origin y. |
|
4857 |
((newTop ~~ top) or:[newLeft ~~ left]) ifTrue:[ |
|
1356 | 4858 |
top := newTop. |
4859 |
left := newLeft. |
|
4860 |
||
4861 |
" |
|
4862 |
if the receiver is visible, or is a topView, perform the |
|
4863 |
operation right away - otherwise, simply remember that the |
|
4864 |
origin has changed - will tell the display once we get realized |
|
4865 |
" |
|
269 | 4866 |
"/ (shown |
4867 |
"/ or:[superView isNil and:[drawableId notNil]]) ifTrue:[ |
|
4868 |
||
1356 | 4869 |
"/ no, have to do it if drawableId is there |
4870 |
"/ (otherwise, we could not move unmapped views around ... |
|
4871 |
"/ |
|
4872 |
drawableId notNil ifTrue:[ |
|
4873 |
device moveWindow:drawableId x:left y:top |
|
4874 |
] ifFalse:[ |
|
4875 |
originChanged := true |
|
4876 |
] |
|
269 | 4877 |
] |
4878 |
! |
|
4879 |
||
4880 |
pixelOrigin:origin corner:corner |
|
4881 |
"set the views origin and corner in pixels" |
|
4882 |
||
4883 |
|w h| |
|
4884 |
||
4885 |
w := corner x - origin x + 1. |
|
4886 |
h := corner y - origin y + 1. |
|
4887 |
self pixelOrigin:origin extent:(w @ h) |
|
4888 |
||
4889 |
"Modified: 31.8.1995 / 18:24:16 / claus" |
|
4890 |
! |
|
4891 |
||
140 | 4892 |
pixelOrigin:origin extent:extent |
4893 |
"set the views origin and extent in pixels" |
|
4894 |
||
4895 |
|newLeft newTop newWidth newHeight how |
|
4896 |
mustRedrawBottomEdge mustRedrawRightEdge mustRepaintBottom |
|
4897 |
mustRepaintRight sameOrigin oldWidth oldHeight| |
|
4898 |
||
4899 |
newLeft := origin x. |
|
4900 |
newTop := origin y. |
|
4901 |
sameOrigin := ((newTop == top) and:[newLeft == left]). |
|
4902 |
||
4903 |
newWidth := extent x. |
|
4904 |
newHeight := extent y. |
|
4905 |
||
4906 |
" |
|
4907 |
X complains badly if you try to create/resize a view with |
|
4908 |
a dimension <= 0 ... (although I think that 0 maks sense ...) |
|
4909 |
" |
|
4910 |
newWidth < 1 ifTrue:[ |
|
739 | 4911 |
newWidth := 1. |
140 | 4912 |
]. |
4913 |
newHeight < 1 ifTrue:[ |
|
739 | 4914 |
newHeight := 1 |
140 | 4915 |
]. |
4916 |
||
4917 |
((newWidth == width) and:[newHeight == height]) ifTrue:[ |
|
739 | 4918 |
sameOrigin ifTrue:[^ self]. |
4919 |
^ self pixelOrigin:origin |
|
140 | 4920 |
]. |
4921 |
top := newTop. |
|
4922 |
left := newLeft. |
|
4923 |
||
4924 |
"/ shown ifTrue:[ "4-nov-94 actually correct," |
|
4925 |
drawableId notNil ifTrue:[ "but theres a bug in menus when resized while hidden" |
|
739 | 4926 |
mustRedrawBottomEdge := (level ~~ 0) and:[newHeight < height]. |
4927 |
mustRedrawRightEdge := (level ~~ 0) and:[newWidth < width]. |
|
4928 |
||
4929 |
((newHeight <= height) and:[newWidth <= width]) ifTrue:[ |
|
4930 |
how := #smaller |
|
4931 |
]. |
|
4932 |
||
4933 |
mustRepaintRight := false. |
|
4934 |
mustRepaintBottom := false. |
|
4935 |
(level ~~ 0) ifTrue:[ |
|
4936 |
"clear the old edges" |
|
4937 |
||
4938 |
newWidth > width ifTrue:[ |
|
4939 |
self clippingRectangle:nil. |
|
4940 |
self paint:viewBackground. |
|
4941 |
self fillDeviceRectangleX:(width - margin) |
|
4942 |
y:0 |
|
4943 |
width:margin |
|
4944 |
height:height. |
|
4945 |
mustRepaintRight := true. |
|
4946 |
oldWidth := width |
|
4947 |
]. |
|
4948 |
newHeight > height ifTrue:[ |
|
4949 |
self clippingRectangle:nil. |
|
4950 |
self paint:viewBackground. |
|
4951 |
self fillDeviceRectangleX:0 |
|
4952 |
y:(height - margin) |
|
4953 |
width:width |
|
4954 |
height:margin. |
|
4955 |
mustRepaintBottom := true. |
|
4956 |
oldHeight := height |
|
4957 |
] |
|
4958 |
]. |
|
4959 |
||
4960 |
width := newWidth. |
|
4961 |
height := newHeight. |
|
4962 |
||
4963 |
self setInnerClip. |
|
4964 |
||
4965 |
"if view becomes smaller, send sizeChanged first" |
|
4966 |
(how == #smaller) ifTrue:[ |
|
4967 |
self sizeChanged:how |
|
4968 |
]. |
|
4969 |
||
4970 |
"have to tell X, when extent of view is changed" |
|
4971 |
sameOrigin ifTrue:[ |
|
4972 |
device resizeWindow:drawableId width:width height:height. |
|
4973 |
] ifFalse:[ |
|
4974 |
"claus: some xservers seem to do better when resizing |
|
4975 |
first ...." |
|
140 | 4976 |
" |
739 | 4977 |
(how == #smaller) ifTrue:[ |
4978 |
device resizeWindow:drawableId width:width height:height. |
|
4979 |
device moveWindow:drawableId x:left y:top |
|
4980 |
] ifFalse:[ |
|
4981 |
device moveResizeWindow:drawableId x:left y:top width:width height:height |
|
4982 |
]. |
|
140 | 4983 |
" |
739 | 4984 |
device moveResizeWindow:drawableId x:left y:top |
4985 |
width:width height:height. |
|
4986 |
]. |
|
4987 |
||
4988 |
"if view becomes bigger, send sizeChanged after" |
|
4989 |
(how ~~ #smaller) ifTrue:[ |
|
4990 |
self sizeChanged:how |
|
4991 |
]. |
|
4992 |
||
4993 |
(mustRedrawBottomEdge or:[mustRedrawRightEdge]) ifTrue:[ |
|
4994 |
self clippingRectangle:nil. |
|
4995 |
mustRedrawBottomEdge ifTrue:[ |
|
4996 |
self drawBottomEdge |
|
4997 |
]. |
|
4998 |
mustRedrawRightEdge ifTrue:[ |
|
4999 |
self drawRightEdge |
|
5000 |
]. |
|
5001 |
self clippingRectangle:innerClipRect |
|
5002 |
]. |
|
5003 |
||
5004 |
mustRepaintRight ifTrue:[ |
|
5005 |
self redrawDeviceX:(oldWidth - margin) |
|
5006 |
y:0 |
|
5007 |
width:margin |
|
5008 |
height:height. |
|
5009 |
]. |
|
5010 |
mustRepaintBottom ifTrue:[ |
|
5011 |
self redrawDeviceX:0 |
|
5012 |
y:(oldHeight - margin) |
|
5013 |
width:width |
|
5014 |
height:margin. |
|
5015 |
]. |
|
140 | 5016 |
] ifFalse:[ |
739 | 5017 |
"otherwise memorize the need for a sizeChanged message" |
5018 |
||
5019 |
width := newWidth. |
|
5020 |
height := newHeight. |
|
5021 |
sameOrigin ifFalse:[ |
|
5022 |
originChanged := true. |
|
5023 |
]. |
|
5024 |
extentChanged := true |
|
140 | 5025 |
] |
739 | 5026 |
|
5027 |
"Modified: 28.5.1996 / 20:04:48 / cg" |
|
140 | 5028 |
! |
5029 |
||
5030 |
pointFromRelative:p |
|
5031 |
"compute absolute coordinate from p" |
|
5032 |
||
5033 |
|newX newY rel inRect bw superWidth superHeight superLeft superTop | |
|
5034 |
||
5035 |
bw := borderWidth. |
|
5036 |
||
5037 |
superView isNil ifTrue:[ |
|
1356 | 5038 |
superWidth := device width + bw. |
5039 |
superHeight := device height + bw. |
|
5040 |
superLeft := superTop := 0. |
|
140 | 5041 |
] ifFalse:[ |
1356 | 5042 |
inRect := superView viewRectangle. |
5043 |
superWidth := inRect width. |
|
5044 |
superHeight := inRect height. |
|
5045 |
superLeft := inRect left. |
|
5046 |
superTop := inRect top. |
|
140 | 5047 |
]. |
5048 |
||
5049 |
rel := p x. |
|
5050 |
rel isInteger ifTrue:[ |
|
1356 | 5051 |
newX := rel |
140 | 5052 |
] ifFalse:[ |
1356 | 5053 |
newX := (rel * superWidth) asInteger + superLeft. |
5054 |
(bw ~~ 0) ifTrue:[ |
|
5055 |
rel ~= 1.0 ifTrue:[ |
|
5056 |
newX := newX - bw |
|
5057 |
] |
|
5058 |
] |
|
140 | 5059 |
]. |
5060 |
||
5061 |
rel := p y. |
|
5062 |
rel isInteger ifTrue:[ |
|
1356 | 5063 |
newY := rel |
140 | 5064 |
] ifFalse:[ |
1356 | 5065 |
newY := (rel * superHeight) asInteger + superTop. |
5066 |
(bw ~~ 0) ifTrue:[ |
|
5067 |
rel ~= 1.0 ifTrue:[ |
|
5068 |
newY := newY - bw |
|
5069 |
] |
|
5070 |
] |
|
140 | 5071 |
]. |
5072 |
^ newX @ newY |
|
5073 |
! |
|
5074 |
||
5075 |
setBorderColor |
|
5076 |
"set my borderColor" |
|
5077 |
||
5078 |
|id dither| |
|
5079 |
||
5080 |
drawableId notNil ifTrue:[ |
|
1172
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
5081 |
borderColor := borderColor on:device. |
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
5082 |
id := borderColor colorId. |
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
5083 |
id notNil ifTrue:[ |
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
5084 |
device setWindowBorderColor:id in:drawableId |
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
5085 |
] ifFalse:[ |
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
5086 |
dither := borderColor ditherForm. |
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
5087 |
dither notNil ifTrue:[ |
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
5088 |
device setWindowBorderPixmap:(dither id) in:drawableId |
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
5089 |
] ifFalse:[ |
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
5090 |
'SimpleView [warning]: bad borderColor' errorPrintCR |
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
5091 |
] |
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
5092 |
] |
135 | 5093 |
] |
1172
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
5094 |
|
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
5095 |
"Modified: 10.1.1997 / 18:06:34 / cg" |
135 | 5096 |
! |
5097 |
||
269 | 5098 |
setInnerClip |
5099 |
"compute, and set the inside clip-area" |
|
5100 |
||
5101 |
self computeInnerClip. |
|
739 | 5102 |
self clippingRectangle:innerClipRect |
5103 |
||
5104 |
"Modified: 28.5.1996 / 20:04:53 / cg" |
|
140 | 5105 |
! ! |
5106 |
||
269 | 5107 |
!SimpleView methodsFor:'queries'! |
5108 |
||
5109 |
buttonMotionEventPending |
|
5110 |
"return true, if a button motion event is pending. |
|
5111 |
Normally, you dont want to use this, since no polling is needed |
|
5112 |
(not even for mouse-tracking). |
|
5113 |
Dont use it, since it does not honor the windowGroup, but |
|
5114 |
goes directly to the device instead. |
|
5115 |
Actually, its a historical leftover" |
|
5116 |
||
5117 |
windowGroup notNil ifTrue:[ |
|
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
5118 |
^ windowGroup sensor hasButtonMotionEventFor:self |
140 | 5119 |
]. |
269 | 5120 |
^ super buttonMotionEventPending |
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
5121 |
|
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
5122 |
"Modified: 1.11.1996 / 17:04:38 / cg" |
269 | 5123 |
! |
5124 |
||
5125 |
canHandle:aKey |
|
5126 |
"return true, if I like to handle the key (from a keyPress event). |
|
5127 |
OBSOLETE: do not use & depend on this method, it is a historic |
|
5128 |
leftOver and will be removed. Use the delegation mechanism for this." |
|
5129 |
||
5130 |
^ false |
|
5131 |
! |
|
5132 |
||
5133 |
canHandle:aKey from:aView |
|
5134 |
"return true, if I like to handle the key (from a keyPress event) |
|
5135 |
in aView. |
|
5136 |
OBSOLETE: do not use & depend on this method, it is a historic |
|
5137 |
leftOver and will be removed. Use the delegation mechanism for this." |
|
5138 |
||
5139 |
^ self canHandle:aKey |
|
5140 |
! |
|
5141 |
||
5142 |
delegatesTo:someone |
|
5143 |
"return true, if I delegate events to someone" |
|
5144 |
||
5145 |
delegate isNil ifTrue:[^ false]. |
|
5146 |
^ delegate delegatesTo:someone |
|
5147 |
! |
|
5148 |
||
1363 | 5149 |
enabled |
5150 |
"return true, if this view is enabled (i.e. accepts user interaction). |
|
5151 |
Most views are enabled - only a few (buttons, SelectionInList etc.) can |
|
5152 |
be disabled." |
|
5153 |
||
5154 |
^ true |
|
5155 |
! |
|
5156 |
||
269 | 5157 |
hasFocus |
5158 |
"return true, if the receiver has the keyboard focus |
|
5159 |
(either via the focusView mechanism in the windowGroup, |
|
5160 |
or via delegation)" |
|
5161 |
||
5162 |
|focusView delegate| |
|
5163 |
||
5164 |
windowGroup isNil ifTrue:[^ false]. |
|
5165 |
||
5166 |
(focusView := windowGroup focusView) == self ifTrue:[^ true]. |
|
5167 |
focusView notNil ifTrue:[ |
|
1356 | 5168 |
"mhmh - is there a delegation to me ?" |
5169 |
(delegate := focusView delegate) notNil ifTrue:[ |
|
5170 |
delegate == self ifTrue:[^ true]. |
|
5171 |
^ delegate delegatesTo:self |
|
5172 |
] |
|
135 | 5173 |
]. |
269 | 5174 |
^ false |
5175 |
! |
|
5176 |
||
370 | 5177 |
is3D |
5178 |
"return true, if my style is some kind of 3D style |
|
5179 |
This is OBSOLETE and will be removed." |
|
5180 |
||
5181 |
^ styleSheet is3D |
|
5182 |
! |
|
5183 |
||
794 | 5184 |
isBorderedWrapper |
5185 |
^ false |
|
5186 |
||
5187 |
"Created: 5.6.1996 / 14:11:15 / cg" |
|
5188 |
! |
|
5189 |
||
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
5190 |
isComponentOf:aViewOrComponent |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
5191 |
"return true, if I am a (direct or indirect) component of aViewOrComponent" |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
5192 |
|
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
5193 |
aViewOrComponent == self isNil ifTrue:[^ true]. |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
5194 |
superView isNil ifTrue:[^ false]. |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
5195 |
superView == aViewOrComponent ifTrue:[^ true]. |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
5196 |
^ superView isComponentOf:aViewOrComponent |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
5197 |
|
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
5198 |
"Created: 5.6.1996 / 14:23:57 / cg" |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
5199 |
"Modified: 5.6.1996 / 14:26:14 / cg" |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
5200 |
! |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
5201 |
|
497 | 5202 |
isInputField |
5203 |
"return true, if the receiver is some kind of input view, |
|
5204 |
i.e. it should (can) be part of an enterGroup. |
|
5205 |
Return false here, this is redefined in EnterField." |
|
5206 |
||
5207 |
^ false |
|
5208 |
||
5209 |
"Created: 4.3.1996 / 11:34:07 / cg" |
|
5210 |
! |
|
5211 |
||
964 | 5212 |
isLayoutWrapper |
5213 |
^ false |
|
5214 |
||
5215 |
"Created: 19.7.1996 / 17:51:04 / cg" |
|
5216 |
! |
|
5217 |
||
370 | 5218 |
isPopUpView |
5219 |
"return true, if this view should be put on top (raised) automatically. |
|
5220 |
usually this is true for alertBoxes etc." |
|
5221 |
||
5222 |
^ false |
|
5223 |
! |
|
5224 |
||
269 | 5225 |
isSubViewOf:aView |
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
5226 |
"return true, if I am a (direct or indirect) subview of aView" |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
5227 |
|
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
5228 |
self obsoleteMethodWarning:'use #isComponentOf:'. |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
5229 |
^ self isComponentOf:aView. |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
5230 |
|
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
5231 |
"Modified: 5.6.1996 / 14:25:35 / cg" |
269 | 5232 |
! |
5233 |
||
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5234 |
isWrapper |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5235 |
^ false |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5236 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5237 |
"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
|
5238 |
! |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5239 |
|
269 | 5240 |
preferredBounds |
5241 |
"ST-80 compatibility." |
|
5242 |
||
971 | 5243 |
^ 0@0 extent:(self preferredExtent) |
5244 |
||
5245 |
"Modified: 19.7.1996 / 20:41:36 / cg" |
|
269 | 5246 |
! |
5247 |
||
5248 |
preferredExtent |
|
5249 |
"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
|
5250 |
If the preferredExtent has been set, that one is returned. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5251 |
Otherwise, if there are any components, a rectangle enclosing them |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5252 |
is returned. Otherwise, the actual extent is returned." |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5253 |
|
1063 | 5254 |
|maxX maxY| |
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5255 |
|
971 | 5256 |
"/ If I have an explicit preferredExtent .. |
5257 |
||
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5258 |
preferredExtent notNil ifTrue:[ |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5259 |
^ preferredExtent |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5260 |
]. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5261 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5262 |
"/ mhmh - if I have subViews, collect their |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5263 |
"/ preferred bounds ... |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5264 |
|
269 | 5265 |
subViews notNil ifTrue:[ |
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5266 |
maxX := maxY := 0. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5267 |
subViews do:[:aSubView | |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5268 |
|org corn| |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5269 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5270 |
org := aSubView computeOrigin. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5271 |
corn := org + aSubView preferredExtent. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5272 |
maxX := maxX max:corn x. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5273 |
maxY := maxY max:corn y. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5274 |
] |
140 | 5275 |
]. |
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5276 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5277 |
"/ mhmh - if I have components, collect their |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5278 |
"/ preferred bounds ... |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5279 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5280 |
components notNil ifTrue:[ |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5281 |
maxX isNil ifTrue:[ |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5282 |
maxX := maxY := 0. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5283 |
]. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5284 |
components do:[:aComponent | |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5285 |
|bounds org corn| |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5286 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5287 |
bounds := aComponent preferredBounds. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5288 |
corn := bounds corner. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5289 |
maxX := maxX max:corn x. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5290 |
maxY := maxY max:corn y. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5291 |
] |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5292 |
]. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5293 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5294 |
"/ nothing found - return the actual size |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5295 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5296 |
maxX isNil ifTrue:[ |
971 | 5297 |
^ self extent. |
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5298 |
]. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5299 |
|
269 | 5300 |
^ maxX @ maxY. |
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
5301 |
|
971 | 5302 |
"Modified: 19.7.1996 / 20:43:32 / cg" |
269 | 5303 |
! |
5304 |
||
5305 |
sizeFixed |
|
5306 |
"return true, if this vew wants its size to remain unchanged. |
|
5307 |
Used by panels, to check if their components want to keep their size." |
|
5308 |
||
5309 |
^ false |
|
5310 |
||
5311 |
"Created: 17.9.1995 / 20:29:20 / claus" |
|
1354 | 5312 |
! |
5313 |
||
5314 |
specClass |
|
1356 | 5315 |
"fallback - heuristics to get a specClass for some viewClass" |
1354 | 5316 |
|
5317 |
|myName cls| |
|
5318 |
||
1409
3818a8a85c16
use CompositeSpecCollection as specClass for
Claus Gittinger <cg@exept.de>
parents:
1402
diff
changeset
|
5319 |
(self class == View |
3818a8a85c16
use CompositeSpecCollection as specClass for
Claus Gittinger <cg@exept.de>
parents:
1402
diff
changeset
|
5320 |
or:[self class == SimpleView]) ifTrue:[ |
3818a8a85c16
use CompositeSpecCollection as specClass for
Claus Gittinger <cg@exept.de>
parents:
1402
diff
changeset
|
5321 |
^ CompositeSpecCollection |
3818a8a85c16
use CompositeSpecCollection as specClass for
Claus Gittinger <cg@exept.de>
parents:
1402
diff
changeset
|
5322 |
]. |
3818a8a85c16
use CompositeSpecCollection as specClass for
Claus Gittinger <cg@exept.de>
parents:
1402
diff
changeset
|
5323 |
|
1354 | 5324 |
myName := self class name. |
5325 |
cls := Smalltalk classNamed:(myName , 'Spec'). |
|
1363 | 5326 |
(cls notNil and:[cls isLoaded not]) ifTrue:[ |
5327 |
cls autoload |
|
5328 |
]. |
|
5329 |
||
1354 | 5330 |
(cls notNil and:[cls isSubclassOf:UISpecification]) ifTrue:[^ cls]. |
5331 |
||
5332 |
(myName endsWith:'View') ifTrue:[ |
|
5333 |
"/ try name without 'View' |
|
5334 |
cls := Smalltalk classNamed:(myName copyWithoutLast:4). |
|
1363 | 5335 |
(cls notNil and:[cls isLoaded not]) ifTrue:[ |
5336 |
cls autoload |
|
5337 |
]. |
|
1354 | 5338 |
(cls notNil and:[cls isSubclassOf:UISpecification]) ifTrue:[^ cls]. |
5339 |
||
5340 |
"/ try with 'View' replaced by 'Spec' |
|
5341 |
cls := Smalltalk classNamed:((myName copyWithoutLast:4) , 'View'). |
|
1363 | 5342 |
(cls notNil and:[cls isLoaded not]) ifTrue:[ |
5343 |
cls autoload |
|
5344 |
]. |
|
1354 | 5345 |
(cls notNil and:[cls isSubclassOf:UISpecification]) ifTrue:[^ cls]. |
5346 |
]. |
|
1356 | 5347 |
^ ArbitraryComponentSpec |
5348 |
||
5349 |
"/ self error:'no spec class (subclassResponsibility)' |
|
1354 | 5350 |
|
5351 |
" |
|
5352 |
FramedBox new specClass |
|
5353 |
" |
|
1409
3818a8a85c16
use CompositeSpecCollection as specClass for
Claus Gittinger <cg@exept.de>
parents:
1402
diff
changeset
|
5354 |
|
3818a8a85c16
use CompositeSpecCollection as specClass for
Claus Gittinger <cg@exept.de>
parents:
1402
diff
changeset
|
5355 |
"Modified: 3.3.1997 / 15:39:04 / cg" |
140 | 5356 |
! ! |
5357 |
||
5358 |
!SimpleView methodsFor:'realization'! |
|
5359 |
||
269 | 5360 |
create |
5361 |
"create (i.e. tell my device about me) if not already created. |
|
5362 |
This does not make the view visible (needs a #map for that)" |
|
5363 |
||
5364 |
drawableId isNil ifTrue:[ |
|
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5365 |
" |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5366 |
make certain that superview is created also |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5367 |
" |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5368 |
superView notNil ifTrue:[ |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5369 |
superView view create. |
269 | 5370 |
|
5371 |
"/ "and put my controller into the superviews controller list" |
|
5372 |
"/ controller notNil ifTrue:[ |
|
5373 |
"/ superView controller notNil ifTrue:[ |
|
5374 |
"/ controller manager:(superView controller manager) |
|
5375 |
"/ ] |
|
5376 |
"/ ] |
|
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5377 |
] ifFalse:[ |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5378 |
"/ |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5379 |
"/ if the display is not already dispatching events, |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5380 |
"/ this starts the event process. |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5381 |
"/ |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5382 |
device startDispatch |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5383 |
]. |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5384 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5385 |
cursor notNil ifTrue:[ |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5386 |
cursor := cursor on:device. |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5387 |
]. |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5388 |
|
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
5389 |
explicitExtent ~~ true ifTrue:[ |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
5390 |
self resize |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
5391 |
]. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
5392 |
|
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5393 |
self physicalCreate. |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5394 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5395 |
viewBackground notNil ifTrue:[ |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5396 |
self setViewBackground |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5397 |
]. |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5398 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5399 |
self initializeMiddleButtonMenu. |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5400 |
self initEvents. |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5401 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5402 |
" |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5403 |
this is the first create, |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5404 |
force sizechange messages to be sent to the view |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5405 |
" |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5406 |
extentChanged := true. |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5407 |
originChanged := true |
151 | 5408 |
] |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5409 |
|
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
5410 |
"Modified: 15.7.1996 / 10:08:35 / cg" |
151 | 5411 |
! |
5412 |
||
269 | 5413 |
createWithAllSubViews |
5414 |
"create, then create all subviews" |
|
5415 |
||
5416 |
drawableId isNil ifTrue:[self create]. |
|
5417 |
subViews notNil ifTrue:[ |
|
1356 | 5418 |
subViews do:[:subView | subView createWithAllSubViews] |
269 | 5419 |
] |
5420 |
! |
|
5421 |
||
5422 |
destroy |
|
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5423 |
"unmap & destroy - make me invisible, destroy subviews then |
269 | 5424 |
make me unknown to the device" |
5425 |
||
1329 | 5426 |
|subs| |
5427 |
||
140 | 5428 |
realized ifTrue:[ |
1329 | 5429 |
self unmap. |
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5430 |
"make it go away immediately |
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5431 |
- also, this hides the subview killing" |
269 | 5432 |
" |
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5433 |
device synchronizeOutput. |
269 | 5434 |
" |
151 | 5435 |
]. |
5436 |
||
1329 | 5437 |
"/ controller notNil ifTrue:[ |
5438 |
"/ controller release. |
|
5439 |
"/ controller := nil. |
|
5440 |
"/ ]. |
|
5441 |
||
5442 |
subs := subViews. |
|
5443 |
subs notNil ifTrue:[ |
|
1290
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
5444 |
self destroySubViews. |
1329 | 5445 |
|
5446 |
"/ subViews := nil. |
|
5447 |
"/ subs do:[:aView | |
|
5448 |
"/ aView notNil ifTrue:[aView destroy] |
|
5449 |
"/ ] |
|
140 | 5450 |
]. |
269 | 5451 |
superView notNil ifTrue:[ |
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5452 |
superView removeSubView:self. |
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5453 |
superView := nil |
140 | 5454 |
]. |
269 | 5455 |
super destroy. |
5456 |
||
1329 | 5457 |
superView isNil ifTrue:[ |
5458 |
device flush |
|
5459 |
]. |
|
5460 |
||
269 | 5461 |
controller notNil ifTrue:[ |
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5462 |
controller release. |
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5463 |
controller := nil. |
140 | 5464 |
]. |
269 | 5465 |
|
5466 |
windowGroup notNil ifTrue:[ |
|
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5467 |
windowGroup removeView:self. |
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5468 |
windowGroup := nil |
140 | 5469 |
]. |
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5470 |
|
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5471 |
"Modified: 3.5.1996 / 23:49:24 / stefan" |
1329 | 5472 |
"Modified: 28.1.1997 / 18:03:24 / cg" |
140 | 5473 |
! |
5474 |
||
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5475 |
fetchDeviceResources |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5476 |
"fetch all device specific resources. This is invoked, |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5477 |
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
|
5478 |
time, to allocate device specific colors, fonts, bitmaps etc. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5479 |
The view may keep those in instance variables, to avoid reallocating |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5480 |
those with every redraw. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5481 |
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
|
5482 |
but possibly slower, since resources are reallocated over and over. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5483 |
If you redefine this method, make certain that 'super fetchDeviceResources' |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5484 |
is always sent." |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5485 |
|
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5486 |
shadowColor notNil ifTrue:[shadowColor := shadowColor on:device]. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5487 |
lightColor notNil ifTrue:[lightColor := lightColor on:device]. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5488 |
|
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5489 |
"Created: 13.1.1997 / 21:51:59 / cg" |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5490 |
! |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5491 |
|
140 | 5492 |
fixSize |
5493 |
"This is called right before the view is made visible. |
|
5494 |
Adjust the size of the view according to either relative/abs or |
|
5495 |
block extent; also set origin. Also, subclasses may redefine this |
|
5496 |
method to adjust the size based on some extent (for example, PopUpMenus |
|
5497 |
do so to take care of changed number of menu entries)." |
|
5498 |
||
151 | 5499 |
|org ext r| |
5500 |
||
5501 |
" |
|
5502 |
slowly migrating to use layoutObjects ... |
|
5503 |
" |
|
5504 |
layout notNil ifTrue:[ |
|
890
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5505 |
(originChanged or:[extentChanged or:[cornerChanged]]) ifTrue:[ |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5506 |
r := (layout rectangleRelativeTo:(superView viewRectangle) |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5507 |
preferred:(self preferredBounds)). |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5508 |
org := r origin rounded. |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5509 |
ext := r extent rounded. |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5510 |
self pixelOrigin:org extent:ext. |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5511 |
]. |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5512 |
^ self. |
151 | 5513 |
]. |
5514 |
||
140 | 5515 |
"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
|
5516 |
"/ extentChanged ifTrue:[ |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5517 |
"/ self sizeChanged:nil. |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5518 |
"/ extentChanged := false |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5519 |
"/ ]. |
140 | 5520 |
|
5521 |
originChanged ifTrue:[ |
|
5522 |
"/ org := self computeOrigin. |
|
5523 |
"/ self pixelOrigin:org. |
|
890
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5524 |
originRule notNil ifTrue:[ |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5525 |
self pixelOrigin:self computeOrigin |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5526 |
] ifFalse:[ |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5527 |
relativeOrigin notNil ifTrue:[ |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5528 |
self originFromRelativeOrigin:relativeOrigin |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5529 |
] ifFalse:[ |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5530 |
shown ifTrue:[ |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5531 |
device moveWindow:drawableId x:left y:top. |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5532 |
] ifFalse:[ |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5533 |
self pixelOrigin:left@top |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5534 |
]. |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5535 |
]. |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5536 |
]. |
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5537 |
originChanged := false |
140 | 5538 |
] |
890
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5539 |
|
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
5540 |
"Modified: 18.6.1996 / 21:44:03 / cg" |
140 | 5541 |
! |
5542 |
||
393
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
5543 |
hide |
1356 | 5544 |
"only useful with modal views: hide the view and return control |
5545 |
back to the suspended main view. Ignored for non-modal views." |
|
5546 |
||
5547 |
|p| |
|
5548 |
||
5549 |
realized ifFalse:[^ self]. |
|
5550 |
windowGroup isNil ifTrue:[^ self]. |
|
5551 |
windowGroup isModal ifFalse:[^ self]. |
|
5552 |
||
5553 |
windowGroup notNil ifTrue:[windowGroup focusView:nil]. |
|
5554 |
||
5555 |
self unmap. |
|
5556 |
device flush. |
|
5557 |
||
5558 |
(windowGroup notNil and:[(p := windowGroup previousGroup) notNil]) ifTrue:[ |
|
5559 |
" |
|
5560 |
this is a kludge for IRIS which does not provide backingstore: |
|
5561 |
when we hide a modalbox (such as a searchbox) which covered |
|
5562 |
a scrollbar, the scrollbars bitblt-method will copy from the |
|
5563 |
not-yet redrawn area - effectively clearing the scroller. |
|
5564 |
We need a short delay here, since at this time, the expose event has |
|
5565 |
not yet arrived. |
|
5566 |
" |
|
5567 |
Delay waitForSeconds:0.1. |
|
5568 |
p processExposeEvents |
|
5569 |
]. |
|
5570 |
WindowGroup leaveSignal raise. |
|
5571 |
"/ not reached |
|
393
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
5572 |
^ self |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
5573 |
! |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
5574 |
|
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
5575 |
hideRequest |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
5576 |
"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
|
5577 |
ignored here." |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
5578 |
|
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
5579 |
^ self |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
5580 |
! |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
5581 |
|
269 | 5582 |
map |
5583 |
"make the view visible on the screen" |
|
5584 |
||
5585 |
realized ifFalse:[ |
|
654 | 5586 |
drawableId isNil ifTrue:[ |
5587 |
self realize |
|
5588 |
] ifFalse:[ |
|
5589 |
" |
|
1039
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
5590 |
no, make the view visible |
654 | 5591 |
" |
1379 | 5592 |
realized := true. |
654 | 5593 |
device mapWindow:drawableId. |
5594 |
] |
|
140 | 5595 |
] |
654 | 5596 |
|
1039
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
5597 |
"Modified: 23.8.1996 / 14:53:55 / stefan" |
1379 | 5598 |
"Modified: 25.2.1997 / 22:43:58 / cg" |
140 | 5599 |
! |
5600 |
||
269 | 5601 |
physicalCreate |
5602 |
"common code for create & recreate: |
|
5603 |
physically create (but do not map) the view on the device." |
|
5604 |
||
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5605 |
|sv| |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5606 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5607 |
sv := superView isNil ifTrue:[superView] ifFalse:[superView view]. |
269 | 5608 |
|
5609 |
drawableId := device |
|
779
9300dc4ed123
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
5610 |
createWindowFor:self |
9300dc4ed123
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
5611 |
origin:(left @ top) |
9300dc4ed123
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
5612 |
extent:(width @ height) |
9300dc4ed123
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
5613 |
minExtent:nil |
9300dc4ed123
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
5614 |
maxExtent:nil |
9300dc4ed123
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
5615 |
borderWidth:borderWidth |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5616 |
subViewOf:sv |
779
9300dc4ed123
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
5617 |
onTop:(self isPopUpView) |
9300dc4ed123
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
5618 |
inputOnly:(self isInputOnly) |
9300dc4ed123
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
5619 |
label:nil |
9300dc4ed123
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
5620 |
cursor:cursor |
1425
c6963c38dcd8
preparations for iconMasks (for windows)
Claus Gittinger <cg@exept.de>
parents:
1413
diff
changeset
|
5621 |
icon:nil iconMask:nil |
779
9300dc4ed123
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
5622 |
iconView:nil. |
269 | 5623 |
|
5624 |
Lobby registerChange:self. |
|
5625 |
extentChanged := false. |
|
5626 |
originChanged := false. |
|
5627 |
||
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
5628 |
(borderColor notNil and:[borderColor ~= Black]) ifTrue:[ |
269 | 5629 |
"/ borderColor := borderColor on:device. |
779
9300dc4ed123
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
5630 |
self setBorderColor |
269 | 5631 |
]. |
5632 |
(viewGravity notNil "and:[viewGravity ~~ #NorthWest]") ifTrue:[ |
|
779
9300dc4ed123
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
5633 |
device setWindowGravity:viewGravity in:drawableId |
269 | 5634 |
]. |
5635 |
(bitGravity notNil "and:[bitGravity ~~ #NorthWest]") ifTrue:[ |
|
779
9300dc4ed123
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
5636 |
device setBitGravity:bitGravity in:drawableId |
269 | 5637 |
]. |
5638 |
borderShape notNil ifTrue:[ |
|
779
9300dc4ed123
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
5639 |
device setWindowBorderShape:(borderShape id) in:drawableId |
269 | 5640 |
]. |
5641 |
viewShape notNil ifTrue:[ |
|
779
9300dc4ed123
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
5642 |
device setWindowShape:(viewShape id) in:drawableId |
269 | 5643 |
]. |
5644 |
(backed notNil and:[backed ~~ false]) ifTrue:[ |
|
779
9300dc4ed123
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
5645 |
device setBackingStore:backed in:drawableId |
269 | 5646 |
]. |
5647 |
saveUnder ifTrue:[ |
|
779
9300dc4ed123
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
5648 |
device setSaveUnder:true in:drawableId |
269 | 5649 |
]. |
779
9300dc4ed123
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
771
diff
changeset
|
5650 |
|
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
5651 |
"Modified: 13.1.1997 / 23:10:56 / cg" |
269 | 5652 |
! |
5653 |
||
5654 |
realize |
|
5655 |
"realize - make visible; |
|
5656 |
realizing is done very late (after layout is fixed) to avoid |
|
5657 |
visible rearranging of windows on the screen" |
|
5658 |
||
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5659 |
"/ fetch device colors, to avoid reallocation at redraw time |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5660 |
|
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5661 |
self fetchDeviceResources. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5662 |
|
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5663 |
"/ now, really realize mySelf |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5664 |
|
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
5665 |
self realizeKeepingGroup:false |
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5666 |
|
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5667 |
"Modified: 13.1.1997 / 21:52:13 / cg" |
269 | 5668 |
! |
5669 |
||
5670 |
realizeAllSubViews |
|
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5671 |
"realize all my subviews - but not myself." |
269 | 5672 |
|
5673 |
subViews notNil ifTrue:[ |
|
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5674 |
subViews do:[:subView | |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5675 |
subView realize |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5676 |
] |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5677 |
]. |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5678 |
components notNil ifTrue:[ |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5679 |
components do:[:component | |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5680 |
component realize |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5681 |
] |
269 | 5682 |
]. |
5683 |
||
5684 |
"Modified: 5.9.1995 / 23:30:47 / claus" |
|
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5685 |
"Modified: 13.1.1997 / 21:25:49 / cg" |
269 | 5686 |
! |
5687 |
||
5688 |
realizeInGroup |
|
5689 |
"special realize - leave windowgroup as is; |
|
5690 |
This allows a view to be realized in any windowgroup; |
|
5691 |
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
|
5692 |
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
|
5693 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
5694 |
windowGroup isForModalSubview:true. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
5695 |
self realize. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
5696 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
5697 |
"/ self realizeKeepingGroup:true |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
5698 |
! |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
5699 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
5700 |
realizeKeepingGroup:keepGroupAsIs |
151 | 5701 |
"common helper for realize and realizeInGroup. |
5702 |
Create the view, if the argument is not true, assign my windowGroup, |
|
5703 |
if hiddenOnRealize is not true, map it." |
|
140 | 5704 |
|
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
5705 |
|superGroup groupChange keep| |
140 | 5706 |
|
5707 |
drawableId isNil ifTrue:[ |
|
654 | 5708 |
self create. |
140 | 5709 |
]. |
5710 |
||
372 | 5711 |
groupChange := false. |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
5712 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
5713 |
(windowGroup notNil and:[windowGroup isForModalSubview]) ifTrue:[ |
654 | 5714 |
keep := true. |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
5715 |
] ifFalse:[ |
654 | 5716 |
keep := keepGroupAsIs |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
5717 |
]. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
5718 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
5719 |
keep ifFalse:[ |
654 | 5720 |
" |
5721 |
put myself into superviews windowgroup if there is a superview |
|
5722 |
" |
|
5723 |
superView notNil ifTrue:[ |
|
5724 |
superGroup := superView windowGroup. |
|
5725 |
(windowGroup notNil and:[superGroup ~~ windowGroup]) ifTrue:[ |
|
5726 |
" |
|
5727 |
mhmh - seems that the windowgroup has changed .... |
|
5728 |
" |
|
145 | 5729 |
"/ 'oops - wgroup change on realize' printNL. |
654 | 5730 |
windowGroup removeView:self. |
5731 |
windowGroup := nil |
|
5732 |
]. |
|
5733 |
superGroup ~~ windowGroup ifTrue:[ |
|
5734 |
groupChange := true. |
|
5735 |
windowGroup := superGroup. |
|
5736 |
windowGroup notNil ifTrue:[ |
|
5737 |
windowGroup addView:self. |
|
5738 |
] |
|
5739 |
] |
|
5740 |
]. |
|
140 | 5741 |
]. |
5742 |
||
1039
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
5743 |
(originChanged or:[extentChanged]) ifTrue:[ |
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
5744 |
self fixSize. |
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
5745 |
self sizeChanged:nil. "/ new 29-aug-1995 |
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
5746 |
]. |
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
5747 |
|
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
5748 |
(subViews notNil or:[components notNil]) ifTrue:[ |
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
5749 |
(realized not or:[groupChange]) ifTrue:[ |
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
5750 |
self realizeAllSubViews. |
654 | 5751 |
]. |
1039
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
5752 |
]. |
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
5753 |
hiddenOnRealize ifFalse:[ |
654 | 5754 |
self setInnerClip. |
5755 |
||
5756 |
realized ifFalse:[ |
|
5757 |
" |
|
5758 |
now, make the view visible |
|
5759 |
" |
|
5760 |
self map |
|
5761 |
] |
|
140 | 5762 |
]. |
5763 |
||
5764 |
controller notNil ifTrue:[ |
|
654 | 5765 |
controller startUp |
140 | 5766 |
] |
654 | 5767 |
|
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5768 |
"Modified: 5.6.1996 / 01:02:01 / cg" |
1039
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
5769 |
"Modified: 23.8.1996 / 15:07:16 / stefan" |
140 | 5770 |
! |
5771 |
||
5772 |
recreate |
|
5773 |
"recreate (i.e. tell X about me) after a snapin" |
|
5774 |
||
5775 |
drawableId isNil ifTrue:[ |
|
1356 | 5776 |
super recreate. |
5777 |
self physicalCreate. |
|
5778 |
||
5779 |
viewBackground notNil ifTrue:[ |
|
5780 |
self setViewBackground |
|
5781 |
]. |
|
5782 |
||
5783 |
" |
|
5784 |
XXX has to be changed: eventmasks are device specific - |
|
5785 |
XXX will not allow restart on another Workstation-type. |
|
5786 |
XXX event masks must become symbolic |
|
5787 |
" |
|
5788 |
device setEventMask:eventMask in:drawableId |
|
140 | 5789 |
] |
5790 |
! |
|
5791 |
||
654 | 5792 |
remap |
5793 |
"make the view visible on the screen at its previous position. |
|
5794 |
In contrast to map, this asks the windowManager to show the view |
|
5795 |
immediately (instead of asking for a frame). However, some windowManagers |
|
5796 |
are known to ignore this ..." |
|
5797 |
||
5798 |
realized ifFalse:[ |
|
5799 |
" |
|
5800 |
now, make the view visible |
|
5801 |
" |
|
1379 | 5802 |
realized := true. |
654 | 5803 |
device mapView:self id:drawableId iconified:false |
5804 |
atX:left y:top width:width height:height. |
|
5805 |
] |
|
5806 |
||
5807 |
"Created: 8.5.1996 / 09:33:06 / cg" |
|
1379 | 5808 |
"Modified: 25.2.1997 / 22:44:33 / cg" |
654 | 5809 |
! |
5810 |
||
1109 | 5811 |
rerealize |
5812 |
"rerealize at old position in (a possibly different) windowGroup." |
|
5813 |
||
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5814 |
self fetchDeviceResources. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5815 |
|
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5816 |
self rerealizeInGroup:windowGroup. |
1109 | 5817 |
|
5818 |
"Created: 7.11.1996 / 16:27:09 / cg" |
|
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
5819 |
"Modified: 13.1.1997 / 21:53:18 / cg" |
1109 | 5820 |
! |
5821 |
||
269 | 5822 |
rerealizeInGroup:aWindowGroup |
5823 |
"rerealize at old position in (a possibly different) windowGroup." |
|
5824 |
||
5825 |
drawableId isNil ifTrue:[ |
|
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5826 |
self create |
269 | 5827 |
]. |
5828 |
drawableId notNil ifTrue:[ |
|
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5829 |
aWindowGroup ~~ windowGroup ifTrue:[ |
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5830 |
windowGroup notNil ifTrue:[ |
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5831 |
windowGroup removeView:self |
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5832 |
]. |
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5833 |
windowGroup := aWindowGroup. |
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5834 |
aWindowGroup addTopView:self. |
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5835 |
]. |
1109 | 5836 |
self remap. |
269 | 5837 |
] |
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5838 |
|
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5839 |
"Modified: 3.5.1996 / 23:59:30 / stefan" |
1109 | 5840 |
"Modified: 7.11.1996 / 16:28:16 / cg" |
140 | 5841 |
! |
5842 |
||
5843 |
rerealizeWithAllSubViews |
|
5844 |
"rerealize myself with all subviews" |
|
5845 |
||
5846 |
drawableId notNil ifTrue:[ |
|
1290
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
5847 |
realized := true. |
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
5848 |
self realizeAllSubViews. |
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
5849 |
device mapView:self id:drawableId iconified:false |
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
5850 |
atX:left y:top width:width height:height |
140 | 5851 |
] |
1290
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
5852 |
|
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
5853 |
"Modified: 28.1.1997 / 17:59:28 / cg" |
180 | 5854 |
! |
5855 |
||
269 | 5856 |
resize |
5857 |
"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
|
5858 |
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
|
5859 |
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
|
5860 |
|
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
5861 |
explicitExtent ~~ true ifTrue:[ |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
5862 |
self extent:(self preferredExtent). |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
5863 |
explicitExtent := false. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
5864 |
] |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
5865 |
|
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
5866 |
"Modified: 15.7.1996 / 11:20:27 / cg" |
269 | 5867 |
! |
5868 |
||
5869 |
unmap |
|
1379 | 5870 |
"hide me - the view stays created, and can be remapped again later." |
269 | 5871 |
|
5872 |
realized ifTrue:[ |
|
1356 | 5873 |
drawableId notNil ifTrue:[ |
1379 | 5874 |
realized := false. |
1356 | 5875 |
device unmapWindow:drawableId |
5876 |
]. |
|
1379 | 5877 |
shown := realized := false. |
269 | 5878 |
]. |
190 | 5879 |
|
5880 |
" |
|
269 | 5881 |
|top sub| |
5882 |
||
5883 |
top := StandardSystemView new. |
|
5884 |
top extent:200@200. |
|
5885 |
||
5886 |
sub := View |
|
1356 | 5887 |
origin:0.2@0.2 |
5888 |
corner:0.8@0.8 |
|
5889 |
in:top. |
|
269 | 5890 |
|
5891 |
sub viewBackground:Color red. |
|
5892 |
sub hiddenOnRealize:true. |
|
5893 |
||
5894 |
top open. |
|
5895 |
(Delay forSeconds:5) wait. |
|
5896 |
sub map. |
|
5897 |
(Delay forSeconds:3) wait. |
|
5898 |
sub unmap. |
|
5899 |
sub viewBackground:(Color green). |
|
5900 |
(Delay forSeconds:3) wait. |
|
5901 |
sub map. |
|
151 | 5902 |
" |
1379 | 5903 |
|
5904 |
"Modified: 25.2.1997 / 23:13:26 / cg" |
|
269 | 5905 |
! |
5906 |
||
5907 |
unrealize |
|
5908 |
"alias for unmap, for historic reasons" |
|
5909 |
||
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5910 |
self obsoleteMethodWarning:'use unmap'. |
269 | 5911 |
self unmap. |
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5912 |
|
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
5913 |
"Modified: 4.5.1996 / 00:07:48 / stefan" |
151 | 5914 |
! ! |
5915 |
||
5916 |
!SimpleView methodsFor:'redrawing'! |
|
5917 |
||
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5918 |
flash |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5919 |
"flash the view - fill it black, then white, finally |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5920 |
redraw completely. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5921 |
Can be used to wakeup the user :- when problem or warning conditions |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5922 |
arise)" |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5923 |
|
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5924 |
self fill:Black. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5925 |
Delay waitForSeconds:0.1. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5926 |
self fill:White. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5927 |
Delay waitForSeconds:0.1. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5928 |
self clear. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5929 |
self invalidate |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5930 |
|
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5931 |
" |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5932 |
|v| |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5933 |
|
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5934 |
v := View new openAndWait. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5935 |
Delay waitForSeconds:2. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5936 |
v flash. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5937 |
Delay waitForSeconds:2. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5938 |
v destroy |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5939 |
" |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5940 |
|
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5941 |
"Modified: 29.5.1996 / 14:09:46 / cg" |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5942 |
! |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5943 |
|
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5944 |
invalidate |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5945 |
"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
|
5946 |
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
|
5947 |
the views process itself, and there is a possibilty to merge |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5948 |
multiple damage rectangles into single redraws." |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5949 |
|
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5950 |
|sensor| |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5951 |
|
753 | 5952 |
shown ifTrue:[ |
5953 |
(sensor := self sensor) notNil ifTrue:[ |
|
1313 | 5954 |
sensor flushExposeEventsFor:self. |
753 | 5955 |
sensor addDamage:(0@0 extent:width@height) view:self |
5956 |
] ifFalse:[ |
|
5957 |
self redrawX:0 y:0 width:width height:height |
|
5958 |
] |
|
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5959 |
] |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5960 |
|
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5961 |
"Created: 26.5.1996 / 17:17:38 / cg" |
1329 | 5962 |
"Modified: 28.5.1996 / 22:15:05 / cg" |
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5963 |
! |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5964 |
|
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5965 |
invalidate:aRectangle |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5966 |
"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
|
5967 |
This is preferable to calling redraw directly, |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5968 |
in that the drawing is done by the views process itself, |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5969 |
and there is a possibilty to merge multiple damage rectangles into |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5970 |
single redraws." |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5971 |
|
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5972 |
|sensor| |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5973 |
|
753 | 5974 |
shown ifTrue:[ |
5975 |
(sensor := self sensor) notNil ifTrue:[ |
|
5976 |
sensor addDamage:aRectangle view:self. |
|
5977 |
] ifFalse:[ |
|
5978 |
self redrawX:(aRectangle left) |
|
5979 |
y:(aRectangle top) |
|
5980 |
width:(aRectangle width) |
|
5981 |
height:(aRectangle height) |
|
5982 |
] |
|
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5983 |
] |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5984 |
|
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5985 |
"Created: 26.5.1996 / 17:18:25 / cg" |
753 | 5986 |
"Modified: 28.5.1996 / 22:15:21 / cg" |
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5987 |
! |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5988 |
|
269 | 5989 |
redraw |
782 | 5990 |
"redraw myself completely - this is sent by redrawX:y:width:height: |
5991 |
as a fallback. |
|
5992 |
Cannot do much here - is redefined in subclasses which dont care for |
|
5993 |
updating regions but instead update everything." |
|
5994 |
||
5995 |
"Modified: 29.5.1996 / 18:02:52 / cg" |
|
269 | 5996 |
! |
5997 |
||
5998 |
redrawDeviceX:x y:y width:w height:h |
|
5999 |
"have to redraw part of the view. |
|
6000 |
The coordinates are in device space - if there is a transformation, |
|
6001 |
must inverse-transform back to logical coordinates. (since the view thinks |
|
6002 |
in its coordinate space)" |
|
6003 |
||
6004 |
|lx ly lw lh| |
|
6005 |
||
6006 |
lx := x. |
|
6007 |
ly := y. |
|
6008 |
lw := w. |
|
6009 |
lh := h. |
|
6010 |
||
6011 |
transformation notNil ifTrue:[ |
|
1356 | 6012 |
lx := transformation applyInverseToX:lx. |
6013 |
ly := transformation applyInverseToY:ly. |
|
6014 |
lw := transformation applyInverseScaleX:lw. |
|
6015 |
lh := transformation applyInverseScaleY:lh. |
|
269 | 6016 |
]. |
6017 |
self redrawX:lx y:ly width:lw height:lh |
|
6018 |
! |
|
6019 |
||
151 | 6020 |
redrawX:x y:y width:w height:h |
6021 |
"have to redraw part of myself, given logical coordinates (if trans is nonNil) |
|
6022 |
default is to redraw everything - subclasses should add intelligence" |
|
6023 |
||
738 | 6024 |
|area oldClip| |
151 | 6025 |
|
6026 |
shown ifFalse:[^ self]. |
|
6027 |
||
6028 |
area := Rectangle left:x top:y width:w height:h. |
|
738 | 6029 |
oldClip := clipRect. |
6030 |
self clippingRectangle:area. |
|
6031 |
||
6032 |
components notNil ifTrue:[ |
|
782 | 6033 |
self clearRectangleX:x y:y width:w height:h. |
738 | 6034 |
components do:[:aComponent | |
6035 |
|thisFrame is| |
|
6036 |
||
6037 |
thisFrame := aComponent bounds. |
|
6038 |
(thisFrame intersects:area) ifTrue:[ |
|
6039 |
aComponent displayOn:self |
|
659 | 6040 |
] |
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
6041 |
] |
738 | 6042 |
] ifFalse:[ |
782 | 6043 |
"/ redraw everything - a fallBack for lazy views. |
738 | 6044 |
self redraw |
6045 |
]. |
|
6046 |
||
6047 |
self clippingRectangle:oldClip. |
|
6048 |
||
782 | 6049 |
"Modified: 3.6.1996 / 11:52:51 / cg" |
151 | 6050 |
! |
6051 |
||
269 | 6052 |
showActive |
6053 |
"redraw myself as active (i.e. busy). |
|
6054 |
Nothing done here, but redefined in some classes." |
|
6055 |
||
6056 |
^ self |
|
135 | 6057 |
! |
6058 |
||
385
15fd1c806d2a
pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents:
376
diff
changeset
|
6059 |
showFocus:explicit |
15fd1c806d2a
pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents:
376
diff
changeset
|
6060 |
"highlight myself somehow to tell user that I have the focus. |
782 | 6061 |
If explicit is true, the focus came via focusStepping (i.e. tabbing); |
6062 |
if false, it came via the window manager (i.e. pointer entering). |
|
385
15fd1c806d2a
pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents:
376
diff
changeset
|
6063 |
Only change my border, if this is an explicit focusChange." |
135 | 6064 |
|
782 | 6065 |
|delta clrId| |
135 | 6066 |
|
385
15fd1c806d2a
pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents:
376
diff
changeset
|
6067 |
explicit ifTrue:[ |
782 | 6068 |
drawableId notNil ifTrue:[ |
6069 |
delta := DefaultFocusBorderWidth - borderWidth. |
|
6070 |
delta ~~ 0 ifTrue:[ |
|
1329 | 6071 |
device moveWindow:drawableId x:left-delta y:top-delta. |
6072 |
device setWindowBorderWidth:DefaultFocusBorderWidth in:drawableId. |
|
782 | 6073 |
]. |
1329 | 6074 |
|
782 | 6075 |
clrId := (DefaultFocusColor on:device) colorId. |
6076 |
clrId isNil ifTrue:[ |
|
6077 |
clrId := device blackpixel |
|
6078 |
]. |
|
6079 |
device setWindowBorderColor:clrId in:drawableId. |
|
6080 |
] |
|
6081 |
] ifFalse:[ |
|
6082 |
superView notNil ifTrue:[ |
|
6083 |
superView showFocus:explicit |
|
6084 |
] |
|
135 | 6085 |
] |
782 | 6086 |
|
1381 | 6087 |
"Modified: 25.2.1997 / 23:46:56 / cg" |
135 | 6088 |
! |
6089 |
||
385
15fd1c806d2a
pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents:
376
diff
changeset
|
6090 |
showNoFocus:explicit |
15fd1c806d2a
pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents:
376
diff
changeset
|
6091 |
"undo the effect of showFocus. |
15fd1c806d2a
pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents:
376
diff
changeset
|
6092 |
Explicit tells if the focus came via focusStepping (i.e. tabbing) |
15fd1c806d2a
pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents:
376
diff
changeset
|
6093 |
or via the window manager (i.e. pointer entering). |
15fd1c806d2a
pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents:
376
diff
changeset
|
6094 |
Only change my border, if this is an explicit focusChange." |
135 | 6095 |
|
6096 |
|delta| |
|
6097 |
||
385
15fd1c806d2a
pass info if focus change was explicit (i.e. Tab-key) or by window manager.
Claus Gittinger <cg@exept.de>
parents:
376
diff
changeset
|
6098 |
explicit ifTrue:[ |
1308 | 6099 |
drawableId notNil ifTrue:[ |
6100 |
(windowGroup notNil |
|
6101 |
and:[windowGroup focusView == self]) ifTrue:[ |
|
6102 |
delta := DefaultFocusBorderWidth - borderWidth. |
|
6103 |
delta ~~ 0 ifTrue:[ |
|
1329 | 6104 |
device setWindowBorderWidth:borderWidth in:drawableId. |
1381 | 6105 |
device moveWindow:drawableId x:left y:top. |
1308 | 6106 |
]. |
6107 |
self setBorderColor. |
|
6108 |
] |
|
6109 |
] |
|
135 | 6110 |
] |
358
27e6259fcb41
only change border in noFocus, if I was the focusView
Claus Gittinger <cg@exept.de>
parents:
355
diff
changeset
|
6111 |
|
1381 | 6112 |
"Modified: 25.2.1997 / 23:51:12 / cg" |
135 | 6113 |
! |
6114 |
||
6115 |
showPassive |
|
6116 |
"redraw myself as inactive (i.e. nonbusy). |
|
151 | 6117 |
Nothing done here, but redefined in some classes." |
135 | 6118 |
|
6119 |
^ self |
|
6120 |
! ! |
|
6121 |
||
269 | 6122 |
!SimpleView methodsFor:'scrolling'! |
6123 |
||
6124 |
horizontalScrollStep |
|
6125 |
"return the amount to scroll when stepping left/right. |
|
6126 |
Subclasses may want to redefine this." |
|
6127 |
||
6128 |
^ (device horizontalPixelPerMillimeter * 20) asInteger |
|
6129 |
! |
|
6130 |
||
1052
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6131 |
pageDown |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6132 |
self scrollDown:(self innerHeight) |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6133 |
|
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6134 |
"Created: 13.9.1996 / 14:06:54 / cg" |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6135 |
! |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6136 |
|
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6137 |
pageUp |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6138 |
self scrollUp:(self innerHeight) |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6139 |
|
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6140 |
"Created: 13.9.1996 / 14:07:01 / cg" |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6141 |
! |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6142 |
|
269 | 6143 |
scrollDown |
6144 |
"scroll down by some amount; this is called when the scrollbars |
|
6145 |
scroll-step down button is pressed." |
|
6146 |
||
6147 |
self scrollDown:(self verticalScrollStep) |
|
6148 |
! |
|
6149 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6150 |
scrollDown:nPixels |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6151 |
"change origin to scroll down some pixels" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6152 |
|
1035
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6153 |
|viewOrigin| |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6154 |
|
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6155 |
viewOrigin := self viewOrigin. |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6156 |
^ self scrollTo:(viewOrigin x @ (viewOrigin y + nPixels)) |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6157 |
|
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6158 |
"Modified: 20.8.1996 / 17:34:36 / stefan" |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6159 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6160 |
|
269 | 6161 |
scrollHorizontalTo:aPixelOffset |
6162 |
"change origin to make aPixelOffset be the left col" |
|
6163 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6164 |
|orgY| |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6165 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6166 |
orgY := self viewOrigin y. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6167 |
^ self scrollTo:(aPixelOffset @ orgY). |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6168 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6169 |
"Modified: 8.7.1996 / 15:34:54 / stefan" |
140 | 6170 |
! |
6171 |
||
269 | 6172 |
scrollHorizontalToPercent:percent |
6173 |
"scroll to a position given in percent of total" |
|
6174 |
||
6175 |
|wCont| |
|
6176 |
||
6177 |
wCont := self widthOfContents. |
|
6178 |
transformation notNil ifTrue:[ |
|
1356 | 6179 |
wCont := transformation applyScaleX:wCont. |
269 | 6180 |
]. |
6181 |
self scrollHorizontalTo: |
|
1356 | 6182 |
((((wCont * percent) / 100.0) + 0.5) asInteger) |
269 | 6183 |
! |
6184 |
||
6185 |
scrollLeft |
|
6186 |
"scroll left by some amount; this is called when the scrollbars |
|
6187 |
scroll-step left button is pressed." |
|
6188 |
||
6189 |
self scrollLeft:(self horizontalScrollStep) |
|
6190 |
! |
|
6191 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6192 |
scrollLeft:nPixels |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6193 |
"change origin to scroll left some pixels" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6194 |
|
1035
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6195 |
|viewOrigin| |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6196 |
|
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6197 |
viewOrigin := self viewOrigin. |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6198 |
^ self scrollTo:((viewOrigin x - nPixels) @ viewOrigin y). |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6199 |
|
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6200 |
"Modified: 20.8.1996 / 17:35:09 / stefan" |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6201 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6202 |
|
269 | 6203 |
scrollRight |
6204 |
"scroll right by some amount; this is called when the scrollbars |
|
6205 |
scroll-step right button is pressed." |
|
6206 |
||
6207 |
self scrollRight:(self horizontalScrollStep) |
|
6208 |
! |
|
6209 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6210 |
scrollRight:nPixels |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6211 |
"change origin to scroll right some pixels" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6212 |
|
1035
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6213 |
|viewOrigin| |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6214 |
|
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6215 |
viewOrigin := self viewOrigin. |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6216 |
^ self scrollTo:((viewOrigin x + nPixels) @ viewOrigin y) |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6217 |
|
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6218 |
"Modified: 20.8.1996 / 17:35:37 / stefan" |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6219 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6220 |
|
1052
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6221 |
scrollToBottom |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6222 |
self scrollTo:0 @ (self heightOfContents - self innerHeight) |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6223 |
|
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6224 |
"Created: 13.9.1996 / 14:08:03 / cg" |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6225 |
"Modified: 13.9.1996 / 14:09:32 / cg" |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6226 |
! |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6227 |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6228 |
scrollToPercent:originAsPercent |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6229 |
"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
|
6230 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6231 |
|wCont hCont percent| |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6232 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6233 |
percent := originAsPercent asPoint. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6234 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6235 |
wCont := self widthOfContents. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6236 |
hCont := self heightOfContents. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6237 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6238 |
transformation notNil ifTrue:[ |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6239 |
wCont := transformation applyScaleX:wCont. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6240 |
hCont := transformation applyScaleY:hCont. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6241 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6242 |
self scrollTo: |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6243 |
((((wCont * percent x) / 100.0) + 0.5) asInteger) @ |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6244 |
((((hCont * percent y) / 100.0) + 0.5) asInteger) |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6245 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6246 |
"Created: 5.8.1996 / 12:15:53 / stefan" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6247 |
"Modified: 5.8.1996 / 12:42:57 / stefan" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6248 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6249 |
|
269 | 6250 |
scrollToTop |
6251 |
"move viewOrigin to top" |
|
6252 |
||
6253 |
self scrollVerticalTo:0 |
|
6254 |
! |
|
6255 |
||
6256 |
scrollToTopLeft |
|
6257 |
"move viewOrigin to top/left" |
|
6258 |
||
6259 |
self scrollTo:(0 @ 0). |
|
6260 |
! |
|
6261 |
||
6262 |
scrollUp |
|
6263 |
"scroll up by some amount; this is called when the scrollbars |
|
6264 |
scroll-step up button is pressed." |
|
6265 |
||
6266 |
self scrollUp:(self verticalScrollStep) |
|
6267 |
! |
|
6268 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6269 |
scrollUp:nPixels |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6270 |
"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
|
6271 |
|
1035
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6272 |
|viewOrigin| |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6273 |
|
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6274 |
viewOrigin := self viewOrigin. |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6275 |
^ self scrollTo:(viewOrigin x @ (viewOrigin y - nPixels)). |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6276 |
|
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
6277 |
"Modified: 20.8.1996 / 17:36:16 / stefan" |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6278 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6279 |
|
269 | 6280 |
scrollVerticalTo:aPixelOffset |
6281 |
"change origin to make aPixelOffset be the top line" |
|
6282 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6283 |
|orgX| |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6284 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6285 |
orgX := self viewOrigin x. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6286 |
^ self scrollTo:(orgX @ aPixelOffset). |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6287 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6288 |
"Modified: 8.7.1996 / 15:35:40 / stefan" |
135 | 6289 |
! |
6290 |
||
269 | 6291 |
scrollVerticalToPercent:percent |
6292 |
"scroll to a position given in percent of total" |
|
6293 |
||
6294 |
|hCont| |
|
6295 |
||
6296 |
hCont := self heightOfContents. |
|
6297 |
transformation notNil ifTrue:[ |
|
1356 | 6298 |
hCont := transformation applyScaleY:hCont. |
140 | 6299 |
]. |
269 | 6300 |
self scrollVerticalTo: |
1356 | 6301 |
((((hCont * percent) / 100.0) + 0.5) asInteger) |
269 | 6302 |
! |
6303 |
||
6304 |
verticalScrollStep |
|
6305 |
"return the amount to scroll when stepping up/down. |
|
6306 |
Subclasses may want to redefine this." |
|
6307 |
||
6308 |
^ (device verticalPixelPerMillimeter * 20) asInteger |
|
6309 |
! |
|
6310 |
||
6311 |
widthForScrollBetween:yStart and:yEnd |
|
6312 |
"return the width in pixels for a scroll between yStart and yEnd |
|
6313 |
- return full width here since we do not know how wide contents is. |
|
6314 |
Views which only use part of their space (short lists, text) may redefine |
|
6315 |
this method and return the number of pixels that have to be scrolled. |
|
6316 |
On slow displays, this may make a difference; on fast ones you will probably |
|
6317 |
not notice any difference." |
|
6318 |
||
6319 |
^ (width - margin - margin) |
|
135 | 6320 |
! ! |
6321 |
||
6322 |
!SimpleView methodsFor:'scrolling-basic'! |
|
6323 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6324 |
scrollTo:newOrigin |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6325 |
"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
|
6326 |
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
|
6327 |
point." |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6328 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6329 |
^ self scrollTo:newOrigin redraw:true |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6330 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6331 |
"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
|
6332 |
"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
|
6333 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6334 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6335 |
scrollTo:newOrigin redraw:doRedraw |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6336 |
"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
|
6337 |
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
|
6338 |
point." |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6339 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6340 |
|dX "{ Class:SmallInteger }" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6341 |
dY "{ Class:SmallInteger }" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6342 |
orgX "{ Class:SmallInteger }" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6343 |
orgY "{ Class:SmallInteger }" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6344 |
x y iw ih |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6345 |
hCont wCont fromX toX fromY toY copyWidth copyHeight |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6346 |
redrawX redrawY| |
135 | 6347 |
|
6348 |
hCont := self heightOfContents. |
|
6349 |
wCont := self widthOfContents. |
|
6350 |
transformation isNil ifTrue:[ |
|
704
fc3711e83946
avoid sending #translation twice
Claus Gittinger <cg@exept.de>
parents:
697
diff
changeset
|
6351 |
orgY := orgX := 0 |
135 | 6352 |
] ifFalse:[ |
704
fc3711e83946
avoid sending #translation twice
Claus Gittinger <cg@exept.de>
parents:
697
diff
changeset
|
6353 |
wCont := (transformation applyScaleX:wCont) rounded. |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6354 |
hCont := (transformation applyScaleY:hCont) rounded. |
709 | 6355 |
orgY := transformation translation y negated. |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6356 |
orgX := transformation translation x negated |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6357 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6358 |
|
135 | 6359 |
iw := self innerWidth. |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6360 |
ih := self innerHeight. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6361 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6362 |
"don't scroll outside of displayed area" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6363 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6364 |
x := newOrigin x. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6365 |
y := newOrigin y. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6366 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6367 |
x + iw > wCont ifTrue:[ |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6368 |
x := wCont - iw. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6369 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6370 |
x < 0 ifTrue:[ |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6371 |
x := 0 |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6372 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6373 |
y + ih > hCont ifTrue:[ |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6374 |
y := hCont - ih. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6375 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6376 |
y < 0 ifTrue:[ |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6377 |
y := 0. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6378 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6379 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6380 |
dX := x - orgX. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6381 |
dY := y - orgY. |
135 | 6382 |
|
1066 | 6383 |
(dX == 0 and:[dY == 0]) ifTrue:[ |
6384 |
^ self |
|
6385 |
]. |
|
6386 |
||
135 | 6387 |
self originWillChange. |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6388 |
(shown and:[doRedraw]) ifTrue:[ |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6389 |
copyWidth := iw - dX abs. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6390 |
copyHeight := ih - dY abs. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6391 |
((copyWidth > 0) and:[copyHeight > 0]) ifTrue:[ |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6392 |
"/ some of the currently displayed pixels |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6393 |
"/ remain visible. Copy them |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6394 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6395 |
dX < 0 ifTrue:[ |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6396 |
fromX := margin. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6397 |
toX := margin - dX. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6398 |
redrawX := margin |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6399 |
] ifFalse:[ |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6400 |
fromX := margin + dX. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6401 |
toX := margin. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6402 |
redrawX := margin + copyWidth. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6403 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6404 |
dY < 0 ifTrue:[ |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6405 |
fromY := margin. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6406 |
toY := margin - dY. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6407 |
redrawY := margin. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6408 |
] ifFalse:[ |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6409 |
fromY := margin + dY. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6410 |
toY := margin. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6411 |
redrawY := margin + copyHeight. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6412 |
]. |
704
fc3711e83946
avoid sending #translation twice
Claus Gittinger <cg@exept.de>
parents:
697
diff
changeset
|
6413 |
self catchExpose. |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6414 |
self setViewOrigin:(x @ y). |
1293 | 6415 |
self |
6416 |
copyFrom:self |
|
6417 |
x:fromX y:fromY |
|
6418 |
toX:toX y:toY |
|
6419 |
width:copyWidth |
|
6420 |
height:copyHeight |
|
6421 |
async:true. |
|
704
fc3711e83946
avoid sending #translation twice
Claus Gittinger <cg@exept.de>
parents:
697
diff
changeset
|
6422 |
|
fc3711e83946
avoid sending #translation twice
Claus Gittinger <cg@exept.de>
parents:
697
diff
changeset
|
6423 |
self setInnerClip. |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6424 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6425 |
"first redraw the rectangle above/below the |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6426 |
copied area (with full width)." |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6427 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6428 |
copyHeight < ih ifTrue:[ |
1293 | 6429 |
self |
6430 |
redrawDeviceX:margin y:redrawY |
|
6431 |
width:iw height:(ih - copyHeight). |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6432 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6433 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6434 |
"second redraw the rectangle left/right of the |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6435 |
copied area" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6436 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6437 |
copyWidth < iw ifTrue:[ |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6438 |
self redrawDeviceX:redrawX y:toY |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6439 |
width:iw - copyWidth |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6440 |
height:copyHeight. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6441 |
]. |
704
fc3711e83946
avoid sending #translation twice
Claus Gittinger <cg@exept.de>
parents:
697
diff
changeset
|
6442 |
self waitForExpose. |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6443 |
] ifFalse:[ |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6444 |
"redraw everything" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6445 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6446 |
self setViewOrigin:(x @ y). |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6447 |
self redrawDeviceX:margin y:margin |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6448 |
width:iw |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6449 |
height:ih. |
704
fc3711e83946
avoid sending #translation twice
Claus Gittinger <cg@exept.de>
parents:
697
diff
changeset
|
6450 |
]. |
269 | 6451 |
] ifFalse:[ |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6452 |
self setViewOrigin:(x @ y). |
269 | 6453 |
]. |
709 | 6454 |
self originChanged:(dX negated @ dY negated). |
6455 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
6456 |
"Modified: 5.8.1996 / 11:57:09 / stefan" |
1293 | 6457 |
"Modified: 29.1.1997 / 13:08:26 / cg" |
135 | 6458 |
! ! |
6459 |
||
269 | 6460 |
!SimpleView methodsFor:'startup'! |
6461 |
||
6462 |
open |
|
6463 |
"open up the view - for normal views, this is a modeless open |
|
6464 |
(i.e. the new view comes up as independent process). |
|
6465 |
Although #open is only to be sent to topviews (i.e. it could have been |
|
6466 |
implemented in TopView), it is implemented here - therefore, every view |
|
6467 |
can be opened as a topView. |
|
6468 |
This is redefined in ModalBox, which comes up modal (i.e. |
|
6469 |
control is under the current process, so that interaction with the |
|
6470 |
current group is blocked while the modalBox is active)." |
|
6471 |
||
6472 |
^ self openModeless |
|
6473 |
||
6474 |
" |
|
6475 |
View new open |
|
6476 |
||
6477 |
(Button label:'hello') open |
|
6478 |
||
6479 |
|top| |
|
6480 |
top := StandardSystemView new. |
|
6481 |
top extent:200@200. |
|
6482 |
Button label:'hello' in:top. |
|
6483 |
top open |
|
6484 |
||
6485 |
YesNoBox new open |
|
6486 |
" |
|
6487 |
! |
|
6488 |
||
6489 |
openAndWait |
|
6490 |
"open up the view - wait until it is visible. |
|
6491 |
In normal applications, you do not need to wait till the view is |
|
6492 |
open - it should do all of its drawing itself when it gets the |
|
6493 |
first expose event. |
|
6494 |
However, if you want to 'manually' draw into the view (for example, |
|
6495 |
in doIt expressions) the view must be visible (realized) before doing so. |
|
6496 |
Use this open in those situations." |
|
6497 |
||
6498 |
self open. |
|
6499 |
self waitUntilVisible. |
|
6500 |
||
6501 |
"does not work: |
|
6502 |
||
1356 | 6503 |
|v| |
6504 |
||
6505 |
v := View new open. |
|
6506 |
v displayLineFrom:0@0 to:50@50 |
|
269 | 6507 |
|
6508 |
does work: |
|
6509 |
||
1356 | 6510 |
|v| |
6511 |
||
6512 |
v := View new openAndWait. |
|
6513 |
v displayLineFrom:0@0 to:50@50 |
|
269 | 6514 |
" |
6515 |
! |
|
6516 |
||
6517 |
openAt:aPoint |
|
6518 |
"open up the view modeless - positions the view" |
|
6519 |
||
6520 |
^self openModelessAt:aPoint |
|
6521 |
||
6522 |
"Created: 18.9.1995 / 23:30:43 / claus" |
|
6523 |
! |
|
6524 |
||
6525 |
openAtCenter |
|
6526 |
"open up the view modeless - positions the view" |
|
6527 |
||
6528 |
^self openModelessAtCenter |
|
6529 |
||
6530 |
"Created: 18.9.1995 / 23:30:56 / claus" |
|
6531 |
! |
|
6532 |
||
6533 |
openAutonomous |
|
6534 |
"create and schedule a new windowgroup for me and open the view. |
|
6535 |
The view will be handled by its own process, effectively running in |
|
6536 |
parallel. This entry is for non-topviews, which want to be served |
|
6537 |
autonomous from the topview. (see the fileBrowsers kill-button |
|
6538 |
when executing unix commands as an example)" |
|
6539 |
||
6540 |
|wg| |
|
6541 |
||
1329 | 6542 |
"/ non-thread operation is no longer supported |
6543 |
"/ |
|
6544 |
"/ Processor isPureEventDriven ifTrue:[ |
|
6545 |
"/ self realize. |
|
6546 |
"/ ^ self |
|
6547 |
"/ ]. |
|
6548 |
||
763 | 6549 |
wg := WindowGroup new. |
6550 |
self windowGroup:wg. |
|
6551 |
wg addView:self. |
|
6552 |
wg startup:false. |
|
6553 |
wg isForModalSubview:true. |
|
6554 |
self realizeInGroup. |
|
6555 |
||
1329 | 6556 |
"Modified: 29.5.1996 / 13:23:12 / cg" |
269 | 6557 |
! |
6558 |
||
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6559 |
openInGroup:aGroup |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6560 |
"special open within another windowGroup. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6561 |
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
|
6562 |
for applications where multiple views act as a group |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6563 |
(i.e. close and iconify together)." |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6564 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6565 |
self windowGroup:aGroup. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6566 |
aGroup addTopView:self. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6567 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6568 |
"/ self realizeKeepingGroup:true |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6569 |
aGroup isForModalSubview:true. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6570 |
self realize. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6571 |
! |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
6572 |
|
269 | 6573 |
openModal |
6574 |
"create a new windowgroup, but start processing in the current process |
|
6575 |
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
|
6576 |
Stay in the modalLoop while the view is visible. |
269 | 6577 |
(i.e. control is returned to the sender when the receiver is closed)" |
6578 |
||
6579 |
self openModal:[true] |
|
6580 |
||
6581 |
" |
|
6582 |
the same: |
|
1356 | 6583 |
YesNoBox new open |
6584 |
||
6585 |
YesNoBox new openModal |
|
269 | 6586 |
|
6587 |
different: |
|
1356 | 6588 |
(Button label:'hello') open |
6589 |
||
6590 |
(Button label:'hello') openModal |
|
269 | 6591 |
" |
6592 |
! |
|
6593 |
||
6594 |
openModal:aBlock |
|
6595 |
"create a new windowgroup, but start processing in the current process - |
|
6596 |
actually suspending event processing for the currently active group. |
|
6597 |
Stay in this modal loop while aBlock evaluates to true AND the receiver is |
|
6598 |
visible. |
|
6599 |
(i.e. control is returned to the sender when the receiver is closed) |
|
6600 |
This makes any interaction with the current window impossible - |
|
6601 |
however, other views (in other windowgroups) still work." |
|
6602 |
||
1397
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6603 |
|mainGroup| |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6604 |
|
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6605 |
mainGroup := WindowGroup activeGroup. |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6606 |
mainGroup notNil ifTrue:[ |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6607 |
mainGroup := mainGroup mainGroup. |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6608 |
]. |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6609 |
^ self openModal:aBlock inGroup:mainGroup. |
299
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
6610 |
|
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
6611 |
"Created: 10.12.1995 / 14:06:45 / cg" |
1397
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6612 |
"Modified: 28.2.1997 / 22:31:50 / cg" |
299
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
6613 |
! |
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
6614 |
|
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
6615 |
openModal:aBlock inGroup:mainGroup |
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
6616 |
"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
|
6617 |
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
|
6618 |
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
|
6619 |
visible. |
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
6620 |
(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
|
6621 |
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
|
6622 |
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
|
6623 |
|
1397
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6624 |
|tops mainView mainViewID| |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6625 |
|
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6626 |
ModalBox usingTransientViews ifTrue:[ |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6627 |
mainGroup notNil ifTrue:[ |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6628 |
mainGroup topViews notNil ifTrue:[ |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6629 |
mainView := mainGroup topViews first. |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6630 |
]. |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6631 |
mainView notNil ifTrue:[ |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6632 |
mainViewID := mainView id. |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6633 |
] |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6634 |
]. |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6635 |
|
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6636 |
mainViewID isNil ifTrue:[ |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6637 |
self origin:(device center - (self extent//2)) |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6638 |
]. |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6639 |
|
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6640 |
self create. |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6641 |
device setTransient:drawableId for:mainViewID. |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6642 |
]. |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6643 |
|
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6644 |
self raise. |
299
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
6645 |
|
269 | 6646 |
Processor activeProcessIsSystemProcess ifTrue:[ |
424
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6647 |
" |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6648 |
put myself into the modal group, let it handle events for |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6649 |
me as well. This is only a half way solution, since the view |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6650 |
is not modal at all ... however, the only situation |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6651 |
where this happens is with modal boxes popped while in a |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6652 |
modal browser. You will forgive me for that inconvenience. |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6653 |
" |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6654 |
windowGroup := mainGroup. |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6655 |
mainGroup notNil ifTrue:[mainGroup addTopView:self]. |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6656 |
self realize |
135 | 6657 |
] ifFalse:[ |
424
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6658 |
" |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6659 |
show a stop-cursor in the main group |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6660 |
" |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6661 |
mainGroup notNil ifTrue:[ |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6662 |
self isPopUpView ifFalse:[ |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6663 |
mainGroup showCursor:(Cursor stop). |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6664 |
] |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6665 |
]. |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6666 |
|
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6667 |
" |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6668 |
create a new window group and put myself into it |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6669 |
" |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6670 |
windowGroup := WindowGroup new. |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6671 |
windowGroup addTopView:self. |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6672 |
|
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6673 |
superView notNil ifTrue:[ |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6674 |
"/ |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6675 |
"/ special: this is a modal subview, |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6676 |
"/ prevent the view to reassign its windowGroup when realized |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6677 |
"/ (subviews normally place themself into the superviews group) |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6678 |
"/ |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6679 |
windowGroup isForModalSubview:true. |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6680 |
]. |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6681 |
|
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6682 |
" |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6683 |
go dispatch events in this new group |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6684 |
(thus current windowgroup is blocked from interaction) |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6685 |
" |
426 | 6686 |
AbortSignal handle:[:ex | |
424
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6687 |
self hide. |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6688 |
ex return. |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6689 |
] do:[ |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6690 |
[ |
1261
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6691 |
[ |
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6692 |
windowGroup startupModal:[realized and:aBlock] forGroup:mainGroup |
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6693 |
] valueOnUnwindDo:[ |
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6694 |
self hide |
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6695 |
] |
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6696 |
] valueNowOrOnUnwindDo:[ |
424
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6697 |
mainGroup notNil ifTrue:[ |
1261
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6698 |
ReturnFocusWhenClosingModalBoxes ifTrue:[ |
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6699 |
" |
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6700 |
return input focus to previously active groups top. |
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6701 |
This helps with windowmanagers which need an explicit click |
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6702 |
on the view for the focus. |
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6703 |
" |
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6704 |
tops := mainGroup topViews. |
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6705 |
(tops notNil and:[tops notEmpty]) ifTrue:[ |
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6706 |
tops first getKeyboardFocus |
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6707 |
] |
424
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6708 |
]. |
1261
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6709 |
|
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6710 |
" |
1329 | 6711 |
restore cursors in the main group & flush its buffered key & mouse events |
1261
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6712 |
" |
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6713 |
mainGroup restoreCursors. |
1329 | 6714 |
"/ mainGroup sensor flushUserEvents. |
1261
15adeadfaa0e
care for returnFocus when aborting modalBoxes
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
6715 |
] |
424
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6716 |
] |
d3d266695780
dont show a waitCursor when opening a popUpView
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
6717 |
]. |
135 | 6718 |
] |
299
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
6719 |
|
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
6720 |
"Created: 10.12.1995 / 14:06:14 / cg" |
1397
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
6721 |
"Modified: 28.2.1997 / 22:29:56 / cg" |
135 | 6722 |
! |
6723 |
||
269 | 6724 |
openModalAt:aPoint |
6725 |
"open up the view modeless - positions the view |
|
6726 |
(i.e. circumvents window managers positioning)" |
|
6727 |
||
6728 |
self origin:aPoint. |
|
6729 |
self create. |
|
560
968d062c79cb
oops - openAt did set transient; definitely wrong ...
Claus Gittinger <cg@exept.de>
parents:
527
diff
changeset
|
6730 |
"/ device setTransient:drawableId for:0. |
269 | 6731 |
^ self openModal |
6732 |
||
6733 |
" |
|
6734 |
View new openModal |
|
6735 |
||
6736 |
View new openModalAt:100@100 |
|
6737 |
" |
|
6738 |
||
6739 |
"Created: 18.9.1995 / 23:21:42 / claus" |
|
6740 |
"Modified: 18.9.1995 / 23:32:26 / claus" |
|
560
968d062c79cb
oops - openAt did set transient; definitely wrong ...
Claus Gittinger <cg@exept.de>
parents:
527
diff
changeset
|
6741 |
"Modified: 12.4.1996 / 19:02:29 / cg" |
269 | 6742 |
! |
6743 |
||
6744 |
openModalAtCenter |
|
6745 |
"open up the view modeless - positions the view |
|
6746 |
(i.e. circumvents window managers positioning)" |
|
6747 |
||
6748 |
^ self openModalAt:(device center - (self extent//2)). |
|
6749 |
||
6750 |
"Created: 18.9.1995 / 23:31:47 / claus" |
|
6751 |
! |
|
6752 |
||
6753 |
openModeless |
|
6754 |
"create and schedule a new windowgroup for me and open the view. |
|
6755 |
The view will be handled by its own process, effectively running in |
|
6756 |
parallel (i.e. control is returned to the sender immediately)." |
|
6757 |
||
566 | 6758 |
Processor isPureEventDriven ifFalse:[ |
503
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6759 |
windowGroup isNil ifTrue:[ |
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6760 |
windowGroup := WindowGroup new. |
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6761 |
windowGroup addTopView:self. |
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6762 |
windowGroup startup:false. |
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6763 |
] ifFalse:[ |
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6764 |
windowGroup addTopView:self. |
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6765 |
windowGroup startup:false. |
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6766 |
self realizeInGroup. |
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6767 |
]. |
269 | 6768 |
] ifTrue:[ |
503
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6769 |
self realize |
135 | 6770 |
] |
269 | 6771 |
|
6772 |
" |
|
6773 |
the same: |
|
503
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6774 |
(Button label:'hello') open |
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6775 |
|
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6776 |
(Button label:'hello') openModeless |
269 | 6777 |
|
6778 |
different: |
|
503
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6779 |
YesNoBox new open |
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6780 |
|
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6781 |
YesNoBox new openModeless |
269 | 6782 |
" |
6783 |
" |
|
6784 |
(almost) the same: |
|
503
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6785 |
YesNoBox new open |
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6786 |
|
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6787 |
YesNoBox new openModal |
269 | 6788 |
|
6789 |
different: |
|
503
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6790 |
(Button label:'hello') open |
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6791 |
|
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6792 |
(Button label:'hello') openModal |
269 | 6793 |
" |
503
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
6794 |
|
566 | 6795 |
"Modified: 13.4.1996 / 20:34:45 / cg" |
269 | 6796 |
! |
6797 |
||
6798 |
openModelessAt:aPoint |
|
6799 |
"open up the view modeless - positions the view |
|
6800 |
(i.e. circumvents window managers positioning)" |
|
6801 |
||
6802 |
self origin:aPoint. |
|
6803 |
self create. |
|
6804 |
^ self openModeless |
|
6805 |
||
6806 |
" |
|
6807 |
View new openModeless |
|
6808 |
||
6809 |
View new openModelessAt:100@100 |
|
6810 |
" |
|
6811 |
||
6812 |
"Created: 18.9.1995 / 23:21:42 / claus" |
|
560
968d062c79cb
oops - openAt did set transient; definitely wrong ...
Claus Gittinger <cg@exept.de>
parents:
527
diff
changeset
|
6813 |
"Modified: 12.4.1996 / 19:02:28 / cg" |
269 | 6814 |
! |
6815 |
||
6816 |
openModelessAtCenter |
|
6817 |
"open up the view modeless - positions the view |
|
6818 |
(i.e. circumvents window managers positioning)" |
|
6819 |
||
6820 |
^ self openModelessAt:(device center - (self extent//2)). |
|
6821 |
||
6822 |
" |
|
6823 |
View new openModeless |
|
6824 |
||
6825 |
View new openModelessAtCenter |
|
6826 |
" |
|
6827 |
||
6828 |
"Created: 18.9.1995 / 23:21:42 / claus" |
|
6829 |
! |
|
6830 |
||
6831 |
waitUntilVisible |
|
6832 |
"wait until the receiver visible. |
|
6833 |
In normal applications, you do not need to wait till a view is |
|
6834 |
open - it should do all of its drawing itself when it gets the |
|
6835 |
first expose event. |
|
6836 |
However, if you want to 'manually' draw into the view (for example, |
|
6837 |
in doIt expressions), or subsequent views depend on some state of |
|
6838 |
another view (which is only available once visible), |
|
6839 |
use this to suspend the current process until the receiver is shown. |
|
6840 |
Caveat: |
|
1356 | 6841 |
we poll here for the view to be shown - we need a semaphore |
6842 |
which is raised by the view in order to do it right." |
|
269 | 6843 |
|
6844 |
[self shown] whileFalse:[ |
|
1356 | 6845 |
Delay waitForSeconds:0.05. |
269 | 6846 |
]. |
6847 |
||
6848 |
"does not work (the view is in its opening phase, |
|
6849 |
when we attempt to draw a line - this gives an error, since |
|
6850 |
its internals are not yet correctly setup): |
|
6851 |
||
1356 | 6852 |
|v| |
6853 |
||
6854 |
v := View new open. |
|
6855 |
v displayLineFrom:0@0 to:50@50 |
|
269 | 6856 |
|
6857 |
does work (since we wait until the view has completely finished |
|
6858 |
its startup phase): |
|
6859 |
||
1356 | 6860 |
|v| |
6861 |
||
6862 |
v := View new open. |
|
6863 |
v waitUntilVisible. |
|
6864 |
v displayLineFrom:0@0 to:50@50 |
|
269 | 6865 |
" |
135 | 6866 |
! ! |
6867 |
||
6868 |
!SimpleView methodsFor:'user notification'! |
|
6869 |
||
6870 |
warn:aString |
|
6871 |
"like Objects warn, but translates the string via the |
|
6872 |
resourcePack, thus giving a translated string automatically" |
|
6873 |
||
151 | 6874 |
super warn:(resources string:aString) withCRs |
135 | 6875 |
! |
6876 |
||
6877 |
warn:aString with:argument |
|
6878 |
"like Objects warn, but translates the string via the |
|
6879 |
resourcePack, thus giving a translated string automatically" |
|
6880 |
||
151 | 6881 |
super warn:(resources string:aString with:argument) withCRs |
6882 |
! |
|
6883 |
||
6884 |
warn:aString with:arg1 with:arg2 |
|
6885 |
"like Objects warn, but translates the string via the |
|
6886 |
resourcePack, thus giving a translated string automatically" |
|
6887 |
||
6888 |
super warn:(resources string:aString with:arg1 with:arg2) withCRs |
|
135 | 6889 |
! ! |
6890 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
6891 |
!SimpleView class methodsFor:'documentation'! |
269 | 6892 |
|
6893 |
version |
|
1427 | 6894 |
^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.184 1997-03-05 16:08:45 ca Exp $' |
135 | 6895 |
! ! |
6896 |
SimpleView initialize! |