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