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