author | Claus Gittinger <cg@exept.de> |
Wed, 09 Jun 2004 11:44:21 +0200 | |
changeset 4189 | e02b0c6dec2f |
parent 4184 | 1b6a082d98e2 |
child 4191 | 7f999428c830 |
permissions | -rw-r--r-- |
135 | 1 |
" |
2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
3152 | 3 |
All Rights Reserved |
135 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
3196
43d42e7c388a
MUST invoke #postBuildWith: / #postBuildAsSubcanvasWith:,
tm
parents:
3191
diff
changeset
|
13 |
"{ Package: 'stx:libview' }" |
43d42e7c388a
MUST invoke #postBuildWith: / #postBuildAsSubcanvasWith:,
tm
parents:
3191
diff
changeset
|
14 |
|
727
bf23a306b6f2
renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents:
724
diff
changeset
|
15 |
DisplaySurface subclass:#SimpleView |
3055
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
16 |
instanceVariableNames:'superView subViews components styleSheet resources borderColor |
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
17 |
borderWidth viewShape top left flagBits relativeOrigin |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
18 |
relativeExtent relativeCorner originRule extentRule cornerRule |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
19 |
insets layout shown hiddenOnRealize name level margin |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
20 |
innerClipRect shadowColor lightColor bitGravity viewGravity |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
21 |
controller windowGroup preferredExtent explicitExtent dependents |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
22 |
layoutManager visibilityChannel' |
3055
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
23 |
classVariableNames:'Grey CentPoint ViewSpacing DefaultStyle StyleSheet |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
24 |
DefaultViewBackgroundColor DefaultBorderColor DefaultLightColor |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
25 |
DefaultShadowColor DefaultBorderWidth DefaultFocusColor |
3375 | 26 |
DefaultFocusBorderWidth ReturnFocusWhenClosingModalBoxes |
3394
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
27 |
FlagOriginChanged FlagExtentChanged FlagCornerChanged |
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
28 |
FlagExtentChangedBeforeCreated FlagCanTab |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
29 |
FlagRequestFocusOnPointerEnter |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
30 |
FlagDoNotRequestFocusOnPointerEnter' |
3055
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
31 |
poolDictionaries:'' |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
32 |
category:'Views-Basic' |
135 | 33 |
! |
34 |
||
452
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
35 |
SimpleView class instanceVariableNames:'ClassResources DefaultFont' |
734 | 36 |
|
37 |
" |
|
3164
f3dce6ea8e3f
VW compatibility: closeAndUnschedule
Claus Gittinger <cg@exept.de>
parents:
3155
diff
changeset
|
38 |
No other class instance variables are inherited by this class. |
734 | 39 |
" |
140 | 40 |
! |
135 | 41 |
|
1903 | 42 |
Object subclass:#ViewShape |
3055
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
43 |
instanceVariableNames:'' |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
44 |
classVariableNames:'' |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
45 |
poolDictionaries:'' |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
46 |
privateIn:SimpleView |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
47 |
! |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
48 |
|
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
49 |
SimpleView::ViewShape subclass:#RoundViewShape |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
50 |
instanceVariableNames:'' |
3055
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
51 |
classVariableNames:'' |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
52 |
poolDictionaries:'' |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
53 |
privateIn:SimpleView |
2750
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
54 |
! |
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
55 |
|
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
56 |
SimpleView::ViewShape subclass:#ArbitraryViewShape |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
57 |
instanceVariableNames:'viewShapeForm borderShapeForm' |
3055
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
58 |
classVariableNames:'' |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
59 |
poolDictionaries:'' |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
60 |
privateIn:SimpleView |
1903 | 61 |
! |
62 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
63 |
!SimpleView class methodsFor:'documentation'! |
135 | 64 |
|
65 |
copyright |
|
66 |
" |
|
67 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
3152 | 68 |
All Rights Reserved |
135 | 69 |
|
70 |
This software is furnished under a license and may be used |
|
71 |
only in accordance with the terms of that license and with the |
|
72 |
inclusion of the above copyright notice. This software may not |
|
73 |
be provided or otherwise made available to, or used by, any |
|
74 |
other person. No title to or ownership of the software is |
|
75 |
hereby transferred. |
|
76 |
" |
|
77 |
! |
|
78 |
||
79 |
documentation |
|
80 |
" |
|
81 |
this class implements functions common to all Views which do not work on / show a model. |
|
82 |
Previously, all of this functionality used to be in the old View class, but has been |
|
83 |
separated into this new SimpleView (which does not know about models) and the new View, which |
|
84 |
does so. |
|
484 | 85 |
I'd prefer to call this class View and the current View class a ModelView, |
86 |
but for backward compatibility its better to leave things the way they are |
|
87 |
(there are simply too many subclasses of View around ...). |
|
88 |
||
135 | 89 |
Instances of SimpleView are seldom used, most views in the system inherit |
90 |
from this class. |
|
91 |
However, sometimes a view is used to create a dummy view for framing |
|
92 |
or layout purposes. |
|
93 |
||
616 | 94 |
[Instance variables:] |
135 | 95 |
|
3152 | 96 |
superView <View> my superview i.e. the view I am in |
97 |
||
98 |
subViews <Collection> the collection of subviews |
|
99 |
||
100 |
components <Collection> collection of gadgets (will be merged with subViews, soon) |
|
101 |
||
102 |
borderColor <Color> color of border |
|
103 |
||
104 |
borderWidth <Number> borderWidth in pixels (device dep.) |
|
105 |
||
106 |
viewShape <Form> shape of view & border (if device supports it) |
|
107 |
||
108 |
top <Number> actual top coordinate (pixels) in superview |
|
109 |
||
110 |
left <Number> actual left coordinate (pixels) in superview |
|
111 |
||
112 |
extendChanged <Boolean> true if extend changed during setup |
|
113 |
||
114 |
originChanged <Boolean> true if origin changed during setup |
|
115 |
||
116 |
relativeOrigin <Number> relative origin in percent within superview |
|
117 |
||
118 |
relativeExtent <Number> relative extent in percent within superview |
|
119 |
||
120 |
relativeCorner <Number> relative corner in percent within superview |
|
121 |
||
122 |
originRule <Block> rule to compute origin if superview changes size |
|
123 |
||
124 |
extentRule <Block> rule to compute extent if superview changes size |
|
125 |
||
126 |
cornerRule <Block> rule to compute corner if superview changes size |
|
127 |
||
128 |
insets <Array> array with top, left, bottom & right insets (or nil) |
|
129 |
||
130 |
layout <LayoutObject> not yet implemented - will replace the above layout |
|
131 |
variables. |
|
132 |
||
133 |
shown <Boolean> true if visible (false if iconified, unmapped or covered) |
|
134 |
||
135 |
hiddenOnRealize <Boolean> dont show automatically when superview is realized |
|
136 |
||
137 |
name <String> my name (future use for resources) |
|
138 |
||
139 |
level <Number> 3D level relative to superview |
|
140 |
||
141 |
margin <Number> convenient margin |
|
142 |
||
143 |
innerClipRect <Rectangle> convenient inner clip (minus margin) |
|
144 |
||
145 |
shadowColor <Color> color used to draw 3D shadowed edges |
|
146 |
||
147 |
lightColor <Color> color used to draw 3D lighted edges |
|
148 |
||
149 |
bitGravity <nil | Symbol> gravity of contents (if device supports it) |
|
150 |
||
151 |
viewGravity <nil | Symbol> gravity of view (if device supports it) |
|
152 |
||
153 |
controller <nil | Controller> the controller (if any) |
|
154 |
||
155 |
windowGroup <WindowGroup> the windowGroup |
|
484 | 156 |
|
135 | 157 |
|
158 |
||
616 | 159 |
[Class variables:] |
135 | 160 |
|
3152 | 161 |
Grey <Color> the color grey - its used so often |
162 |
||
163 |
ViewSpacing <Number> preferred spacing between views; 1mm |
|
164 |
||
165 |
CentPoint <Point> 100 @ 100 - its used so often |
|
166 |
||
167 |
StyleSheet <ResourcePack> contains all view-style specifics |
|
168 |
||
169 |
ReturnFocusWhenClosingModalBoxes if true, a closing modalBox returns |
|
170 |
<Boolean> the keyboard focus to the view which was |
|
171 |
active when the box was opened. |
|
172 |
If false (the default), it is left to |
|
173 |
window manager to assign a new focus. |
|
174 |
If running on olwm/olvwm (which requires an |
|
175 |
explicit click to reassign a focus), it is |
|
176 |
better to turn this on in a private.rc file. |
|
135 | 177 |
|
616 | 178 |
[styleSheet parameters:] |
135 | 179 |
|
3152 | 180 |
popupShadow <Boolean> if true, popupViews show a shadow below |
181 |
||
182 |
popupLevel <nil | Integer> 3D level |
|
183 |
||
184 |
borderWidth <nil | Integer> borderWidth (ignored in 3D styles) |
|
185 |
||
186 |
borderColor <nil | Color> borderColor (ignored in 3D styles) |
|
187 |
||
188 |
viewBackground <nil | Color> views background |
|
189 |
||
190 |
shadowColor <nil | Color> color for shadow edges (ignored in 2D styles) |
|
191 |
||
192 |
lightColor <nil | Color> color for light edges (ignored in 2D styles) |
|
193 |
||
194 |
font <nil | Font> font to use |
|
135 | 195 |
|
196 |
||
197 |
TODO: |
|
3152 | 198 |
get rid of relativeOrigin, relativeCorner, originRule, extentRule, |
199 |
and insets; replace by a single object which defines the size |
|
200 |
(mhmh - ST-80 seems to call this LayoutFrame ?) |
|
201 |
-> be prepared for a change here in the near future and ONLY use |
|
202 |
access methods to get those instance variables' values |
|
203 |
||
204 |
get rid of 3D level & margin, move it to extra wrappers |
|
205 |
(although this will make view setup more complicated, it will remove |
|
206 |
complexity from the internals of view. Also, it will allow for more |
|
207 |
varieties of borders.) |
|
151 | 208 |
|
3152 | 209 |
add components (could also call them gadgets or lightweight views) |
210 |
- views are expensive in terms of X resources. This would make all |
|
211 |
framing/edge and panel helper views become cheap ST objects, instead |
|
212 |
of views. |
|
616 | 213 |
|
214 |
||
215 |
[see also:] |
|
3152 | 216 |
StandardSystemView DialogBox |
217 |
WindowGroup WindowEvent |
|
218 |
Layout |
|
219 |
( introduction to view programming :html: programming/viewintro.html ) |
|
616 | 220 |
|
221 |
[author:] |
|
3152 | 222 |
Claus Gittinger |
135 | 223 |
" |
151 | 224 |
! |
225 |
||
226 |
examples |
|
227 |
" |
|
228 |
(all examples below use different viewBackgrounds, |
|
229 |
to make the individual subviews visible) |
|
230 |
||
616 | 231 |
a subView in a topView: |
3152 | 232 |
[exBegin] |
233 |
|top v| |
|
234 |
||
235 |
top := StandardSystemView new. |
|
236 |
v := View new. |
|
237 |
v origin:0.25 @ 0.25 corner:0.75 @ 0.75. |
|
238 |
top addSubView:v. |
|
239 |
top open |
|
240 |
[exEnd] |
|
616 | 241 |
|
242 |
||
243 |
the same, a bit more compact: |
|
3152 | 244 |
[exBegin] |
245 |
|top v| |
|
246 |
||
247 |
top := StandardSystemView new. |
|
248 |
v := View origin:0.25 @ 0.25 corner:0.75 @ 0.75 in:top. |
|
249 |
top open |
|
250 |
[exEnd] |
|
616 | 251 |
|
252 |
||
151 | 253 |
fixed position/size: |
3152 | 254 |
[exBegin] |
151 | 255 |
|top v1 v2| |
256 |
||
257 |
top := StandardSystemView new. |
|
258 |
top extent:300@300. |
|
259 |
||
260 |
v1 := View origin:10@10 |
|
3152 | 261 |
corner:50@50 |
262 |
in:top. |
|
151 | 263 |
v2 := View origin:60@10 |
3152 | 264 |
corner:150@100 |
265 |
in:top. |
|
151 | 266 |
|
267 |
v1 viewBackground:(Color red). |
|
268 |
v2 viewBackground:(Color yellow). |
|
269 |
||
270 |
top open |
|
3152 | 271 |
[exEnd] |
151 | 272 |
|
273 |
same, using ST-80 way of bulding up view hierarchies |
|
274 |
(recommended, if you plan to port applications later) |
|
3152 | 275 |
[exBegin] |
151 | 276 |
|top v1 v2| |
277 |
||
278 |
top := StandardSystemView new. |
|
279 |
top extent:300@300. |
|
280 |
||
281 |
v1 := View new. |
|
282 |
v1 origin:10@10 corner:50@50. |
|
283 |
||
284 |
v2 := View new. |
|
285 |
v2 origin:60@10 corner:150@100. |
|
286 |
||
287 |
v1 viewBackground:(Color red). |
|
288 |
v2 viewBackground:(Color yellow). |
|
289 |
||
290 |
top add:v1. |
|
291 |
top add:v2. |
|
292 |
||
293 |
v1 viewBackground:(Color red). |
|
294 |
v2 viewBackground:(Color yellow). |
|
295 |
||
296 |
top open |
|
3152 | 297 |
[exEnd] |
151 | 298 |
|
299 |
fixed origin, variable size: |
|
3152 | 300 |
[exBegin] |
151 | 301 |
|top v1 v2| |
302 |
||
303 |
top := StandardSystemView new. |
|
304 |
top extent:300@300. |
|
305 |
||
306 |
v1 := View new. |
|
307 |
v1 origin:10@10 corner:50@0.5. |
|
308 |
||
309 |
v2 := View new. |
|
310 |
v2 origin:60@10 corner:150@0.5. |
|
311 |
||
312 |
v1 viewBackground:(Color red). |
|
313 |
v2 viewBackground:(Color yellow). |
|
314 |
||
315 |
top add:v1. |
|
316 |
top add:v2. |
|
317 |
||
318 |
top open |
|
3152 | 319 |
[exEnd] |
151 | 320 |
|
321 |
fixed origin, variable size, |
|
322 |
bottomInset for constant distance from bottom: |
|
3152 | 323 |
[exBegin] |
151 | 324 |
|top v1 v2| |
325 |
||
326 |
top := StandardSystemView new. |
|
327 |
top extent:300@300. |
|
328 |
||
329 |
v1 := View new. |
|
330 |
v1 origin:10@10 corner:50@1.0. |
|
331 |
v1 bottomInset:10. |
|
332 |
||
333 |
v2 := View new. |
|
334 |
v2 origin:60@10 corner:150@1.0. |
|
335 |
v2 bottomInset:10. |
|
336 |
||
337 |
v1 viewBackground:(Color red). |
|
338 |
v2 viewBackground:(Color yellow). |
|
339 |
||
340 |
top add:v1. |
|
341 |
top add:v2. |
|
342 |
||
343 |
top open |
|
3152 | 344 |
[exEnd] |
151 | 345 |
|
346 |
variable origin, variable size, |
|
3152 | 347 |
[exBegin] |
151 | 348 |
|top v1 v2| |
349 |
||
350 |
top := StandardSystemView new. |
|
351 |
top extent:300@300. |
|
352 |
||
353 |
v1 := View new. |
|
354 |
v1 origin:0.0@0.0 corner:0.5@0.5. |
|
355 |
||
356 |
v2 := View new. |
|
357 |
v2 origin:0.5@0.0 corner:1.0@0.5. |
|
358 |
||
359 |
v1 viewBackground:(Color red). |
|
360 |
v2 viewBackground:(Color yellow). |
|
361 |
||
362 |
top add:v1. |
|
363 |
top add:v2. |
|
364 |
||
365 |
top open |
|
3152 | 366 |
[exEnd] |
151 | 367 |
|
368 |
variable origin, variable size, |
|
369 |
insets for some constant distance |
|
3152 | 370 |
[exBegin] |
151 | 371 |
|top v1 v2| |
372 |
||
373 |
top := StandardSystemView new. |
|
374 |
top extent:300@300. |
|
375 |
||
376 |
v1 := View new. |
|
377 |
v1 origin:0.0@0.0 corner:0.5@0.5. |
|
378 |
v1 rightInset:5. |
|
379 |
||
380 |
v2 := View new. |
|
381 |
v2 origin:0.5@0.0 corner:1.0@0.5. |
|
382 |
v2 leftInset:5. |
|
383 |
||
384 |
v1 viewBackground:(Color red). |
|
385 |
v2 viewBackground:(Color yellow). |
|
386 |
||
387 |
top add:v1. |
|
388 |
top add:v2. |
|
389 |
||
390 |
top open |
|
3152 | 391 |
[exEnd] |
151 | 392 |
|
393 |
using layout objects (ST-80 style): |
|
394 |
fully specifying the frame |
|
3152 | 395 |
[exBegin] |
151 | 396 |
|top v1 v2| |
397 |
||
398 |
top := StandardSystemView new. |
|
399 |
top extent:300@300. |
|
400 |
||
401 |
v1 := View new. |
|
402 |
v2 := View new. |
|
403 |
||
404 |
v1 viewBackground:(Color red). |
|
405 |
v2 viewBackground:(Color yellow). |
|
406 |
||
407 |
top add:v1 in:(LayoutFrame new |
|
3152 | 408 |
leftFraction:0.25; |
409 |
rightFraction:0.75; |
|
410 |
topFraction:0.0; |
|
411 |
bottomFraction:0.5). |
|
151 | 412 |
top add:v2 in:(LayoutFrame new |
3152 | 413 |
leftFraction:0.5; |
414 |
rightFraction:1.0; |
|
415 |
topFraction:0.5; |
|
416 |
bottomFraction:0.75). |
|
151 | 417 |
|
418 |
top open |
|
3152 | 419 |
[exEnd] |
151 | 420 |
|
421 |
another one, with offsets: |
|
3152 | 422 |
[exBegin] |
151 | 423 |
|top v1 v2| |
424 |
||
425 |
top := StandardSystemView new. |
|
426 |
top extent:300@300. |
|
427 |
||
428 |
v1 := View new. |
|
429 |
v2 := View new. |
|
430 |
||
431 |
v1 viewBackground:(Color red). |
|
432 |
v2 viewBackground:(Color yellow). |
|
433 |
||
434 |
top add:v1 in:(LayoutFrame new |
|
3152 | 435 |
leftFraction:0.0 offset:10; |
436 |
rightFraction:1.0 offset:-10; |
|
437 |
topFraction:0.0 offset:10; |
|
438 |
bottomFraction:0.5). |
|
151 | 439 |
top add:v2 in:(LayoutFrame new |
3152 | 440 |
leftFraction:0.0 offset:30; |
441 |
rightFraction:1.0 offset:-30; |
|
442 |
topFraction:0.5 offset:10; |
|
443 |
bottomFraction:0.75). |
|
151 | 444 |
|
445 |
top open |
|
3152 | 446 |
[exEnd] |
151 | 447 |
|
448 |
specifying origin only. Extent is views preferred |
|
449 |
(notice, that plain views have some defaultExtent of 100@100) |
|
3152 | 450 |
[exBegin] |
151 | 451 |
|top v1 v2| |
452 |
||
453 |
top := StandardSystemView new. |
|
454 |
top extent:300@300. |
|
455 |
||
456 |
v1 := View new. |
|
457 |
v2 := View new. |
|
458 |
||
459 |
v1 viewBackground:(Color red). |
|
460 |
v2 viewBackground:(Color yellow). |
|
461 |
||
462 |
top add:v1 in:(LayoutOrigin new |
|
3152 | 463 |
leftFraction:0.25; |
464 |
topFraction:0.0). |
|
151 | 465 |
top add:v2 in:(LayoutOrigin new |
3152 | 466 |
leftFraction:0.5; |
467 |
topFraction:0.5). |
|
151 | 468 |
|
469 |
top open |
|
3152 | 470 |
[exEnd] |
151 | 471 |
|
472 |
same example, using buttons which compute their preferredBounds: |
|
3152 | 473 |
[exBegin] |
151 | 474 |
|top v1 v2| |
475 |
||
476 |
top := StandardSystemView new. |
|
477 |
top extent:300@300. |
|
478 |
||
479 |
v1 := Button label:'foo'. |
|
480 |
v2 := Button label:'a very long buttonLabel'. |
|
481 |
||
482 |
v1 backgroundColor:(Color red). |
|
483 |
v2 backgroundColor:(Color yellow). |
|
484 |
||
485 |
top add:v1 in:(LayoutOrigin new |
|
3152 | 486 |
leftFraction:0.25; |
487 |
topFraction:0.0). |
|
151 | 488 |
top add:v2 in:(LayoutOrigin new |
3152 | 489 |
leftFraction:0.5; |
490 |
topFraction:0.5). |
|
151 | 491 |
|
492 |
top open |
|
3152 | 493 |
[exEnd] |
151 | 494 |
" |
269 | 495 |
! |
496 |
||
497 |
layoutComputation |
|
498 |
" |
|
499 |
Due to historic reasons, there are 2 mechanisms to resize a view: |
|
3152 | 500 |
- (old, to be eliminated mechanism) |
501 |
based upon info found in |
|
502 |
relativeOrigin / relativeCorner / relativeExtent |
|
503 |
originRule / cornerRule / extentRule |
|
504 |
||
505 |
- (new, will migrate to that one) |
|
506 |
letting a layoutObject compute things |
|
269 | 507 |
|
508 |
Actually, the old mechanism is just as powerful, as the new (layoutObject |
|
509 |
based) mechanism; with the help of block=rules, you can compute whatever |
|
510 |
geometry is desired. |
|
511 |
However, having 6 instance variables in every view creates some overhead, |
|
512 |
which can be avoided in most cases (most views are either fixed-size or |
|
513 |
relative-sized). |
|
514 |
Therefore (and also to make porting of ST-80 apps easier), ST/X will migrate |
|
515 |
to use layoutObjects. |
|
516 |
You will not see a difference at the views protocol level, since |
|
517 |
existing interfaces will (silently) create layoutObjects as appropriate. |
|
518 |
However, you should remove all direct accesses to the above mentioned |
|
519 |
instance variables, to be prepared for that change. |
|
520 |
||
521 |
Notice, that a view recomputes its size whenever its superview |
|
522 |
changes size. This is done via: |
|
3152 | 523 |
sizeChanged |
524 |
-> allSubviews: superViewChangedSize |
|
269 | 525 |
|
526 |
If the geometry computation as performed in superViewChangedSize |
|
527 |
is not powerful enough for your application, you can either: |
|
3152 | 528 |
- redefine superViewChangedSize |
529 |
- create a special layoutObject which computes a new layout. |
|
269 | 530 |
" |
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
531 |
! |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
532 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
533 |
popupMenus |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
534 |
" |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
535 |
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
|
536 |
definition: |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
537 |
|
3152 | 538 |
- static menus |
539 |
||
540 |
- dynamic menus from the view |
|
541 |
||
542 |
- dynamic menus from the model / menuHolder |
|
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
543 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
544 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
545 |
static menus |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
546 |
------------ |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
547 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
548 |
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
|
549 |
has a constant menu which never changes. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
550 |
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
|
551 |
The menu is defined with: |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
552 |
|
3152 | 553 |
someView middleButtonMenu:<aPopUpMenu> |
522
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 |
Compatibility note: |
3152 | 556 |
static menus should no longer be used - their operation |
557 |
is incompatible with ST-80 and ST/X's dynamic menus. |
|
558 |
Do not use them if you care for compatibility. |
|
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
559 |
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
|
560 |
(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
|
561 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
562 |
example: |
3152 | 563 |
|top v1 v2| |
564 |
||
565 |
top := StandardSystemView new. |
|
566 |
top extent:300@300. |
|
567 |
||
568 |
v1 := View origin:0.0@0.0 corner:0.5@1.0 in:top. |
|
569 |
v1 viewBackground:Color red. |
|
570 |
||
571 |
v2 := View origin:0.5@0.0 corner:1.0@1.0 in:top. |
|
572 |
v2 viewBackground:Color yellow. |
|
573 |
||
574 |
v1 middleButtonMenu:( |
|
575 |
PopUpMenu |
|
576 |
labels:#('foo' 'bar') |
|
577 |
selectors:#(foo bar) |
|
578 |
receiver:v1 |
|
579 |
). |
|
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
580 |
|
3152 | 581 |
top open. |
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
582 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
583 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
584 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
585 |
dynamic menus |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
586 |
------------- |
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 |
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
|
589 |
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
|
590 |
(i.e. it may be different from the model). |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
591 |
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
|
592 |
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
|
593 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
594 |
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
|
595 |
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
|
596 |
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
|
597 |
by textViews. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
598 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
599 |
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
|
600 |
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
|
601 |
- so the textView still performs the copy-function correctly |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
602 |
(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
|
603 |
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
|
604 |
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
|
605 |
(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
|
606 |
|
3152 | 607 |
|top v1 v2 holder| |
608 |
||
609 |
holder := Plug new. |
|
610 |
holder respondTo:#menu1 |
|
611 |
with:[ |
|
612 |
v1 menuMessage:#otherMenu1. |
|
613 |
PopUpMenu |
|
614 |
labels:#('foo' 'bar') |
|
615 |
selectors:#(foo bar). |
|
616 |
]. |
|
617 |
holder respondTo:#otherMenu1 |
|
618 |
with:[ |
|
619 |
v1 menuMessage:#menu1. |
|
620 |
PopUpMenu |
|
621 |
labels:#('other foo' 'other bar') |
|
622 |
selectors:#(foo bar). |
|
623 |
]. |
|
624 |
holder respondTo:#menu2 |
|
625 |
with:[ PopUpMenu |
|
626 |
labels:#('copy' 'bar2') |
|
627 |
selectors:#(copySelection bar2) |
|
628 |
]. |
|
629 |
||
630 |
top := StandardSystemView new. |
|
631 |
top extent:300@300. |
|
632 |
||
633 |
v1 := View origin:0.0@0.0 corner:0.5@1.0 in:top. |
|
634 |
v1 viewBackground:Color red. |
|
635 |
||
636 |
v2 := TextView origin:0.5@0.0 corner:1.0@1.0 in:top. |
|
637 |
v2 contents:'pop me up'. |
|
638 |
||
639 |
v1 model:holder; menuMessage:#menu1. |
|
640 |
v2 menuHolder:holder; menuMessage:#menu2. |
|
641 |
||
642 |
top open. |
|
522
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 |
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
|
645 |
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
|
646 |
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
|
647 |
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
|
648 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
649 |
example: |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
650 |
(Notice: the executor understands the #copySelection message - therefore, the |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
651 |
views built-in copy is NOT performed |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
652 |
- it could be forwarded to the view, though. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
653 |
This could be useful to intercept/filter things). |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
654 |
|
3152 | 655 |
|top v menuProvider menuExecutor | |
656 |
||
657 |
menuProvider := Plug new. |
|
658 |
menuProvider respondTo:#menu |
|
659 |
with:[ PopUpMenu |
|
660 |
labels:#('copy' 'foo') |
|
661 |
selectors:#(copySelection foo) |
|
662 |
]. |
|
663 |
||
664 |
menuExecutor := Plug new. |
|
665 |
menuExecutor respondTo:#copySelection |
|
666 |
with:[Transcript showCR:'copy function']. |
|
667 |
menuExecutor respondTo:#foo |
|
668 |
with:[Transcript showCR:'foo function']. |
|
669 |
||
670 |
top := StandardSystemView new. |
|
671 |
top extent:300@300. |
|
672 |
||
673 |
v := TextView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
674 |
v contents:'pop me up'. |
|
675 |
||
676 |
v menuHolder:menuProvider; menuMessage:#menu. |
|
677 |
v menuPerformer:menuExecutor. |
|
678 |
||
679 |
top open. |
|
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
680 |
" |
135 | 681 |
! ! |
682 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
683 |
!SimpleView class methodsFor:'initialization'! |
135 | 684 |
|
685 |
initialize |
|
686 |
DefaultStyle isNil ifTrue:[ |
|
3762 | 687 |
Font initialize. |
688 |
Form initialize. |
|
689 |
Color initialize. |
|
3378 | 690 |
]. |
691 |
self == SimpleView ifTrue:[ |
|
3762 | 692 |
Smalltalk addDependent:self "/ to get language changes |
3378 | 693 |
]. |
694 |
||
365 | 695 |
ReturnFocusWhenClosingModalBoxes := false. |
696 | 696 |
|
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
697 |
FlagOriginChanged := 2r0000001. |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
698 |
FlagExtentChanged := 2r0000010. |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
699 |
FlagCornerChanged := 2r0000100. |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
700 |
|
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
701 |
FlagCanTab := 2r0001000. |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
702 |
FlagExtentChangedBeforeCreated := 2r0010000. |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
703 |
FlagRequestFocusOnPointerEnter := 2r0100000. |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
704 |
FlagDoNotRequestFocusOnPointerEnter := 2r1000000. |
3375 | 705 |
|
696 | 706 |
"Modified: 18.5.1996 / 16:56:28 / cg" |
135 | 707 |
! |
708 |
||
709 |
postAutoload |
|
2994
c6be08b45a76
eliminated refs to Display (must use Screen current)
Stefan Vogel <sv@exept.de>
parents:
2985
diff
changeset
|
710 |
(Screen notNil and:[Screen current notNil]) ifTrue:[ |
3152 | 711 |
self updateStyleCache. |
2985
62552b74e805
do not read styleSheet if Display is nil
Stefan Vogel <sv@exept.de>
parents:
2979
diff
changeset
|
712 |
] |
135 | 713 |
! ! |
714 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
715 |
!SimpleView class methodsFor:'instance creation'! |
135 | 716 |
|
269 | 717 |
extent:extent |
718 |
"create a new view with given extent" |
|
719 |
||
720 |
^ self origin:nil extent:extent borderWidth:nil |
|
3152 | 721 |
font:nil label:nil in:nil |
269 | 722 |
! |
723 |
||
724 |
extent:extent in:aView |
|
725 |
"create a new view as a subview of aView with given extent" |
|
726 |
||
727 |
^ self origin:nil extent:extent borderWidth:nil |
|
3152 | 728 |
font:nil label:nil in:aView |
269 | 729 |
! |
730 |
||
731 |
extent:extent label:label |
|
732 |
"create a new view with given extent and label" |
|
733 |
||
734 |
^ self origin:nil extent:extent borderWidth:nil |
|
3152 | 735 |
font:nil label:label in:nil |
135 | 736 |
! |
737 |
||
738 |
in:aView |
|
739 |
"return a new view as a subview of aView. |
|
740 |
If aView is nil, it is left unspecified, in which superview |
|
741 |
the new view will be placed. The view can later be assigned |
|
742 |
by adding it to the superview via #addSubView:. |
|
1918
a4042019bc8b
no need to set the container twice in SimpleView class>>in:
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
743 |
If its later realized and no superview has ever been set, |
a4042019bc8b
no need to set the container twice in SimpleView class>>in:
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
744 |
it will come up as a topview." |
135 | 745 |
|
746 |
|newView| |
|
747 |
||
748 |
newView := self basicNew. |
|
749 |
aView notNil ifTrue:[ |
|
3152 | 750 |
newView device:(aView graphicsDevice). |
2302
9525834a6be7
manual bg-pixmap drawing on devices which do not support them (win32)
Claus Gittinger <cg@exept.de>
parents:
2294
diff
changeset
|
751 |
"/ newView container:aView. |
135 | 752 |
] ifFalse:[ |
3152 | 753 |
newView device:Screen current |
135 | 754 |
]. |
755 |
newView initialize. |
|
756 |
aView notNil ifTrue:[aView addSubView:newView]. |
|
757 |
^ newView |
|
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
758 |
|
743 | 759 |
"Modified: 28.5.1996 / 20:24:58 / cg" |
135 | 760 |
! |
761 |
||
140 | 762 |
label:label |
763 |
"create a new view with given label" |
|
135 | 764 |
|
765 |
^ self origin:nil extent:nil borderWidth:nil |
|
3152 | 766 |
font:nil label:label in:nil |
140 | 767 |
! |
768 |
||
269 | 769 |
label:label in:aView |
770 |
"create a new view as subview of aView with given label" |
|
771 |
||
772 |
^ self origin:nil extent:nil borderWidth:nil |
|
3152 | 773 |
font:nil label:label in:aView |
269 | 774 |
! |
775 |
||
1393
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
776 |
model:aModel |
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
777 |
"st-80 style view creation: create a new view and set its model. |
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
778 |
Notice, that simpleViews do not understand #model:; however, |
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
779 |
subclasses may." |
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
780 |
|
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
781 |
^ self new model:aModel |
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
782 |
|
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
783 |
"Created: 28.2.1997 / 19:27:40 / cg" |
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
784 |
"Modified: 28.2.1997 / 19:28:12 / cg" |
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
785 |
! |
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
786 |
|
269 | 787 |
on:aModel |
788 |
"create a new drawable on aModel" |
|
789 |
||
790 |
"although this one does not know about models, |
|
791 |
it can still send the model-assign message. This was done |
|
792 |
to catch obsolete calls to on:aDevice. |
|
793 |
" |
|
794 |
^ self new model:aModel. |
|
795 |
! |
|
796 |
||
797 |
onSameDeviceAs:anotherView |
|
798 |
"create a view on the same device as anotherView. |
|
799 |
Used with popUpMenus, which should be created on the device of |
|
800 |
its masterView." |
|
801 |
||
802 |
|device| |
|
803 |
||
804 |
anotherView notNil ifTrue:[ |
|
3152 | 805 |
device := anotherView graphicsDevice. |
269 | 806 |
] ifFalse:[ |
3152 | 807 |
device := Screen current. |
269 | 808 |
]. |
809 |
^ self onDevice:device |
|
743 | 810 |
|
811 |
"Modified: 28.5.1996 / 20:25:05 / cg" |
|
269 | 812 |
! |
813 |
||
814 |
origin:origin corner:corner |
|
815 |
"create a new view with given origin and extent" |
|
135 | 816 |
|
140 | 817 |
^ self origin:origin corner:corner borderWidth:nil |
3152 | 818 |
font:nil label:nil in:nil |
135 | 819 |
! |
820 |
||
821 |
origin:anOrigin corner:aCorner borderWidth:bw font:aFont label:aLabel in:aView |
|
822 |
|newView| |
|
823 |
||
824 |
aView notNil ifTrue:[ |
|
3152 | 825 |
newView := self basicNew. |
826 |
newView device:(aView graphicsDevice). |
|
827 |
newView initialize. |
|
828 |
aView addSubView:newView. |
|
135 | 829 |
] ifFalse:[ |
3152 | 830 |
newView := self onDevice:Screen current |
135 | 831 |
]. |
832 |
bw notNil ifTrue:[newView borderWidth:bw]. |
|
833 |
anOrigin notNil ifTrue:[newView origin:anOrigin]. |
|
834 |
aCorner notNil ifTrue:[newView corner:aCorner]. |
|
835 |
aFont notNil ifTrue:[newView font:aFont]. |
|
836 |
aLabel notNil ifTrue:[newView label:aLabel]. |
|
837 |
^ newView |
|
743 | 838 |
|
839 |
"Modified: 28.5.1996 / 20:25:15 / cg" |
|
135 | 840 |
! |
841 |
||
269 | 842 |
origin:origin corner:corner borderWidth:bw in:aView |
843 |
"create a new view as a subview of aView with given origin and extent" |
|
844 |
||
845 |
^ self origin:origin corner:corner borderWidth:bw |
|
3152 | 846 |
font:nil label:nil in:aView |
269 | 847 |
! |
848 |
||
849 |
origin:origin corner:corner in:aView |
|
850 |
"create a new view as a subview of aView with given origin and extent" |
|
851 |
||
852 |
^ self origin:origin corner:corner borderWidth:nil |
|
3152 | 853 |
font:nil label:nil in:aView |
269 | 854 |
! |
855 |
||
856 |
origin:origin extent:extent |
|
857 |
"create a new view with given origin and extent" |
|
858 |
||
859 |
^ self origin:origin extent:extent borderWidth:nil |
|
3152 | 860 |
font:nil label:nil in:nil |
269 | 861 |
! |
862 |
||
863 |
origin:origin extent:extent borderWidth:bw |
|
864 |
"create a new view with given origin, extent and borderWidth" |
|
865 |
||
866 |
^ self origin:origin extent:extent borderWidth:bw |
|
3152 | 867 |
font:nil label:nil in:nil |
269 | 868 |
! |
869 |
||
870 |
origin:anOrigin extent:anExtent borderWidth:bw font:aFont label:aLabel in:aView |
|
871 |
|newView| |
|
872 |
||
873 |
aView notNil ifTrue:[ |
|
3152 | 874 |
newView := self basicNew. |
875 |
newView device:(aView graphicsDevice). |
|
876 |
newView initialize. |
|
877 |
aView addSubView:newView. |
|
140 | 878 |
] ifFalse:[ |
3152 | 879 |
newView := self onDevice:Screen current |
140 | 880 |
]. |
269 | 881 |
bw notNil ifTrue:[newView borderWidth:bw]. |
882 |
anExtent notNil ifTrue:[newView extent:anExtent]. |
|
883 |
anOrigin notNil ifTrue:[newView origin:anOrigin]. |
|
884 |
aFont notNil ifTrue:[newView font:aFont]. |
|
885 |
aLabel notNil ifTrue:[newView label:aLabel]. |
|
886 |
^ newView |
|
743 | 887 |
|
888 |
"Modified: 28.5.1996 / 20:25:19 / cg" |
|
269 | 889 |
! |
890 |
||
891 |
origin:origin extent:extent borderWidth:bw in:aView |
|
892 |
"create a new view as a subview of aView with given origin, extent |
|
893 |
and borderWidth" |
|
894 |
||
895 |
^ self origin:origin extent:extent borderWidth:bw |
|
3152 | 896 |
font:nil label:nil in:aView |
269 | 897 |
! |
898 |
||
899 |
origin:origin extent:extent font:aFont label:label |
|
900 |
^ self origin:origin extent:extent borderWidth:nil |
|
3152 | 901 |
font:nil label:label in:nil |
269 | 902 |
! |
903 |
||
904 |
origin:origin extent:extent font:aFont label:label in:aView |
|
905 |
^ self origin:origin extent:extent borderWidth:nil |
|
3152 | 906 |
font:aFont label:label in:aView |
269 | 907 |
! |
908 |
||
909 |
origin:origin extent:extent in:aView |
|
910 |
"create a new view as a subview of aView with given origin and extent" |
|
911 |
||
912 |
^ self origin:origin extent:extent borderWidth:nil |
|
3152 | 913 |
font:nil label:nil in:aView |
269 | 914 |
! |
915 |
||
916 |
origin:origin extent:extent label:label |
|
917 |
"create a new view with given origin, extent and label" |
|
918 |
||
919 |
^ self origin:origin extent:extent borderWidth:nil |
|
3152 | 920 |
font:nil label:label in:nil |
135 | 921 |
! |
922 |
||
923 |
origin:anOrigin extent:anExtent |
|
3152 | 924 |
label:aLabel icon:aForm |
925 |
minExtent:minExtent maxExtent:maxExtent |
|
135 | 926 |
|newView| |
927 |
||
2994
c6be08b45a76
eliminated refs to Display (must use Screen current)
Stefan Vogel <sv@exept.de>
parents:
2985
diff
changeset
|
928 |
newView := self onDevice:Screen current. |
135 | 929 |
anOrigin notNil ifTrue:[newView origin:anOrigin]. |
930 |
anExtent notNil ifTrue:[newView extent:anExtent]. |
|
931 |
aLabel notNil ifTrue:[newView label:aLabel]. |
|
932 |
aForm notNil ifTrue:[newView icon:aForm]. |
|
933 |
minExtent notNil ifTrue:[newView minExtent:minExtent]. |
|
934 |
maxExtent notNil ifTrue:[newView maxExtent:maxExtent]. |
|
935 |
^ newView |
|
936 |
! |
|
937 |
||
140 | 938 |
origin:origin in:aView |
939 |
"create a new view as a subview of aView with given origin" |
|
940 |
||
941 |
^ self origin:origin extent:nil borderWidth:nil |
|
3152 | 942 |
font:nil label:nil in:aView |
135 | 943 |
! ! |
944 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
945 |
!SimpleView class methodsFor:'change & update'! |
269 | 946 |
|
867 | 947 |
update:something with:aParameter from:changedObject |
3378 | 948 |
changedObject == Smalltalk ifTrue:[ |
4038
538491244f6f
preps for handling language changes
Claus Gittinger <cg@exept.de>
parents:
3968
diff
changeset
|
949 |
(something == #Language or:[something == LanguageTerritory]) ifTrue:[ |
538491244f6f
preps for handling language changes
Claus Gittinger <cg@exept.de>
parents:
3968
diff
changeset
|
950 |
"flush resources on language changes" |
538491244f6f
preps for handling language changes
Claus Gittinger <cg@exept.de>
parents:
3968
diff
changeset
|
951 |
self flushAllClassResources. |
538491244f6f
preps for handling language changes
Claus Gittinger <cg@exept.de>
parents:
3968
diff
changeset
|
952 |
self allSubInstancesDo:[:eachView | eachView languageChanged]. |
538491244f6f
preps for handling language changes
Claus Gittinger <cg@exept.de>
parents:
3968
diff
changeset
|
953 |
]. |
135 | 954 |
] |
867 | 955 |
|
956 |
"Created: 15.6.1996 / 15:23:04 / cg" |
|
135 | 957 |
! ! |
958 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
959 |
!SimpleView class methodsFor:'defaults'! |
135 | 960 |
|
140 | 961 |
defaultExtent |
586 | 962 |
"return the default extent of my instances. |
963 |
The value returned here is usually ignored, and |
|
964 |
the value from preferredExtent taken instead." |
|
140 | 965 |
|
966 |
CentPoint isNil ifTrue:[CentPoint := 100 @ 100]. |
|
967 |
^ CentPoint |
|
586 | 968 |
|
969 |
"Modified: 22.4.1996 / 23:38:39 / cg" |
|
140 | 970 |
! |
971 |
||
269 | 972 |
defaultFont |
990 | 973 |
|f| |
974 |
||
452
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
975 |
DefaultFont notNil ifTrue:[^ DefaultFont]. |
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
976 |
|
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
977 |
DefaultFont isNil ifTrue:[ |
3152 | 978 |
self == SimpleView ifFalse:[ |
979 |
f := self superclass defaultFont. |
|
980 |
] ifTrue:[ |
|
981 |
f := super defaultFont |
|
982 |
]. |
|
452
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
983 |
]. |
997 | 984 |
|
990 | 985 |
f notNil ifTrue:[ |
3152 | 986 |
DefaultFont := f. |
987 |
f := f onDevice:(Screen current). |
|
988 |
f notNil ifTrue:[ |
|
989 |
DefaultFont := f. |
|
990 |
] |
|
990 | 991 |
]. |
452
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
992 |
^ DefaultFont |
467 | 993 |
|
994 |
"Modified: 27.2.1996 / 02:20:54 / cg" |
|
269 | 995 |
! |
996 |
||
450 | 997 |
defaultFont:aFont |
452
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
998 |
"set the default font used for drawing" |
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
999 |
|
997 | 1000 |
|f| |
1001 |
||
527
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1002 |
DefaultFont := aFont. |
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1003 |
aFont notNil ifTrue:[ |
3152 | 1004 |
f := aFont onDevice:(Screen current). |
1005 |
f notNil ifTrue:[ |
|
1006 |
DefaultFont := f. |
|
1007 |
] |
|
527
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1008 |
] |
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1009 |
|
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1010 |
"Modified: 18.3.1996 / 12:56:20 / cg" |
450 | 1011 |
! |
1012 |
||
269 | 1013 |
defaultStyle |
1014 |
"return the default view style" |
|
1015 |
||
1016 |
^ DefaultStyle |
|
1017 |
||
1018 |
" |
|
1019 |
View defaultStyle |
|
1020 |
" |
|
135 | 1021 |
! |
1022 |
||
1023 |
defaultStyle:aStyle |
|
1024 |
"set the view style for new views" |
|
1025 |
||
2985
62552b74e805
do not read styleSheet if Display is nil
Stefan Vogel <sv@exept.de>
parents:
2979
diff
changeset
|
1026 |
DefaultStyle := aStyle. |
2994
c6be08b45a76
eliminated refs to Display (must use Screen current)
Stefan Vogel <sv@exept.de>
parents:
2985
diff
changeset
|
1027 |
(Screen notNil and:[Screen current notNil]) ifTrue:[ |
3152 | 1028 |
self readStyleSheetAndUpdateAllStyleCaches. |
2985
62552b74e805
do not read styleSheet if Display is nil
Stefan Vogel <sv@exept.de>
parents:
2979
diff
changeset
|
1029 |
]. |
135 | 1030 |
|
1031 |
" |
|
1032 |
View defaultStyle:#next. SystemBrowser start |
|
1033 |
View defaultStyle:#motif. SystemBrowser start |
|
1034 |
View defaultStyle:#iris. SystemBrowser start |
|
1035 |
View defaultStyle:#st80. SystemBrowser start |
|
1036 |
View defaultStyle:#normal. SystemBrowser start |
|
1037 |
" |
|
2351
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1038 |
|
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1039 |
"Modified: / 15.9.1998 / 22:05:02 / cg" |
135 | 1040 |
! |
1041 |
||
1860
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1042 |
defaultViewBackgroundColor |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1043 |
"return the default view background" |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1044 |
|
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1045 |
^ DefaultViewBackgroundColor |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1046 |
|
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1047 |
" |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1048 |
View defaultViewBackgroundColor |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1049 |
" |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1050 |
|
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1051 |
"Modified: 13.8.1997 / 19:37:55 / cg" |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1052 |
! |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1053 |
|
2351
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1054 |
readStyleSheet |
3181 | 1055 |
"(re)load the styleSheet." |
2351
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1056 |
|
3762 | 1057 |
DefaultStyle isNil ifTrue:[ |
1058 |
self setDefaultStyle |
|
1059 |
]. |
|
3002 | 1060 |
|
2351
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1061 |
StyleSheet := ViewStyle fromFile:(DefaultStyle , '.style'). |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1062 |
StyleSheet fileReadFailed ifTrue:[ |
3367 | 1063 |
('SimpleView [warning]: ***** no styleSheet for ' , DefaultStyle , '-style.') errorPrintCR. |
1064 |
DefaultStyle ~~ #normal ifTrue:[ |
|
1065 |
DefaultStyle := #normal. |
|
1066 |
StyleSheet := ViewStyle fromFile:(DefaultStyle , '.style'). |
|
2351
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1067 |
|
3367 | 1068 |
StyleSheet fileReadFailed ifTrue:[ |
3889 | 1069 |
'SimpleView [warning]: not even a styleSheet for normal-style (using ugly defaults).' errorPrintCR. |
3367 | 1070 |
] |
1071 |
] |
|
2351
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1072 |
]. |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1073 |
|
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1074 |
"Created: / 15.9.1998 / 22:03:06 / cg" |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1075 |
! |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1076 |
|
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1077 |
readStyleSheetAndUpdateAllStyleCaches |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1078 |
"reload all style caches in all view classes. |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1079 |
Needed after a style change or when a style file has been changed" |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1080 |
|
3002 | 1081 |
DefaultStyle notNil ifTrue:[ |
3152 | 1082 |
self readStyleSheet. |
1083 |
self updateAllStyleCaches |
|
3002 | 1084 |
] |
2351
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1085 |
|
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1086 |
"Created: / 15.9.1998 / 22:03:59 / cg" |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1087 |
! |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1088 |
|
362 | 1089 |
returnFocusWhenClosingModalBoxes |
364
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1090 |
"return the current focus-return behavior. |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1091 |
See #returnFocusWhenClosingModalBoxes: for a description." |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1092 |
|
362 | 1093 |
^ ReturnFocusWhenClosingModalBoxes |
1094 |
! |
|
1095 |
||
1096 |
returnFocusWhenClosingModalBoxes:aBoolean |
|
364
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1097 |
"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
|
1098 |
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
|
1099 |
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
|
1100 |
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
|
1101 |
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
|
1102 |
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
|
1103 |
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
|
1104 |
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
|
1105 |
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
|
1106 |
display.rc file." |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1107 |
|
362 | 1108 |
ReturnFocusWhenClosingModalBoxes := aBoolean |
364
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1109 |
|
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1110 |
" |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1111 |
Dialog returnFocusWhenClosingModalBoxes:false |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1112 |
Dialog returnFocusWhenClosingModalBoxes:true |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1113 |
" |
362 | 1114 |
! |
1115 |
||
2294 | 1116 |
setDefaultStyle |
1117 |
|defStyle| |
|
1118 |
||
3185 | 1119 |
DefaultStyle isNil ifTrue:[ |
3830
d421b20c5d93
default viewStyle under linux is now also #mswindows95
Claus Gittinger <cg@exept.de>
parents:
3821
diff
changeset
|
1120 |
defStyle := OperatingSystem getEnvironment:'STX_VIEWSTYLE'. |
d421b20c5d93
default viewStyle under linux is now also #mswindows95
Claus Gittinger <cg@exept.de>
parents:
3821
diff
changeset
|
1121 |
defStyle notNil ifTrue:[ |
d421b20c5d93
default viewStyle under linux is now also #mswindows95
Claus Gittinger <cg@exept.de>
parents:
3821
diff
changeset
|
1122 |
DefaultStyle := defStyle asSymbol. |
d421b20c5d93
default viewStyle under linux is now also #mswindows95
Claus Gittinger <cg@exept.de>
parents:
3821
diff
changeset
|
1123 |
] ifFalse:[ |
d421b20c5d93
default viewStyle under linux is now also #mswindows95
Claus Gittinger <cg@exept.de>
parents:
3821
diff
changeset
|
1124 |
(OperatingSystem isMSWINDOWSlike |
d421b20c5d93
default viewStyle under linux is now also #mswindows95
Claus Gittinger <cg@exept.de>
parents:
3821
diff
changeset
|
1125 |
or:[OperatingSystem getOSType = #linux]) ifTrue:[ |
d421b20c5d93
default viewStyle under linux is now also #mswindows95
Claus Gittinger <cg@exept.de>
parents:
3821
diff
changeset
|
1126 |
DefaultStyle := #mswindows95 |
d421b20c5d93
default viewStyle under linux is now also #mswindows95
Claus Gittinger <cg@exept.de>
parents:
3821
diff
changeset
|
1127 |
] ifFalse:[ |
d421b20c5d93
default viewStyle under linux is now also #mswindows95
Claus Gittinger <cg@exept.de>
parents:
3821
diff
changeset
|
1128 |
DefaultStyle := #motif |
d421b20c5d93
default viewStyle under linux is now also #mswindows95
Claus Gittinger <cg@exept.de>
parents:
3821
diff
changeset
|
1129 |
] |
d421b20c5d93
default viewStyle under linux is now also #mswindows95
Claus Gittinger <cg@exept.de>
parents:
3821
diff
changeset
|
1130 |
]. |
2294 | 1131 |
]. |
1132 |
! |
|
1133 |
||
1161
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1134 |
styleSheet |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1135 |
"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
|
1136 |
|
3923 | 1137 |
StyleSheet isNil ifTrue:[ |
3924 | 1138 |
self updateAllStyleCaches. |
3923 | 1139 |
]. |
1161
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1140 |
^ StyleSheet |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1141 |
|
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1142 |
" |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1143 |
View styleSheet |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1144 |
" |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1145 |
|
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1146 |
"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
|
1147 |
! |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1148 |
|
269 | 1149 |
styleSheet:aViewStyle |
1150 |
"set the view style from a style-sheet" |
|
1151 |
||
1152 |
StyleSheet := aViewStyle. |
|
1153 |
DefaultStyle := (StyleSheet at:'name' ifAbsent:'unknown') asSymbol. |
|
1154 |
self updateAllStyleCaches. |
|
1155 |
! |
|
1156 |
||
1157 |
updateAllStyleCaches |
|
1158 |
"reload all style caches in all view classes. |
|
1159 |
Needed after a style change or when a style file has been changed" |
|
1160 |
||
2994
c6be08b45a76
eliminated refs to Display (must use Screen current)
Stefan Vogel <sv@exept.de>
parents:
2985
diff
changeset
|
1161 |
(Screen isNil or:[Screen current isNil]) ifTrue:[^ self]. |
2985
62552b74e805
do not read styleSheet if Display is nil
Stefan Vogel <sv@exept.de>
parents:
2979
diff
changeset
|
1162 |
|
269 | 1163 |
" |
1164 |
tell all view classes to flush any |
|
1165 |
cached style-data |
|
1166 |
" |
|
1167 |
self changed:#style. |
|
1168 |
SimpleView updateStyleCache. |
|
1169 |
SimpleView allSubclassesDo:[:aClass | |
|
3762 | 1170 |
aClass defaultFont:nil. |
1171 |
(aClass class includesSelector:#updateStyleCache) ifTrue:[ |
|
1172 |
aClass updateStyleCache |
|
1173 |
]. |
|
269 | 1174 |
] |
1175 |
||
1176 |
" |
|
1177 |
View updateAllStyleCaches |
|
1178 |
" |
|
527
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1179 |
|
2351
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1180 |
"Modified: / 15.9.1998 / 22:04:15 / cg" |
269 | 1181 |
! |
1182 |
||
135 | 1183 |
updateStyleCache |
1184 |
"this method gets some heavily used style stuff and keeps |
|
1185 |
it in class-variables for faster access. |
|
1186 |
Subclasses should redefine this to load any cached style-values |
|
1187 |
into faster class variables as well. These should NOT do a |
|
1188 |
super updateStyleCache, since this method is called for all view-classes |
|
1189 |
anyway." |
|
1190 |
||
2492 | 1191 |
<resource: #style (#viewSpacing #font #borderWidth #borderColor |
3367 | 1192 |
#viewBackground #shadowColor #lightColor |
1193 |
#focusColor #focusBorderWidth)> |
|
2292
8efc5272cf0b
defaultStyle either from environmane (STX_VIEWSTYLE)
Claus Gittinger <cg@exept.de>
parents:
2274
diff
changeset
|
1194 |
|
2994
c6be08b45a76
eliminated refs to Display (must use Screen current)
Stefan Vogel <sv@exept.de>
parents:
2985
diff
changeset
|
1195 |
|bgGrey currentScreen| |
135 | 1196 |
|
1197 |
" |
|
1198 |
when coming here the first time, we read the styleSheet |
|
1199 |
and keep the values in fast class variables |
|
1200 |
" |
|
1201 |
StyleSheet isNil ifTrue:[ |
|
3367 | 1202 |
self setDefaultStyle. |
1203 |
self readStyleSheet. |
|
135 | 1204 |
]. |
1205 |
||
2994
c6be08b45a76
eliminated refs to Display (must use Screen current)
Stefan Vogel <sv@exept.de>
parents:
2985
diff
changeset
|
1206 |
currentScreen := Screen current. |
c6be08b45a76
eliminated refs to Display (must use Screen current)
Stefan Vogel <sv@exept.de>
parents:
2985
diff
changeset
|
1207 |
|
135 | 1208 |
Grey := StyleSheet viewGrey. |
1209 |
Grey isNil ifTrue:[ |
|
3367 | 1210 |
Grey := Color grey |
2829 | 1211 |
]. |
2994
c6be08b45a76
eliminated refs to Display (must use Screen current)
Stefan Vogel <sv@exept.de>
parents:
2985
diff
changeset
|
1212 |
Grey := Grey onDevice:currentScreen. |
135 | 1213 |
|
151 | 1214 |
StyleSheet fileReadFailed ifTrue:[ |
3367 | 1215 |
bgGrey := White |
135 | 1216 |
] ifFalse:[ |
3367 | 1217 |
currentScreen hasGrayscales ifTrue:[ |
1218 |
bgGrey := Grey |
|
1219 |
] ifFalse:[ |
|
1220 |
bgGrey := White |
|
1221 |
] |
|
2829 | 1222 |
]. |
2994
c6be08b45a76
eliminated refs to Display (must use Screen current)
Stefan Vogel <sv@exept.de>
parents:
2985
diff
changeset
|
1223 |
bgGrey := bgGrey onDevice:currentScreen. |
135 | 1224 |
|
2492 | 1225 |
ViewSpacing := StyleSheet at:#viewSpacing. |
135 | 1226 |
ViewSpacing isNil ifTrue:[ |
3367 | 1227 |
ViewSpacing := currentScreen defaultStyleValueFor:#viewSpacing. |
2492 | 1228 |
]. |
1229 |
||
1230 |
DefaultBorderColor := StyleSheet colorAt:#borderColor. |
|
1678
5c93a4791a8b
prepare to fetch style defaults from device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1617
diff
changeset
|
1231 |
DefaultBorderColor isNil ifTrue:[ |
3367 | 1232 |
DefaultBorderColor := currentScreen defaultStyleValueFor:#borderColor |
1678
5c93a4791a8b
prepare to fetch style defaults from device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1617
diff
changeset
|
1233 |
]. |
151 | 1234 |
|
1235 |
StyleSheet fileReadFailed ifTrue:[ |
|
3367 | 1236 |
DefaultBorderWidth := 1. |
1237 |
DefaultShadowColor := Black. |
|
1238 |
DefaultLightColor := White. |
|
1239 |
DefaultFocusColor := Black. |
|
1240 |
DefaultFocusBorderWidth := 2. |
|
1241 |
DefaultViewBackgroundColor := White. |
|
151 | 1242 |
] ifFalse:[ |
3367 | 1243 |
DefaultBorderWidth := StyleSheet at:#borderWidth default:0. |
1244 |
DefaultViewBackgroundColor := StyleSheet colorAt:#viewBackground default:bgGrey. |
|
1245 |
DefaultShadowColor := StyleSheet colorAt:#shadowColor. |
|
1246 |
DefaultLightColor := StyleSheet colorAt:#lightColor. |
|
1247 |
DefaultFocusColor := StyleSheet colorAt:#focusColor default:Color red. |
|
1248 |
DefaultFocusBorderWidth := StyleSheet at:'focusBorderWidth' default:2. |
|
151 | 1249 |
]. |
135 | 1250 |
|
526 | 1251 |
self == SimpleView ifTrue:[ |
3367 | 1252 |
DefaultFont := StyleSheet at:#font. |
1253 |
DefaultFont isNil ifTrue:[ |
|
1254 |
DefaultFont := Font family:'courier' face:'medium' style:'roman' size:12. |
|
1255 |
]. |
|
1256 |
DefaultFont := DefaultFont onDevice:currentScreen. |
|
527
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1257 |
] ifFalse:[ |
3367 | 1258 |
DefaultFont := nil |
135 | 1259 |
]. |
1260 |
||
1261 |
DefaultViewBackgroundColor isNil ifTrue:[ |
|
3367 | 1262 |
'SimpleView [warning]: bad viewBackground in style - using white' errorPrintCR. |
1263 |
DefaultViewBackgroundColor := White |
|
2492 | 1264 |
]. |
1265 |
||
1266 |
"Modified: / 29.4.1997 / 11:16:52 / dq" |
|
1267 |
"Modified: / 8.3.1999 / 01:36:05 / cg" |
|
135 | 1268 |
! |
1269 |
||
269 | 1270 |
viewSpacing |
1271 |
"return a convenient number of pixels used to separate views (usually 1mm). |
|
1272 |
Having this value here at a common place makes certain that all views |
|
1273 |
get a common look" |
|
1274 |
||
1275 |
^ ViewSpacing |
|
1276 |
! ! |
|
1277 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
1278 |
!SimpleView class methodsFor:'resources'! |
269 | 1279 |
|
1280 |
classResources |
|
4091
3995bf25130a
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
4069
diff
changeset
|
1281 |
"if not already loaded, get the classes resourcePack and return it" |
269 | 1282 |
|
1283 |
ClassResources isNil ifTrue:[ |
|
4091
3995bf25130a
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
4069
diff
changeset
|
1284 |
ClassResources := super classResources. |
140 | 1285 |
]. |
269 | 1286 |
^ ClassResources |
1287 |
! |
|
1288 |
||
1289 |
classResources:aResourcePack |
|
1290 |
"allow setting of the classResources" |
|
1291 |
||
1292 |
ClassResources := aResourcePack |
|
1293 |
! |
|
1294 |
||
1295 |
flushAllClassResources |
|
1296 |
"flush all classes resource translations. |
|
1297 |
Needed after a resource file has changed." |
|
1298 |
||
1299 |
ResourcePack flushCachedResourcePacks. |
|
3378 | 1300 |
SimpleView withAllSubclassesDo:[:aClass | |
3762 | 1301 |
aClass flushClassResources. |
140 | 1302 |
] |
1303 |
||
1304 |
" |
|
269 | 1305 |
View flushAllClassResources |
140 | 1306 |
" |
269 | 1307 |
"to change the language: |
3762 | 1308 |
Language := #en. |
1309 |
Smalltalk changed:#Language. |
|
1310 |
View flushAllClassResources |
|
269 | 1311 |
or: |
3762 | 1312 |
Language := #de. |
1313 |
Smalltalk changed:#Language. |
|
1314 |
View flushAllClassResources |
|
269 | 1315 |
" |
1316 |
! |
|
1317 |
||
1318 |
flushClassResources |
|
1319 |
"flush classes resource string translations. |
|
1320 |
Needed whenever a resource file or language has changed" |
|
1321 |
||
1322 |
ClassResources := nil. |
|
1323 |
! |
|
1324 |
||
2130
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
1325 |
resources |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
1326 |
^ self classResources |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
1327 |
|
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
1328 |
"Created: / 25.5.1998 / 13:00:30 / cg" |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
1329 |
! |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
1330 |
|
269 | 1331 |
updateClassResources |
1332 |
"flush classes resource string translations and reload them. |
|
1333 |
Needed whenever a resource file or language has changed" |
|
1334 |
||
1335 |
ClassResources := nil. |
|
1336 |
self classResources |
|
135 | 1337 |
! ! |
1338 |
||
3781 | 1339 |
!SimpleView class methodsFor:'startup'! |
1340 |
||
1341 |
open |
|
1342 |
"create, realize the view - this topview and all its subviews will |
|
1343 |
run as a separate process with its own windowGroup" |
|
1344 |
||
1345 |
^ self new open |
|
4054 | 1346 |
! |
1347 |
||
1348 |
openOnXScreenNamed:aScreenName |
|
1349 |
"create an instance of the view and open it |
|
1350 |
on some X display screen. The argument aScreenName must be |
|
1351 |
a valid x-display name (i.e. of the form '<host>:<screenNr>' as in 'foo:0'). |
|
1352 |
For more info, read the document on multiple display |
|
1353 |
support and the documentation of the DeviceWorkstation class." |
|
1354 |
||
1355 |
|newDevice| |
|
1356 |
||
1357 |
[ |
|
1358 |
newDevice := XWorkstation newDispatchingFor:aScreenName. |
|
1359 |
] on:Screen deviceOpenErrorSignal do:[:ex| |
|
1360 |
self warn:'Could not open display: ' , aScreenName. |
|
1361 |
^ self |
|
1362 |
]. |
|
1363 |
^ (self onDevice:newDevice) open. |
|
1364 |
||
1365 |
" |
|
1366 |
FileBrowser openOnXScreenNamed:'bitsy:0' |
|
1367 |
FileBrowser openOnXScreenNamed:':0' |
|
1368 |
View openOnXScreenNamed:'bitsy:0' |
|
1369 |
" |
|
1370 |
||
1371 |
"Modified: 13.1.1997 / 20:55:27 / cg" |
|
3781 | 1372 |
! ! |
1373 |
||
3880 | 1374 |
!SimpleView methodsFor:'Compatibility-ST80'! |
269 | 1375 |
|
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1376 |
bounds |
1182 | 1377 |
"ST-80 compatibility: return my bounds" |
1378 |
||
971 | 1379 |
^ (self origin) corner:(self corner) |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1380 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1381 |
"Created: 4.6.1996 / 21:23:27 / cg" |
1182 | 1382 |
"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
|
1383 |
! |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1384 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1385 |
bounds:aRectangle |
1182 | 1386 |
"ST-80 compatibility: change my bounds" |
1387 |
||
971 | 1388 |
explicitExtent := true. |
1389 |
self pixelOrigin:aRectangle origin |
|
3152 | 1390 |
corner:aRectangle corner |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1391 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1392 |
"Created: 4.6.1996 / 21:44:27 / cg" |
1182 | 1393 |
"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
|
1394 |
! |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1395 |
|
269 | 1396 |
checkForEvents |
1182 | 1397 |
"ST-80 compatibility: |
1398 |
check for any pending events and process them" |
|
1399 |
||
269 | 1400 |
(shown and:[windowGroup notNil]) ifTrue:[windowGroup processEvents]. |
1182 | 1401 |
|
1402 |
"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
|
1403 |
! |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1404 |
|
3164
f3dce6ea8e3f
VW compatibility: closeAndUnschedule
Claus Gittinger <cg@exept.de>
parents:
3155
diff
changeset
|
1405 |
closeAndUnschedule |
f3dce6ea8e3f
VW compatibility: closeAndUnschedule
Claus Gittinger <cg@exept.de>
parents:
3155
diff
changeset
|
1406 |
"actually sent to a controller in VW... |
f3dce6ea8e3f
VW compatibility: closeAndUnschedule
Claus Gittinger <cg@exept.de>
parents:
3155
diff
changeset
|
1407 |
however, #open returns the view in ST/X, so we respond here" |
f3dce6ea8e3f
VW compatibility: closeAndUnschedule
Claus Gittinger <cg@exept.de>
parents:
3155
diff
changeset
|
1408 |
|
3316 | 1409 |
self topView destroy |
3164
f3dce6ea8e3f
VW compatibility: closeAndUnschedule
Claus Gittinger <cg@exept.de>
parents:
3155
diff
changeset
|
1410 |
! |
f3dce6ea8e3f
VW compatibility: closeAndUnschedule
Claus Gittinger <cg@exept.de>
parents:
3155
diff
changeset
|
1411 |
|
3775 | 1412 |
displayOn:aGCOrStream |
1182 | 1413 |
"ST-80 compatibility: (re-)display myself" |
1414 |
||
3775 | 1415 |
"/ what a kludge - Dolphin and Squeak mean: printOn:; |
1416 |
"/ ST/X (and some old ST80's) mean: draw-yourself on. |
|
1417 |
(aGCOrStream isStream or:[aGCOrStream == Transcript]) ifTrue:[ |
|
1418 |
^ super displayOn:aGCOrStream |
|
3774 | 1419 |
]. |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1420 |
self redraw |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1421 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1422 |
"Created: 4.6.1996 / 21:25:59 / cg" |
1182 | 1423 |
"Modified: 10.1.1997 / 19:46:58 / cg" |
1363 | 1424 |
! |
1425 |
||
1432 | 1426 |
displayPendingInvalidation |
1427 |
"dummy - for ST-80 compatibility" |
|
1428 |
||
1429 |
"Created: 6.3.1997 / 15:17:14 / cg" |
|
1430 |
"Modified: 6.3.1997 / 15:17:31 / cg" |
|
1431 |
! |
|
1432 |
||
1363 | 1433 |
isEnabled |
1434 |
"return true, if this view is enabled (i.e. accepts user interaction). |
|
1435 |
Most views are enabled - only a few (buttons, SelectionInList etc.) can |
|
1436 |
be disabled. |
|
1437 |
#isEnabled is ST-80's equivalent of #enabled" |
|
1438 |
||
1439 |
^ self enabled |
|
1413 | 1440 |
! |
1441 |
||
2061
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1442 |
isOpen |
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1443 |
"ST80 compatibility" |
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1444 |
|
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1445 |
^ realized |
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1446 |
|
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1447 |
|
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1448 |
! |
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1449 |
|
2159 | 1450 |
lookPreferences:prefs |
1451 |
"ignored - but required for some apps" |
|
1452 |
||
1453 |
"Created: / 19.6.1998 / 00:05:10 / cg" |
|
1454 |
! |
|
1455 |
||
1413 | 1456 |
newLayout:aLayoutObject |
1457 |
"set the layout object which controls my geometry. |
|
1458 |
ST80-compatibility." |
|
1459 |
||
1460 |
here layout:aLayoutObject. |
|
1461 |
||
1462 |
"Created: 3.3.1997 / 18:54:53 / cg" |
|
1427 | 1463 |
! |
1464 |
||
1465 |
refresh |
|
1466 |
self invalidate |
|
3909 | 1467 |
! |
1468 |
||
1469 |
takeKeyboardFocus |
|
1470 |
self requestFocus |
|
151 | 1471 |
! ! |
1472 |
||
3880 | 1473 |
!SimpleView methodsFor:'Compatibility-Squeak'! |
2956 | 1474 |
|
1475 |
insetDisplayBox |
|
1476 |
"Squeak mimicri: return my bounds" |
|
1477 |
||
1478 |
^ 0@0 corner:(self corner) |
|
1479 |
||
1480 |
! ! |
|
1481 |
||
2450 | 1482 |
!SimpleView methodsFor:'accessing'! |
1483 |
||
1484 |
keyboardProcessor |
|
1485 |
"return my keyboard processor" |
|
1486 |
||
1487 |
^ nil |
|
1488 |
||
1489 |
"Created: / 13.2.1999 / 10:31:39 / cg" |
|
1490 |
! ! |
|
1491 |
||
2549
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1492 |
!SimpleView methodsFor:'accessing-behavior'! |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1493 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1494 |
disable |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1495 |
"alternative method; redirected to basic mechanism" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1496 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1497 |
self enabled:false |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1498 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1499 |
"Modified: / 30.3.1999 / 14:47:30 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1500 |
"Created: / 30.3.1999 / 15:54:11 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1501 |
! |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1502 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1503 |
enable |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1504 |
"alternative method; redirected to basic mechanism" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1505 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1506 |
self enabled:true |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1507 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1508 |
"Modified: / 30.3.1999 / 14:47:22 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1509 |
"Created: / 30.3.1999 / 15:54:16 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1510 |
! |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1511 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1512 |
enabled |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1513 |
"views are enabled by default" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1514 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1515 |
^ true |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1516 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1517 |
"Modified: / 30.3.1999 / 16:27:57 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1518 |
! |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1519 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1520 |
enabled:bool |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1521 |
"this is the basic machanism to enable/disable a view. |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1522 |
empty in this class; may be redefined by subclasses" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1523 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1524 |
"Modified: / 30.3.1999 / 14:46:24 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1525 |
"Created: / 30.3.1999 / 15:54:21 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1526 |
! |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1527 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1528 |
isEnabled:aState |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1529 |
"ST-80 compatibility; set enabled state |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1530 |
" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1531 |
self enabled:aState |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1532 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1533 |
"Created: / 30.3.1999 / 15:54:29 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1534 |
! ! |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1535 |
|
269 | 1536 |
!SimpleView methodsFor:'accessing-bg & border'! |
1537 |
||
3356
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1538 |
allSubViewsBackground:something |
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1539 |
"set the viewBackground to something, a color, image or form, |
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1540 |
recursively in all of my subviews" |
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1541 |
|
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1542 |
subViews notNil ifTrue:[ |
3367 | 1543 |
subViews do:[:v| |
1544 |
v allViewBackground:something |
|
1545 |
] |
|
3356
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1546 |
] |
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1547 |
|
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1548 |
"Modified: / 18.7.1996 / 13:34:26 / cg" |
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1549 |
"Created: / 31.10.2000 / 13:06:02 / bg" |
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1550 |
! |
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1551 |
|
955 | 1552 |
allViewBackground:something |
1553 |
"set the viewBackground to something, a color, image or form, |
|
1554 |
in myself and recursively in all of my subviews" |
|
1555 |
||
2784
cd0a37151aba
allViewBackground: now implies a redraw
Claus Gittinger <cg@exept.de>
parents:
2769
diff
changeset
|
1556 |
viewBackground ~~ something ifTrue:[ |
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
1557 |
self viewBackground:something. |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
1558 |
self invalidate |
3356
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1559 |
]. |
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1560 |
|
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1561 |
self allSubViewsBackground:something |
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1562 |
|
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1563 |
"Modified: / 31.10.2000 / 13:06:17 / bg" |
955 | 1564 |
! |
1565 |
||
2158
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1566 |
backgroundColor |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1567 |
"return the background color of the contents - |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1568 |
here, (since there is no contents), the viewBackground is returned." |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1569 |
|
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1570 |
^ self viewBackground |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1571 |
|
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1572 |
"Modified: / 3.5.1997 / 10:28:04 / cg" |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1573 |
"Created: / 18.6.1998 / 15:59:36 / cg" |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1574 |
! |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1575 |
|
1726
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1576 |
backgroundColor:aColor |
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1577 |
"set the background color of the contents - |
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1578 |
here, (since there is no contents), the viewBackground is changed." |
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1579 |
|
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1580 |
self viewBackground:aColor |
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1581 |
|
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1582 |
"Created: 3.5.1997 / 10:26:49 / cg" |
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1583 |
"Modified: 3.5.1997 / 10:28:04 / cg" |
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1584 |
! |
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1585 |
|
269 | 1586 |
borderColor |
1587 |
"return my borderColor" |
|
1588 |
||
794 | 1589 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
3152 | 1590 |
^ superView borderColor |
794 | 1591 |
]. |
1592 |
||
269 | 1593 |
^ borderColor |
794 | 1594 |
|
1595 |
"Modified: 5.6.1996 / 14:11:44 / cg" |
|
269 | 1596 |
! |
1597 |
||
1598 |
borderColor:aColor |
|
1599 |
"set my borderColor" |
|
1600 |
||
794 | 1601 |
"/ backward compatibility |
1602 |
"/ superView will be renamed to container soon. |
|
1603 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
|
3152 | 1604 |
^ superView borderColor:aColor |
794 | 1605 |
]. |
1606 |
||
269 | 1607 |
(aColor ~~ borderColor) ifTrue:[ |
3152 | 1608 |
borderColor := aColor. |
1609 |
drawableId notNil ifTrue:[ |
|
1610 |
self setBorderColor |
|
1611 |
] |
|
269 | 1612 |
] |
794 | 1613 |
|
1614 |
"Modified: 5.6.1996 / 14:11:50 / cg" |
|
269 | 1615 |
! |
1616 |
||
1617 |
borderShape:aForm |
|
1618 |
"set the borderShape to aForm" |
|
1619 |
||
2757
e26b401eeb0c
allow for a shape to be taken away (i.e. no longer a shaped view)
Claus Gittinger <cg@exept.de>
parents:
2750
diff
changeset
|
1620 |
aForm isNil ifTrue:[ |
3152 | 1621 |
viewShape := nil. |
1622 |
drawableId notNil ifTrue:[ |
|
1623 |
device setWindowBorderShape:nil in:drawableId |
|
1624 |
] |
|
2757
e26b401eeb0c
allow for a shape to be taken away (i.e. no longer a shaped view)
Claus Gittinger <cg@exept.de>
parents:
2750
diff
changeset
|
1625 |
] ifFalse:[ |
3152 | 1626 |
viewShape isNil ifTrue:[ |
1627 |
viewShape := ArbitraryViewShape new |
|
1628 |
]. |
|
1629 |
viewShape borderShapeForm:aForm. |
|
1630 |
drawableId notNil ifTrue:[ |
|
1631 |
device setWindowBorderShape:(aForm id) in:drawableId |
|
1632 |
] |
|
269 | 1633 |
] |
1903 | 1634 |
|
1635 |
"Modified: 18.9.1997 / 11:09:40 / cg" |
|
269 | 1636 |
! |
1637 |
||
1638 |
borderWidth |
|
1639 |
"return my borderWidth" |
|
1640 |
||
794 | 1641 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
3152 | 1642 |
^ superView borderWidth |
794 | 1643 |
]. |
1644 |
||
269 | 1645 |
^ borderWidth |
794 | 1646 |
|
1647 |
"Modified: 5.6.1996 / 14:11:57 / cg" |
|
269 | 1648 |
! |
1649 |
||
1650 |
borderWidth:aNumber |
|
1651 |
"set my borderWidth" |
|
1652 |
||
2907
901ffdc575a8
ask device if it supports borders
Claus Gittinger <cg@exept.de>
parents:
2886
diff
changeset
|
1653 |
|bd| |
901ffdc575a8
ask device if it supports borders
Claus Gittinger <cg@exept.de>
parents:
2886
diff
changeset
|
1654 |
|
794 | 1655 |
"/ backward compatibility |
1656 |
"/ superView will be renamed to container soon. |
|
1657 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
|
3152 | 1658 |
^ superView borderWidth:aNumber |
794 | 1659 |
]. |
1660 |
||
269 | 1661 |
(aNumber ~~ borderWidth) ifTrue:[ |
3152 | 1662 |
bd := aNumber. |
1663 |
(device supportsWindowBorder:bd) ifFalse:[ |
|
1664 |
bd > 1 ifTrue:[ |
|
1665 |
(device supportsWindowBorder:(bd := 1)) ifFalse:[ |
|
1666 |
^ self |
|
1667 |
]. |
|
1668 |
] |
|
1669 |
]. |
|
1670 |
borderWidth := bd. |
|
1671 |
drawableId notNil ifTrue:[ |
|
1672 |
device setWindowBorderWidth:aNumber in:drawableId |
|
1673 |
] |
|
269 | 1674 |
] |
794 | 1675 |
|
1676 |
"Modified: 5.6.1996 / 14:12:05 / cg" |
|
269 | 1677 |
! |
1678 |
||
4150 | 1679 |
fillFormWithBorderShape:aForm |
1680 |
"fill aForm with my borderShape" |
|
1681 |
||
1682 |
aForm fillRectangle:(Rectangle origin:self origin corner:self corner). |
|
1683 |
! |
|
1684 |
||
2158
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1685 |
foregroundColor |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1686 |
"return the foreground color of the contents - |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1687 |
here, (since there is no contents), some default is returned." |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1688 |
|
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1689 |
^ Color black |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1690 |
|
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1691 |
"Modified: / 3.5.1997 / 10:28:04 / cg" |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1692 |
"Created: / 18.6.1998 / 16:57:33 / cg" |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1693 |
! |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1694 |
|
3392 | 1695 |
foregroundColor:aColor |
1696 |
"set the foreground color of the contents - |
|
1697 |
ignored here, since there is no contents." |
|
1698 |
! |
|
1699 |
||
269 | 1700 |
level |
1701 |
"return my level relative to superView (3D)" |
|
1702 |
||
794 | 1703 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
3152 | 1704 |
^ superView level |
794 | 1705 |
]. |
1706 |
||
269 | 1707 |
^ level |
794 | 1708 |
|
1709 |
"Modified: 5.6.1996 / 14:12:10 / cg" |
|
269 | 1710 |
! |
1711 |
||
1712 |
level:aNumber |
|
1713 |
"set my level relative to superView (3D)" |
|
1714 |
||
1715 |
|oldMargin how| |
|
1716 |
||
794 | 1717 |
"/ backward compatibility |
1718 |
"/ superView will be renamed to container soon. |
|
1719 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
|
4069 | 1720 |
^ superView level:aNumber |
794 | 1721 |
]. |
1722 |
||
269 | 1723 |
(aNumber ~~ level and:[aNumber notNil]) ifTrue:[ |
4069 | 1724 |
self is3D ifTrue:[ |
1725 |
level := aNumber. |
|
1726 |
oldMargin := margin. |
|
1727 |
margin := level abs. |
|
1728 |
||
1729 |
realized ifTrue:[ |
|
1730 |
margin ~~ oldMargin ifTrue:[ |
|
1731 |
(margin > oldMargin) ifTrue:[ |
|
1732 |
how := #smaller |
|
1733 |
] ifFalse:[ |
|
1734 |
how := #larger |
|
1735 |
]. |
|
1736 |
self sizeChanged:how. |
|
1737 |
self setInnerClip. |
|
1738 |
]. |
|
1739 |
shown ifTrue:[ |
|
1740 |
margin ~~ oldMargin ifTrue:[ |
|
1741 |
self clearView. |
|
1742 |
self redrawX:margin y:margin |
|
1743 |
width:width-(margin*2) |
|
1744 |
height:height-(margin*2) |
|
1745 |
]. |
|
1746 |
self redrawEdges. |
|
1747 |
] |
|
1748 |
] |
|
1749 |
] |
|
135 | 1750 |
] |
794 | 1751 |
|
1752 |
"Modified: 5.6.1996 / 14:12:17 / cg" |
|
269 | 1753 |
! |
1754 |
||
3698 | 1755 |
lightColor |
1756 |
"returb the color to be used for lighted edges (3D only)" |
|
1757 |
||
1758 |
^ lightColor |
|
1759 |
! |
|
1760 |
||
269 | 1761 |
lightColor:aColorOrImage |
1762 |
"set the color to be used for lighted edges (3D only)" |
|
1763 |
||
1764 |
lightColor := aColorOrImage |
|
1765 |
! |
|
1766 |
||
1767 |
margin |
|
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1768 |
"return my inner margin - this is usually the level, |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1769 |
but can be more for some views |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1770 |
(textViews which add more margin between the border and the text)" |
269 | 1771 |
|
1772 |
^ margin |
|
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1773 |
|
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1774 |
"Modified: 5.6.1996 / 14:37:54 / cg" |
269 | 1775 |
! |
1776 |
||
3698 | 1777 |
shadowColor |
1778 |
"returb the color to be used for shadowed edges (3D only)" |
|
1779 |
||
1780 |
^ shadowColor |
|
1781 |
! |
|
1782 |
||
269 | 1783 |
shadowColor:aColorOrImage |
1784 |
"set the color to be used for shadowed edges (3D only)" |
|
1785 |
||
1786 |
shadowColor := aColorOrImage |
|
1787 |
! |
|
1788 |
||
1789 |
viewBackground:something |
|
1790 |
"set the viewBackground to something, a color, image or form. |
|
1791 |
If its a color and we run on a color display, also set shadow and light |
|
1792 |
colors - this means, that a red view will get light-red and dark-red |
|
1793 |
edges." |
|
1794 |
||
2584
55a405cec086
when lighting/darkening colors, take the average in the topLeft
Claus Gittinger <cg@exept.de>
parents:
2583
diff
changeset
|
1795 |
|avgColor| |
55a405cec086
when lighting/darkening colors, take the average in the topLeft
Claus Gittinger <cg@exept.de>
parents:
2583
diff
changeset
|
1796 |
|
1808 | 1797 |
"/ debug check only: |
1798 |
something isNil ifTrue:[ |
|
3762 | 1799 |
self error:'invalid viewBackground argument'. |
1800 |
^ self |
|
1808 | 1801 |
]. |
1802 |
||
269 | 1803 |
something isColor ifTrue:[ |
3762 | 1804 |
device hasGrayscales ifTrue:[ |
1805 |
avgColor := something averageColorIn:(0@0 corner:7@7). |
|
1806 |
shadowColor := avgColor darkened "on:device". |
|
1807 |
lightColor := avgColor lightened "on:device". |
|
1808 |
] |
|
135 | 1809 |
]. |
269 | 1810 |
super viewBackground:something |
749 | 1811 |
|
1808 | 1812 |
"Modified: 4.7.1997 / 20:09:22 / cg" |
269 | 1813 |
! |
1814 |
||
1815 |
viewShape:aForm |
|
1816 |
"set the viewShape to aForm" |
|
1817 |
||
2757
e26b401eeb0c
allow for a shape to be taken away (i.e. no longer a shaped view)
Claus Gittinger <cg@exept.de>
parents:
2750
diff
changeset
|
1818 |
aForm isNil ifTrue:[ |
3152 | 1819 |
viewShape := nil. |
1820 |
drawableId notNil ifTrue:[ |
|
1821 |
device setWindowShape:nil in:drawableId |
|
1822 |
] |
|
2757
e26b401eeb0c
allow for a shape to be taken away (i.e. no longer a shaped view)
Claus Gittinger <cg@exept.de>
parents:
2750
diff
changeset
|
1823 |
] ifFalse:[ |
3152 | 1824 |
viewShape isNil ifTrue:[ |
1825 |
viewShape := ArbitraryViewShape new |
|
1826 |
]. |
|
1827 |
||
1828 |
viewShape viewShapeForm:aForm. |
|
1829 |
drawableId notNil ifTrue:[ |
|
1830 |
device setWindowShape:(aForm id) in:drawableId |
|
1831 |
] |
|
135 | 1832 |
] |
1903 | 1833 |
|
1834 |
"Modified: 18.9.1997 / 11:11:04 / cg" |
|
269 | 1835 |
! ! |
1836 |
||
3139 | 1837 |
!SimpleView methodsFor:'accessing-channels'! |
1838 |
||
1839 |
setupChannel:newChannel for:changeSelector withOld:oldChannel |
|
1840 |
"common code to change a channel. |
|
1841 |
If changeSelector is non-nil, arrange for it to be sent when |
|
1842 |
the channel changes its value; otherwise, arrange for a simple update. |
|
1843 |
This is so common, that ist worth a helper method: |
|
1844 |
release any old channel (if non-nil), |
|
1845 |
arrange for changeSelector (or #update) to be sent for the new channel." |
|
1846 |
||
1847 |
|oldValue| |
|
1848 |
||
1849 |
oldChannel == newChannel ifTrue:[^ self]. |
|
1850 |
||
1851 |
oldChannel notNil ifTrue:[ |
|
3152 | 1852 |
changeSelector isNil ifTrue:[ |
1853 |
oldChannel removeDependent:self |
|
1854 |
] ifFalse:[ |
|
1855 |
oldChannel retractInterestsFor:self. |
|
1856 |
]. |
|
1857 |
oldValue := oldChannel value. |
|
3139 | 1858 |
]. |
1859 |
newChannel notNil ifTrue:[ |
|
3152 | 1860 |
changeSelector isNil ifTrue:[ |
1861 |
newChannel addDependent:self. |
|
1862 |
newChannel value ~~ oldValue ifTrue:[ |
|
1863 |
self update:#value with:nil from:newChannel. |
|
1864 |
] |
|
1865 |
] ifFalse:[ |
|
1866 |
newChannel onChangeSend:changeSelector to:self. |
|
1867 |
newChannel value ~~ oldValue ifTrue:[ |
|
1868 |
self perform:changeSelector. |
|
1869 |
] |
|
1870 |
] |
|
3139 | 1871 |
]. |
1872 |
||
1873 |
^ newChannel |
|
1874 |
||
1875 |
"Modified: / 31.10.1997 / 14:47:21 / cg" |
|
1876 |
! ! |
|
1877 |
||
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1878 |
!SimpleView methodsFor:'accessing-contents'! |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1879 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1880 |
heightOfContents |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1881 |
"return the height of the contents in logical units |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1882 |
- defaults to views visible area here. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1883 |
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
|
1884 |
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
|
1885 |
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
|
1886 |
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
|
1887 |
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
|
1888 |
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
|
1889 |
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
|
1890 |
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
|
1891 |
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
|
1892 |
of this will scale as appropriate." |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1893 |
|
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1894 |
^ (self innerHeight max:(self maxSubViewBottom)) max:self maxComponentBottom |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1895 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1896 |
"Modified: 26.5.1996 / 12:44:21 / cg" |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1897 |
! |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1898 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1899 |
widthOfContents |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1900 |
"return the width of the contents in logical units |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1901 |
- defaults to views visible area here. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1902 |
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
|
1903 |
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
|
1904 |
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
|
1905 |
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
|
1906 |
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
|
1907 |
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
|
1908 |
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
|
1909 |
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
|
1910 |
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
|
1911 |
of this will scale as appropriate." |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1912 |
|
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1913 |
^ (self innerWidth max:(self maxSubViewRight)) max:self maxComponentRight |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1914 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1915 |
"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
|
1916 |
! ! |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
1917 |
|
269 | 1918 |
!SimpleView methodsFor:'accessing-dimensions'! |
1919 |
||
1920 |
allInset:aNumber |
|
1921 |
"set all insets; positive makes the view smaller, |
|
1922 |
negative makes it larger." |
|
1923 |
||
1924 |
insets isNil ifTrue:[ |
|
3152 | 1925 |
insets := Array new:4. |
269 | 1926 |
]. |
1927 |
insets atAllPut:aNumber. |
|
1928 |
||
1929 |
"force recomputation" |
|
1930 |
"/ drawableId isNil ifTrue:[ |
|
3375 | 1931 |
"/ self originChangedFlag:true |
269 | 1932 |
"/ ] ifFalse:[ |
3152 | 1933 |
self containerChangedSize. |
269 | 1934 |
"/ ] |
964 | 1935 |
|
1936 |
"Modified: 19.7.1996 / 17:30:18 / cg" |
|
269 | 1937 |
! |
1938 |
||
1939 |
bottom |
|
1940 |
"return the y position of the actual bottom edge (in pixels)" |
|
1941 |
||
1942 |
^ top + height - 1 |
|
1943 |
! |
|
1944 |
||
1945 |
bottom:aNumber |
|
1946 |
"set the corners y position" |
|
1947 |
||
1948 |
self corner:(self corner x @ aNumber) |
|
1949 |
! |
|
1950 |
||
1951 |
bottomInset |
|
1952 |
"return the inset of the bottom edge; positive is to the top, |
|
1953 |
negative to the bottom" |
|
1954 |
||
1955 |
insets isNil ifTrue:[^ 0]. |
|
1956 |
^ insets at:4 |
|
1957 |
! |
|
1958 |
||
1959 |
bottomInset:aNumber |
|
1960 |
"set the inset of the bottom edge; |
|
1961 |
positive is to the top (view becomes smaller), |
|
1962 |
negative to the bottom (becomes larger)" |
|
1963 |
||
1964 |
insets isNil ifTrue:[ |
|
3152 | 1965 |
insets := Array with:0 with:0 with:0 with:0 |
269 | 1966 |
]. |
1967 |
insets at:4 put:aNumber. |
|
1968 |
||
1969 |
"force recomputation" |
|
1970 |
"/ drawableId isNil ifTrue:[ |
|
3375 | 1971 |
"/ self originChangedFlag:true |
269 | 1972 |
"/ ] ifFalse:[ |
3152 | 1973 |
self containerChangedSize |
269 | 1974 |
"/ ] |
964 | 1975 |
|
1976 |
"Modified: 19.7.1996 / 17:30:22 / cg" |
|
269 | 1977 |
! |
1978 |
||
1979 |
center |
|
1980 |
"return the point at the center of the receiver (in pixels)" |
|
1981 |
||
1982 |
^ (left + (width // 2)) @ (top + (height // 2)) |
|
1983 |
! |
|
1984 |
||
1985 |
center:newCenter |
|
1986 |
"move the receiver so that newCenter, aPoint becomes the center point" |
|
1987 |
||
1988 |
self origin:(newCenter - ((width // 2) @ (height // 2))) |
|
1989 |
! |
|
1990 |
||
1991 |
computeCorner |
|
1992 |
"compute my corner; if I have a layoutObject, |
|
1993 |
relative origins or blocks to evaluate, compute it now .. |
|
1994 |
Blocks may return relative values or nil; nil means: take current value. |
|
1995 |
Returns the corner point in device coordinates (pixels)." |
|
1996 |
||
1997 |
|org newCorner newExt x y| |
|
1998 |
||
1999 |
" |
|
2000 |
slowly migrating to use layoutObjects ... |
|
2001 |
" |
|
2002 |
layout notNil ifTrue:[ |
|
3152 | 2003 |
superView isNil ifTrue:[^ self preferredBounds corner]. |
2004 |
^ (layout rectangleRelativeTo:(superView viewRectangle) |
|
2005 |
preferred:[self preferredBounds]) corner rounded |
|
269 | 2006 |
]. |
2007 |
||
2008 |
(cornerRule notNil) ifTrue:[ |
|
3152 | 2009 |
newCorner := cornerRule value. |
2010 |
" |
|
2011 |
allow return of relative values ... |
|
2012 |
" |
|
2013 |
x := newCorner x. |
|
2014 |
y := newCorner y. |
|
2015 |
x isNil ifTrue:[x := self corner x]. |
|
2016 |
y isNil ifTrue:[y := self corner y]. |
|
2017 |
((x isInteger not) or:[y isInteger not]) ifTrue:[ |
|
2018 |
newCorner := self cornerFromRelativeCorner:x@y |
|
2019 |
] |
|
269 | 2020 |
] ifFalse:[ |
3152 | 2021 |
(relativeCorner notNil) ifTrue:[ |
2022 |
newCorner := self cornerFromRelativeCorner:relativeCorner |
|
2023 |
] ifFalse:[ |
|
2024 |
org := self computeOrigin. |
|
2025 |
(extentRule notNil) ifTrue:[ |
|
2026 |
newExt := extentRule value |
|
2027 |
] ifFalse:[ |
|
2028 |
(relativeExtent notNil) ifTrue:[ |
|
2029 |
newExt := self extentFromRelativeExtent:relativeExtent |
|
2030 |
] ifFalse:[ |
|
2031 |
newExt := self extent. |
|
2032 |
] |
|
2033 |
]. |
|
2034 |
newCorner := org + newExt |
|
2035 |
] |
|
269 | 2036 |
]. |
2037 |
^ newCorner |
|
1389 | 2038 |
|
2039 |
"Modified: 28.2.1997 / 10:33:39 / cg" |
|
269 | 2040 |
! |
2041 |
||
2042 |
computeExtent |
|
2043 |
"compute my extent; if I have a layoutObject, a relative extent |
|
2044 |
or blocks to evaluate, compute it now .. |
|
2045 |
There is one catch here, if the dimension was defined |
|
2046 |
by origin/corner, compute them here and take that value. |
|
2047 |
I.e. origin/corner definition has precedence over extent definition. |
|
2048 |
Returns the extent in device coordinates (pixels)." |
|
2049 |
||
2050 |
|newOrg newExt newCorner x y| |
|
2051 |
||
2052 |
" |
|
2053 |
slowly migrating to use layoutObjects ... |
|
2054 |
" |
|
2055 |
layout notNil ifTrue:[ |
|
3152 | 2056 |
^ (layout rectangleRelativeTo:(superView viewRectangle) |
2057 |
preferred:[self preferredBounds]) extent rounded |
|
135 | 2058 |
]. |
269 | 2059 |
|
2060 |
(cornerRule notNil) ifTrue:[ |
|
3152 | 2061 |
newCorner := cornerRule value. |
2062 |
" |
|
2063 |
allow return of relative values ... |
|
2064 |
" |
|
2065 |
x := newCorner x. |
|
2066 |
y := newCorner y. |
|
2067 |
x isNil ifTrue:[x := self corner x]. |
|
2068 |
y isNil ifTrue:[y := self corner y]. |
|
2069 |
((x isInteger not) or:[y isInteger not]) ifTrue:[ |
|
2070 |
newCorner := self cornerFromRelativeCorner:x@y |
|
2071 |
] |
|
269 | 2072 |
] ifFalse:[ |
3152 | 2073 |
(relativeCorner notNil) ifTrue:[ |
2074 |
newCorner := self cornerFromRelativeCorner:relativeCorner |
|
2075 |
] ifFalse:[ |
|
2076 |
(extentRule notNil) ifTrue:[ |
|
2077 |
newExt := extentRule value. |
|
2078 |
" |
|
2079 |
allow return of relative values ... |
|
2080 |
" |
|
2081 |
x := newExt x. |
|
2082 |
y := newExt y. |
|
2083 |
x isNil ifTrue:[x := width]. |
|
2084 |
y isNil ifTrue:[y := height]. |
|
2085 |
((x isInteger not) or:[y isInteger not]) ifTrue:[ |
|
2086 |
newExt := self extentFromRelativeExtent:x@y |
|
2087 |
] |
|
2088 |
] ifFalse:[ |
|
2089 |
(relativeExtent notNil) ifTrue:[ |
|
2090 |
newExt := self extentFromRelativeExtent:relativeExtent |
|
2091 |
] ifFalse:[ |
|
2092 |
newExt := (width @ height). |
|
2093 |
]. |
|
2094 |
]. |
|
2095 |
]. |
|
269 | 2096 |
]. |
2097 |
||
2098 |
newCorner notNil ifTrue:[ |
|
3152 | 2099 |
newOrg := self computeOrigin. |
2100 |
^ newCorner - newOrg. |
|
269 | 2101 |
]. |
2102 |
^ newExt. |
|
2103 |
! |
|
2104 |
||
2105 |
computeOrigin |
|
2106 |
"compute my origin; if I have a layoutObject, a relative origin |
|
2107 |
or blocks to evaluate, compute it now .. |
|
2108 |
Blocks may return relative values or nil; nil means: take current value. |
|
2109 |
Returns the origin point in device coordinates (pixels)." |
|
2110 |
||
2111 |
|newOrg x y| |
|
2112 |
||
2113 |
" |
|
2114 |
slowly migrating to use layoutObjects ... |
|
2115 |
" |
|
2116 |
layout notNil ifTrue:[ |
|
3152 | 2117 |
superView isNil ifTrue:[^ 0@0]. |
2118 |
^ (layout rectangleRelativeTo:(superView viewRectangle) |
|
2119 |
preferred:[self preferredBounds]) origin rounded |
|
269 | 2120 |
]. |
2121 |
||
2122 |
(originRule notNil) ifTrue:[ |
|
3152 | 2123 |
newOrg := originRule value. |
2124 |
" |
|
2125 |
allow return of relative values ... |
|
2126 |
" |
|
2127 |
x := newOrg x. |
|
2128 |
y := newOrg y. |
|
2129 |
x isNil ifTrue:[x := self origin x]. |
|
2130 |
y isNil ifTrue:[y := self origin y]. |
|
2131 |
((x isInteger not) or:[y isInteger not]) ifTrue:[ |
|
2132 |
newOrg := self originFromRelativeOrigin:x@y. |
|
2133 |
] |
|
269 | 2134 |
] ifFalse:[ |
3152 | 2135 |
(relativeOrigin notNil) ifTrue:[ |
2136 |
newOrg := self originFromRelativeOrigin:relativeOrigin. |
|
2137 |
] ifFalse:[ |
|
2138 |
^ (left @ top). |
|
2139 |
]. |
|
269 | 2140 |
]. |
2141 |
^ newOrg |
|
2142 |
! |
|
2143 |
||
2144 |
corner |
|
2145 |
"return the lower right corner-point (in pixels)" |
|
2146 |
||
2147 |
"/ ^ (left + width "- 1") @ (top + height "- 1") |
|
2148 |
^ (left + width - 1) @ (top + height - 1) |
|
2149 |
||
2150 |
"Modified: 31.8.1995 / 16:51:40 / claus" |
|
2151 |
! |
|
2152 |
||
2153 |
corner:corner |
|
2154 |
"set the views corner; |
|
2155 |
the corner argument may be: |
|
3152 | 2156 |
a point |
2157 |
where integer fields mean 'pixel-values' |
|
2158 |
and float values mean 'relative-to-superview' |
|
2159 |
and nil means 'take current value'; |
|
269 | 2160 |
or a block returning a point which is interpreted as above. |
2161 |
Please migrate to use layoutObjects, if possible." |
|
2162 |
||
2163 |
|x y pixelCorner c| |
|
2164 |
||
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2165 |
explicitExtent := true. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2166 |
|
269 | 2167 |
corner isBlock ifTrue:[ |
3152 | 2168 |
cornerRule := corner. |
2169 |
drawableId notNil ifTrue:[ |
|
2170 |
pixelCorner := corner value |
|
2171 |
] ifFalse:[ |
|
3375 | 2172 |
self extentChangedFlag:true |
3152 | 2173 |
] |
269 | 2174 |
] ifFalse:[ |
3152 | 2175 |
x := corner x. |
2176 |
y := corner y. |
|
2177 |
x isNil ifTrue:[x := self corner x]. |
|
2178 |
y isNil ifTrue:[y := self corner y]. |
|
2179 |
c := x @ y. |
|
2180 |
((x isInteger not) or:[y isInteger not]) ifTrue:[ |
|
2181 |
relativeCorner := c. |
|
2182 |
pixelCorner := self cornerFromRelativeCorner. |
|
2183 |
pixelCorner isNil ifTrue:[ |
|
3375 | 2184 |
self extentChangedFlag:true |
3152 | 2185 |
] |
2186 |
] ifFalse:[ |
|
2187 |
pixelCorner := c |
|
2188 |
] |
|
269 | 2189 |
]. |
2190 |
||
2191 |
pixelCorner notNil ifTrue:[ |
|
3152 | 2192 |
self pixelCorner:pixelCorner |
269 | 2193 |
] |
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2194 |
|
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2195 |
"Modified: 15.7.1996 / 09:51:06 / cg" |
269 | 2196 |
! |
2197 |
||
1327 | 2198 |
cornerRule |
2199 |
"return the corner block - non public; this will vanish without notice" |
|
2200 |
||
2201 |
^ cornerRule |
|
2202 |
! |
|
2203 |
||
269 | 2204 |
extent:extent |
2205 |
"set the views extent; |
|
2206 |
extent may be: |
|
3152 | 2207 |
a point |
2208 |
where integer fields mean 'pixel-values' |
|
2209 |
and float values mean 'relative-to-superview' |
|
2210 |
and nil means 'leave current value'; |
|
269 | 2211 |
or a block returning a point which is interpreted as above. |
2212 |
Be careful when using relative extents: rounding errors may |
|
2213 |
accumulate. Better use origin/corner. |
|
1048
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2214 |
Best: migrate to use layour objects. |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2215 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2216 |
Notice: this sets the views explicitExtent flag, which prevents it normally |
3152 | 2217 |
from resizing itself to its preferredExtent. |
2218 |
See initialExtent: for a variation." |
|
269 | 2219 |
|
2220 |
|w h pixelExtent e| |
|
2221 |
||
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2222 |
explicitExtent := true. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2223 |
|
269 | 2224 |
extent isBlock ifTrue:[ |
3152 | 2225 |
extentRule := extent. |
2226 |
drawableId notNil ifTrue:[ |
|
2227 |
pixelExtent := extent value |
|
2228 |
] ifFalse:[ |
|
3375 | 2229 |
self extentChangedFlag:true |
3152 | 2230 |
] |
135 | 2231 |
] ifFalse:[ |
3152 | 2232 |
w := extent x. |
2233 |
h := extent y. |
|
2234 |
w isNil ifTrue:[w := width]. |
|
2235 |
h isNil ifTrue:[h := height]. |
|
2236 |
e := w@h. |
|
2237 |
((w isInteger not) or:[h isInteger not]) ifTrue:[ |
|
2238 |
relativeExtent := e. |
|
2239 |
pixelExtent := self extentFromRelativeExtent. |
|
2240 |
pixelExtent isNil ifTrue:[ |
|
3375 | 2241 |
self extentChangedFlag:true |
3152 | 2242 |
] |
2243 |
] ifFalse:[ |
|
2244 |
relativeExtent := nil. |
|
2245 |
pixelExtent := e |
|
2246 |
] |
|
269 | 2247 |
]. |
2248 |
pixelExtent notNil ifTrue:[ |
|
3152 | 2249 |
self pixelExtent:pixelExtent |
269 | 2250 |
] |
573
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2251 |
|
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2252 |
"Modified: 15.7.1996 / 09:51:21 / cg" |
269 | 2253 |
! |
2254 |
||
1327 | 2255 |
extentRule |
2256 |
"return the extent block - non public; this will vanish without notice" |
|
2257 |
||
2258 |
^ extentRule |
|
2259 |
! |
|
2260 |
||
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
2261 |
frame |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
2262 |
"compatibility with displayObjects: returns my bounds" |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
2263 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
2264 |
^ self bounds |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
2265 |
! |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
2266 |
|
269 | 2267 |
geometryLayout |
2268 |
"this method will vanish, as soon as all implementations of |
|
2269 |
#layout: are removed ... |
|
2270 |
(conflict for example in label>>layout:). |
|
2271 |
DO NOT USE #geometryLayout: in your code; it will be removed without |
|
2272 |
notice." |
|
2273 |
||
2274 |
^ here layout |
|
2275 |
! |
|
2276 |
||
2277 |
geometryLayout:aLayoutObject |
|
2278 |
"this method will vanish, as soon as all implementations of |
|
2279 |
#layout: are removed ... |
|
2280 |
(conflict for example in label>>layout:). |
|
2281 |
DO NOT USE #geometryLayout: in your code; it will be removed without |
|
2282 |
notice." |
|
2283 |
||
2284 |
here layout:aLayoutObject |
|
2285 |
! |
|
2286 |
||
2287 |
height:aNumber |
|
2288 |
"set the views height in pixels" |
|
2289 |
||
2290 |
self extent:(width @ aNumber) |
|
2291 |
! |
|
2292 |
||
2293 |
heightIncludingBorder |
|
2294 |
"return my height including border |
|
2295 |
(this is my height as seen from the outside view; |
|
2296 |
while #height returns the height as seen by myself)" |
|
2297 |
||
2298 |
^ height + (2*borderWidth) |
|
2299 |
! |
|
2300 |
||
2301 |
horizontalInset:aNumber |
|
2302 |
"set the insets of the left/right edge; |
|
2303 |
positive makes it smaller, negative makes it larger" |
|
2304 |
||
2305 |
insets isNil ifTrue:[ |
|
3152 | 2306 |
insets := Array with:0 with:0 with:0 with:0 |
135 | 2307 |
]. |
269 | 2308 |
insets at:1 put:aNumber. |
2309 |
insets at:3 put:aNumber. |
|
2310 |
||
2311 |
"force recomputation" |
|
2312 |
"/ drawableId isNil ifTrue:[ |
|
3375 | 2313 |
"/ self originChangedFlag:true |
269 | 2314 |
"/ ] ifFalse:[ |
3152 | 2315 |
self containerChangedSize. |
269 | 2316 |
"/ ] |
964 | 2317 |
|
2318 |
"Modified: 19.7.1996 / 17:30:25 / cg" |
|
269 | 2319 |
! |
2320 |
||
1048
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2321 |
initialExtent:extent |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2322 |
"set the views extent, but dont change its explicitExtent setting. |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2323 |
a variant of #extent." |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2324 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2325 |
|expl| |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2326 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2327 |
expl := explicitExtent. |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2328 |
self extent:extent. |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2329 |
explicitExtent := expl |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2330 |
! |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2331 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2332 |
initialHeight:aNumber |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2333 |
"set the views height in pixels, but dont change its explicitExtent setting" |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2334 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2335 |
self initialExtent:(width @ aNumber) |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2336 |
! |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2337 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2338 |
initialWidth:aNumber |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2339 |
"set the views width in pixels, but dont change its explicitExtent setting" |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2340 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2341 |
self initialExtent:(aNumber @ height) |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2342 |
! |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2343 |
|
269 | 2344 |
innerHeight |
2345 |
"return the height of the view minus any 3D-shadow-borders" |
|
2346 |
||
2347 |
(margin == 0) ifTrue:[^ height]. |
|
2348 |
^ height - (2 * margin) |
|
2349 |
! |
|
2350 |
||
369 | 2351 |
innerHeight:pixels |
2352 |
"set the height of the view plus any 3D-shadow-borders. |
|
2353 |
This does not work with a relative size." |
|
2354 |
||
2355 |
^ self height:( pixels + (margin + self innerVerticalMargin * 2) ). |
|
2356 |
! |
|
2357 |
||
2358 |
innerHorizontalMargin |
|
2359 |
"return any additional inner margin (i.e. contents margin). |
|
2360 |
This should be redefined by views which do add margins |
|
2361 |
(for example: textViews do this)" |
|
2362 |
||
2363 |
^ 0 |
|
2364 |
! |
|
2365 |
||
2366 |
innerVerticalMargin |
|
2367 |
"return any additional inner margin (i.e. contents margin). |
|
2368 |
This should be redefined by views which do add margins |
|
2369 |
(for example: textViews do this)" |
|
2370 |
||
2371 |
^ 0 |
|
2372 |
! |
|
2373 |
||
269 | 2374 |
innerWidth |
2375 |
"return the width of the view minus any 3D-shadow-borders" |
|
2376 |
||
2377 |
(level == 0) ifTrue:[^ width]. |
|
2378 |
^ width - (2 * margin) |
|
2379 |
! |
|
2380 |
||
369 | 2381 |
innerWidth:pixels |
2382 |
"set the width of the view plus any 3D-shadow-borders. |
|
2383 |
This does not work with a relative size." |
|
2384 |
||
2385 |
^ self width:( pixels + (margin + self innerHorizontalMargin * 2) ). |
|
2386 |
! |
|
2387 |
||
269 | 2388 |
inset:aNumber |
2389 |
"set all insets; positive makes the view smaller, |
|
2390 |
negative makes it larger." |
|
2391 |
||
2392 |
self allInset:aNumber |
|
2393 |
! |
|
2394 |
||
2395 |
layout |
|
2396 |
"return the layout object which controls my geometry. |
|
2397 |
Currently, this is nil in most cases, and my geometry is |
|
2398 |
defined by relativeOrigin/relativeCorner/relativeExtent, |
|
2399 |
originRule/extentRule/cornerRule and inset. |
|
2400 |
Applications should be changed to use layoutObjects, |
|
2401 |
since the above listed instance variables will vanish." |
|
2402 |
||
2403 |
^ layout |
|
2404 |
! |
|
2405 |
||
2406 |
layout:aLayoutObject |
|
2407 |
"set the layout object which controls my geometry. |
|
2408 |
Currently, this is almost nowhere used but views will be |
|
2409 |
incrementally changed to use this new geometry management." |
|
2410 |
||
2411 |
layout := aLayoutObject. |
|
2412 |
superView isNil ifTrue:[ |
|
3375 | 2413 |
self originChangedFlag:true. |
2414 |
self cornerChangedFlag:true. |
|
2415 |
self extentChangedFlag:true. |
|
269 | 2416 |
] ifFalse:[ |
3152 | 2417 |
self containerChangedSize. |
269 | 2418 |
] |
2419 |
||
2420 |
"Modified: 19.9.1995 / 16:17:25 / claus" |
|
964 | 2421 |
"Modified: 19.7.1996 / 17:30:27 / cg" |
269 | 2422 |
! |
2423 |
||
2424 |
left |
|
2425 |
"return the x position of the left border (in pixels)" |
|
2426 |
||
2427 |
^ left |
|
2428 |
! |
|
2429 |
||
2430 |
left:aNumber |
|
2431 |
"set the x position" |
|
2432 |
||
2433 |
self origin:(aNumber @ top) |
|
2434 |
! |
|
2435 |
||
2436 |
left:newLeft top:newTop width:newWidth height:newHeight |
|
2437 |
"another way of specifying origin and extent" |
|
2438 |
||
2439 |
self origin:(newLeft @ newTop) extent:(newWidth @ newHeight) |
|
2440 |
! |
|
2441 |
||
2442 |
leftInset |
|
2443 |
"return the inset of the left edge; positive is to the right, |
|
2444 |
negative to the left" |
|
2445 |
||
2446 |
insets isNil ifTrue:[^ 0]. |
|
2447 |
^ insets at:1 |
|
2448 |
! |
|
2449 |
||
2450 |
leftInset:aNumber |
|
2451 |
"set the inset of the left edge; |
|
2452 |
positive is to the right (view becomes smaller), |
|
2453 |
negative to the left (becomes larger)" |
|
2454 |
||
2455 |
insets isNil ifTrue:[ |
|
3152 | 2456 |
insets := Array with:0 with:0 with:0 with:0 |
269 | 2457 |
]. |
2458 |
insets at:1 put:aNumber. |
|
2459 |
||
2460 |
"force recomputation" |
|
2461 |
"/ drawableId isNil ifTrue:[ |
|
3375 | 2462 |
"/ self originChangedFlag:true |
269 | 2463 |
"/ ] ifFalse:[ |
3152 | 2464 |
self containerChangedSize. |
269 | 2465 |
"/ ] |
964 | 2466 |
|
2467 |
"Modified: 19.7.1996 / 17:30:30 / cg" |
|
269 | 2468 |
! |
2469 |
||
2470 |
makeFullyVisible |
|
2471 |
"make sure, that the view is fully visible by shifting it |
|
2472 |
into the visible screen area if nescessary. |
|
2473 |
This method will be moved to StandardSystemView ..." |
|
2474 |
||
2475 |
|devBot devRight newTop newLeft| |
|
2476 |
||
2477 |
newTop := top. |
|
2478 |
newLeft := left. |
|
2479 |
||
1703 | 2480 |
((top + height) > (devBot := device usableHeight)) ifTrue:[ |
3152 | 2481 |
newTop := devBot - height |
269 | 2482 |
]. |
1703 | 2483 |
((left + width) > (devRight := device usableWidth)) ifTrue:[ |
3152 | 2484 |
newLeft := devRight - width |
269 | 2485 |
]. |
2486 |
(newTop < 0) ifTrue:[ |
|
3152 | 2487 |
newTop := 0. |
269 | 2488 |
]. |
2489 |
(newLeft < 0) ifTrue:[ |
|
3152 | 2490 |
newLeft := 0 |
269 | 2491 |
]. |
2492 |
((newTop ~~ top) or:[newLeft ~~ left]) ifTrue:[ |
|
3152 | 2493 |
self origin:newLeft @ newTop |
269 | 2494 |
] |
2495 |
! |
|
2496 |
||
2750
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2497 |
makeRoundViewShapeWithBorder:bw |
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2498 |
"setup my window for a round shaped view; |
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2499 |
this is not supported by all devices" |
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2500 |
|
3167
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2501 |
self makeRoundViewShapeWithBorder:bw opaque:true. |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2502 |
|
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2503 |
! |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2504 |
|
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2505 |
makeRoundViewShapeWithBorder:bw opaque:opaque |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2506 |
"setup my window for a round shaped view; |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2507 |
this is not supported by all devices" |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2508 |
|
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2509 |
|extent shapeForm borderForm w h f| |
2750
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2510 |
|
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2511 |
device supportsRoundShapedViews ifTrue:[ |
3762 | 2512 |
"/ TODO: add code for round shaped view (mswin) |
2750
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2513 |
]. |
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2514 |
|
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2515 |
device supportsArbitraryShapedViews ifTrue:[ |
3762 | 2516 |
extent := self extent. |
2517 |
w := extent x. |
|
2518 |
h := extent y. |
|
2519 |
borderForm := Form extent:extent. |
|
2520 |
shapeForm := Form extent:extent. |
|
2521 |
||
2522 |
borderForm fillArcX:0 y:0 |
|
2523 |
width:w |
|
2524 |
height:h |
|
2525 |
from:0 |
|
2526 |
angle:360. |
|
2527 |
||
2528 |
opaque ifFalse:[ |
|
2529 |
f := borderForm. |
|
2530 |
borderForm foreground:(Color colorId:0). |
|
2531 |
] ifTrue:[ |
|
2532 |
f := shapeForm. |
|
2533 |
shapeForm foreground:(Color colorId:1). |
|
2534 |
]. |
|
2535 |
||
2536 |
f fillArcX:lineWidth y:lineWidth |
|
2537 |
width:w - (bw * 2) |
|
2538 |
height:h - (bw * 2) |
|
2539 |
from:0 |
|
2540 |
angle:360. |
|
2541 |
||
2542 |
self borderShape:borderForm. |
|
2543 |
self viewShape:shapeForm. |
|
2544 |
^ self. |
|
3474 | 2545 |
|
2546 |
"/ |
|
2547 |
"/ extent := self extent. |
|
3167
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2548 |
"/ |
3474 | 2549 |
"/ w := extent x. |
2550 |
"/ h := extent y. |
|
2551 |
"/ borderForm := Form width:w height:h. |
|
2552 |
"/ "/ borderForm fill:(Color colorId:0). |
|
2553 |
"/ |
|
2554 |
"/ shapeForm := Form width:w height:h. |
|
2555 |
"/ "/ shapeForm fill:(Color colorId:0). |
|
2556 |
"/ |
|
2557 |
"/ borderForm foreground:(Color colorId:1). |
|
2558 |
"/ borderForm |
|
2559 |
"/ fillArcX:0 y:0 |
|
2560 |
"/ width:w |
|
2561 |
"/ height:h |
|
2562 |
"/ from:0 |
|
2563 |
"/ angle:360. |
|
2564 |
"/ |
|
2565 |
"/ opaque ifFalse:[ |
|
2566 |
"/ f := borderForm. |
|
2567 |
"/ borderForm foreground:(Color colorId:0). |
|
2568 |
"/ ] ifTrue:[ |
|
2569 |
"/ f := shapeForm. |
|
2570 |
"/ shapeForm foreground:(Color colorId:1). |
|
2571 |
"/ ]. |
|
2572 |
"/ f |
|
2573 |
"/ fillArcX:bw y:bw |
|
2574 |
"/ width:(w - (bw * 2)) |
|
2575 |
"/ height:(h - (bw * 2)) |
|
2576 |
"/ from:0 |
|
2577 |
"/ angle:360. |
|
2578 |
"/ |
|
2579 |
"/ self borderShape:borderForm. |
|
2580 |
"/ self viewShape:shapeForm |
|
3167
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2581 |
] |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2582 |
! |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2583 |
|
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2584 |
makeTransparentRectangularViewShapeWithBorder:bw |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2585 |
"setup my window for a rectangluar transparent shaped view; |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2586 |
this is not supported by all devices" |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2587 |
|
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2588 |
|extent shapeForm borderForm w h f| |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2589 |
|
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2590 |
"/ device supportsPolygonShapedViews ifTrue:[ |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2591 |
"/ "/ TODO: add code for mswin |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2592 |
"/ ]. |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2593 |
|
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2594 |
device supportsArbitraryShapedViews ifTrue:[ |
3367 | 2595 |
extent := self extent. |
2596 |
w := extent x. |
|
2597 |
h := extent y. |
|
2598 |
borderForm := Form extent:extent. |
|
2599 |
shapeForm := Form extent:extent. |
|
2600 |
||
2601 |
borderForm |
|
2602 |
fillRectangleX:0 y:0 |
|
2603 |
width:w |
|
2604 |
height:h. |
|
2605 |
||
2606 |
f := borderForm. |
|
2607 |
borderForm foreground:(Color colorId:0). |
|
2608 |
||
2609 |
borderForm |
|
2610 |
fillRectangleX:bw y:bw |
|
2611 |
width:w - (bw * 2) |
|
2612 |
height:h - (bw * 2). |
|
2613 |
||
2614 |
self borderShape:borderForm. |
|
2615 |
self viewShape:shapeForm. |
|
2616 |
^ self. |
|
2750
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2617 |
] |
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2618 |
|
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2619 |
! |
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2620 |
|
2127 | 2621 |
maxExtent |
2103
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2622 |
"for compatibility with StdSysView" |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2623 |
|
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2624 |
^ nil |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2625 |
! |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2626 |
|
2127 | 2627 |
minExtent |
2103
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2628 |
"for compatibility with StdSysView" |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2629 |
|
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2630 |
^ nil |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2631 |
! |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2632 |
|
269 | 2633 |
origin |
2634 |
"return the origin (in pixels)" |
|
2635 |
||
2636 |
^ left@top |
|
2637 |
! |
|
2638 |
||
2639 |
origin:origin |
|
2640 |
"set the views origin; |
|
2641 |
origin may be: |
|
3152 | 2642 |
a point |
2643 |
where integer fields mean 'pixel-values' |
|
2644 |
and float values mean 'relative-to-superview' |
|
2645 |
and nil means 'take current value'; |
|
269 | 2646 |
or a block returning a point which is interpreted as above. |
2647 |
Please migrate to use layout objects." |
|
2648 |
||
2649 |
|newLeft newTop pixelOrigin o| |
|
2650 |
||
2651 |
origin isBlock ifTrue:[ |
|
3152 | 2652 |
originRule := origin. |
2653 |
drawableId notNil ifTrue:[ |
|
2654 |
pixelOrigin := origin value |
|
2655 |
] ifFalse:[ |
|
3375 | 2656 |
self originChangedFlag:true |
3152 | 2657 |
] |
269 | 2658 |
] ifFalse:[ |
3152 | 2659 |
o := origin. |
2660 |
newLeft := origin x. |
|
2661 |
newTop := origin y. |
|
2662 |
newLeft isNil ifTrue:[newLeft := left]. |
|
2663 |
newTop isNil ifTrue:[newTop := top]. |
|
2664 |
o := newLeft @ newTop. |
|
2665 |
((newLeft isInteger not) or:[newTop isInteger not]) ifTrue:[ |
|
2666 |
relativeOrigin := o. |
|
2667 |
pixelOrigin := self originFromRelativeOrigin. |
|
2668 |
pixelOrigin isNil ifTrue:[ |
|
3375 | 2669 |
self originChangedFlag:true |
3152 | 2670 |
] |
2671 |
] ifFalse:[ |
|
2672 |
relativeOrigin := nil. |
|
2673 |
pixelOrigin := o |
|
2674 |
] |
|
269 | 2675 |
]. |
2676 |
pixelOrigin notNil ifTrue:[ |
|
3152 | 2677 |
self pixelOrigin:pixelOrigin |
269 | 2678 |
]. |
573
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2679 |
|
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2680 |
"Modified: 19.4.1996 / 15:12:36 / cg" |
269 | 2681 |
! |
2682 |
||
2683 |
origin:origin corner:corner |
|
2684 |
"set both origin and extent" |
|
2685 |
||
2686 |
|newLeft newTop newRight newBot| |
|
2687 |
||
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2688 |
explicitExtent := true. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2689 |
|
269 | 2690 |
"do it as one operation if possible" |
2691 |
||
2692 |
origin isBlock ifFalse:[ |
|
3152 | 2693 |
corner isBlock ifFalse:[ |
2694 |
newLeft := origin x. |
|
2695 |
newLeft isInteger ifTrue:[ |
|
2696 |
newTop := origin y. |
|
2697 |
newTop isInteger ifTrue:[ |
|
2698 |
newRight := corner x. |
|
2699 |
newRight isInteger ifTrue:[ |
|
2700 |
newBot := corner y. |
|
2701 |
newBot isInteger ifTrue:[ |
|
2702 |
self pixelOrigin:origin corner:corner |
|
2703 |
] |
|
2704 |
] |
|
2705 |
] |
|
2706 |
] |
|
2707 |
] |
|
135 | 2708 |
]. |
269 | 2709 |
self origin:origin. |
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2710 |
self corner:corner |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2711 |
|
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2712 |
"Modified: 15.7.1996 / 09:52:43 / cg" |
269 | 2713 |
! |
2714 |
||
2715 |
origin:origin extent:extent |
|
2716 |
"set both origin and extent" |
|
2717 |
||
2718 |
|newLeft newTop newWidth newHeight| |
|
2719 |
||
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2720 |
explicitExtent := true. |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2721 |
|
269 | 2722 |
"do it as one operation if possible" |
2723 |
||
2724 |
origin isBlock ifFalse:[ |
|
3152 | 2725 |
extent isBlock ifFalse:[ |
2726 |
newLeft := origin x. |
|
2727 |
newLeft isInteger ifTrue:[ |
|
2728 |
newTop := origin y. |
|
2729 |
newTop isInteger ifTrue:[ |
|
2730 |
newWidth := extent x. |
|
2731 |
newWidth isInteger ifTrue:[ |
|
2732 |
newHeight := extent y. |
|
2733 |
newHeight isInteger ifTrue:[ |
|
2734 |
self pixelOrigin:origin extent:extent |
|
2735 |
] |
|
2736 |
] |
|
2737 |
] |
|
2738 |
] |
|
2739 |
] |
|
269 | 2740 |
]. |
2741 |
self extent:extent. |
|
2742 |
self origin:origin |
|
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2743 |
|
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2744 |
"Modified: 15.7.1996 / 09:52:39 / cg" |
269 | 2745 |
! |
2746 |
||
2747 |
originRelativeTo:aView |
|
2748 |
"return the origin (in pixels) relative to a superView, |
|
2749 |
or relative to the rootView (if the aView argument is nil). |
|
2750 |
If the receiver is nonNil and not a subview of aView, return nil." |
|
2751 |
||
2752 |
|currentView |
|
2414 | 2753 |
bw "{ Class: SmallInteger }" |
269 | 2754 |
sumX "{ Class: SmallInteger }" |
2755 |
sumY "{ Class: SmallInteger }" | |
|
2756 |
||
2757 |
currentView := self. |
|
2758 |
sumX := 0. |
|
2759 |
sumY := 0. |
|
2760 |
[currentView notNil] whileTrue:[ |
|
3152 | 2761 |
(currentView == aView) ifTrue:[ |
2762 |
^ (sumX @ sumY) |
|
2763 |
]. |
|
2764 |
bw := currentView borderWidth. |
|
2765 |
sumX := sumX + (currentView left) + bw. |
|
2766 |
sumY := sumY + (currentView top) + bw. |
|
2767 |
currentView := currentView superView |
|
269 | 2768 |
]. |
729
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
2769 |
(aView isNil or:[aView == device rootView]) ifTrue:[ |
3152 | 2770 |
"return relative to screen ..." |
2771 |
^ (sumX @ sumY) |
|
269 | 2772 |
]. |
2773 |
^ nil |
|
2774 |
||
2775 |
" |
|
2776 |
|top sub1 sub2| |
|
2777 |
||
2778 |
top := StandardSystemView new. |
|
2779 |
top extent:200@200. |
|
2780 |
sub1 := View origin:0.2 @ 0.2 corner:0.8 @ 0.8 in:top. |
|
2781 |
sub2 := Button origin:0.3 @ 0.3 corner:0.7 @ 0.7 in:sub1. |
|
2782 |
top openAndWait. |
|
697 | 2783 |
Transcript show:'button in top:'; showCR:(sub2 originRelativeTo:top). |
2784 |
Transcript show:'button on screen:'; showCR:(sub2 originRelativeTo:nil). |
|
269 | 2785 |
" |
2171
df6af7cc7a62
fixed #originRelativeTo: when borderWidth ~~ 0
Claus Gittinger <cg@exept.de>
parents:
2167
diff
changeset
|
2786 |
|
2414 | 2787 |
"Modified: / 5.12.1998 / 14:30:57 / cg" |
269 | 2788 |
! |
2789 |
||
1327 | 2790 |
originRule |
2791 |
"return the origin block - non public; this will vanish without notice" |
|
2792 |
||
2793 |
^ originRule |
|
2794 |
! |
|
2795 |
||
763 | 2796 |
preferredExtent:anExtentPoint |
2797 |
"override the views own preferredExtent computation, |
|
2798 |
and let it prefer the size given by the argument." |
|
2799 |
||
2800 |
preferredExtent := anExtentPoint. |
|
1038
fb193cba16b6
#preferredExtent: no longer changes the extent
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
2801 |
|
fb193cba16b6
#preferredExtent: no longer changes the extent
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
2802 |
"Modified: 22.8.1996 / 13:41:47 / cg" |
763 | 2803 |
! |
2804 |
||
269 | 2805 |
relativeCorner |
2806 |
"return the relative corner or nil" |
|
2807 |
||
2808 |
^ relativeCorner |
|
2809 |
! |
|
2810 |
||
2811 |
relativeCorner:aPoint |
|
2812 |
"set the relative corner" |
|
2813 |
||
3627
eefbbc5c3d04
when setting a relativeExtent, clear any relativeCorner
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
2814 |
aPoint notNil ifTrue:[relativeExtent := nil]. |
269 | 2815 |
relativeCorner := aPoint |
2816 |
! |
|
2817 |
||
2818 |
relativeExtent |
|
2819 |
"return the relative extent or nil" |
|
2820 |
||
2821 |
^ relativeExtent |
|
2822 |
! |
|
2823 |
||
2824 |
relativeExtent:aPoint |
|
2825 |
"set the relative extent" |
|
2826 |
||
3627
eefbbc5c3d04
when setting a relativeExtent, clear any relativeCorner
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
2827 |
aPoint notNil ifTrue:[relativeCorner := nil]. |
269 | 2828 |
relativeExtent := aPoint |
2829 |
! |
|
2830 |
||
2831 |
relativeOrigin |
|
2832 |
"return the relative origin or nil" |
|
2833 |
||
2834 |
^ relativeOrigin |
|
2835 |
! |
|
2836 |
||
2837 |
relativeOrigin:aPoint |
|
2838 |
"set the relative origin" |
|
2839 |
||
2840 |
relativeOrigin := aPoint |
|
2841 |
! |
|
2842 |
||
2843 |
right |
|
2844 |
"return the x position of the right edge (in pixels)" |
|
2845 |
||
2846 |
^ left + width - 1 |
|
2847 |
||
2848 |
"Modified: 31.8.1995 / 19:31:10 / claus" |
|
2849 |
! |
|
2850 |
||
2851 |
right:aNumber |
|
2852 |
"set the corners x position" |
|
2853 |
||
2854 |
self corner:(aNumber @ self corner y) |
|
2855 |
! |
|
2856 |
||
2857 |
rightInset |
|
2858 |
"return the inset of the right edge; positive is to the left, |
|
2859 |
negative to the right" |
|
2860 |
||
2861 |
insets isNil ifTrue:[^ 0]. |
|
2862 |
^ insets at:3 |
|
2863 |
! |
|
2864 |
||
2865 |
rightInset:aNumber |
|
2866 |
"set the inset of the right edge; |
|
2867 |
positive is to the left (view becomes smaller), |
|
2868 |
negative to the right (becomes larger)" |
|
2869 |
||
2870 |
insets isNil ifTrue:[ |
|
3152 | 2871 |
insets := Array with:0 with:0 with:0 with:0 |
269 | 2872 |
]. |
2873 |
insets at:3 put:aNumber. |
|
2874 |
||
2875 |
"force recomputation" |
|
2876 |
"/ drawableId isNil ifTrue:[ |
|
3375 | 2877 |
"/ self originChangedFlag:true |
269 | 2878 |
"/ ] ifFalse:[ |
3152 | 2879 |
self containerChangedSize. |
135 | 2880 |
"/ ] |
964 | 2881 |
|
2882 |
"Modified: 19.7.1996 / 17:30:32 / cg" |
|
269 | 2883 |
! |
2884 |
||
3007 | 2885 |
setOrigin:aPoint |
2886 |
"set the origin only" |
|
2887 |
||
2888 |
left := aPoint x. |
|
2889 |
top := aPoint y. |
|
2890 |
! |
|
2891 |
||
269 | 2892 |
sizeFixed:aBoolean |
2893 |
"set/clear the fix-size attribute, if supported by concrete subclasses. |
|
2894 |
Views which want to resize themselfes as appropriate to their contents |
|
2895 |
should cease to do so and take their current size if sizeFixed is set to |
|
2896 |
true. Currently, only supported by Labels. |
|
2897 |
This does NOT prevent the window manager from resizing the view, |
|
2898 |
instead it tell the view to NOT resize ITSELF. |
|
2899 |
Added here to provide a common protocol for all views." |
|
2900 |
||
2901 |
^ self |
|
2902 |
! |
|
2903 |
||
2904 |
top |
|
2905 |
"return the y position of the top border" |
|
2906 |
||
2907 |
^ top |
|
2908 |
! |
|
2909 |
||
2910 |
top:aNumber |
|
2911 |
"set the y position" |
|
2912 |
||
2913 |
self origin:(left @ aNumber) |
|
2914 |
! |
|
2915 |
||
2916 |
topInset |
|
2917 |
"return the inset of the top edge; positive is to the bottom, |
|
2918 |
negative to the top" |
|
2919 |
||
2920 |
insets isNil ifTrue:[^ 0]. |
|
2921 |
^ insets at:2 |
|
2922 |
! |
|
2923 |
||
2924 |
topInset:aNumber |
|
2925 |
"set the inset of the top edge; |
|
2926 |
positive is to the bottom (view becomes smaller), |
|
2927 |
negative to the top (becomes larger)" |
|
2928 |
||
2929 |
insets isNil ifTrue:[ |
|
3152 | 2930 |
insets := Array with:0 with:0 with:0 with:0 |
269 | 2931 |
]. |
2932 |
insets at:2 put:aNumber. |
|
2933 |
||
2934 |
"force recomputation" |
|
2935 |
"/ drawableId isNil ifTrue:[ |
|
3375 | 2936 |
"/ self originChangedFlag:true |
269 | 2937 |
"/ ] ifFalse:[ |
3152 | 2938 |
self containerChangedSize. |
269 | 2939 |
"/ ] |
964 | 2940 |
|
2941 |
"Modified: 19.7.1996 / 17:30:45 / cg" |
|
269 | 2942 |
! |
2943 |
||
2944 |
verticalInset:aNumber |
|
2945 |
"set the insets of the top/bottom edge; |
|
2946 |
positive makes it smaller, negative makes it larger" |
|
2947 |
||
2948 |
insets isNil ifTrue:[ |
|
3152 | 2949 |
insets := Array with:0 with:0 with:0 with:0 |
269 | 2950 |
]. |
2951 |
insets at:2 put:aNumber. |
|
2952 |
insets at:4 put:aNumber. |
|
2953 |
||
2954 |
"force recomputation" |
|
2955 |
"/ drawableId isNil ifTrue:[ |
|
3375 | 2956 |
"/ self originChangedFlag:true |
269 | 2957 |
"/ ] ifFalse:[ |
3152 | 2958 |
self containerChangedSize. |
269 | 2959 |
"/ ] |
964 | 2960 |
|
2961 |
"Modified: 19.7.1996 / 17:30:50 / cg" |
|
269 | 2962 |
! |
2963 |
||
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2964 |
viewRectangle |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2965 |
"return the inside area. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2966 |
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
|
2967 |
to base relative coordinates on. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2968 |
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
|
2969 |
margins required for 3D levels) is ok. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2970 |
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
|
2971 |
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
|
2972 |
(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
|
2973 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2974 |
|m2| |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2975 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2976 |
m2 := margin + margin. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2977 |
^ (margin @ margin) extent:((width - m2) @ (height - m2)) |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2978 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2979 |
"Modified: 8.2.1996 / 20:05:00 / cg" |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2980 |
! |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2981 |
|
269 | 2982 |
width:aNumber |
2983 |
"set the views width in pixels" |
|
2984 |
||
2985 |
self extent:(aNumber @ height) |
|
2986 |
! |
|
2987 |
||
2988 |
widthIncludingBorder |
|
2989 |
"return my width including border |
|
2990 |
(this is my width as seen from the outside view; |
|
2991 |
while #width returns the width as seen by myself)" |
|
2992 |
||
2993 |
^ width + (2*borderWidth) |
|
2994 |
! ! |
|
2995 |
||
3918
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
2996 |
!SimpleView methodsFor:'accessing-display attributes'! |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
2997 |
|
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
2998 |
setWindowClass:windowClassNameString name:nameString |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
2999 |
"define class and name of a window. |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3000 |
This may be used by the window manager to |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3001 |
select client specific resources." |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3002 |
|
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3003 |
device setWindowClass:windowClassNameString name:nameString in:drawableId. |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3004 |
! ! |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3005 |
|
269 | 3006 |
!SimpleView methodsFor:'accessing-hierarchy'! |
3007 |
||
756 | 3008 |
components |
3009 |
"return the collection of non-view components" |
|
3010 |
||
3011 |
^ components |
|
3012 |
||
3013 |
"Created: 28.5.1996 / 23:59:37 / cg" |
|
3014 |
! |
|
3015 |
||
1182 | 3016 |
container |
3017 |
"return my container" |
|
3018 |
||
3019 |
^ superView |
|
3020 |
||
3021 |
"Created: 5.6.1996 / 01:08:36 / cg" |
|
3022 |
"Modified: 10.1.1997 / 19:47:59 / cg" |
|
3023 |
! |
|
3024 |
||
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3025 |
container:aContainer |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3026 |
"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
|
3027 |
|
3558
5b0c805753aa
fixed container: (no error if same container is given)
martin
parents:
3556
diff
changeset
|
3028 |
superView == aContainer ifTrue:[ |
3762 | 3029 |
"/ no change |
3030 |
^ self. |
|
3558
5b0c805753aa
fixed container: (no error if same container is given)
martin
parents:
3556
diff
changeset
|
3031 |
]. |
5b0c805753aa
fixed container: (no error if same container is given)
martin
parents:
3556
diff
changeset
|
3032 |
|
3485 | 3033 |
(drawableId notNil) ifTrue:[ |
3762 | 3034 |
"/ actually, this is worth an exception |
3035 |
"/ ('View [error]: ' , self printString , ' already realized - cannot change container') errorPrintCR. |
|
3036 |
self error:'already realized - cannot change container' mayProceed:true. |
|
3485 | 3037 |
]. |
1296 | 3038 |
(superView notNil and:[superView ~~ aContainer]) ifTrue:[ |
3762 | 3039 |
"/ actually, this is worth an exception |
3040 |
('View [warning]: ' , self printString , ' already has a container') errorPrintCR. |
|
3041 |
superView removeComponent:self. |
|
1296 | 3042 |
]. |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3043 |
superView := aContainer |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3044 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3045 |
"Created: 9.5.1996 / 00:40:56 / cg" |
1297 | 3046 |
"Modified: 29.1.1997 / 17:37:38 / cg" |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3047 |
! |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3048 |
|
269 | 3049 |
lower |
3050 |
"bring to back" |
|
3051 |
||
3052 |
drawableId isNil ifTrue:[self create]. |
|
3053 |
device lowerWindow:drawableId |
|
3054 |
||
3055 |
" |
|
3056 |
Transcript topView lower |
|
3057 |
" |
|
3058 |
! |
|
3059 |
||
3060 |
raise |
|
3061 |
"bring to front" |
|
3062 |
||
3063 |
drawableId isNil ifTrue:[self create]. |
|
3064 |
device raiseWindow:drawableId |
|
3065 |
||
3066 |
" |
|
3067 |
Transcript topView raise |
|
3068 |
" |
|
3069 |
! |
|
3070 |
||
3625 | 3071 |
setContainer:aContainer |
3072 |
"set my container (i.e. superView) to be aContainer" |
|
3073 |
||
3074 |
superView := aContainer |
|
3075 |
! |
|
3076 |
||
269 | 3077 |
subViews |
3078 |
"return the collection of subviews" |
|
3079 |
||
3626
fa436ffc8ae7
subViews always returns a collection
Claus Gittinger <cg@exept.de>
parents:
3625
diff
changeset
|
3080 |
^ subViews ? #() |
269 | 3081 |
! |
3082 |
||
3083 |
subViews:aListOfViews |
|
3084 |
"set the collection of subviews" |
|
3085 |
||
3616 | 3086 |
self obsoleteMethodWarning. |
3087 |
||
269 | 3088 |
subViews := aListOfViews. |
135 | 3089 |
subViews notNil ifTrue:[ |
3762 | 3090 |
subViews do:[:view | |
3091 |
view container:self |
|
3092 |
] |
|
135 | 3093 |
] |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3094 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3095 |
"Modified: 9.5.1996 / 00:42:28 / cg" |
135 | 3096 |
! |
3097 |
||
269 | 3098 |
superView |
3099 |
"return my superView" |
|
3100 |
||
3101 |
^ superView |
|
3102 |
! |
|
3103 |
||
3104 |
superView:aView |
|
3105 |
"set my superView to be aView" |
|
3106 |
||
3434 | 3107 |
<resource:#obsolete> |
3108 |
||
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3109 |
self obsoleteMethodWarning:'use #container:'. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3110 |
self container:aView. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3111 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3112 |
"Modified: 9.5.1996 / 00:46:24 / cg" |
269 | 3113 |
! |
3114 |
||
662
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
3115 |
topComponent |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
3116 |
"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
|
3117 |
For ST-80 compatibility." |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
3118 |
|
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
3119 |
^ self topView |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
3120 |
|
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
3121 |
"Modified: 9.5.1996 / 01:40:24 / cg" |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
3122 |
! |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
3123 |
|
269 | 3124 |
topView |
3125 |
"return the topView - thats the one with no superview" |
|
3126 |
||
3425 | 3127 |
|v next n| |
3128 |
||
3129 |
n := 1. |
|
269 | 3130 |
v := self. |
3131 |
[v notNil] whileTrue:[ |
|
3918
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3132 |
(next := v container) isNil ifTrue:[^ v]. |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3133 |
v := next. |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3134 |
n := n + 1. |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3135 |
n > 1000 ifTrue:[self error:'circular superView chain']. |
135 | 3136 |
]. |
3137 |
||
269 | 3138 |
^ nil |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3139 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3140 |
"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
|
3141 |
! |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3142 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3143 |
view |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3144 |
"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
|
3145 |
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
|
3146 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3147 |
^ self |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3148 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3149 |
"Created: 4.6.1996 / 21:32:11 / cg" |
269 | 3150 |
! ! |
3151 |
||
3152 |
!SimpleView methodsFor:'accessing-menus'! |
|
3153 |
||
3154 |
menuHolder |
|
3155 |
"who has the menu ? |
|
3156 |
By default, I have it." |
|
3157 |
||
3158 |
^ self |
|
3159 |
! |
|
3160 |
||
3161 |
menuMessage |
|
3162 |
"Return the symbol sent to myself to aquire the menu" |
|
3163 |
||
3164 |
^ #middleButtonMenu |
|
3165 |
! |
|
3166 |
||
3167 |
menuPerformer |
|
3168 |
"who should perform the menu actions ? |
|
3169 |
By default, I do it." |
|
3170 |
||
3171 |
^ self |
|
3172 |
! |
|
3173 |
||
3174 |
yellowButtonMenu |
|
3175 |
"actually, this should be called 'middleButtonMenu'. |
|
3176 |
But for ST-80 compatibility .... |
|
3177 |
This method will vanish, once all views have controllers |
|
3178 |
associated with them; for now, duplicate some code also found in |
|
3179 |
controller." |
|
3180 |
||
3821 | 3181 |
|sym menuHolder| |
269 | 3182 |
|
3183 |
"/ middleButtonMenu notNil ifTrue:[ |
|
3184 |
"/ "/ |
|
3185 |
"/ "/ has been assigned a static middleButtonMenu |
|
3186 |
"/ "/ (or a cached menu) |
|
3187 |
"/ "/ |
|
3188 |
"/ ^ middleButtonMenu |
|
3189 |
"/ ]. |
|
3190 |
||
3191 |
menuHolder := self menuHolder. |
|
3821 | 3192 |
menuHolder isNil ifTrue:[^ nil]. |
3193 |
||
3194 |
(menuHolder isKindOf:Menu) ifTrue:[^ menuHolder]. |
|
3195 |
||
3196 |
sym := self menuMessage. |
|
3197 |
sym isNil ifTrue:[^ nil]. |
|
3198 |
||
3199 |
" |
|
3200 |
mhmh - for backward compatibility, try to ask |
|
3201 |
the model first, then use the views menu. |
|
3202 |
" |
|
3203 |
(menuHolder respondsTo:sym) ifFalse:[ |
|
3204 |
(self respondsTo:sym) ifTrue:[ |
|
3205 |
menuHolder := self |
|
3206 |
] |
|
3207 |
]. |
|
3894 | 3208 |
|
3209 |
sym numArgs == 1 ifTrue:[ |
|
3210 |
"/ squeak compatibility: create the menu here, let model add items |
|
3211 |
^ menuHolder perform:sym with:(Menu new). |
|
3212 |
]. |
|
3213 |
sym numArgs == 2 ifTrue:[ |
|
3214 |
"/ squeak compatibility: create the menu here, let model add items |
|
3215 |
^ menuHolder perform:sym with:(Menu new) with:(device shiftDown). |
|
3216 |
]. |
|
3217 |
||
3821 | 3218 |
" |
3219 |
ask the menuHolder for the menu |
|
3220 |
" |
|
3221 |
^ menuHolder perform:sym. |
|
135 | 3222 |
! ! |
3223 |
||
3224 |
!SimpleView methodsFor:'accessing-misc'! |
|
3225 |
||
3226 |
bitGravity |
|
3227 |
"return the bitGravity - thats the direction where the contents will move |
|
3228 |
when the the view is resized." |
|
3229 |
||
3230 |
^ bitGravity |
|
3231 |
! |
|
3232 |
||
3233 |
bitGravity:gravity |
|
3234 |
"set the bitGravity - thats the direction where the contents will move |
|
3235 |
when the view is resized." |
|
3236 |
||
3237 |
bitGravity ~~ gravity ifTrue:[ |
|
3152 | 3238 |
bitGravity := gravity. |
3239 |
drawableId notNil ifTrue:[ |
|
3240 |
device setBitGravity:gravity in:drawableId |
|
3241 |
] |
|
135 | 3242 |
] |
3243 |
! |
|
3244 |
||
737 | 3245 |
clippingRectangle:aRectangle |
153 | 3246 |
"set the clipping rectangle for drawing (in logical coordinates); |
754 | 3247 |
a nil argument turns off clipping (i.e. whole view is drawable). |
153 | 3248 |
Redefined to care for any margin." |
3249 |
||
3250 |
|x y w h| |
|
3251 |
||
3252 |
aRectangle isNil ifTrue:[ |
|
3152 | 3253 |
clipRect isNil ifTrue:[^ self]. |
3254 |
gcId notNil ifTrue:[ |
|
3255 |
device noClipIn:drawableId gc:gcId |
|
3256 |
] |
|
153 | 3257 |
] ifFalse:[ |
3152 | 3258 |
clipRect notNil ifTrue:[ |
3259 |
(clipRect = aRectangle) ifTrue:[^ self] |
|
3260 |
]. |
|
3261 |
gcId notNil ifTrue:[ |
|
3262 |
x := aRectangle left. |
|
3263 |
y := aRectangle top. |
|
3264 |
w := aRectangle width. |
|
3265 |
h := aRectangle height. |
|
3266 |
transformation notNil ifTrue:[ |
|
3267 |
x := transformation applyToX:x. |
|
3268 |
y := transformation applyToY:y. |
|
3269 |
w := transformation applyScaleX:w. |
|
3270 |
h := transformation applyScaleY:h. |
|
3271 |
]. |
|
3272 |
(x isMemberOf:SmallInteger) ifFalse:[ |
|
3273 |
w := w + (x - x truncated). |
|
3274 |
x := x truncated |
|
3275 |
]. |
|
3276 |
(y isMemberOf:SmallInteger) ifFalse:[ |
|
3277 |
h := h + (y - y truncated). |
|
3278 |
y := y truncated |
|
3279 |
]. |
|
3280 |
(w isMemberOf:SmallInteger) ifFalse:[ |
|
3281 |
w := w truncated + 1 |
|
3282 |
]. |
|
3283 |
(h isMemberOf:SmallInteger) ifFalse:[ |
|
3284 |
h := h truncated + 1 |
|
3285 |
]. |
|
3286 |
x < margin ifTrue:[ |
|
3287 |
x := margin. |
|
3288 |
]. |
|
3289 |
y < margin ifTrue:[ |
|
3290 |
y := margin. |
|
3291 |
]. |
|
3292 |
x + w - 1 >= (width-margin) ifTrue:[ |
|
3293 |
w := width - margin - x |
|
3294 |
]. |
|
3295 |
y + h - 1 >= (height-margin) ifTrue:[ |
|
3296 |
h := height - margin - y |
|
3297 |
]. |
|
3298 |
device setClipX:x y:y width:w height:h in:drawableId gc:gcId |
|
3299 |
] |
|
153 | 3300 |
]. |
3301 |
clipRect := aRectangle |
|
737 | 3302 |
|
3303 |
"Created: 28.5.1996 / 19:50:03 / cg" |
|
754 | 3304 |
"Modified: 28.5.1996 / 22:32:15 / cg" |
153 | 3305 |
! |
3306 |
||
3307 |
fullName |
|
3308 |
"return my full name to be used for resource-access" |
|
3309 |
||
3310 |
superView notNil ifTrue:[ |
|
3152 | 3311 |
^ superView fullName , '.' , name |
153 | 3312 |
]. |
3313 |
^ name |
|
3314 |
! |
|
3315 |
||
269 | 3316 |
name |
3317 |
"return my name component to be used for resource-access" |
|
3318 |
||
3319 |
^ name |
|
3320 |
! |
|
3321 |
||
3322 |
name:aString |
|
3323 |
"set my name component to be used for resource-access" |
|
3324 |
||
3325 |
name := aString |
|
3326 |
! |
|
3327 |
||
153 | 3328 |
processName |
3329 |
"return a string to be shown in the process monitor" |
|
3330 |
||
3331 |
^ self name |
|
269 | 3332 |
! |
3333 |
||
3334 |
styleSheet |
|
3335 |
"return the styleSheet. This is set at early view-creation time, |
|
3336 |
from the defaultStyleSheet which is valid at that time. |
|
3337 |
It is not affected by later defaultStyle changes" |
|
3338 |
||
3339 |
^ styleSheet |
|
3340 |
||
3341 |
"Created: 10.9.1995 / 11:02:20 / claus" |
|
3342 |
! |
|
3343 |
||
3384 | 3344 |
styleSheet:aStyleSheet |
3345 |
"change the styleSheet. Knowledgable users only, please." |
|
3346 |
||
3347 |
styleSheet := aStyleSheet. |
|
3348 |
! |
|
3349 |
||
269 | 3350 |
viewGravity |
3351 |
"return the viewGravity - thats the direction where the view will move |
|
3352 |
when the superView is resized." |
|
3353 |
||
3354 |
^ viewGravity |
|
3355 |
! |
|
3356 |
||
3357 |
viewGravity:gravity |
|
3358 |
"set the viewGravity - thats the direction where the view will move |
|
3359 |
when the superView is resized." |
|
3360 |
||
3361 |
viewGravity ~~ gravity ifTrue:[ |
|
3152 | 3362 |
viewGravity := gravity. |
3363 |
drawableId notNil ifTrue:[ |
|
3364 |
device setWindowGravity:gravity in:drawableId |
|
3365 |
] |
|
269 | 3366 |
] |
140 | 3367 |
! ! |
3368 |
||
3369 |
!SimpleView methodsFor:'accessing-mvc'! |
|
3370 |
||
1187
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
3371 |
application |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
3372 |
"return the application, under which this view was opened, |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
3373 |
or nil, if there is no application" |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
3374 |
|
1751 | 3375 |
superView notNil ifTrue:[ |
3152 | 3376 |
^ superView application |
1187
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
3377 |
]. |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
3378 |
^ nil |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
3379 |
|
1190 | 3380 |
"Modified: 13.1.1997 / 20:30:31 / cg" |
1187
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
3381 |
! |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
3382 |
|
269 | 3383 |
aspect:aspectSymbol |
3384 |
"ST-80 style updating: If a views aspectSymbol is nonNil, |
|
3385 |
it will respond to changes of this aspect from the model. |
|
3386 |
Alias for aspectMessage: for ST-80 compatibility." |
|
3387 |
||
3388 |
self aspectMessage:aspectSymbol |
|
3389 |
! |
|
3390 |
||
2919
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3391 |
client:anApplicationModel |
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3392 |
"release existing components and generate new components from |
3251 | 3393 |
the applications windowSpec. |
3394 |
ATTENTION: this is a low level interface; postBuild is NOT invoked" |
|
2919
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3395 |
|
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3396 |
^ self client:anApplicationModel spec:#windowSpec |
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3397 |
|
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3398 |
|
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3399 |
! |
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3400 |
|
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3401 |
client:anApplication spec:aWindowSpecOrSelector |
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3402 |
"release existing components and generate new components from |
3251 | 3403 |
the applications windowSpec. |
3404 |
ATTENTION: this is a low level interface; postBuild is NOT invoked" |
|
2919
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3405 |
|
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3406 |
^ self client:anApplication spec:aWindowSpecOrSelector builder:nil |
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3407 |
|
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3408 |
! |
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3409 |
|
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3410 |
client:anApplication spec:aWindowSpecOrSpecSymbol builder:aBuilder |
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3411 |
"release existing components and generate new components from |
3251 | 3412 |
the given windowSpec, using the given builder. |
3837 | 3413 |
ATTENTION: this is a low level interface; postBuild is NOT invoked. |
3414 |
TODO: this code is so ugly and badly designed - it must be redesigned |
|
3415 |
or at least well documented." |
|
3416 |
||
3918
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3417 |
|builder subSpec isApplicationModel thisApp savedView masterApp| |
2919
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3418 |
|
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3419 |
aWindowSpecOrSpecSymbol isNil ifTrue:[^ self]. |
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3420 |
|
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3421 |
(builder := aBuilder) isNil ifTrue:[ |
3837 | 3422 |
"/ problem: anApplication could have no builder |
3423 |
"/ or anApplication could be a non-appModel (theoretically - only providing a spec) |
|
3918
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3424 |
isApplicationModel := true. |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3425 |
builder := anApplication perform:#builder ifNotUnderstood:[isApplicationModel := false. nil]. |
3837 | 3426 |
builder isNil ifTrue:[ |
3918
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3427 |
isApplicationModel ifTrue:[ |
3837 | 3428 |
anApplication createBuilder. |
3429 |
builder := anApplication builder |
|
3918
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3430 |
] ifFalse:[ |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3431 |
builder := UIBuilder new. |
3837 | 3432 |
] |
3433 |
] |
|
2919
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3434 |
]. |
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3435 |
|
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3436 |
(subSpec := aWindowSpecOrSpecSymbol) isSymbol ifTrue:[ |
3837 | 3437 |
anApplication isNil ifTrue:[^ self]. |
3438 |
subSpec := anApplication class interfaceSpecFor:aWindowSpecOrSpecSymbol. |
|
3439 |
subSpec isNil ifTrue:[ |
|
3440 |
^ self |
|
3441 |
]. |
|
3382 | 3442 |
]. |
3443 |
||
3444 |
"/ if the appl is not the master, but the masters builder is used, |
|
3837 | 3445 |
"/ we have to temporarily change the builders window |
3395
d10fb1559329
check for #masterApplication being understood
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
3446 |
|
3918
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3447 |
masterApp := anApplication perform:#masterApplication ifNotUnderstood:[isApplicationModel := false. nil]. |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3448 |
thisApp := builder application. |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3449 |
(isApplicationModel and:[anApplication ~~ thisApp]) ifTrue:[ |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3450 |
masterApp ~~ thisApp ifTrue:[self error:'should not happen']. |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3451 |
|
3837 | 3452 |
builder application:anApplication. |
3453 |
savedView := builder window. |
|
3454 |
builder window:self. |
|
3455 |
[ |
|
3456 |
anApplication buildSubCanvas:subSpec withBuilder:builder. |
|
3457 |
] ensure:[ |
|
3458 |
builder window:savedView. |
|
3918
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3459 |
builder application:thisApp. |
3837 | 3460 |
]. |
3461 |
||
3382 | 3462 |
] ifFalse:[ |
3838 | 3463 |
builder window isNil ifTrue:[ |
3464 |
builder window:self |
|
3837 | 3465 |
]. |
3838 | 3466 |
builder buildFromSpec:subSpec in:self. |
3382 | 3467 |
]. |
3251 | 3468 |
|
3469 |
"/ postBuildWith: will be called twice if code below is enabled |
|
3470 |
"/ notAnAppModel isNil ifTrue:[ |
|
3471 |
"/ notAnAppModel := (anApplication isKindOf:ApplicationModel) not |
|
3472 |
"/ ]. |
|
3473 |
"/ notAnAppModel ifTrue:[ |
|
3474 |
"/ builder buildFromSpec:subSpec in:self. |
|
3475 |
"/ ] ifFalse:[ |
|
3476 |
"/ savedView := builder window. |
|
3477 |
"/ builder window:self. |
|
3478 |
"/ [ |
|
3479 |
"/ anApplication buildSubCanvas:subSpec withBuilder:builder. |
|
3604
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3601
diff
changeset
|
3480 |
"/ ] ensure:[ |
3251 | 3481 |
"/ savedView notNil ifTrue:[ |
3482 |
"/ builder window:savedView. |
|
3483 |
"/ ] |
|
3484 |
"/ ]. |
|
3485 |
"/ ]. |
|
2919
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3486 |
! |
a6219b65a111
Moved #client: and #client:spec from SubCanvas
Stefan Vogel <sv@exept.de>
parents:
2917
diff
changeset
|
3487 |
|
140 | 3488 |
controller |
1943 | 3489 |
"return the controller. For views which implement the controller |
3490 |
functionality themself, return the receiver itself" |
|
3491 |
||
3492 |
^ controller ? self |
|
3493 |
||
3494 |
"Modified: / 31.10.1997 / 19:58:10 / cg" |
|
140 | 3495 |
! |
3496 |
||
3497 |
controller:aController |
|
1943 | 3498 |
"set the controller - thats the one handling user events" |
140 | 3499 |
|
3500 |
controller := aController. |
|
3501 |
controller notNil ifTrue:[ |
|
3152 | 3502 |
controller view:self. |
135 | 3503 |
] |
1943 | 3504 |
|
3505 |
"Modified: / 31.10.1997 / 19:58:33 / cg" |
|
135 | 3506 |
! |
3507 |
||
140 | 3508 |
model |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3509 |
"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
|
3510 |
|
135 | 3511 |
^ nil |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3512 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3513 |
"Modified: 5.6.1996 / 14:17:29 / cg" |
135 | 3514 |
! |
3515 |
||
1182 | 3516 |
sensor |
3517 |
"return the views sensor" |
|
3518 |
||
3519 |
windowGroup notNil ifTrue:[ |
|
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
3520 |
^ windowGroup sensor. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
3521 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
3522 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
3523 |
"there is now window group. Deliver events synchronously" |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
3524 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
3525 |
^ SynchronousWindowSensor new. |
1182 | 3526 |
|
3527 |
"Modified: 10.1.1997 / 19:47:13 / cg" |
|
3528 |
! |
|
3529 |
||
954 | 3530 |
setController:aController |
3531 |
"set the controller but do not affect the model/view releationship" |
|
3532 |
||
3533 |
controller := aController. |
|
3534 |
||
3535 |
"Created: 18.7.1996 / 11:43:40 / cg" |
|
3536 |
! |
|
3537 |
||
1874
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3538 |
setWindowGroup:aGroup |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3539 |
"set the window group." |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3540 |
|
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3541 |
windowGroup := aGroup |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3542 |
|
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3543 |
"Created: 19.8.1997 / 17:58:35 / cg" |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3544 |
! |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3545 |
|
269 | 3546 |
windowGroup |
3547 |
"return the window group. For old style views, return nil" |
|
3548 |
||
3549 |
^ windowGroup |
|
3550 |
! |
|
3551 |
||
1874
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3552 |
windowGroup:newGroup |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3553 |
"set the window group of myself and recursively of any children. |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3554 |
If I am currently in a group, remove me from it it." |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3555 |
|
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3556 |
windowGroup notNil ifTrue:[ |
3152 | 3557 |
windowGroup removeView:self. |
3558 |
windowGroup := nil |
|
1874
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3559 |
]. |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3560 |
windowGroup := newGroup. |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3561 |
newGroup notNil ifTrue:[ |
3152 | 3562 |
newGroup addView:self. |
1877 | 3563 |
|
3564 |
]. |
|
1874
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3565 |
subViews notNil ifTrue:[ |
3152 | 3566 |
subViews do:[:aSubview | |
3567 |
aSubview windowGroup:newGroup |
|
3568 |
] |
|
1874
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3569 |
]. |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3570 |
|
1877 | 3571 |
"Modified: 20.8.1997 / 13:26:37 / cg" |
269 | 3572 |
! ! |
3573 |
||
3574 |
!SimpleView methodsFor:'accessing-transformation'! |
|
3575 |
||
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3576 |
maxComponentBottom |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3577 |
"return the maximum of all components bottom" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3578 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3579 |
components isNil ifTrue:[^ 0]. |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3580 |
^ components inject:0 into:[:maxSoFar :sub |
3152 | 3581 |
| (sub bottom) max:maxSoFar]. |
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3582 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3583 |
"Created: 26.5.1996 / 12:44:05 / cg" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3584 |
"Modified: 26.5.1996 / 12:56:39 / cg" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3585 |
! |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3586 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3587 |
maxComponentRight |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3588 |
"return the maximum of all components rights" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3589 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3590 |
components isNil ifTrue:[^ 0]. |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3591 |
^ components inject:0 into:[:maxSoFar :sub |
3152 | 3592 |
| (sub right) max:maxSoFar]. |
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3593 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3594 |
"Modified: 26.5.1996 / 12:56:39 / cg" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3595 |
"Created: 26.5.1996 / 13:02:19 / cg" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3596 |
! |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3597 |
|
269 | 3598 |
maxSubViewBottom |
3599 |
"/ subViews isNil ifTrue:[^ 0]. |
|
3600 |
"/ ^ subViews inject:0 into:[:maxSoFar :sub | (sub top + sub height) max:maxSoFar]. |
|
3601 |
^ 0 |
|
3602 |
! |
|
3603 |
||
3604 |
maxSubViewRight |
|
3605 |
"/ subViews isNil ifTrue:[^ 0]. |
|
3606 |
"/ ^ subViews inject:0 into:[:maxSoFar :sub | (sub left + sub width) max:maxSoFar]. |
|
3607 |
^ 0 |
|
3608 |
! |
|
3609 |
||
3610 |
scale:aPoint |
|
3611 |
"set the scale factor of the transformation" |
|
3612 |
||
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
3613 |
super scale:aPoint. |
269 | 3614 |
self computeInnerClip |
3615 |
! |
|
3616 |
||
3617 |
setViewOrigin:aPoint |
|
3618 |
"set the viewOrigin - i.e. virtually scroll without redrawing" |
|
3619 |
||
3620 |
|p| |
|
3621 |
||
3622 |
p := aPoint negated. |
|
3623 |
transformation isNil ifTrue:[ |
|
3152 | 3624 |
transformation := WindowingTransformation scale:1 translation:p |
269 | 3625 |
] ifFalse:[ |
3152 | 3626 |
transformation translation:p |
269 | 3627 |
]. |
3628 |
clipRect notNil ifTrue:[ |
|
3152 | 3629 |
self setInnerClip. |
269 | 3630 |
]. |
3631 |
! |
|
3632 |
||
3633 |
viewOrigin |
|
3634 |
"return the viewOrigin; thats the coordinate of the contents |
|
3635 |
which is shown topLeft in the view |
|
3636 |
(i.e. the origin of the visible part of the contents)." |
|
3637 |
||
3638 |
transformation isNil ifTrue:[ |
|
3152 | 3639 |
^ 0@0 |
269 | 3640 |
]. |
3641 |
^ transformation translation negated |
|
3642 |
! |
|
3643 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3644 |
visibleArea |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3645 |
"return the rectangle that contains the visible part |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3646 |
of the view in user coordinates." |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3647 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3648 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3649 |
transformation isNil ifTrue:[ |
3152 | 3650 |
^ Rectangle left:0 top:0 width:width height:height. |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3651 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3652 |
^ Rectangle origin:(transformation translation negated) |
3152 | 3653 |
extent:((width @ height) scaledBy:(transformation scale)). |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3654 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3655 |
"Created: 12.7.1996 / 11:57:04 / stefan" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3656 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3657 |
|
269 | 3658 |
xOriginOfContents |
3659 |
"return the x coordinate of the viewOrigin in pixels; |
|
3660 |
used by scrollBars to compute thumb position within the document." |
|
3661 |
||
3662 |
^ self viewOrigin x |
|
3663 |
! |
|
3664 |
||
3665 |
yOriginOfContents |
|
3666 |
"return the y coordinate of the viewOrigin in pixels; |
|
3667 |
used by scrollBars to compute thumb position within the document." |
|
3668 |
||
3669 |
^ self viewOrigin y |
|
3670 |
! ! |
|
3671 |
||
370 | 3672 |
!SimpleView methodsFor:'accessing-visibility'! |
3673 |
||
3674 |
beInvisible |
|
1524 | 3675 |
"make the view invisible; if my container is visible, |
3676 |
change visibility immediately; |
|
3677 |
otherwise, arrange for the receiver to be not realized, |
|
3678 |
when the container is made visible." |
|
3679 |
||
370 | 3680 |
self hiddenOnRealize:true. |
3681 |
realized ifTrue:[ |
|
3367 | 3682 |
(superView isNil "/ I am a topView |
3683 |
or:[superView realized "/ superview already shown |
|
3684 |
or:[superView id notNil]]) "/ superview already created |
|
3685 |
ifTrue:[ |
|
3686 |
self unmap |
|
3687 |
] |
|
370 | 3688 |
] |
3689 |
||
1524 | 3690 |
"Modified: 3.4.1997 / 21:20:40 / cg" |
370 | 3691 |
! |
3692 |
||
3693 |
beVisible |
|
1524 | 3694 |
"make the view visible; if my container is already visible, |
3695 |
change visibility immediately; otherwise, arrange for the receiver |
|
3696 |
to be made visible when the container is made visible. |
|
3697 |
Notice, that the command may not be sent immediately to the display, |
|
3698 |
and that ST/X considers the view to be still invisible until a |
|
1754 | 3699 |
visibility event arrives from the display. |
3700 |
Thus, the view may remain logically invisible |
|
1524 | 3701 |
for a while. (see #beVisibleNow for more on this)" |
3702 |
||
370 | 3703 |
self hiddenOnRealize:false. |
3704 |
realized ifFalse:[ |
|
3762 | 3705 |
superView isNil ifTrue:[ "/ I am a topView |
3706 |
drawableId isNil ifTrue:[ |
|
3707 |
"this once was: |
|
3708 |
self realize. |
|
3709 |
but we don't want Topviews to realize implicitly. |
|
3710 |
BTW. the code doesn't work anyway" |
|
3711 |
] ifFalse:[ |
|
3712 |
self remap. |
|
3713 |
]. |
|
3714 |
] ifFalse:[ |
|
3715 |
(superView realized "/ superview already shown |
|
3716 |
or:[superView id notNil]) "/ superview already created |
|
3717 |
ifTrue:[ |
|
3718 |
self realize |
|
3719 |
] |
|
3720 |
]. |
|
370 | 3721 |
] |
3722 |
||
3723 |
" |
|
3724 |
|top topFrame check list| |
|
3725 |
||
3726 |
top := StandardSystemView new. |
|
3727 |
top extent:150@400. |
|
3728 |
topFrame := VerticalPanelView origin:0.0@0.0 corner:1.0@0.4 in:top. |
|
3729 |
topFrame horizontalLayout:#leftSpace. |
|
3730 |
||
3731 |
topFrame add:(check := CheckBox label:'hidden'). |
|
3732 |
check pressAction:[list beInvisible]. |
|
3733 |
check releaseAction:[list beVisible]. |
|
3734 |
||
3735 |
list := ScrollableView for:SelectionInListView. |
|
3736 |
list origin:0.0@0.4 corner:1.0@1.0. |
|
3737 |
list list:#('foo' 'bar' 'baz'). |
|
3738 |
top add:list. |
|
3739 |
||
3740 |
check turnOn. |
|
3741 |
list beInvisible. |
|
3742 |
||
3743 |
top open |
|
3744 |
" |
|
3745 |
||
1981
0c3b8ef42df8
Take care of views with nil visibleID in #beVisible
Stefan Vogel <sv@exept.de>
parents:
1960
diff
changeset
|
3746 |
"Created: / 22.9.1995 / 15:50:33 / claus" |
0c3b8ef42df8
Take care of views with nil visibleID in #beVisible
Stefan Vogel <sv@exept.de>
parents:
1960
diff
changeset
|
3747 |
"Modified: / 17.6.1997 / 11:23:00 / cg" |
0c3b8ef42df8
Take care of views with nil visibleID in #beVisible
Stefan Vogel <sv@exept.de>
parents:
1960
diff
changeset
|
3748 |
"Modified: / 14.1.1998 / 17:33:15 / stefan" |
1524 | 3749 |
! |
3750 |
||
3751 |
beVisibleNow |
|
3752 |
"make the view visible immediately. |
|
3753 |
In contrast to #beVisible, this waits until the view is really |
|
3754 |
visible." |
|
3755 |
||
3756 |
self beVisible. |
|
3648 | 3757 |
device sync. "thats a round-trip; when returning, the view is definitely visible" |
3758 |
||
2721 | 3759 |
"/ realized := true. |
3760 |
"/ shown := true. |
|
1524 | 3761 |
|
3762 |
"Created: 3.4.1997 / 21:23:28 / cg" |
|
370 | 3763 |
! |
3764 |
||
3765 |
hidden |
|
3766 |
"return true, if the view does not want to be realized |
|
3767 |
automatically when superview is realized" |
|
3768 |
||
3434 | 3769 |
<resource:#obsolete> |
3770 |
||
370 | 3771 |
self obsoleteMethodWarning:'use #isHiddenOnRealize'. |
3772 |
^ hiddenOnRealize |
|
3773 |
||
1754 | 3774 |
"Modified: 17.6.1997 / 11:19:55 / cg" |
370 | 3775 |
! |
3776 |
||
3777 |
hidden:aBoolean |
|
3778 |
"if the argument is true, the receiver view will not |
|
3779 |
be realized automatically when superview is realized" |
|
3780 |
||
3434 | 3781 |
<resource:#obsolete> |
3782 |
||
370 | 3783 |
self obsoleteMethodWarning:'use #beVisible / #beInvisible'. |
3784 |
hiddenOnRealize := aBoolean |
|
3785 |
||
3786 |
"Modified: 17.1.1996 / 11:45:06 / cg" |
|
3787 |
! |
|
3788 |
||
3789 |
hiddenOnRealize:aBoolean |
|
3790 |
"if the argument is true, the receiver view will not |
|
1754 | 3791 |
be mapped (i.e. shown) automatically when the superview is realized. |
370 | 3792 |
The hiddenOnRealize flag is useful to create views which are |
1524 | 3793 |
to be made visible conditionally or later. |
3794 |
For ST-80 compatibility, please use #beVisible / #beInvisible." |
|
370 | 3795 |
|
3796 |
hiddenOnRealize := aBoolean |
|
1524 | 3797 |
|
1754 | 3798 |
"Modified: 17.6.1997 / 11:23:26 / cg" |
3799 |
! |
|
3800 |
||
3801 |
isHiddenOnRealize |
|
370 | 3802 |
"return true, if the receiver will NOT be mapped when |
3803 |
realized. False otherwise. |
|
3804 |
The hiddenOnRealize flag is useful to create views which are |
|
3805 |
to be made visible conditionally or later." |
|
3806 |
||
3807 |
^ hiddenOnRealize |
|
1754 | 3808 |
|
3809 |
"Created: 17.6.1997 / 11:21:42 / cg" |
|
370 | 3810 |
! |
3811 |
||
3516 | 3812 |
isVisible |
3813 |
"return true, if the view is visible" |
|
3814 |
||
3815 |
^ self realized |
|
3816 |
! |
|
3817 |
||
1938
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3818 |
isVisible:aBoolean |
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3819 |
"make the view visible or invisible" |
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3820 |
|
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3821 |
aBoolean ifTrue:[ |
3152 | 3822 |
self beVisible |
1938
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3823 |
] ifFalse:[ |
3152 | 3824 |
self beInvisible |
1938
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3825 |
] |
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3826 |
|
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3827 |
"Created: / 27.10.1997 / 04:23:04 / cg" |
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3828 |
! |
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
3829 |
|
3139 | 3830 |
setVisibilityChannel:aValueHolder |
3831 |
"set the valueHolder, which holds the visible boolean value" |
|
3832 |
||
3367 | 3833 |
visibilityChannel := aValueHolder |
3139 | 3834 |
! |
3835 |
||
370 | 3836 |
shown |
3837 |
"return true if the view is shown; false if not. |
|
3838 |
Shown means: the view is mapped and is not completely covered." |
|
3839 |
||
3840 |
^ shown |
|
3366 | 3841 |
! |
3842 |
||
3367 | 3843 |
visibilityChannel |
3844 |
"return a valueHolder for visible/invisible" |
|
3845 |
||
3846 |
^ visibilityChannel |
|
3847 |
||
3848 |
"Modified: / 30.3.1999 / 13:49:56 / stefan" |
|
3366 | 3849 |
! |
3850 |
||
3851 |
visibilityChannel:aValueHolder |
|
3367 | 3852 |
"set the valueHolder, which holds the visible boolean value" |
3853 |
||
3366 | 3854 |
|
3855 |
|prev| |
|
3856 |
||
3367 | 3857 |
prev := visibilityChannel. |
3858 |
visibilityChannel := aValueHolder. |
|
3366 | 3859 |
self setupChannel:aValueHolder for:#visibilityStateChanged withOld:prev |
3860 |
||
3367 | 3861 |
" |
3862 |
|v h| |
|
3863 |
||
3864 |
v := View new. |
|
3865 |
v visibilityChannel:(h := ValueHolder with:true). |
|
3866 |
v open. |
|
3867 |
Delay waitForSeconds:2. |
|
3868 |
h value:false. |
|
3869 |
Delay waitForSeconds:2. |
|
3870 |
h value:true. |
|
3871 |
Delay waitForSeconds:2. |
|
3872 |
" |
|
3873 |
||
3874 |
"Created: / 14.1.1998 / 17:11:15 / stefan" |
|
3875 |
"Modified: / 14.1.1998 / 17:33:40 / stefan" |
|
370 | 3876 |
! ! |
3877 |
||
269 | 3878 |
!SimpleView methodsFor:'adding & removing components'! |
3879 |
||
3880 |
add:aComponent |
|
3881 |
"add a component (either a view or gadget) to the collection of |
|
3882 |
subComponents." |
|
3883 |
||
3884 |
self addComponent:aComponent |
|
3885 |
! |
|
3886 |
||
1335 | 3887 |
add:aComponent at:anOrigin |
3888 |
"for ST-80 compatibility. |
|
3889 |
add a component at some origin" |
|
3890 |
||
3891 |
|l comp| |
|
3892 |
||
1614 | 3893 |
comp := aComponent. |
3894 |
||
3895 |
"/ (comp isWrapper not |
|
3896 |
"/ or:[comp isLayoutWrapper not]) ifTrue:[ |
|
3897 |
"/ comp := LayoutWrapper on:comp |
|
3898 |
"/ ]. |
|
1335 | 3899 |
|
3900 |
l := anOrigin asLayout. |
|
3901 |
comp layout:l. |
|
3902 |
||
3903 |
self addComponent:comp |
|
3904 |
||
1614 | 3905 |
"Modified: 18.4.1997 / 20:00:20 / cg" |
1335 | 3906 |
! |
3907 |
||
1617
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3908 |
add:aComponentOrCollection in:aRectangleOrLayoutFrame |
269 | 3909 |
"for ST-80 compatibility. |
3910 |
add a component in some frame; the argument may be either a rectangle |
|
3911 |
with relative coordinates, or an instance of LayoutFrame, specifying |
|
3912 |
both relative coordinates and the insets." |
|
3913 |
||
1617
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3914 |
|l wrapper| |
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3915 |
|
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3916 |
aComponentOrCollection isCollection ifTrue:[ |
3152 | 3917 |
wrapper := View new. |
3918 |
aComponentOrCollection do:[:aComponent | |
|
3919 |
wrapper add:aComponent |
|
3920 |
] |
|
1617
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3921 |
] ifFalse:[ |
3152 | 3922 |
wrapper := aComponentOrCollection |
1617
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3923 |
]. |
269 | 3924 |
|
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
3925 |
l := aRectangleOrLayoutFrame asLayout. |
269 | 3926 |
|
3927 |
"/ will soon be replaced by: |
|
3928 |
"/ aComponent layout:l. |
|
1617
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3929 |
wrapper geometryLayout:l. |
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3930 |
|
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3931 |
self addComponent:wrapper. |
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3932 |
|
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3933 |
^ wrapper |
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
3934 |
|
1756 | 3935 |
"Modified: 17.6.1997 / 18:03:34 / cg" |
269 | 3936 |
! |
3937 |
||
3938 |
addComponent:aComponent |
|
3939 |
"components (i.e. gadgets or lightweight views) are being prepared. |
|
3940 |
Dont use this right now for non-views" |
|
3941 |
||
3942 |
aComponent isView ifTrue:[ |
|
3152 | 3943 |
self addSubView:aComponent |
269 | 3944 |
] ifFalse:[ |
3152 | 3945 |
components isNil ifTrue:[ |
3946 |
components := OrderedCollection new |
|
3947 |
]. |
|
3948 |
components add:aComponent. |
|
3949 |
aComponent container:self. |
|
3950 |
shown ifTrue:[ |
|
3951 |
aComponent displayOn:self |
|
3952 |
] |
|
269 | 3953 |
] |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3954 |
|
683
ecc5d13f22b2
redraw new components if already visible
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
3955 |
"Modified: 13.5.1996 / 21:19:51 / cg" |
269 | 3956 |
! |
3957 |
||
3958 |
addSubView:newView |
|
3959 |
"add a view to the collection of subviews" |
|
3960 |
||
3961 |
subViews isNil ifTrue:[ |
|
3653 | 3962 |
subViews := OrderedCollection with:newView |
269 | 3963 |
] ifFalse:[ |
3653 | 3964 |
(subViews includesIdentical:newView) ifTrue:[ |
3965 |
self error:'trying to add a view twice' mayProceed:true. |
|
3966 |
^ self. |
|
3967 |
]. |
|
3968 |
subViews add:newView. |
|
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3969 |
]. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3970 |
self setContainerIn:newView. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3971 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3972 |
"Modified: 9.5.1996 / 00:47:16 / cg" |
269 | 3973 |
! |
3974 |
||
3975 |
addSubView:newView after:aView |
|
3976 |
"add a view to the collection of subviews after another view. |
|
3977 |
This makes sense, in Panels and other layout views, to enter a new |
|
3978 |
element at some defined place." |
|
3979 |
||
3980 |
subViews isNil ifTrue:[ |
|
3653 | 3981 |
subViews := OrderedCollection with:newView |
269 | 3982 |
] ifFalse:[ |
3653 | 3983 |
(subViews includesIdentical:newView) ifTrue:[ |
3984 |
self error:'trying to add a view twice' mayProceed:true. |
|
3985 |
^ self. |
|
3986 |
]. |
|
3987 |
aView isNil ifTrue:[ |
|
3988 |
subViews add:newView |
|
3989 |
] ifFalse:[ |
|
3990 |
subViews add:newView after:aView. |
|
3991 |
] |
|
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3992 |
]. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3993 |
self setContainerIn:newView. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3994 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3995 |
"Modified: 9.5.1996 / 00:47:20 / cg" |
269 | 3996 |
! |
3997 |
||
3998 |
addSubView:newView before:aView |
|
3999 |
"add a view to the collection of subviews before another view. |
|
4000 |
This makes sense, in Panels and other layout views, to enter a new |
|
4001 |
element at some defined place." |
|
4002 |
||
4003 |
subViews isNil ifTrue:[ |
|
3653 | 4004 |
subViews := OrderedCollection with:newView |
269 | 4005 |
] ifFalse:[ |
3653 | 4006 |
(subViews includesIdentical:newView) ifTrue:[ |
4007 |
self error:'trying to add a view twice' mayProceed:true. |
|
4008 |
^ self. |
|
4009 |
]. |
|
4010 |
aView isNil ifTrue:[ |
|
4011 |
subViews addFirst:newView |
|
4012 |
] ifFalse:[ |
|
4013 |
subViews add:newView before:aView. |
|
4014 |
] |
|
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4015 |
]. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4016 |
self setContainerIn:newView. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4017 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4018 |
"Modified: 9.5.1996 / 00:47:23 / cg" |
269 | 4019 |
! |
4020 |
||
4021 |
addSubView:aView in:bounds borderWidth:bw |
|
4022 |
"for ST-80 V2.x compatibility" |
|
4023 |
||
4024 |
aView borderWidth:bw. |
|
4025 |
self add:aView in:bounds. |
|
4026 |
! |
|
4027 |
||
1439 | 4028 |
addSubViewFirst:newView |
4029 |
"add a view to the front of the collection of subviews" |
|
4030 |
||
4031 |
subViews isNil ifTrue:[ |
|
3653 | 4032 |
subViews := OrderedCollection with:newView |
1439 | 4033 |
] ifFalse:[ |
3653 | 4034 |
(subViews includesIdentical:newView) ifTrue:[ |
4035 |
self error:'trying to add a view twice' mayProceed:true. |
|
4036 |
^ self. |
|
4037 |
]. |
|
4038 |
subViews addFirst:newView. |
|
1439 | 4039 |
]. |
4040 |
self setContainerIn:newView. |
|
4041 |
||
4042 |
"Modified: 9.5.1996 / 00:47:16 / cg" |
|
4043 |
"Created: 6.3.1997 / 18:43:38 / cg" |
|
4044 |
! |
|
4045 |
||
269 | 4046 |
component:aComponent |
4047 |
"components (i.e. gadgets or lightweight views) are being prepared. |
|
4048 |
Dont use this right now for non-views" |
|
4049 |
||
4050 |
aComponent origin:0.0@0.0 corner:1.0@1.0. |
|
4051 |
aComponent isView ifTrue:[ |
|
3152 | 4052 |
self addSubView:aComponent |
269 | 4053 |
] ifFalse:[ |
3152 | 4054 |
components := OrderedCollection with:aComponent. |
4055 |
aComponent container:self. |
|
4056 |
||
4057 |
shown ifTrue:[ |
|
4058 |
aComponent displayOn:self |
|
4059 |
] |
|
269 | 4060 |
] |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4061 |
|
683
ecc5d13f22b2
redraw new components if already visible
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
4062 |
"Modified: 13.5.1996 / 21:20:29 / cg" |
269 | 4063 |
! |
4064 |
||
4065 |
destroySubViews |
|
4066 |
"remove all subviews" |
|
4067 |
||
4068 |
subViews notNil ifTrue:[ |
|
3152 | 4069 |
subViews copy do:[:aSubView | |
4070 |
aSubView destroy. |
|
4071 |
]. |
|
4072 |
||
4073 |
"/ paranoia ;-) |
|
4074 |
subViews size ~~ 0 ifTrue:[ |
|
4075 |
(self class name , ' >>View [warning]: some subView(s) did not destroy: ' , subViews printString) infoPrintCR. |
|
4076 |
subViews := nil |
|
4077 |
]. |
|
269 | 4078 |
] |
4079 |
||
4080 |
"Modified: 5.9.1995 / 22:35:36 / claus" |
|
1296 | 4081 |
"Modified: 29.1.1997 / 17:07:45 / cg" |
269 | 4082 |
! |
4083 |
||
4084 |
removeComponent:aComponent |
|
4085 |
"components (i.e. gadgets or lightweight views) are being prepared. |
|
4086 |
Dont use this right now for non-views" |
|
4087 |
||
4088 |
aComponent isView ifTrue:[ |
|
3152 | 4089 |
self removeSubView:aComponent |
269 | 4090 |
] ifFalse:[ |
3152 | 4091 |
components isNil ifTrue:[^self]. |
4092 |
components remove:aComponent ifAbsent:[]. |
|
4093 |
aComponent parent:nil |
|
269 | 4094 |
] |
4095 |
! |
|
4096 |
||
4097 |
removeSubView:aView |
|
4098 |
"remove a view from the collection of subviews" |
|
4099 |
||
4100 |
subViews notNil ifTrue:[ |
|
3762 | 4101 |
subViews remove:aView ifAbsent:[nil]. |
4102 |
aView setContainer:nil. |
|
4103 |
||
4104 |
(subViews size == 0) ifTrue:[ |
|
4105 |
subViews := nil |
|
4106 |
] |
|
269 | 4107 |
] |
4108 |
! |
|
4109 |
||
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4110 |
setContainerIn:aView |
269 | 4111 |
"common code for addSubView* methods" |
4112 |
||
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4113 |
aView container:self. |
743 | 4114 |
(aView graphicsDevice ~~ device) ifTrue:[ |
3762 | 4115 |
'SimpleView [warning]: subview (' errorPrint. aView class name errorPrint. |
4116 |
') has different device than me (' errorPrint. |
|
4117 |
self class name errorPrint. ').' errorPrintCR. |
|
4118 |
aView device:device |
|
3616 | 4119 |
]. |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4120 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4121 |
"Created: 9.5.1996 / 00:46:59 / cg" |
1172
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
4122 |
"Modified: 10.1.1997 / 18:06:49 / cg" |
269 | 4123 |
! ! |
4124 |
||
4125 |
!SimpleView methodsFor:'change & update'! |
|
4126 |
||
1437
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
4127 |
changedPreferredBounds:someArgument |
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
4128 |
"tell any dependents, that I have changed my preferred bounds; |
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
4129 |
Interface is provided mostly provided for ST80 compatibility; |
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
4130 |
here, translate into ST/X's mechanism for telling others about this." |
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
4131 |
|
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
4132 |
^ self changed:#preferredExtent |
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
4133 |
|
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
4134 |
"Modified: 6.3.1997 / 16:12:02 / cg" |
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
4135 |
! |
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
4136 |
|
4038
538491244f6f
preps for handling language changes
Claus Gittinger <cg@exept.de>
parents:
3968
diff
changeset
|
4137 |
languageChanged |
538491244f6f
preps for handling language changes
Claus Gittinger <cg@exept.de>
parents:
3968
diff
changeset
|
4138 |
! |
538491244f6f
preps for handling language changes
Claus Gittinger <cg@exept.de>
parents:
3968
diff
changeset
|
4139 |
|
269 | 4140 |
update:aspect with:aParameter from:changedObject |
4141 |
"an update request" |
|
4142 |
||
4143 |
aspect == #sizeOfView ifTrue:[ |
|
3762 | 4144 |
"one of the views we depend on changed its size" |
4145 |
^ self containerChangedSize. |
|
3730 | 4146 |
]. |
4147 |
super update:aspect with:aParameter from:changedObject |
|
964 | 4148 |
|
4149 |
"Modified: 19.7.1996 / 17:30:48 / cg" |
|
269 | 4150 |
! ! |
4151 |
||
4152 |
!SimpleView methodsFor:'cursor animation'! |
|
4153 |
||
4154 |
showBusyWhile:aBlock |
|
4155 |
"evaluate some time consuming block, while doing this, |
|
1943 | 4156 |
show a spinning wheel cursor. If those bitmaps are not found, |
4157 |
fallback to the standard busy cursor. |
|
4158 |
Experimental." |
|
269 | 4159 |
|
4160 |
|ok bitmaps cursors mask process oldCursor| |
|
4161 |
||
4162 |
oldCursor := cursor. |
|
4163 |
||
4164 |
ok := true. |
|
4165 |
bitmaps := #('wheel1' 'wheel2' 'wheel3' 'wheel4') |
|
3762 | 4166 |
collect:[:name | |
4167 |
|f| |
|
4168 |
||
4169 |
f := Smalltalk imageFromFileNamed:(name , '.xbm') forClass:self class. |
|
4170 |
f isNil ifTrue:[ |
|
4171 |
('SimpleView [warning]: no bitmap file: ' , name , '.xbm') errorPrintCR. |
|
4172 |
ok := false |
|
4173 |
]. |
|
4174 |
f |
|
4175 |
]. |
|
1141 | 4176 |
|
3098 | 4177 |
mask := Smalltalk imageFromFileNamed:'wheelm.xbm' forClass:self class. |
269 | 4178 |
mask isNil ifTrue:[ |
3762 | 4179 |
('SimpleView [warning]: no bitmap file: wheelm.xbm') errorPrintCR. |
4180 |
ok := false |
|
269 | 4181 |
]. |
4182 |
||
4183 |
ok ifFalse:[ |
|
3762 | 4184 |
self cursor:Cursor wait. |
4185 |
aBlock ensure:[ |
|
4186 |
self cursor:oldCursor |
|
4187 |
] |
|
269 | 4188 |
] ifTrue:[ |
3762 | 4189 |
cursors := bitmaps collect:[:form | (Cursor sourceForm:form |
4190 |
maskForm:mask |
|
4191 |
hotX:8 |
|
4192 |
hotY:8) onDevice:device]. |
|
4193 |
||
4194 |
process := [ |
|
4195 |
Delay waitForSeconds:0.25. |
|
4196 |
[true] whileTrue:[ |
|
4197 |
cursors do:[:curs | |
|
4198 |
self cursor:curs. |
|
4199 |
Delay waitForSeconds:0.05 |
|
4200 |
] |
|
4201 |
] |
|
4202 |
] fork. |
|
4203 |
||
4204 |
Processor activeProcess priority:7. |
|
4205 |
aBlock ensure:[ |
|
4206 |
Processor activeProcess priority:8. |
|
4207 |
process terminate. |
|
4208 |
self cursor:oldCursor |
|
4209 |
] |
|
269 | 4210 |
]. |
4211 |
||
4212 |
" |
|
4213 |
View new realize showBusyWhile:[10 timesRepeat:[3000 factorial]] |
|
4214 |
" |
|
1141 | 4215 |
|
1943 | 4216 |
"Modified: / 31.10.1997 / 19:59:49 / cg" |
269 | 4217 |
! ! |
4218 |
||
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4219 |
!SimpleView methodsFor:'dependents access'! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4220 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4221 |
addDependent:anObject |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4222 |
"make the argument, anObject be a dependent of the receiver" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4223 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4224 |
|wasBlocked| |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4225 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4226 |
wasBlocked := OperatingSystem blockInterrupts. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4227 |
[ |
3762 | 4228 |
|deps| |
4229 |
||
4230 |
deps := dependents. |
|
4231 |
"/ |
|
4232 |
"/ store the very first dependent directly in |
|
4233 |
"/ the dependents instVar |
|
4234 |
"/ |
|
4235 |
(deps isNil and:[anObject isCollection not]) ifTrue:[ |
|
4236 |
dependents := anObject |
|
4237 |
] ifFalse:[ |
|
4238 |
"/ |
|
4239 |
"/ store more dependents in the dependents collection |
|
4240 |
"/ |
|
4241 |
deps isCollection ifTrue:[ |
|
4242 |
deps add:anObject |
|
4243 |
] ifFalse:[ |
|
4244 |
deps == anObject ifFalse:[ |
|
4245 |
deps isNil ifTrue:[ |
|
4246 |
dependents := (IdentitySet with:anObject) |
|
4247 |
] ifFalse:[ |
|
4248 |
dependents := (IdentitySet with:deps with:anObject) |
|
4249 |
] |
|
4250 |
] |
|
4251 |
] |
|
4252 |
] |
|
3604
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3601
diff
changeset
|
4253 |
] ensure:[ |
3762 | 4254 |
wasBlocked ifFalse:[ |
4255 |
OperatingSystem unblockInterrupts |
|
4256 |
] |
|
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4257 |
] |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4258 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4259 |
"Modified: 8.1.1997 / 23:40:30 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4260 |
"Created: 11.6.1997 / 13:10:40 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4261 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4262 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4263 |
dependents |
2015 | 4264 |
"return a Collection of dependents" |
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4265 |
|
1938
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
4266 |
dependents isNil ifTrue:[^ #()]. |
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4267 |
dependents isCollection ifTrue:[ |
3152 | 4268 |
^ dependents |
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4269 |
]. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4270 |
^ IdentitySet with:dependents |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4271 |
|
1938
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
4272 |
"Created: / 11.6.1997 / 13:10:44 / cg" |
2015 | 4273 |
"Modified: / 26.1.1998 / 11:18:36 / cg" |
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4274 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4275 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4276 |
dependents:aCollection |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4277 |
"set the collection of dependents" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4278 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4279 |
|dep| |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4280 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4281 |
aCollection size == 1 ifTrue:[ |
3152 | 4282 |
dep := aCollection first. |
4283 |
dep isCollection ifFalse:[ |
|
4284 |
dependents := aCollection first. |
|
4285 |
^ self |
|
4286 |
] |
|
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4287 |
]. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4288 |
dependents := aCollection |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4289 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4290 |
"Modified: 19.4.1996 / 12:23:05 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4291 |
"Created: 11.6.1997 / 13:10:47 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4292 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4293 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4294 |
dependentsDo:aBlock |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4295 |
"evaluate aBlock for all of my dependents" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4296 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4297 |
|deps| |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4298 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4299 |
deps := dependents. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4300 |
deps notNil ifTrue:[ |
3152 | 4301 |
deps isCollection ifTrue:[ |
4302 |
deps do:aBlock |
|
4303 |
] ifFalse:[ |
|
4304 |
aBlock value:deps |
|
4305 |
] |
|
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4306 |
] |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4307 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4308 |
"Created: 11.6.1997 / 13:10:51 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4309 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4310 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4311 |
release |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4312 |
"remove all dependencies from the receiver" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4313 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4314 |
dependents := nil |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4315 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4316 |
"Modified: 19.4.1996 / 10:31:35 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4317 |
"Created: 11.6.1997 / 13:11:53 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4318 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4319 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4320 |
removeDependent:anObject |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4321 |
"make the argument, anObject be independent of the receiver" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4322 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4323 |
|wasBlocked| |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4324 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4325 |
"/ must do this save from interrupts, since the dependents collection |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4326 |
"/ is possibly accessed from multiple threads. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4327 |
"/ Used to use #valueUninterruptably here; inlined that code for slightly |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4328 |
"/ faster execution. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4329 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4330 |
wasBlocked := OperatingSystem blockInterrupts. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4331 |
[ |
3762 | 4332 |
|deps sz dep| |
4333 |
||
4334 |
deps := dependents. |
|
4335 |
deps notNil ifTrue:[ |
|
4336 |
deps isCollection ifTrue:[ |
|
4337 |
deps remove:anObject ifAbsent:[]. |
|
4338 |
(sz := deps size) == 0 ifTrue:[ |
|
4339 |
dependents := nil |
|
4340 |
] ifFalse:[ |
|
4341 |
sz == 1 ifTrue:[ |
|
4342 |
(dep := deps first) isCollection ifFalse:[ |
|
4343 |
dependents := dep |
|
4344 |
] |
|
4345 |
] |
|
4346 |
] |
|
4347 |
] ifFalse:[ |
|
4348 |
deps == anObject ifTrue:[ |
|
4349 |
dependents := nil |
|
4350 |
] |
|
4351 |
] |
|
4352 |
] |
|
3604
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3601
diff
changeset
|
4353 |
] ensure:[ |
3762 | 4354 |
wasBlocked ifFalse:[ |
4355 |
OperatingSystem unblockInterrupts |
|
4356 |
] |
|
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4357 |
] |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4358 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4359 |
"Modified: 8.1.1997 / 23:41:39 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4360 |
"Created: 11.6.1997 / 13:11:58 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4361 |
! ! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4362 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4363 |
!SimpleView methodsFor:'dependents access (non weak)'! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4364 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4365 |
addNonWeakDependent:anObject |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4366 |
"make the argument, anObject be a dependent of the receiver. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4367 |
Since all dependencies are nonWeak in Model, this is simply |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4368 |
forwarded to addDependent:" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4369 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4370 |
^ self addDependent:anObject |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4371 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4372 |
"Created: 11.6.1997 / 13:15:40 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4373 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4374 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4375 |
interests |
2037
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
4376 |
"return a Collection of interests - empty if there is none. |
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4377 |
Here, we use the normal dependents collection for interests." |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4378 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4379 |
^ self dependents |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4380 |
|
2037
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
4381 |
"Modified: / 14.10.1996 / 22:19:58 / stefan" |
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
4382 |
"Created: / 11.6.1997 / 13:15:44 / cg" |
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
4383 |
"Modified: / 30.1.1998 / 14:07:48 / cg" |
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4384 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4385 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4386 |
nonWeakDependents |
2037
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
4387 |
"return a Collection of dependents - empty if there is none. |
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4388 |
Since all dependencies are nonWeak in Model, this is a dummy." |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4389 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4390 |
^ self dependents |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4391 |
|
2037
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
4392 |
"Created: / 11.6.1997 / 13:15:48 / cg" |
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
4393 |
"Modified: / 30.1.1998 / 14:06:55 / cg" |
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4394 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4395 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4396 |
removeNonWeakDependent:anObject |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4397 |
"make the argument, anObject be independent of the receiver. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4398 |
Since all dependencies are nonWeak in Model, this is simply |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4399 |
forwarded to removeDependent:" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4400 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4401 |
^ self removeDependent:anObject |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4402 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4403 |
"Created: 11.6.1997 / 13:15:52 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4404 |
! ! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4405 |
|
1308 | 4406 |
!SimpleView methodsFor:'drag & drop'! |
4407 |
||
1581
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
4408 |
canDrop:aCollectionOfDropObjects |
1308 | 4409 |
"return true, if anObjectOrCollection can be |
4410 |
dropped in the receiver. This method should be |
|
4411 |
redefined in views which can take objects" |
|
4412 |
||
4413 |
|app| |
|
4414 |
||
4415 |
(app := self application) notNil ifTrue:[ |
|
3152 | 4416 |
^ app canDrop:aCollectionOfDropObjects in:self |
1308 | 4417 |
]. |
4418 |
^ false |
|
1581
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
4419 |
|
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
4420 |
"Modified: 11.4.1997 / 12:42:13 / cg" |
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
4421 |
! |
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
4422 |
|
3947 | 4423 |
dragAutoScroll:aContext |
4424 |
"called by the DragAndDropManager to scroll during a drag/drop operation |
|
4425 |
if necassery (decided by the widget itself); If a scroll is done return |
|
4426 |
true otherwise false (used to restore the background) |
|
4427 |
on default false is returned. |
|
4428 |
" |
|
4429 |
^ false |
|
4430 |
! |
|
4431 |
||
1581
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
4432 |
drop:aCollectionOfDropObjects at:aPoint |
1308 | 4433 |
"drop manager wants to drop. |
4434 |
If I have an application, forward the request. |
|
4435 |
Otherwise, ignore it. This is only sent, if #canDrop: returned true; |
|
4436 |
if you redefined #canDrop: in a subclass, #drop:at: must also be redefined." |
|
4437 |
||
4438 |
|app| |
|
4439 |
||
4440 |
(app := self application) notNil ifTrue:[ |
|
3152 | 4441 |
^ app drop:aCollectionOfDropObjects in:self at:aPoint |
1308 | 4442 |
]. |
4443 |
self subclassResponsibility |
|
1581
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
4444 |
|
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
4445 |
"Modified: 11.4.1997 / 12:44:34 / cg" |
3591 | 4446 |
! |
4447 |
||
4448 |
dropTarget |
|
4449 |
"returns the dropTarget or nil |
|
4450 |
" |
|
4451 |
^ nil |
|
1308 | 4452 |
! ! |
4453 |
||
269 | 4454 |
!SimpleView methodsFor:'edge drawing'! |
4455 |
||
4456 |
drawBottomEdge |
|
4457 |
"draw bottom 3D edge into window frame" |
|
4458 |
||
4459 |
self drawBottomEdgeLevel:level |
|
3152 | 4460 |
shadow:shadowColor |
4461 |
light:lightColor |
|
4462 |
halfShadow:nil |
|
4463 |
halfLight:nil |
|
4464 |
style:nil. |
|
269 | 4465 |
! |
4466 |
||
4467 |
drawBottomEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle |
|
4468 |
|botFg |
|
4469 |
count "{ Class: SmallInteger }" |
|
4470 |
b r| |
|
4471 |
||
4472 |
count := level. |
|
4473 |
count == 0 ifTrue:[^ self]. |
|
4474 |
||
4475 |
(count < 0) ifTrue:[ |
|
3152 | 4476 |
botFg := lightColor. |
4477 |
count := count negated |
|
269 | 4478 |
] ifFalse:[ |
3152 | 4479 |
((edgeStyle == #soft) and:[level > 1]) ifTrue:[ |
4480 |
botFg := halfShadowColor |
|
4481 |
] ifFalse:[ |
|
4482 |
botFg := shadowColor |
|
4483 |
]. |
|
269 | 4484 |
]. |
4485 |
super paint:botFg. |
|
4486 |
super lineWidth:0. |
|
4487 |
||
4488 |
r := width - 1. |
|
4489 |
0 to:(count - 1) do:[:i | |
|
3152 | 4490 |
b := height - 1 - i. |
4491 |
super displayDeviceLineFromX:i y:b toX:(r - i) y:b |
|
269 | 4492 |
]. |
4493 |
||
4494 |
((edgeStyle == #soft) and:[level > 1]) ifTrue:[ |
|
3152 | 4495 |
b := height - 1. |
4496 |
super paint:shadowColor. |
|
4497 |
super displayDeviceLineFromX:1 y:b toX:r y:b. |
|
1444 | 4498 |
]. |
4499 |
||
4500 |
self edgeDrawn:#bottom. |
|
4501 |
||
4502 |
"Modified: 7.3.1997 / 17:59:39 / cg" |
|
269 | 4503 |
! |
4504 |
||
4505 |
drawEdges |
|
4506 |
"draw all of my 3D edges" |
|
4507 |
||
4508 |
self drawEdgesForX:0 y:0 width:width height:height level:level |
|
3152 | 4509 |
shadow:shadowColor |
4510 |
light:lightColor |
|
4511 |
halfShadow:nil |
|
4512 |
halfLight:nil |
|
4513 |
style:nil |
|
269 | 4514 |
! |
4515 |
||
4516 |
drawEdgesForX:x y:y width:w height:h level:l |
|
4517 |
"draw 3D edges into a rectangle" |
|
4518 |
||
4519 |
self drawEdgesForX:x y:y width:w height:h level:l |
|
3152 | 4520 |
shadow:shadowColor |
4521 |
light:lightColor |
|
4522 |
halfShadow:nil |
|
4523 |
halfLight:nil |
|
4524 |
style:nil |
|
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
4525 |
! |
269 | 4526 |
|
4527 |
drawLeftEdge |
|
4528 |
"draw left 3D edge into window frame" |
|
4529 |
||
4530 |
self drawLeftEdgeLevel:level |
|
3152 | 4531 |
shadow:shadowColor |
4532 |
light:lightColor |
|
4533 |
halfShadow:nil |
|
4534 |
halfLight:nil |
|
4535 |
style:nil. |
|
269 | 4536 |
! |
4537 |
||
4538 |
drawLeftEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle |
|
4539 |
|leftFg leftHalfFg paint b |
|
4540 |
count "{ Class: SmallInteger }" | |
|
4541 |
||
4542 |
count := level. |
|
4543 |
count == 0 ifTrue:[^ self]. |
|
4544 |
||
4545 |
(count < 0) ifTrue:[ |
|
3152 | 4546 |
leftFg := shadowColor. |
4547 |
leftHalfFg := halfShadowColor. |
|
4548 |
count := count negated. |
|
269 | 4549 |
] ifFalse:[ |
3152 | 4550 |
leftFg := lightColor. |
4551 |
leftHalfFg := halfLightColor. |
|
269 | 4552 |
]. |
4553 |
leftHalfFg isNil ifTrue:[ |
|
3152 | 4554 |
leftHalfFg := leftFg |
269 | 4555 |
]. |
4556 |
||
4557 |
((edgeStyle == #soft) and:[level > 0]) ifTrue:[ |
|
3152 | 4558 |
paint := leftHalfFg |
269 | 4559 |
] ifFalse:[ |
3152 | 4560 |
paint := leftFg |
269 | 4561 |
]. |
4562 |
super paint:paint. |
|
4563 |
super lineWidth:0. |
|
4564 |
||
4565 |
b := height - 1. |
|
4566 |
0 to:(count - 1) do:[:i | |
|
3152 | 4567 |
super displayDeviceLineFromX:i y:i toX:i y:(b - i) |
269 | 4568 |
]. |
4569 |
||
4570 |
((edgeStyle == #soft) and:[level > 2]) ifTrue:[ |
|
3152 | 4571 |
super paint:(device blackColor). |
4572 |
super displayDeviceLineFromX:0 y:0 toX:0 y:b. |
|
1444 | 4573 |
]. |
4574 |
||
4575 |
self edgeDrawn:#left. |
|
4576 |
||
4577 |
"Modified: 7.3.1997 / 17:59:53 / cg" |
|
269 | 4578 |
! |
4579 |
||
4580 |
drawRightEdge |
|
4581 |
"draw right 3D edge into window frame" |
|
4582 |
||
4583 |
self drawRightEdgeLevel:level |
|
3152 | 4584 |
shadow:shadowColor |
4585 |
light:lightColor |
|
4586 |
halfShadow:nil |
|
4587 |
halfLight:nil |
|
4588 |
style:nil. |
|
269 | 4589 |
! |
4590 |
||
4591 |
drawRightEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle |
|
4592 |
|rightFg |
|
4593 |
count "{ Class: SmallInteger }" |
|
4594 |
r b| |
|
4595 |
||
4596 |
count := level. |
|
4597 |
count == 0 ifTrue:[^ self]. |
|
4598 |
||
4599 |
(count < 0) ifTrue:[ |
|
3152 | 4600 |
rightFg := lightColor. |
4601 |
count := count negated |
|
269 | 4602 |
] ifFalse:[ |
3152 | 4603 |
((edgeStyle == #soft) and:[level > 1]) ifTrue:[ |
4604 |
rightFg := halfShadowColor |
|
4605 |
] ifFalse:[ |
|
4606 |
rightFg := shadowColor |
|
4607 |
]. |
|
269 | 4608 |
]. |
4609 |
super paint:rightFg. |
|
4610 |
super lineWidth:0. |
|
4611 |
||
4612 |
b := height - 1. |
|
4613 |
0 to:(count - 1) do:[:i | |
|
3152 | 4614 |
r := width - 1 - i. |
4615 |
super displayDeviceLineFromX:r y:i toX:r y:(b - i) |
|
269 | 4616 |
]. |
4617 |
((edgeStyle == #soft) and:[level > 1]) ifTrue:[ |
|
3152 | 4618 |
r := width - 1. |
4619 |
super paint:shadowColor. |
|
4620 |
super displayDeviceLineFromX:r y:1 toX:r y:b. |
|
1444 | 4621 |
]. |
4622 |
||
4623 |
self edgeDrawn:#right. |
|
4624 |
||
4625 |
"Modified: 7.3.1997 / 18:00:02 / cg" |
|
269 | 4626 |
! |
4627 |
||
4628 |
drawTopEdge |
|
4629 |
"draw top 3D edge into window frame" |
|
4630 |
||
4631 |
self drawTopEdgeLevel:level |
|
3152 | 4632 |
shadow:shadowColor |
4633 |
light:lightColor |
|
4634 |
halfShadow:nil |
|
4635 |
halfLight:nil |
|
4636 |
style:nil. |
|
269 | 4637 |
! |
4638 |
||
4639 |
drawTopEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle |
|
4640 |
|topFg topHalfFg paint r |
|
4641 |
count "{ Class: SmallInteger }" | |
|
4642 |
||
4643 |
count := level. |
|
4644 |
count == 0 ifTrue:[^ self]. |
|
4645 |
||
4646 |
(count < 0) ifTrue:[ |
|
3152 | 4647 |
topFg := shadowColor. |
4648 |
topHalfFg := halfShadowColor. |
|
4649 |
count := count negated |
|
269 | 4650 |
] ifFalse:[ |
3152 | 4651 |
topFg := lightColor. |
4652 |
topHalfFg := halfLightColor. |
|
269 | 4653 |
]. |
4654 |
topHalfFg isNil ifTrue:[ |
|
3152 | 4655 |
topHalfFg := topFg |
269 | 4656 |
]. |
4657 |
||
4658 |
((edgeStyle == #soft) and:[level > 0]) ifTrue:[ |
|
3152 | 4659 |
paint := topHalfFg |
269 | 4660 |
] ifFalse:[ |
3152 | 4661 |
paint := topFg |
269 | 4662 |
]. |
4663 |
super paint:paint. |
|
4664 |
super lineWidth:0. |
|
4665 |
||
4666 |
r := width - 1. |
|
4667 |
0 to:(count - 1) do:[:i | |
|
3152 | 4668 |
super displayDeviceLineFromX:i y:i toX:(r - i) y:i |
269 | 4669 |
]. |
4670 |
((edgeStyle == #soft) and:[level > 2]) ifTrue:[ |
|
3152 | 4671 |
super paint:(device blackColor). |
4672 |
super displayDeviceLineFromX:0 y:0 toX:r y:0. |
|
1444 | 4673 |
]. |
4674 |
||
4675 |
self edgeDrawn:#top. |
|
4676 |
||
4677 |
"Modified: 7.3.1997 / 18:00:11 / cg" |
|
269 | 4678 |
! |
4679 |
||
4680 |
redrawEdges |
|
4681 |
"redraw my edges (if any)" |
|
4682 |
||
4683 |
(level ~~ 0) ifTrue:[ |
|
3152 | 4684 |
shown ifTrue:[ |
4685 |
self clippingRectangle:nil. |
|
4686 |
self drawEdges. |
|
4687 |
self deviceClippingRectangle:innerClipRect |
|
4688 |
] |
|
739 | 4689 |
] |
4690 |
||
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4691 |
"Modified: / 25.5.1999 / 14:50:25 / cg" |
269 | 4692 |
! ! |
4693 |
||
4694 |
!SimpleView methodsFor:'enumerating subviews'! |
|
4695 |
||
4696 |
allSubViewsDo:aBlock |
|
4697 |
"evaluate aBlock for all subviews (recursively)" |
|
4698 |
||
1335 | 4699 |
subViews notNil ifTrue:[ |
3653 | 4700 |
subViews do:[:aSubview | |
4701 |
aSubview withAllSubViewsDo:aBlock |
|
4702 |
] |
|
269 | 4703 |
] |
1335 | 4704 |
|
4705 |
"Modified: 12.2.1997 / 12:23:38 / cg" |
|
269 | 4706 |
! |
4707 |
||
1363 | 4708 |
changeSequenceOrderFor:aSubView to:anIndex |
1984 | 4709 |
"change a subview's position in the subviews collection. |
4710 |
Usually, this only affects the order of components in a panelView. |
|
1363 | 4711 |
" |
4712 |
|aView| |
|
4713 |
||
4714 |
(subViews notNil and:[subViews size >= anIndex]) ifTrue:[ |
|
3152 | 4715 |
aView := subViews remove:aSubView ifAbsent:nil. |
4716 |
||
4717 |
aView notNil ifTrue:[ |
|
4718 |
subViews add:aView beforeIndex:anIndex. |
|
4719 |
^ true |
|
4720 |
] |
|
1363 | 4721 |
]. |
4722 |
^ false |
|
4723 |
! |
|
4724 |
||
269 | 4725 |
withAllSubViewsDo:aBlock |
4726 |
"evaluate aBlock for the receiver and all subviews (recursively)" |
|
4727 |
||
4728 |
aBlock value:self. |
|
4729 |
self allSubViewsDo:aBlock |
|
135 | 4730 |
! ! |
4731 |
||
4732 |
!SimpleView methodsFor:'event handling'! |
|
4733 |
||
1581
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
4734 |
alienDrop:aCollectionOfDropObjects |
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
4735 |
"a drop from some other non-ST/X application." |
1555
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4736 |
|
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4737 |
|v| |
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4738 |
|
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4739 |
v := self. |
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4740 |
[v notNil] whileTrue:[ |
3152 | 4741 |
(v canDrop:aCollectionOfDropObjects) ifTrue:[ |
4742 |
v drop:aCollectionOfDropObjects at:nil. |
|
4743 |
^ self. |
|
4744 |
]. |
|
4745 |
v := v superView |
|
1555
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4746 |
] |
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4747 |
|
1581
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
4748 |
"Modified: 11.4.1997 / 12:41:16 / cg" |
1555
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4749 |
! |
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4750 |
|
269 | 4751 |
buttonPress:button x:x y:y |
659 | 4752 |
"button was pressed - check my components for a hit." |
269 | 4753 |
|
4754 |
components notNil ifTrue:[ |
|
3152 | 4755 |
self componentsContainingX:x y:y do:[:comp :cx :cy | |
4756 |
comp buttonPress:button x:cx y:cy. |
|
4757 |
^ self |
|
4758 |
] |
|
140 | 4759 |
]. |
4760 |
||
269 | 4761 |
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
|
4762 |
|
659 | 4763 |
"Modified: 8.5.1996 / 23:43:41 / cg" |
4764 |
! |
|
4765 |
||
4766 |
buttonRelease:button x:x y:y |
|
4767 |
"button was released - check my components for a hit." |
|
4768 |
||
4769 |
components notNil ifTrue:[ |
|
3152 | 4770 |
self componentsContainingX:x y:y do:[:comp :cx :cy | |
4771 |
comp buttonRelease:button x:cx y:cy. |
|
4772 |
^ self |
|
4773 |
] |
|
659 | 4774 |
]. |
4775 |
||
4776 |
super buttonRelease:button x:x y:y |
|
4777 |
||
4778 |
"Modified: 8.5.1996 / 23:41:58 / cg" |
|
4779 |
"Created: 8.5.1996 / 23:43:25 / cg" |
|
193 | 4780 |
! |
4781 |
||
1544
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4782 |
clientMessage:msgType format:msgFormat eventData:msgData |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4783 |
"a client message - very X-specific and only useful |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4784 |
for special applications. |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4785 |
Ignored here" |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4786 |
|
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4787 |
"Created: 4.4.1997 / 18:56:52 / cg" |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4788 |
! |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4789 |
|
2216
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4790 |
closeRequest |
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4791 |
"programmatic close request" |
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4792 |
|
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4793 |
self destroy |
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4794 |
|
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4795 |
"Modified: / 3.8.1998 / 19:50:50 / cg" |
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4796 |
! |
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
4797 |
|
140 | 4798 |
configureX:x y:y width:newWidth height:newHeight |
4799 |
"my size has changed by window manager action" |
|
4800 |
||
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4801 |
|how anyEdge mustRedrawBottomEdge mustRedrawRightEdge p originChanged| |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4802 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4803 |
originChanged := (left ~= x) or:[top ~= y]. |
180 | 4804 |
|
2966 | 4805 |
left := x. |
4806 |
top := y. |
|
4807 |
||
180 | 4808 |
(superView isNil |
4809 |
and:[drawableId notNil]) ifTrue:[ |
|
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4810 |
"/ have to be careful - some window managers (motif) wrap another |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4811 |
"/ view around and the reported origin is relative to that. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4812 |
"/ not relative to the screen. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4813 |
p := device translatePoint:0@0 fromView:self toView:nil. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4814 |
p := p + self borderWidth. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4815 |
left := p x. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4816 |
top := p y. |
2414 | 4817 |
]. |
4818 |
||
140 | 4819 |
((width ~~ newWidth) or:[height ~~ newHeight]) ifTrue:[ |
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4820 |
realized ifFalse:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4821 |
width := newWidth. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4822 |
height := newHeight. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4823 |
self extentChangedFlag:true. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4824 |
^ self |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4825 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4826 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4827 |
((newWidth <= width) and:[newHeight <= height]) ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4828 |
how := #smaller |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4829 |
] ifFalse:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4830 |
((newWidth >= width) and:[newHeight >= height]) ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4831 |
how := #larger |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4832 |
] |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4833 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4834 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4835 |
level ~~ 0 ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4836 |
mustRedrawBottomEdge := newHeight < height. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4837 |
mustRedrawRightEdge := newWidth < width. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4838 |
anyEdge := mustRedrawBottomEdge or:[mustRedrawRightEdge] |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4839 |
] ifFalse:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4840 |
anyEdge := false |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4841 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4842 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4843 |
width := newWidth. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4844 |
height := newHeight. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4845 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4846 |
"recompute inner-clip if needed" |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4847 |
self setInnerClip. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4848 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4849 |
" |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4850 |
must first process pending exposes; |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4851 |
otherwise, those may be drawn at a wrong position |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4852 |
" |
971 | 4853 |
"/ claus: no; expose events are in the same queue as configure events; |
4854 |
"/ which is exactly for that reason ... |
|
4855 |
||
4856 |
"/ windowGroup notNil ifTrue:[ |
|
4857 |
"/ windowGroup processExposeEvents |
|
4858 |
"/ ]. |
|
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4859 |
self sizeChanged:how. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4860 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4861 |
(anyEdge and:[shown]) ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4862 |
mustRedrawBottomEdge ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4863 |
self invalidateDeviceRectangle:((0 @ (height-1-margin)) extent:width@margin) repairNow:false. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4864 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4865 |
mustRedrawRightEdge ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4866 |
self invalidateDeviceRectangle:((width-1-margin)@0 extent:margin@height) repairNow:false. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4867 |
]. |
2821
8eda25202d32
async border redraw when size changes
Claus Gittinger <cg@exept.de>
parents:
2816
diff
changeset
|
4868 |
"/ OLD code: |
8eda25202d32
async border redraw when size changes
Claus Gittinger <cg@exept.de>
parents:
2816
diff
changeset
|
4869 |
"/ self clippingRectangle:nil. |
8eda25202d32
async border redraw when size changes
Claus Gittinger <cg@exept.de>
parents:
2816
diff
changeset
|
4870 |
"/ mustRedrawBottomEdge ifTrue:[ |
8eda25202d32
async border redraw when size changes
Claus Gittinger <cg@exept.de>
parents:
2816
diff
changeset
|
4871 |
"/ self drawBottomEdge |
8eda25202d32
async border redraw when size changes
Claus Gittinger <cg@exept.de>
parents:
2816
diff
changeset
|
4872 |
"/ ]. |
8eda25202d32
async border redraw when size changes
Claus Gittinger <cg@exept.de>
parents:
2816
diff
changeset
|
4873 |
"/ mustRedrawRightEdge ifTrue:[ |
8eda25202d32
async border redraw when size changes
Claus Gittinger <cg@exept.de>
parents:
2816
diff
changeset
|
4874 |
"/ self drawRightEdge |
8eda25202d32
async border redraw when size changes
Claus Gittinger <cg@exept.de>
parents:
2816
diff
changeset
|
4875 |
"/ ]. |
8eda25202d32
async border redraw when size changes
Claus Gittinger <cg@exept.de>
parents:
2816
diff
changeset
|
4876 |
"/ self deviceClippingRectangle:innerClipRect |
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4877 |
] |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4878 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4879 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4880 |
originChanged ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4881 |
self changed:#origin. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
4882 |
]. |
739 | 4883 |
|
3518
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
4884 |
"Modified: / 10.10.2001 / 14:14:19 / cg" |
138 | 4885 |
! |
4886 |
||
964 | 4887 |
containerChangedSize |
4888 |
"my container has changed size; if I have relative |
|
4889 |
origin/extent or blocks to evaluate, do it now .." |
|
4890 |
||
1063 | 4891 |
|oldWidth oldHeight oldTop oldLeft newExt newOrg r| |
964 | 4892 |
|
4893 |
oldWidth := width. |
|
4894 |
oldHeight := height. |
|
4895 |
oldTop := top. |
|
4896 |
oldLeft := left. |
|
4897 |
||
4898 |
" |
|
4899 |
slowly migrating to use layoutObjects ... |
|
4900 |
" |
|
4901 |
layout isNil ifTrue:[ |
|
3762 | 4902 |
newOrg := self computeOrigin. |
4903 |
newExt := self computeExtent. |
|
964 | 4904 |
] ifFalse:[ |
3762 | 4905 |
r := (layout rectangleRelativeTo:(superView viewRectangle) |
4906 |
preferred:[self preferredBounds]). |
|
4907 |
newOrg := r origin rounded. |
|
4908 |
newExt := r extent rounded. |
|
964 | 4909 |
"/ newOrg printNL. |
4910 |
"/ newExt printNL. |
|
4911 |
]. |
|
4912 |
||
3394
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4913 |
"/ newOrg notNil ifTrue:[ |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4914 |
"/ ((newOrg x == oldLeft) and:[newOrg y == oldTop]) ifTrue:[ |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4915 |
"/ newOrg := nil |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4916 |
"/ ] |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4917 |
"/ ]. |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4918 |
"/ newExt notNil ifTrue:[ |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4919 |
"/ ((newExt x == width) and:[newExt y == height]) ifTrue:[ |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4920 |
"/ newExt := nil |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4921 |
"/ ] |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4922 |
"/ ]. |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4923 |
"/ |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4924 |
"/ newExt isNil ifTrue:[ |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4925 |
"/ newOrg notNil ifTrue:[ |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4926 |
"/ self pixelOrigin:newOrg |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4927 |
"/ ] |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4928 |
"/ ] ifFalse:[ |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4929 |
"/ newOrg isNil ifTrue:[ |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4930 |
"/ self pixelExtent:newExt |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4931 |
"/ ] ifFalse:[ |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4932 |
"/ self pixelOrigin:newOrg extent:newExt |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4933 |
"/ ] |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4934 |
"/ ] |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
4935 |
self pixelOrigin:newOrg extent:newExt |
964 | 4936 |
|
4937 |
"Modified: 19.7.1996 / 17:32:50 / cg" |
|
4938 |
! |
|
4939 |
||
4940 |
containerMapped |
|
4941 |
"my container was mapped (became visible). |
|
4942 |
If I was previously realized, this implies that I myself |
|
4943 |
am now mapped as well." |
|
4944 |
||
4945 |
"/ if I was not previously shown, tell it to all of |
|
4946 |
"/ my subviews (they remember this in the shown instVar) |
|
4947 |
||
4948 |
realized ifTrue:[ |
|
3152 | 4949 |
shown ifFalse:[ |
964 | 4950 |
"/ old: |
4951 |
"/ shown := true. |
|
4952 |
"/ subViews notNil ifTrue:[ |
|
4953 |
"/ subViews do:[:v | |
|
4954 |
"/ v containerMapped |
|
4955 |
"/ ] |
|
4956 |
"/ ] |
|
4957 |
||
4958 |
"/ which is equivalent to: |
|
3152 | 4959 |
self mapped. |
4960 |
] |
|
964 | 4961 |
]. |
4962 |
||
4963 |
"Modified: 30.5.1996 / 11:41:02 / cg" |
|
4964 |
"Created: 19.7.1996 / 17:41:10 / cg" |
|
4965 |
! |
|
4966 |
||
4967 |
containerUnmapped |
|
4968 |
"my container was unmapped |
|
4969 |
- this implies that the recevier is now also unmapped." |
|
4970 |
||
4971 |
"/ if I was previously shown, tell it to all of |
|
4972 |
"/ my subviews (they remember this in the shown instVar) |
|
4973 |
||
4974 |
realized ifTrue:[ |
|
3152 | 4975 |
shown ifTrue:[ |
4976 |
self unmapped |
|
4977 |
] |
|
964 | 4978 |
] |
4979 |
||
4980 |
"Modified: 30.5.1996 / 11:41:25 / cg" |
|
4981 |
"Created: 19.7.1996 / 17:43:50 / cg" |
|
4982 |
! |
|
4983 |
||
269 | 4984 |
destroyed |
4985 |
"view has been destroyed by someone else (usually window system)" |
|
4986 |
||
4987 |
shown := false. |
|
4988 |
super destroyed |
|
3183
e55c249cd6e5
kludge: remove objectAttributes when destroyed.
Claus Gittinger <cg@exept.de>
parents:
3182
diff
changeset
|
4989 |
|
e55c249cd6e5
kludge: remove objectAttributes when destroyed.
Claus Gittinger <cg@exept.de>
parents:
3182
diff
changeset
|
4990 |
"Modified: / 18.2.2000 / 11:20:34 / cg" |
269 | 4991 |
! |
4992 |
||
1555
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4993 |
dropMessage:dropType data:dropValue |
1544
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4994 |
"a drop from some other view. |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4995 |
Convert to the ST/X drag and drop protocol here." |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
4996 |
|
1559 | 4997 |
|dropObjects| |
4998 |
||
1555
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
4999 |
dropType == #file ifTrue:[ |
3152 | 5000 |
dropObjects := Array with:(DropObject newFile:dropValue) |
1559 | 5001 |
] ifFalse:[ |
3152 | 5002 |
dropType == #directory ifTrue:[ |
5003 |
dropObjects := Array with:(DropObject newFile:dropValue) |
|
5004 |
] ifFalse:[ |
|
5005 |
dropType == #files ifTrue:[ |
|
5006 |
dropObjects := (dropValue collect:[:fn | DropObject newFile:fn]) |
|
5007 |
] ifFalse:[ |
|
5008 |
dropType == #text ifTrue:[ |
|
5009 |
dropObjects := Array with:(DropObject newText:dropValue) |
|
5010 |
] ifFalse:[ |
|
5011 |
dropObjects := Array with:(DropObject new:dropValue) |
|
5012 |
] |
|
5013 |
] |
|
5014 |
] |
|
1559 | 5015 |
]. |
5016 |
||
5017 |
self alienDrop:dropObjects |
|
5018 |
||
5019 |
"Modified: 6.4.1997 / 14:44:43 / cg" |
|
1544
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
5020 |
! |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
5021 |
|
135 | 5022 |
exposeX:x y:y width:w height:h |
5023 |
"a low level redraw event from device |
|
5024 |
- let subclass handle the redraw and take care of edges here" |
|
5025 |
||
3340 | 5026 |
|leftEdge topEdge rightEdge botEdge anyEdge nx ny nw nh dx dy dw dh old oldPaint| |
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5027 |
|
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5028 |
shown ifFalse:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5029 |
^ self |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5030 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5031 |
|
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5032 |
nw := dw := w. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5033 |
nh := dh := h. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5034 |
nx := dx := x. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5035 |
ny := dy := y. |
135 | 5036 |
|
5037 |
anyEdge := false. |
|
5038 |
||
5039 |
" |
|
5040 |
check if there is a need to draw an edge (i.e. if margin is hit) |
|
5041 |
" |
|
5042 |
(margin ~~ 0) ifTrue:[ |
|
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5043 |
leftEdge := false. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5044 |
topEdge := false. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5045 |
rightEdge := false. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5046 |
botEdge := false. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5047 |
transformation notNil ifTrue:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5048 |
" |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5049 |
need device coordinates for this test |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5050 |
" |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5051 |
nx := transformation applyToX:nx. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5052 |
ny := transformation applyToY:ny. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5053 |
nw := transformation applyScaleX:nw. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5054 |
nh := transformation applyScaleY:nh. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5055 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5056 |
" |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5057 |
adjust expose rectangle, to exclude the margin. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5058 |
Care for rounding errors ... |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5059 |
" |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5060 |
(nx isMemberOf:SmallInteger) ifFalse:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5061 |
old := nx. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5062 |
nx := nx truncated. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5063 |
nw := nw + (nx - old). |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5064 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5065 |
(ny isMemberOf:SmallInteger) ifFalse:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5066 |
old := ny. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5067 |
ny := ny truncated. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5068 |
nh := nh + (ny - old). |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5069 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5070 |
(nw isMemberOf:SmallInteger) ifFalse:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5071 |
nw := nw truncated + 1 |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5072 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5073 |
(nh isMemberOf:SmallInteger) ifFalse:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5074 |
nh := nh truncated + 1 |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5075 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5076 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5077 |
dx := nx. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5078 |
dy := ny. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5079 |
dw := nw. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5080 |
dh := nh. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5081 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5082 |
(nx < margin) ifTrue:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5083 |
old := nx. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5084 |
nx := margin. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5085 |
nw := nw - (nx - old). |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5086 |
leftEdge := anyEdge := true. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5087 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5088 |
((nx + nw - 1) >= (width - margin)) ifTrue:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5089 |
nw := (width - margin - nx). |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5090 |
rightEdge := anyEdge := true. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5091 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5092 |
(ny < margin) ifTrue:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5093 |
old := ny. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5094 |
ny := margin. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5095 |
nh := nh - (ny - old). |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5096 |
topEdge := anyEdge := true. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5097 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5098 |
((ny + nh - 1) >= (height - margin)) ifTrue:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5099 |
nh := (height - margin - ny). |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5100 |
botEdge := anyEdge := true. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5101 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5102 |
transformation notNil ifTrue:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5103 |
" |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5104 |
need logical coordinates for redraw |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5105 |
" |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5106 |
nx := transformation applyInverseToX:nx. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5107 |
ny := transformation applyInverseToY:ny. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5108 |
nw := transformation applyInverseScaleX:nw. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5109 |
nh := transformation applyInverseScaleY:nh. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5110 |
]. |
135 | 5111 |
]. |
5112 |
||
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5113 |
(nw > 0 and:[nh > 0]) ifTrue:[ |
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5114 |
" |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5115 |
redraw inside area |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5116 |
" |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5117 |
self clippingRectangle:(Rectangle left:nx top:ny width:nw height:nh). |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5118 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5119 |
device supportsAnyViewBackgroundPixmaps ifFalse:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5120 |
"/ workaround: non-existing bg-pixmap support (win95) |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5121 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5122 |
viewBackground isImageOrForm ifTrue:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5123 |
(device supportsViewBackgroundPixmap:viewBackground) ifFalse:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5124 |
self fillRectangleWithViewBackgroundX:nx y:ny width:nw height:nh |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5125 |
] |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5126 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5127 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5128 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5129 |
self redrawX:nx y:ny width:nw height:nh. |
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5130 |
]. |
135 | 5131 |
|
5132 |
" |
|
5133 |
redraw edge(s) |
|
5134 |
" |
|
5135 |
anyEdge ifTrue:[ |
|
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5136 |
self deviceClippingRectangle:nil. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5137 |
oldPaint := paint. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5138 |
(topEdge and:[leftEdge and:[botEdge and:[rightEdge]]]) ifTrue:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5139 |
self drawEdges |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5140 |
] ifFalse:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5141 |
topEdge ifTrue:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5142 |
self drawTopEdge |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5143 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5144 |
leftEdge ifTrue:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5145 |
self drawLeftEdge |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5146 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5147 |
botEdge ifTrue:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5148 |
self drawBottomEdge |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5149 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5150 |
rightEdge ifTrue:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5151 |
self drawRightEdge |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5152 |
] |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5153 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5154 |
self paint:oldPaint. |
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5155 |
]. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5156 |
self deviceClippingRectangle:innerClipRect. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5157 |
|
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5158 |
"Modified: / 25.5.1999 / 14:57:38 / cg" |
135 | 5159 |
! |
5160 |
||
269 | 5161 |
focusIn |
2506 | 5162 |
"got keyboard focus (via the window manager). |
5163 |
Nothing done here" |
|
5164 |
||
269 | 5165 |
! |
5166 |
||
5167 |
focusOut |
|
2506 | 5168 |
"lost keyboard focus (via the window manager). |
5169 |
Nothing done here" |
|
269 | 5170 |
! |
5171 |
||
5172 |
hasKeyboardFocus:aBoolean |
|
2506 | 5173 |
"notification from the windowGroup that I got the keyboardFocus." |
5174 |
||
5175 |
delegate notNil ifTrue:[ |
|
3152 | 5176 |
delegate perform:#hasKeyboardFocus: with:aBoolean ifNotUnderstood:nil |
2506 | 5177 |
]. |
140 | 5178 |
^ self |
5179 |
! |
|
5180 |
||
5181 |
keyPress:key x:x y:y |
|
5182 |
"a key has been pressed. If there are components, |
|
5183 |
pass it to the corresponding one. |
|
5184 |
Otherwise, forward it to the superview, if there is any." |
|
5185 |
||
510 | 5186 |
<resource: #keyboard ( #Menu ) > |
5187 |
||
3247
d6e631975bd1
forward Menu-key (CMD-Z) to focusView if there is one.
Claus Gittinger <cg@exept.de>
parents:
3242
diff
changeset
|
5188 |
|focusView| |
d6e631975bd1
forward Menu-key (CMD-Z) to focusView if there is one.
Claus Gittinger <cg@exept.de>
parents:
3242
diff
changeset
|
5189 |
|
140 | 5190 |
components notNil ifTrue:[ |
3367 | 5191 |
components notNil ifTrue:[ |
5192 |
self componentsContainingX:x y:y do:[:comp :cx :cy | |
|
5193 |
comp keyPress:key x:cx y:cy. |
|
5194 |
^ self |
|
5195 |
] |
|
5196 |
]. |
|
490
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
5197 |
]. |
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
5198 |
|
494 | 5199 |
key == #Menu ifTrue:[ |
3367 | 5200 |
((focusView := self windowGroup focusView) notNil |
5201 |
and:[focusView ~~ self]) |
|
5202 |
ifTrue:[ |
|
5203 |
"/ forward to the focusView |
|
5204 |
focusView keyPress:key x:-1 y:-1. |
|
5205 |
^ self |
|
5206 |
]. |
|
5207 |
^ self activateMenu. |
|
135 | 5208 |
]. |
5209 |
||
490
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
5210 |
x isNil ifTrue:[ |
3367 | 5211 |
"/ already redelegated, but nowhere handled |
5212 |
superView notNil ifTrue:[ |
|
5213 |
superView keyPress:key x:nil y:nil. |
|
5214 |
]. |
|
5215 |
^ self |
|
490
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
5216 |
]. |
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
5217 |
|
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
5218 |
superView notNil ifTrue:[ |
3367 | 5219 |
superView |
5220 |
dispatchEvent:#keyPress:x:y: |
|
5221 |
arguments:(Array with:key with:0 with:0) |
|
2127 | 5222 |
|
5223 |
"/ WindowEvent |
|
5224 |
"/ sendEvent:#keyPress:x:y: |
|
5225 |
"/ arguments:(Array with:key with:0 with:0) |
|
5226 |
"/ view:superView |
|
411
2d5deb02d8f8
if not already forwarded, let keyEvents be handled by superView
Claus Gittinger <cg@exept.de>
parents:
393
diff
changeset
|
5227 |
] ifFalse:[ |
3367 | 5228 |
super keyPress:key x:x y:y |
135 | 5229 |
] |
411
2d5deb02d8f8
if not already forwarded, let keyEvents be handled by superView
Claus Gittinger <cg@exept.de>
parents:
393
diff
changeset
|
5230 |
|
2127 | 5231 |
"Modified: / 20.5.1998 / 22:55:08 / cg" |
659 | 5232 |
! |
5233 |
||
5234 |
keyRelease:key x:x y:y |
|
5235 |
"a key has been released. If there are components, |
|
5236 |
pass it to the corresponding one. |
|
5237 |
Otherwise, do whatever my superclass would do." |
|
5238 |
||
5239 |
components notNil ifTrue:[ |
|
3152 | 5240 |
components notNil ifTrue:[ |
5241 |
self componentsContainingX:x y:y do:[:comp :cx :cy | |
|
5242 |
comp keyRelease:key x:cx y:cy. |
|
5243 |
^ self |
|
5244 |
] |
|
5245 |
]. |
|
659 | 5246 |
]. |
5247 |
||
5248 |
super keyRelease:key x:x y:y |
|
5249 |
||
5250 |
"Modified: 8.5.1996 / 23:44:36 / cg" |
|
5251 |
"Created: 8.5.1996 / 23:45:28 / cg" |
|
135 | 5252 |
! |
5253 |
||
269 | 5254 |
mapped |
5255 |
"the view has been mapped (by some outside |
|
5256 |
action - i.e. window manager de-iconified me)" |
|
5257 |
||
5258 |
" |
|
5259 |
the old code was: |
|
5260 |
||
3152 | 5261 |
realized := true. |
5262 |
shown := true. |
|
5263 |
... |
|
269 | 5264 |
|
5265 |
this created a race condition, if the view was |
|
5266 |
realized and shortly after unrealized - before the mapped event |
|
1379 | 5267 |
arrived. This lead to realized being set to true even thought the |
5268 |
view was not. |
|
5269 |
Boy - that was a bad one (hard to reproduce and hard to find). |
|
269 | 5270 |
" |
5271 |
||
5272 |
realized ifTrue:[ |
|
769 | 5273 |
|
3152 | 5274 |
"/ currently, the 'shown ifFalse:' optimization is |
5275 |
"/ not ok, since 'shown' is also modified by visibilityChanges. |
|
5276 |
"/ Also, when remapped, X11 only sends a mapped event for the topView. |
|
5277 |
"/ Therefore, synthetically generate those #superViewMapped messages |
|
5278 |
"/ in any case. |
|
5279 |
||
5280 |
shown := true. |
|
5281 |
" |
|
5282 |
backed views will not get expose events - have |
|
5283 |
to force a redraw here to get things drawn into |
|
5284 |
backing store. |
|
5285 |
" |
|
5286 |
backed ifTrue:[ |
|
5287 |
self redrawX:0 y:0 width:width height:height |
|
5288 |
]. |
|
5289 |
||
5290 |
"/ tell my subViews ... |
|
5291 |
subViews notNil ifTrue:[ |
|
5292 |
subViews do:[:v | v mapped |
|
2721 | 5293 |
"/ v shown ifFalse:[ |
5294 |
"/ v mapped |
|
5295 |
"/ ] |
|
3152 | 5296 |
] |
5297 |
]. |
|
5298 |
self changed:#visibility. |
|
269 | 5299 |
] |
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5300 |
|
1379 | 5301 |
"Modified: 25.2.1997 / 22:41:34 / cg" |
269 | 5302 |
! |
5303 |
||
2733
5af2417bc450
pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
5304 |
mouseWheelMotion:buttonState x:x y:y amount:amount deltaTime:dTime |
2701 | 5305 |
"the mouseWheel was turned - handle as a scroll operation. |
5306 |
Specialized application windows may redefine this for any other |
|
2709 | 5307 |
operation. |
5308 |
Here, we scroll some amount which depends upon the views contents height |
|
5309 |
(but never too much); |
|
5310 |
if shift is pressed, always scroll a single scroll-step; |
|
5311 |
if ctrl is pressed, always scroll one page." |
|
5312 |
||
5313 |
|hCont pageScroll amountToScroll sensor factor| |
|
5314 |
||
5315 |
amountToScroll := self verticalScrollStep. |
|
5316 |
pageScroll := false. |
|
5317 |
||
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5318 |
sensor := self sensor. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5319 |
sensor ctrlDown ifTrue:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5320 |
pageScroll := true |
2709 | 5321 |
]. |
5322 |
||
5323 |
pageScroll ifFalse:[ |
|
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5324 |
sensor shiftDown ifFalse:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5325 |
hCont := self heightOfContents. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5326 |
hCont > (self innerHeight * 3) ifTrue:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5327 |
factor := (hCont // self innerHeight) min:4. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5328 |
amountToScroll := amountToScroll * factor. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5329 |
] |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5330 |
] |
2709 | 5331 |
]. |
2701 | 5332 |
|
2699 | 5333 |
amount > 0 ifTrue:[ |
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5334 |
pageScroll ifTrue:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5335 |
self pageUp |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5336 |
] ifFalse:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5337 |
self scrollUp:amountToScroll |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5338 |
] |
2699 | 5339 |
] ifFalse:[ |
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5340 |
pageScroll ifTrue:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5341 |
self pageDown |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5342 |
] ifFalse:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5343 |
self scrollDown:amountToScroll |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5344 |
] |
2709 | 5345 |
]. |
5346 |
||
5347 |
"Modified: / 21.5.1999 / 19:58:42 / cg" |
|
2699 | 5348 |
! |
5349 |
||
1381 | 5350 |
pointerEnter:state x:x y:y |
3087 | 5351 |
"mouse pointer entered - request the keyboard focus (sometimes)" |
5352 |
||
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5353 |
|doRequestFocus| |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5354 |
|
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5355 |
self requestFocusOnPointerEnter ifTrue:[ |
3762 | 5356 |
doRequestFocus := true |
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5357 |
] ifFalse:[ |
3762 | 5358 |
self doNotRequestFocusOnPointerEnter ifTrue:[ |
5359 |
doRequestFocus := false |
|
5360 |
] ifFalse:[ |
|
5361 |
doRequestFocus := self wantsFocusWithPointerEnter |
|
5362 |
] |
|
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5363 |
]. |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5364 |
|
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5365 |
doRequestFocus ifTrue:[ |
3762 | 5366 |
self requestFocus. |
3087 | 5367 |
]. |
1381 | 5368 |
! |
5369 |
||
5370 |
pointerLeave:state |
|
2506 | 5371 |
"got mouse pointer. |
5372 |
Nothing done here" |
|
1381 | 5373 |
|
5374 |
"Modified: 25.2.1997 / 23:43:17 / cg" |
|
5375 |
! |
|
5376 |
||
269 | 5377 |
reparented |
5378 |
"the view has changed its parent by some outside |
|
5379 |
action - i.e. window manager has added a frame. |
|
5380 |
nothing done here" |
|
5381 |
||
5382 |
^ self |
|
5383 |
! |
|
5384 |
||
5385 |
saveAndTerminate |
|
5386 |
"window manager wants me to save and go away; |
|
5387 |
- notice, that not all window managers are nice enough to |
|
5388 |
send this event, but simply destroy the view instead. |
|
5389 |
Can be redefined in subclasses to do whatever is required |
|
5390 |
to prepare for restart." |
|
5391 |
||
2216
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
5392 |
self closeRequest |
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
5393 |
|
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
5394 |
"Modified: / 3.8.1998 / 19:51:26 / cg" |
269 | 5395 |
! |
5396 |
||
5397 |
sizeChanged:how |
|
5398 |
"tell subviews if I change size. |
|
5399 |
How is either #smaller, #larger or nil, and is used to control the order, |
|
5400 |
in which subviews are notified (possibly reducing redraw activity)" |
|
5401 |
||
1290
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
5402 |
|subViews| |
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
5403 |
|
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
5404 |
(subViews := self subViews) notNil ifTrue:[ |
3152 | 5405 |
(how isNil "false" |
5406 |
or:[how == #smaller]) ifTrue:[ |
|
5407 |
subViews do:[:view | |
|
5408 |
view notNil ifTrue:[ |
|
5409 |
view containerChangedSize |
|
5410 |
] |
|
5411 |
] |
|
5412 |
] ifFalse:[ |
|
5413 |
"doing it reverse speeds up resizing - usually subviews |
|
5414 |
are created from top-left to bottom-right; therefore |
|
5415 |
bottom-right views will be moved/resized first, then top-left ones; |
|
5416 |
this avoids multiple redraws of subviews" |
|
5417 |
||
5418 |
subViews reverseDo:[:view | |
|
5419 |
view notNil ifTrue:[ |
|
5420 |
view containerChangedSize |
|
5421 |
] |
|
5422 |
] |
|
5423 |
] |
|
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5424 |
]. |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5425 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5426 |
components notNil ifTrue:[ |
3152 | 5427 |
(how isNil "false" |
5428 |
or:[how == #smaller]) ifTrue:[ |
|
5429 |
components do:[:view | |
|
5430 |
view containerChangedSize |
|
5431 |
] |
|
5432 |
] ifFalse:[ |
|
5433 |
"doing it reverse speeds up resizing - usually subviews |
|
5434 |
are created from top-left to bottom-right; therefore |
|
5435 |
bottom-right views will be moved/resized first, then top-left ones; |
|
5436 |
this avoids multiple redraws of subviews" |
|
5437 |
||
5438 |
components reverseDo:[:view | |
|
5439 |
view containerChangedSize |
|
5440 |
] |
|
5441 |
] |
|
135 | 5442 |
]. |
1290
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
5443 |
|
269 | 5444 |
self changed:#sizeOfView with:how. |
1290
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
5445 |
|
269 | 5446 |
superView notNil ifTrue:[ |
3152 | 5447 |
superView subViewChangedSize |
269 | 5448 |
] |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5449 |
|
2084
e997f6ea54c2
also pass down #larger to sizeCanged: method.
Claus Gittinger <cg@exept.de>
parents:
2061
diff
changeset
|
5450 |
"Modified: / 2.4.1998 / 13:59:59 / cg" |
269 | 5451 |
! |
5452 |
||
5453 |
subViewChangedSize |
|
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
5454 |
"some subview has changed its size; we are not interested |
269 | 5455 |
in that here, but some geometry managers redefine this, to reorganize |
5456 |
components if that happens." |
|
5457 |
||
5458 |
^ self |
|
5459 |
||
5460 |
"Created: 22.9.1995 / 14:44:59 / claus" |
|
5461 |
! |
|
5462 |
||
5463 |
terminate |
|
5464 |
"window manager wants me to go away; |
|
5465 |
- notice, that not all window managers are nice enough to |
|
5466 |
send this event, but simply destroy the view instead. |
|
5467 |
Can be redefined in subclasses to do whatever cleanup is |
|
5468 |
required." |
|
5469 |
||
2216
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
5470 |
self closeRequest |
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
5471 |
|
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
5472 |
"Modified: / 3.8.1998 / 19:51:23 / cg" |
269 | 5473 |
! |
5474 |
||
5475 |
unmapped |
|
5476 |
"the view has been unmapped |
|
5477 |
(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
|
5478 |
or due to unmapping of my parentView)." |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5479 |
|
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5480 |
"/ 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
|
5481 |
"/ my subviews (they remember this in the shown instVar) |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5482 |
|
769 | 5483 |
"/ currently, the 'shown ifTrue:' optimization is |
964 | 5484 |
"/ not ok, since 'shown' is also modified by visibilityChanges. |
5485 |
"/ Also, when remapped, X11 only sends a mapped event for the topView. |
|
769 | 5486 |
"/ Therefore, synthetically generate those #superViewUnmapped messages |
5487 |
"/ in any case. |
|
5488 |
||
1379 | 5489 |
shown := false. |
5490 |
subViews notNil ifTrue:[ |
|
3152 | 5491 |
subViews do:[:v | |
5492 |
v containerUnmapped |
|
5493 |
]. |
|
5494 |
self changed:#visibility. |
|
1379 | 5495 |
] |
5496 |
||
5497 |
"Modified: 25.2.1997 / 22:40:52 / cg" |
|
135 | 5498 |
! |
5499 |
||
5500 |
visibilityChange:how |
|
5501 |
"the visibility of the view has changed (by some outside |
|
5502 |
action - i.e. window manager rearranged things). |
|
5503 |
Using this knowledge avoids useless redraw in obsucred views." |
|
5504 |
||
5505 |
how == #fullyObscured ifTrue:[ |
|
3152 | 5506 |
shown := false |
135 | 5507 |
] ifFalse:[ |
3152 | 5508 |
shown := true. |
135 | 5509 |
] |
3139 | 5510 |
! |
5511 |
||
5512 |
visibilityStateChanged |
|
5513 |
"this is called when our visibilityChannel changes" |
|
5514 |
||
3410 | 5515 |
self isVisible:visibilityChannel value |
269 | 5516 |
! ! |
5517 |
||
1302 | 5518 |
!SimpleView methodsFor:'event simulation'! |
5519 |
||
5520 |
pushEvent:aSelector |
|
5521 |
"push some messageSend into my event queue - |
|
5522 |
I will perform the corresponding method when its time |
|
5523 |
to handle events (useful to update low-prio views from |
|
5524 |
a higher prio process, to avoid blocking in the high prio one)" |
|
5525 |
||
2143
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5526 |
^ self pushEvent:aSelector withArguments:#() |
1302 | 5527 |
|
5528 |
" |
|
5529 |
|v| |
|
5530 |
||
5531 |
v := View new openAndWait. |
|
5532 |
v fill:Color red. |
|
5533 |
v pushEvent:#redraw |
|
5534 |
" |
|
5535 |
||
2143
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5536 |
"Modified: / 10.6.1998 / 17:28:40 / cg" |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5537 |
! |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5538 |
|
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5539 |
pushEvent:aSelector with:arg |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5540 |
"push some 1-arg messageSend into my event queue - |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5541 |
I will perform the corresponding method when its time |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5542 |
to handle events (useful to update low-prio views from |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5543 |
a higher prio process, to avoid blocking in the high prio one)" |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5544 |
|
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5545 |
^ self pushEvent:aSelector withArguments:(Array with:arg) |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5546 |
|
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5547 |
"Created: / 10.6.1998 / 17:27:17 / cg" |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5548 |
! |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5549 |
|
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5550 |
pushEvent:aSelector with:arg1 with:arg2 |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5551 |
"push some 1-arg messageSend into my event queue - |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5552 |
I will perform the corresponding method when its time |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5553 |
to handle events (useful to update low-prio views from |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5554 |
a higher prio process, to avoid blocking in the high prio one)" |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5555 |
|
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5556 |
^ self pushEvent:aSelector withArguments:(Array with:arg1 with:arg2) |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5557 |
|
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5558 |
"Created: / 10.6.1998 / 17:27:41 / cg" |
1302 | 5559 |
! |
5560 |
||
5561 |
pushEvent:aSelector withArguments:args |
|
5562 |
"push some messageSend into my event queue - |
|
5563 |
I will perform the corresponding method when its time |
|
5564 |
to handle events (useful to update low-prio views from |
|
5565 |
a higher prio process, to avoid blocking in the high prio one)" |
|
5566 |
||
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5567 |
self sensor pushUserEvent:aSelector for:self withArguments:args |
1302 | 5568 |
|
5569 |
" |
|
5570 |
|v| |
|
5571 |
||
5572 |
v := (Button label:'hello') openAndWait. |
|
5573 |
Delay waitForSeconds:1. |
|
5574 |
v pushEvent:#buttonPress:x:y: withArguments:#(1 10 10). |
|
5575 |
Delay waitForSeconds:1. |
|
5576 |
v pushEvent:#buttonRelease:x:y: withArguments:#(1 10 10). |
|
5577 |
" |
|
5578 |
||
2143
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5579 |
"Modified: / 10.6.1998 / 17:28:16 / cg" |
1302 | 5580 |
! ! |
5581 |
||
2506 | 5582 |
!SimpleView methodsFor:'focus handling'! |
5583 |
||
3150 | 5584 |
canTab |
5585 |
"returns true if widget is tabable |
|
5586 |
" |
|
3375 | 5587 |
"/ ^ canTab == true |
5588 |
^ flagBits bitTest:FlagCanTab |
|
5589 |
! |
|
5590 |
||
5591 |
canTab:aBoolean |
|
3150 | 5592 |
"set widget tabable or not |
5593 |
" |
|
3375 | 5594 |
"/ canTab := aBoolean |
5595 |
aBoolean ifTrue:[ |
|
5596 |
flagBits := flagBits bitOr:FlagCanTab |
|
5597 |
] ifFalse:[ |
|
5598 |
flagBits := flagBits bitClear:FlagCanTab |
|
5599 |
]. |
|
3150 | 5600 |
! |
5601 |
||
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5602 |
doNotRequestFocusOnPointerEnter |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5603 |
"returns true if widget SHOULD NOT request the focus on pointer enter; |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5604 |
if false is returned, the behavior depends upon the settings. |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5605 |
" |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5606 |
^ flagBits bitTest:FlagDoNotRequestFocusOnPointerEnter |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5607 |
! |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5608 |
|
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5609 |
doNotRequestFocusOnPointerEnter:aBoolean |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5610 |
"if true, setup that the widget SHOULD NOT request the focus on pointer enter; |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5611 |
if false, the behavior depends upon the settings. |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5612 |
" |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5613 |
|
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5614 |
aBoolean ifTrue:[ |
3762 | 5615 |
flagBits := flagBits bitOr:FlagDoNotRequestFocusOnPointerEnter |
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5616 |
] ifFalse:[ |
3762 | 5617 |
flagBits := flagBits bitClear:FlagDoNotRequestFocusOnPointerEnter |
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5618 |
]. |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5619 |
! |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5620 |
|
3155 | 5621 |
focusNext |
5622 |
"get next focus view to self |
|
5623 |
Skip invisible & disabled widgets. |
|
5624 |
" |
|
5625 |
|viewInSubView| |
|
5626 |
||
5627 |
(shown and:[subViews notNil]) ifTrue:[ |
|
3367 | 5628 |
subViews do:[:aSubView| |
5629 |
aSubView shown ifTrue:[ |
|
5630 |
(aSubView canTab and:[aSubView enabled]) ifTrue:[ |
|
5631 |
^ aSubView |
|
5632 |
]. |
|
5633 |
||
5634 |
(viewInSubView := aSubView focusNext) notNil ifTrue:[ |
|
5635 |
^ viewInSubView |
|
5636 |
] |
|
5637 |
] |
|
5638 |
] |
|
3155 | 5639 |
]. |
5640 |
^ nil |
|
5641 |
||
5642 |
||
5643 |
||
5644 |
! |
|
5645 |
||
5646 |
focusPrevious |
|
5647 |
"get previous focus view to self |
|
5648 |
Skip invisible & disabled widgets. |
|
5649 |
" |
|
5650 |
|viewInSubView| |
|
5651 |
||
5652 |
(shown and:[subViews notNil]) ifTrue:[ |
|
3367 | 5653 |
subViews reverseDo:[:aSubView| |
5654 |
aSubView shown ifTrue:[ |
|
5655 |
viewInSubView := aSubView focusPrevious. |
|
5656 |
||
5657 |
viewInSubView notNil ifTrue:[ |
|
5658 |
^ viewInSubView |
|
5659 |
]. |
|
5660 |
(aSubView canTab and:[aSubView enabled]) ifTrue:[ |
|
5661 |
^ aSubView |
|
5662 |
]. |
|
5663 |
] |
|
5664 |
] |
|
3155 | 5665 |
]. |
5666 |
^ nil |
|
5667 |
||
5668 |
||
5669 |
||
5670 |
! |
|
5671 |
||
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5672 |
requestDoNotFocusOnPointerEnter |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5673 |
"returns true if widget SHOULD NOT request the focus on pointer enter; |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5674 |
if false is returned, the behavior depends upon the settings. |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5675 |
" |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5676 |
^ flagBits bitTest:FlagDoNotRequestFocusOnPointerEnter |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5677 |
! |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5678 |
|
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5679 |
requestDoNotFocusOnPointerEnter:aBoolean |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5680 |
"if true, setup that the widget SHOULD NOT request the focus on pointer enter; |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5681 |
if false, the behavior depends upon the settings. |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5682 |
" |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5683 |
|
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5684 |
aBoolean ifTrue:[ |
3762 | 5685 |
flagBits := flagBits bitOr:FlagDoNotRequestFocusOnPointerEnter |
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5686 |
] ifFalse:[ |
3762 | 5687 |
flagBits := flagBits bitClear:FlagDoNotRequestFocusOnPointerEnter |
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5688 |
]. |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5689 |
! |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5690 |
|
2506 | 5691 |
requestFocus |
5692 |
"request focus from my windowGroup; |
|
5693 |
typically, this is invoked when the mouse pointer enters a |
|
5694 |
widget. The request may or may not be ignored by the wGroup |
|
5695 |
(it will be ignored, if an explicit focus-change is currently |
|
5696 |
active - i.e. if the user tabbed into a widget)" |
|
5697 |
||
5698 |
windowGroup notNil ifTrue:[ |
|
3152 | 5699 |
^ windowGroup focusRequestFrom:self |
2506 | 5700 |
]. |
5701 |
^ true |
|
5702 |
! |
|
5703 |
||
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5704 |
requestFocusOnPointerEnter |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5705 |
"returns true if widget SHOULD request the focus on pointer enter; |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5706 |
if false is returned, the behavior depends upon the settings. |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5707 |
" |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5708 |
^ flagBits bitTest:FlagRequestFocusOnPointerEnter |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5709 |
! |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5710 |
|
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5711 |
requestFocusOnPointerEnter:aBoolean |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5712 |
"if true, setup that the widget SHOULD request the focus on pointer enter; |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5713 |
if false, the behavior depends upon the settings. |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5714 |
" |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5715 |
|
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5716 |
aBoolean ifTrue:[ |
3762 | 5717 |
flagBits := flagBits bitOr:FlagRequestFocusOnPointerEnter |
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5718 |
] ifFalse:[ |
3762 | 5719 |
flagBits := flagBits bitClear:FlagRequestFocusOnPointerEnter |
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5720 |
]. |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5721 |
! |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5722 |
|
2506 | 5723 |
showFocus:explicit |
5724 |
"highlight myself somehow to tell user that I have the focus. |
|
5725 |
If explicit is true, the focus came via focusStepping (i.e. tabbing); |
|
5726 |
if false, it came via the window manager (i.e. pointer entering). |
|
5727 |
Only change my border, if this is an explicit focusChange." |
|
5728 |
||
2907
901ffdc575a8
ask device if it supports borders
Claus Gittinger <cg@exept.de>
parents:
2886
diff
changeset
|
5729 |
|delta clrId bd| |
2506 | 5730 |
|
5731 |
explicit ifTrue:[ |
|
3367 | 5732 |
(drawableId notNil and:[superView notNil]) ifTrue:[ |
5733 |
(styleSheet at:#'focus.showBorder' default:true) ifTrue:[ |
|
5734 |
(device supportsWindowBorder:(bd := DefaultFocusBorderWidth)) ifFalse:[ |
|
5735 |
(device supportsWindowBorder:(bd := 1)) ifFalse:[ |
|
5736 |
bd := 0. |
|
5737 |
] |
|
5738 |
]. |
|
5739 |
delta := bd - borderWidth. |
|
5740 |
delta ~~ 0 ifTrue:[ |
|
5741 |
(left == 0 or:[top == 0]) ifTrue:[ |
|
5742 |
device resizeWindow:drawableId width:width-delta-delta height:height-delta-delta. |
|
5743 |
] ifFalse:[ |
|
5744 |
device moveWindow:drawableId x:left-delta y:top-delta. |
|
5745 |
]. |
|
5746 |
device setWindowBorderWidth:bd in:drawableId. |
|
5747 |
]. |
|
5748 |
||
5749 |
clrId := (DefaultFocusColor onDevice:device) colorId. |
|
5750 |
clrId isNil ifTrue:[ |
|
5751 |
clrId := device blackpixel |
|
5752 |
]. |
|
5753 |
device setWindowBorderColor:clrId in:drawableId. |
|
5754 |
] |
|
5755 |
] |
|
2506 | 5756 |
] ifFalse:[ |
2560 | 5757 |
"/ superView notNil ifTrue:[ |
5758 |
"/ superView showFocus:explicit |
|
5759 |
"/ ] |
|
2506 | 5760 |
] |
5761 |
||
5762 |
"Modified: / 17.9.1998 / 15:08:34 / cg" |
|
5763 |
! |
|
5764 |
||
5765 |
showNoFocus:explicit |
|
5766 |
"undo the effect of showFocus. |
|
5767 |
Explicit tells if the focus came via focusStepping (i.e. tabbing) |
|
5768 |
or via the window manager (i.e. pointer entering). |
|
5769 |
Only change my border, if this is an explicit focusChange." |
|
5770 |
||
2907
901ffdc575a8
ask device if it supports borders
Claus Gittinger <cg@exept.de>
parents:
2886
diff
changeset
|
5771 |
|delta bd| |
2506 | 5772 |
|
5773 |
explicit ifTrue:[ |
|
3367 | 5774 |
(drawableId notNil and:[superView notNil]) ifTrue:[ |
5775 |
(styleSheet at:#'focus.showBorder' default:true) ifTrue:[ |
|
5776 |
(device supportsWindowBorder:(bd := borderWidth)) ifFalse:[ |
|
5777 |
(device supportsWindowBorder:(bd := 1)) ifFalse:[ |
|
5778 |
bd := 0. |
|
5779 |
] |
|
5780 |
]. |
|
5781 |
delta := DefaultFocusBorderWidth - bd. |
|
5782 |
delta ~~ 0 ifTrue:[ |
|
5783 |
device setWindowBorderWidth:bd in:drawableId. |
|
5784 |
device moveWindow:drawableId x:left y:top. |
|
5785 |
device resizeWindow:drawableId width:width height:height. |
|
5786 |
]. |
|
5787 |
self setBorderColor. |
|
5788 |
] |
|
5789 |
] |
|
2506 | 5790 |
] |
5791 |
||
5792 |
"Modified: / 17.9.1998 / 15:08:02 / cg" |
|
5793 |
! |
|
5794 |
||
5795 |
wantsFocusWithButtonPress |
|
2741
7e85a327ce98
added extra query: #wantsFocusWithButtonPress
Claus Gittinger <cg@exept.de>
parents:
2733
diff
changeset
|
5796 |
"views which do not like to take the keyboard focus |
7e85a327ce98
added extra query: #wantsFocusWithButtonPress
Claus Gittinger <cg@exept.de>
parents:
2733
diff
changeset
|
5797 |
with buttonPress can do so by redefining this |
7e85a327ce98
added extra query: #wantsFocusWithButtonPress
Claus Gittinger <cg@exept.de>
parents:
2733
diff
changeset
|
5798 |
to return false" |
7e85a327ce98
added extra query: #wantsFocusWithButtonPress
Claus Gittinger <cg@exept.de>
parents:
2733
diff
changeset
|
5799 |
|
3087 | 5800 |
(self class == SimpleView) ifTrue:[ |
3762 | 5801 |
"/ a pure filler/geometric layout view |
5802 |
^ false |
|
3581
72e09769d372
do not take focus when disabled
Claus Gittinger <cg@exept.de>
parents:
3559
diff
changeset
|
5803 |
]. |
72e09769d372
do not take focus when disabled
Claus Gittinger <cg@exept.de>
parents:
3559
diff
changeset
|
5804 |
^ self enabled |
2741
7e85a327ce98
added extra query: #wantsFocusWithButtonPress
Claus Gittinger <cg@exept.de>
parents:
2733
diff
changeset
|
5805 |
! |
7e85a327ce98
added extra query: #wantsFocusWithButtonPress
Claus Gittinger <cg@exept.de>
parents:
2733
diff
changeset
|
5806 |
|
7e85a327ce98
added extra query: #wantsFocusWithButtonPress
Claus Gittinger <cg@exept.de>
parents:
2733
diff
changeset
|
5807 |
wantsFocusWithPointerEnter |
2506 | 5808 |
"views which like to take the keyboard focus |
2741
7e85a327ce98
added extra query: #wantsFocusWithButtonPress
Claus Gittinger <cg@exept.de>
parents:
2733
diff
changeset
|
5809 |
when the pointer enters can do so by redefining this |
2506 | 5810 |
to return true" |
5811 |
||
2741
7e85a327ce98
added extra query: #wantsFocusWithButtonPress
Claus Gittinger <cg@exept.de>
parents:
2733
diff
changeset
|
5812 |
^ false |
2506 | 5813 |
! ! |
5814 |
||
3087 | 5815 |
!SimpleView methodsFor:'grabbing'! |
5816 |
||
5817 |
forceUngrabKeyboard |
|
5818 |
"force a keyboard ungrab - even if was not the grabber" |
|
5819 |
||
5820 |
device ungrabKeyboard. |
|
5821 |
||
5822 |
! |
|
5823 |
||
5824 |
forceUngrabPointer |
|
5825 |
"force a pointer ungrab - even if was not the grabber" |
|
5826 |
||
5827 |
device ungrabPointer |
|
5828 |
||
5829 |
! |
|
5830 |
||
5831 |
grabKeyboard |
|
5832 |
"grab the keayboard - that is: report all keyboard events to myself, |
|
5833 |
even if the mouse moved out of myself. |
|
5834 |
Returns true, if the grab was sucessfull (could fail, if some other |
|
5835 |
application has a grab - but thats very unlikely)." |
|
5836 |
||
5837 |
^ device grabKeyboardInView:self. |
|
5838 |
! |
|
5839 |
||
5840 |
grabPointer |
|
5841 |
"grab the pointer - that is: report all motion events relative to |
|
5842 |
myself, even if moved out of myself. |
|
5843 |
Returns true, if the grab was sucessfull (could fail, if some other |
|
5844 |
application has a grab - but thats very unlikely)." |
|
5845 |
||
5846 |
^ self grabPointerWithCursor:nil |
|
5847 |
! |
|
5848 |
||
5849 |
grabPointerWithCursor:aCursorOrNil |
|
5850 |
"grab the pointer - that is: report all motion events relative to |
|
5851 |
myself, even if moved out of myself. |
|
5852 |
Show aCursor during the grab, if the cursor argument is not nil. |
|
5853 |
Returns true, if the grab was sucessfull (could fail, if some other |
|
5854 |
application has a grab - but thats very unlikely)." |
|
5855 |
||
5856 |
||
5857 |
"/ (sensor := self sensor) notNil ifTrue:[ |
|
5858 |
"/ "/ make certain all X events have been received |
|
5859 |
"/ device sync. |
|
5860 |
"/ "/ now all events have been received. |
|
5861 |
"/ "/ now, flush all pointer events |
|
5862 |
"/ sensor flushMotionEventsFor:nil |
|
5863 |
"/ ]. |
|
5864 |
||
5865 |
aCursorOrNil notNil ifTrue:[ |
|
3762 | 5866 |
cursor := (aCursorOrNil onDevice:device). |
5867 |
^ device grabPointerInView:self withCursor:cursor |
|
3087 | 5868 |
]. |
5869 |
^ device grabPointerInView:self |
|
5870 |
! |
|
5871 |
||
5872 |
ungrabKeyboard |
|
5873 |
"ungrab the keyboard - but only if I was the grabber" |
|
5874 |
||
5875 |
|sensor| |
|
5876 |
||
5877 |
device activeKeyboardGrab == self ifTrue:[ |
|
3152 | 5878 |
(sensor := self sensor) notNil ifTrue:[ |
5879 |
"/ make certain all X events have been received |
|
5880 |
device sync. |
|
5881 |
"/ now all events have been received. |
|
5882 |
"/ now, flush all pointer events |
|
5883 |
sensor flushKeyboardFor:self |
|
5884 |
]. |
|
5885 |
device ungrabKeyboard. |
|
3087 | 5886 |
]. |
5887 |
||
5888 |
! |
|
5889 |
||
5890 |
ungrabPointer |
|
5891 |
"ungrab the pointer - but only if I was the grabber" |
|
5892 |
||
5893 |
|sensor| |
|
5894 |
||
5895 |
device activePointerGrab == self ifTrue:[ |
|
3152 | 5896 |
(sensor := self sensor) notNil ifTrue:[ |
5897 |
"/ make certain all X events have been received |
|
5898 |
device sync. |
|
5899 |
"/ now all events have been received. |
|
5900 |
"/ now, flush all pointer events |
|
5901 |
sensor flushMotionEventsFor:self |
|
5902 |
]. |
|
5903 |
device ungrabPointer. |
|
3087 | 5904 |
] |
5905 |
! ! |
|
5906 |
||
269 | 5907 |
!SimpleView methodsFor:'informing others of changes'! |
5908 |
||
5909 |
contentsChanged |
|
5910 |
"this one is sent, whenever contents changes size - |
|
5911 |
tell dependents about the change (i.e. scrollers)." |
|
5912 |
||
5913 |
self changed:#sizeOfContents |
|
5914 |
! |
|
5915 |
||
3383
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
5916 |
noticeOfWindowClose |
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
5917 |
|app| |
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
5918 |
|
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
5919 |
(app := self application) notNil ifTrue:[ |
3762 | 5920 |
app noticeOfWindowClose:self |
3383
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
5921 |
]. |
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
5922 |
! |
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
5923 |
|
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
5924 |
noticeOfWindowOpen |
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
5925 |
|app| |
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
5926 |
|
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
5927 |
(app := self application) notNil ifTrue:[ |
3762 | 5928 |
app noticeOfWindowOpen:self |
3383
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
5929 |
]. |
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
5930 |
! |
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
5931 |
|
269 | 5932 |
originChanged:delta |
5933 |
"this one is sent, after the origin of my contents has changed - |
|
5934 |
tell dependents (i.e. scrollers) about this" |
|
5935 |
||
3510 | 5936 |
(delta = (0@0)) ifTrue:[^ self]. |
269 | 5937 |
self changed:#originOfContents with:delta. |
5938 |
"/ subViews notNil ifTrue:[ |
|
5939 |
"/ subViews do:[:aSubView | |
|
5940 |
"/ aSubView pixelOrigin:((aSubView left @ aSubView top) - delta) |
|
5941 |
"/ ] |
|
5942 |
"/ ] |
|
5943 |
! |
|
5944 |
||
5945 |
originWillChange |
|
5946 |
"this one is sent, just before viewOrigin changes - |
|
5947 |
gives subclasses a chance to catch scrolls easily |
|
5948 |
(for example to hide cursor before scroll)" |
|
5949 |
||
5950 |
^ self |
|
5951 |
! ! |
|
5952 |
||
3165 | 5953 |
!SimpleView methodsFor:'initialization & release'! |
269 | 5954 |
|
5955 |
defaultControllerClass |
|
5956 |
^ nil "/ Controller |
|
5957 |
! |
|
5958 |
||
483
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
5959 |
defaultExtent |
586 | 5960 |
"return the default extent of my instances." |
5961 |
||
483
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
5962 |
^ self class defaultExtent |
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
5963 |
|
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
5964 |
"Created: 1.3.1996 / 19:20:46 / cg" |
586 | 5965 |
"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
|
5966 |
! |
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
5967 |
|
3662 | 5968 |
defaultFont |
5969 |
^ self class defaultFont |
|
5970 |
! |
|
5971 |
||
2573 | 5972 |
destroy |
5973 |
"unmap & destroy - make me invisible, destroy subviews then |
|
5974 |
make me unknown to the device" |
|
5975 |
||
5976 |
realized ifTrue:[ |
|
3762 | 5977 |
self unmap. |
2573 | 5978 |
]. |
5979 |
shown := false. |
|
5980 |
||
5981 |
"/ controller notNil ifTrue:[ |
|
5982 |
"/ controller release. |
|
5983 |
"/ controller := nil. |
|
5984 |
"/ ]. |
|
5985 |
||
5986 |
subViews notNil ifTrue:[ |
|
3762 | 5987 |
self destroySubViews. |
2573 | 5988 |
]. |
5989 |
superView notNil ifTrue:[ |
|
3762 | 5990 |
superView removeSubView:self. |
5991 |
superView := nil |
|
2573 | 5992 |
]. |
5993 |
super destroy. |
|
5994 |
||
3709 | 5995 |
self release. |
5996 |
||
2573 | 5997 |
"/ superView isNil ifTrue:[ |
5998 |
"/ device flush |
|
5999 |
"/ ]. |
|
6000 |
||
6001 |
controller notNil ifTrue:[ |
|
3762 | 6002 |
controller release. |
6003 |
controller := nil. |
|
2573 | 6004 |
]. |
6005 |
||
6006 |
windowGroup notNil ifTrue:[ |
|
3762 | 6007 |
windowGroup removeView:self. |
6008 |
windowGroup := nil |
|
3383
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
6009 |
]. |
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
6010 |
|
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
6011 |
self noticeOfWindowClose. |
2573 | 6012 |
! |
6013 |
||
269 | 6014 |
initEvents |
6015 |
"will be sent by create - can be redefined by subclasses to enable |
|
6016 |
view events" |
|
6017 |
||
6018 |
^ self |
|
6019 |
! |
|
6020 |
||
6021 |
initStyle |
|
6022 |
"this method sets up all style dependent things" |
|
6023 |
||
6024 |
self initStyleSheet. |
|
6025 |
||
6026 |
borderWidth := DefaultBorderWidth. |
|
6027 |
borderWidth isNil ifTrue:[borderWidth := 1]. |
|
6028 |
||
6029 |
viewBackground := DefaultViewBackgroundColor. |
|
6030 |
||
6031 |
DefaultLightColor notNil ifTrue:[ |
|
3762 | 6032 |
lightColor := DefaultLightColor. |
269 | 6033 |
] ifFalse:[ |
3762 | 6034 |
device hasGrayscales ifTrue:[ |
6035 |
DefaultLightColor := lightColor := viewBackground lightened. |
|
6036 |
] ifFalse:[ |
|
6037 |
" |
|
6038 |
this seems strange: on B&W screens, we create the light color |
|
6039 |
darker than normal viewBackground (White) - |
|
6040 |
to make the boundary of the view visible |
|
6041 |
" |
|
6042 |
lightColor := Color gray:50 |
|
6043 |
] |
|
269 | 6044 |
]. |
6045 |
DefaultShadowColor notNil ifTrue:[ |
|
3762 | 6046 |
shadowColor := DefaultShadowColor. |
269 | 6047 |
] ifFalse:[ |
3762 | 6048 |
shadowColor := Black |
3669 | 6049 |
]. |
6050 |
||
269 | 6051 |
borderColor := DefaultBorderColor. |
3669 | 6052 |
"/ font := self defaultFont. -- already done in #initialize |
2829 | 6053 |
font := font onDevice:device. |
747 | 6054 |
|
749 | 6055 |
"Modified: 28.5.1996 / 21:13:58 / cg" |
269 | 6056 |
! |
6057 |
||
6058 |
initStyleSheet |
|
6059 |
"this method gets the styleSheet" |
|
6060 |
||
6061 |
" |
|
6062 |
when coming here the first time, we read the styleSheet |
|
6063 |
and keep the values in fast class variables |
|
6064 |
" |
|
6065 |
StyleSheet isNil ifTrue:[ |
|
3765 | 6066 |
DefaultStyle isNil ifTrue:[ |
6067 |
"/ the very-very first time (no styleSheet yet) |
|
6068 |
View setDefaultStyle. |
|
6069 |
View defaultStyle:DefaultStyle. |
|
6070 |
]. |
|
6071 |
SimpleView updateAllStyleCaches |
|
269 | 6072 |
]. |
6073 |
||
6074 |
styleSheet := StyleSheet. |
|
1005
03041f7fb340
init styleSheet (in case no startup file did it)
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
6075 |
|
03041f7fb340
init styleSheet (in case no startup file did it)
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
6076 |
"Modified: 25.7.1996 / 22:00:06 / cg" |
269 | 6077 |
! |
6078 |
||
6079 |
initialize |
|
6080 |
"initialize all state of the view - usually redefined in subclasses, |
|
6081 |
but always doing a 'super initialize'. Each class should setup its |
|
6082 |
locals - and not forget the others. |
|
6083 |
View setup is separated into two parts, the general setup done here |
|
6084 |
and the style specific setup in initStyle. Each view should be prepared |
|
6085 |
for a stylechange by being sent another initStyle with a new style value. |
|
6086 |
(in this case, it should set all of its style-dependent things, but |
|
6087 |
leave the state and contents as-is)" |
|
6088 |
||
6089 |
|ext myClass controllerClass| |
|
6090 |
||
3375 | 6091 |
flagBits := 0. |
6092 |
||
269 | 6093 |
super initialize. |
6094 |
||
3662 | 6095 |
font := self defaultFont. |
4123 | 6096 |
font := font onDevice:device. |
269 | 6097 |
|
6098 |
shown := hiddenOnRealize := realized := false. |
|
6099 |
||
6100 |
"fill in some defaults - some of them are usually redefined in subclasses |
|
6101 |
initialize methods" |
|
6102 |
||
6103 |
myClass := self class. |
|
6104 |
name := myClass name "asString" asLowercaseFirst. |
|
6105 |
resources := myClass classResources. |
|
6106 |
||
2382 | 6107 |
level := borderWidth := margin := 0. |
269 | 6108 |
|
6109 |
self initStyle. |
|
6110 |
||
483
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
6111 |
ext := self defaultExtent. |
269 | 6112 |
left := top := 0. |
6113 |
width := ext x. |
|
6114 |
height := ext y. |
|
6115 |
||
3375 | 6116 |
self originChangedFlag:false. |
6117 |
self extentChangedFlag:false. |
|
6118 |
self cornerChangedFlag:false. |
|
2084
e997f6ea54c2
also pass down #larger to sizeCanged: method.
Claus Gittinger <cg@exept.de>
parents:
2061
diff
changeset
|
6119 |
bitGravity := #NorthWest. "/ nil. |
269 | 6120 |
viewGravity := nil. |
6121 |
||
6122 |
controllerClass := self defaultControllerClass. |
|
6123 |
controllerClass notNil ifTrue:[ |
|
3967
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
6124 |
controller := controllerClass new. |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
6125 |
controller view:self. |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
6126 |
]. |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
6127 |
|
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
6128 |
self initializeMiddleButtonMenu. |
2382 | 6129 |
|
6130 |
"Modified: / 1.10.1998 / 14:31:05 / cg" |
|
269 | 6131 |
! |
6132 |
||
6133 |
initializeMiddleButtonMenu |
|
3968 | 6134 |
"a place to initialize menu - this one is sent once when the view-object is initialized. |
6135 |
usually redefined in subclasses; default here is no menu. |
|
269 | 6136 |
Notice, that static middleButtonmenus are a historic thing in ST/X; |
3968 | 6137 |
you may prefer to create the menu dynamically." |
269 | 6138 |
|
6139 |
^ self |
|
6140 |
! |
|
6141 |
||
6142 |
prepareForReinit |
|
6143 |
super prepareForReinit. |
|
6144 |
windowGroup notNil ifTrue:[ |
|
3152 | 6145 |
windowGroup reinitialize |
269 | 6146 |
] |
6147 |
! |
|
6148 |
||
6149 |
reinitStyle |
|
6150 |
"this method is called for a style change" |
|
6151 |
||
6152 |
|t| |
|
6153 |
||
6154 |
self initStyle. |
|
3945
bdbc16f787dc
systemColorChange on windows
Claus Gittinger <cg@exept.de>
parents:
3926
diff
changeset
|
6155 |
(drawableId notNil and:[gcId notNil]) ifTrue:[ |
bdbc16f787dc
systemColorChange on windows
Claus Gittinger <cg@exept.de>
parents:
3926
diff
changeset
|
6156 |
"force a change" |
bdbc16f787dc
systemColorChange on windows
Claus Gittinger <cg@exept.de>
parents:
3926
diff
changeset
|
6157 |
t := borderWidth. borderWidth := nil. self borderWidth:t. |
bdbc16f787dc
systemColorChange on windows
Claus Gittinger <cg@exept.de>
parents:
3926
diff
changeset
|
6158 |
t := viewBackground. viewBackground := nil. self viewBackground:t. |
4069 | 6159 |
self clearView. |
3945
bdbc16f787dc
systemColorChange on windows
Claus Gittinger <cg@exept.de>
parents:
3926
diff
changeset
|
6160 |
self invalidate. |
2357
29a966362aad
clear and invalidate in reinitStyle.
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
6161 |
]. |
29a966362aad
clear and invalidate in reinitStyle.
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
6162 |
|
29a966362aad
clear and invalidate in reinitStyle.
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
6163 |
"Modified: / 18.9.1998 / 21:15:33 / cg" |
269 | 6164 |
! |
6165 |
||
6166 |
reinitialize |
|
795 | 6167 |
"this is called right after snapIn" |
269 | 6168 |
|
2649 | 6169 |
|myController sv| |
269 | 6170 |
|
6171 |
"if I have already been reinited - return" |
|
6172 |
drawableId notNil ifTrue:[ |
|
3152 | 6173 |
^ self |
269 | 6174 |
]. |
6175 |
||
6176 |
" |
|
6177 |
superView must be there, first |
|
6178 |
" |
|
6179 |
superView notNil ifTrue:[ |
|
3152 | 6180 |
(sv := superView view) id isNil ifTrue:[ |
6181 |
sv reinitialize |
|
6182 |
] |
|
2452
0c63e21efd57
(re)initCursor in reinitialize (i.e. after snapIn)
Claus Gittinger <cg@exept.de>
parents:
2451
diff
changeset
|
6183 |
]. |
0c63e21efd57
(re)initCursor in reinitialize (i.e. after snapIn)
Claus Gittinger <cg@exept.de>
parents:
2451
diff
changeset
|
6184 |
|
0c63e21efd57
(re)initCursor in reinitialize (i.e. after snapIn)
Claus Gittinger <cg@exept.de>
parents:
2451
diff
changeset
|
6185 |
"reinit cursor" |
0c63e21efd57
(re)initCursor in reinitialize (i.e. after snapIn)
Claus Gittinger <cg@exept.de>
parents:
2451
diff
changeset
|
6186 |
self initCursor. |
269 | 6187 |
|
6188 |
myController := controller. |
|
6189 |
controller := nil. |
|
6190 |
self recreate. |
|
6191 |
||
6192 |
"if I was mapped, do it again" |
|
6193 |
realized ifTrue:[ |
|
3152 | 6194 |
"only remap if I have a superview - otherwise, I might be |
6195 |
a hidden iconView or menu ..." |
|
6196 |
superView notNil ifTrue:[ |
|
269 | 6197 |
"/ shown ifTrue:[ |
3152 | 6198 |
device |
6199 |
mapView:self id:drawableId iconified:false |
|
6200 |
atX:left y:top width:width height:height |
|
6201 |
minExtent:(self minExtent) maxExtent:(self maxExtent) |
|
269 | 6202 |
"/ ]. |
3152 | 6203 |
]. |
269 | 6204 |
]. |
6205 |
||
6206 |
"restore controller" |
|
2452
0c63e21efd57
(re)initCursor in reinitialize (i.e. after snapIn)
Claus Gittinger <cg@exept.de>
parents:
2451
diff
changeset
|
6207 |
controller := myController. |
795 | 6208 |
|
2649 | 6209 |
"Modified: / 6.5.1999 / 13:11:07 / cg" |
135 | 6210 |
! ! |
6211 |
||
3371 | 6212 |
!SimpleView methodsFor:'keyboard control'! |
6213 |
||
6214 |
defineShortcutAndTranslateLabelStringFrom:aString |
|
6215 |
|i| |
|
6216 |
||
6217 |
aString isString ifFalse:[ ^ aString]. |
|
6218 |
||
6219 |
(aString includes:$&) ifFalse:[ ^ aString]. |
|
6220 |
i := self shortcutAndTranslatedStringFrom:aString. |
|
6221 |
self shortcutKey:(i at:1). |
|
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6222 |
^ i at:2. |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6223 |
! |
3371 | 6224 |
|
6225 |
mnemonicKey |
|
6226 |
"get the mnemonic key or nil if undefined |
|
6227 |
" |
|
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6228 |
^ self objectAttributeAt:#mnemonicKey |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6229 |
! |
3371 | 6230 |
|
6231 |
mnemonicKey:aSymbolOrNil |
|
6232 |
"set or clear the mnemonic key |
|
6233 |
" |
|
6234 |
aSymbolOrNil isSymbol ifTrue:[ |
|
3762 | 6235 |
self objectAttributeAt:#mnemonicKey put:aSymbolOrNil |
3371 | 6236 |
] ifFalse:[ |
3762 | 6237 |
self removeObjectAttribute:#mnemonicKey |
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6238 |
]. |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6239 |
! |
3371 | 6240 |
|
6241 |
mnemonicViewNext:aKeyEvent |
|
6242 |
"a mnemonicKey event as forwarded from the keyboardProcessor - if there |
|
6243 |
is the mnemonic-key defined for a subView return the view otherwise nil. |
|
6244 |
" |
|
6245 |
|key rawKey mnemonic view| |
|
6246 |
||
6247 |
key := aKeyEvent key. |
|
6248 |
rawKey := aKeyEvent rawKey. |
|
6249 |
||
6250 |
(shown and:[subViews notNil]) ifTrue:[ |
|
6251 |
||
3762 | 6252 |
subViews do:[:aSubView| |
6253 |
aSubView shown ifTrue:[ |
|
6254 |
( aSubView enabled |
|
6255 |
and:[(mnemonic := aSubView mnemonicKey) notNil |
|
6256 |
and:[(mnemonic == rawKey or:[mnemonic == key])]] |
|
6257 |
) ifTrue:[ |
|
6258 |
^ aSubView |
|
6259 |
]. |
|
6260 |
||
6261 |
(view := aSubView mnemonicViewNext:aKeyEvent) notNil ifTrue:[ |
|
6262 |
^ view |
|
6263 |
]. |
|
6264 |
] |
|
6265 |
] |
|
3371 | 6266 |
]. |
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6267 |
^ nil |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6268 |
! |
3371 | 6269 |
|
6270 |
performShortcutAction |
|
6271 |
"perform my shortcutKey action. |
|
6272 |
" |
|
3374 | 6273 |
"/ intentionally left blank here |
6274 |
! |
|
3371 | 6275 |
|
6276 |
processShortcut:aKeyEvent |
|
6277 |
"a shortcutKey event as forwarded from the keyboardProcessor - if there is the |
|
6278 |
shortcut-key defined process the shortcut and return true otherwise false. |
|
6279 |
" |
|
6280 |
|key| |
|
6281 |
||
6282 |
shown ifTrue:[ |
|
3762 | 6283 |
self enabled ifTrue:[ |
6284 |
(key := self shortcutKey) notNil ifTrue:[ |
|
6285 |
(key == aKeyEvent key or:[key == aKeyEvent rawKey]) ifTrue:[ |
|
6286 |
self requestFocus. |
|
6287 |
(controller ? self) performShortcutAction. |
|
6288 |
^ true |
|
6289 |
] |
|
6290 |
]. |
|
6291 |
]. |
|
6292 |
||
6293 |
subViews notNil ifTrue:[ |
|
6294 |
subViews do:[:aSubView| |
|
6295 |
(aSubView processShortcut:aKeyEvent) ifTrue:[ |
|
6296 |
^ true |
|
6297 |
] |
|
6298 |
] |
|
6299 |
] |
|
3371 | 6300 |
]. |
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6301 |
^ false |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6302 |
! |
3371 | 6303 |
|
6304 |
shortcutAndTranslatedStringFrom:aString |
|
6305 |
"return an array filled with an extracted shortcut key and a translated string; |
|
6306 |
looks for and reemoves any ampercent character from aString, and adds underline emphasis to the |
|
6307 |
following character" |
|
6308 |
||
3642 | 6309 |
|xLatedString c n s pos shortcutCharacter shortcut| |
3371 | 6310 |
|
6311 |
xLatedString := '' writeStream. |
|
6312 |
s := aString readStream. |
|
6313 |
||
6314 |
[s atEnd] whileFalse:[ |
|
3762 | 6315 |
c := s next. |
6316 |
c == $& ifTrue:[ |
|
6317 |
n := s peek. |
|
6318 |
(n notNil and:[n isLetter]) ifTrue:[ |
|
6319 |
c := s next. |
|
6320 |
pos := xLatedString size + 1. |
|
6321 |
] ifFalse:[ |
|
6322 |
n == $& ifTrue:[ |
|
6323 |
s next. |
|
6324 |
] |
|
6325 |
] |
|
6326 |
]. |
|
6327 |
c notNil ifTrue:[ |
|
6328 |
xLatedString nextPut:c |
|
6329 |
] |
|
3371 | 6330 |
]. |
6331 |
||
6332 |
xLatedString := xLatedString contents. |
|
6333 |
pos notNil ifTrue:[ |
|
3762 | 6334 |
shortcutCharacter := xLatedString at:pos ifAbsent:nil. |
6335 |
||
6336 |
xLatedString isText ifFalse:[ |
|
6337 |
xLatedString := Text string:xLatedString |
|
6338 |
]. |
|
6339 |
xLatedString emphasisAt:pos add:#underline. |
|
6340 |
||
6341 |
shortcut := ('Cmd' , shortcutCharacter asLowercase) asSymbol. |
|
3371 | 6342 |
]. |
6343 |
^ Array with:shortcut with:xLatedString |
|
6344 |
||
6345 |
" |
|
6346 |
Transcript showCR:(self basicNew shortcutAndTranslatedStringFrom:'hello' ) last |
|
6347 |
Transcript showCR:(self basicNew shortcutAndTranslatedStringFrom:'he&llo' ) last |
|
6348 |
Transcript showCR:(self basicNew shortcutAndTranslatedStringFrom:'he&&llo' ) last |
|
6349 |
Transcript showCR:(self basicNew shortcutAndTranslatedStringFrom:'he& llo' ) last |
|
6350 |
Transcript showCR:(self basicNew shortcutAndTranslatedStringFrom:'he&123llo' ) last |
|
6351 |
Transcript showCR:(self basicNew shortcutAndTranslatedStringFrom:'hello &' ) last |
|
6352 |
Transcript showCR:(self basicNew shortcutAndTranslatedStringFrom:'hello &&' ) last |
|
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6353 |
" |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6354 |
! |
3371 | 6355 |
|
6356 |
shortcutKey |
|
6357 |
"get the shortcut key |
|
6358 |
" |
|
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6359 |
^ self objectAttributeAt:#shortcutKey |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6360 |
! |
3371 | 6361 |
|
6362 |
shortcutKey:aSymbolOrNil |
|
6363 |
"set or clear the shortcut key |
|
6364 |
" |
|
6365 |
aSymbolOrNil isSymbol ifTrue:[ |
|
3762 | 6366 |
self objectAttributeAt:#shortcutKey put:aSymbolOrNil |
3371 | 6367 |
] ifFalse:[ |
3762 | 6368 |
self removeObjectAttribute:#shortcutKey |
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6369 |
]. |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6370 |
! ! |
3371 | 6371 |
|
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6372 |
!SimpleView methodsFor:'menu handling'! |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6373 |
|
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6374 |
activateMenu |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6375 |
"activate my menu. |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6376 |
This code will move into the controller ASAP |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6377 |
If there is a static middleButtonMenu, that one is taken, |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6378 |
and handled in the superClass (static menus are a historic leftOver). |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6379 |
Otherwise, the follwing steps are performed: |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6380 |
|
4189
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6381 |
- ask the receiver for the menu (via #yellowButtonMenu) |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6382 |
- ask the receiver for the menuPerformer. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6383 |
- startUp the menu - it is supposed to return an actionSelector |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6384 |
- if the menuPerformer responds to the selector, |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6385 |
send it to the performer; |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6386 |
otherwise send it to the view (the receiver) |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6387 |
This is funny, it allows additional menuItems to be added |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6388 |
AND still get the views copy/cut/paste functionality. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6389 |
Without this, you had to redefine and forward all of those |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6390 |
messages in the performer." |
2489
f7ce16896fa1
process exposes when menu closes.
Claus Gittinger <cg@exept.de>
parents:
2465
diff
changeset
|
6391 |
|
f7ce16896fa1
process exposes when menu closes.
Claus Gittinger <cg@exept.de>
parents:
2465
diff
changeset
|
6392 |
|menu menuPerformer actionSelector prevReceiver wg| |
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6393 |
|
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6394 |
middleButtonMenu isNil ifTrue:[ |
4189
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6395 |
" |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6396 |
try ST-80 style menus first: |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6397 |
if there is a model, and a menuMessage is defined, |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6398 |
ask model for the menu and launch that if non-nil. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6399 |
" |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6400 |
menu := self yellowButtonMenu. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6401 |
menu notNil ifTrue:[ |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6402 |
" |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6403 |
got one, launch the menu. It is supposed |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6404 |
to return an actionSelector. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6405 |
" |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6406 |
menuPerformer := self menuPerformer value. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6407 |
|
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6408 |
"/ could be a spec ... |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6409 |
menu isArray ifTrue:[ |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6410 |
menu := menu decodeAsLiteralArray. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6411 |
menu receiver:menuPerformer. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6412 |
menu findGuiResourcesIn:self application. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6413 |
] ifFalse:[ |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6414 |
(menu respondsTo:#receiver) ifTrue:[ |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6415 |
menuPerformer := menu receiver ? menuPerformer. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6416 |
]. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6417 |
]. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6418 |
|
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6419 |
" |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6420 |
a temporary kludge: |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6421 |
pass myself as receiver, the menuPerformer as performer; |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6422 |
the menu will send its messages to either the |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6423 |
menuPerformer or me (its receiver). |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6424 |
This allows for the ST-80 behavior, where some messages |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6425 |
go to the model, others to the view |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6426 |
(copy/cut/paste). |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6427 |
" |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6428 |
(prevReceiver := menu receiver) isNil ifTrue:[ |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6429 |
"/ kludge for oldStyle menus (MenuView/PopUpMenu) |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6430 |
"/ not req'd for real Menus |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6431 |
"/ (menu isKindOf:Menu) ifFalse:[ |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6432 |
(menu respondsTo:#menuPerformer:) ifTrue:[ |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6433 |
menu receiver:self. "/ really ? |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6434 |
menu menuPerformer:menuPerformer. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6435 |
] ifFalse:[ |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6436 |
"/ ] ifTrue:[ |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6437 |
"/ new style menu |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6438 |
menu receiver:menuPerformer. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6439 |
] |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6440 |
]. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6441 |
|
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6442 |
"/ |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6443 |
"/ startup the menu - this returns a selector |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6444 |
"/ |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6445 |
actionSelector := self startUpMenu:menu. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6446 |
|
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6447 |
"/ before doing anything else, redraw expose area from |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6448 |
"/ the menu (in case the action changes my state) |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6449 |
(wg := self windowGroup) notNil ifTrue:[ |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6450 |
wg processExposeEvents. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6451 |
]. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6452 |
|
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6453 |
(actionSelector notNil and:[actionSelector isSymbol]) ifTrue:[ |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6454 |
self dispatchMenuSelection:actionSelector to: menuPerformer. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6455 |
]. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6456 |
|
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6457 |
menu receiver:prevReceiver. |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6458 |
|
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6459 |
^ self |
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
6460 |
]. |
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6461 |
]. |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6462 |
|
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6463 |
"/ |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6464 |
"/ old style static menu |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6465 |
"/ |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6466 |
super activateMenu |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6467 |
|
2127 | 6468 |
"Created: / 1.3.1996 / 13:24:18 / cg" |
2246
8666105a8750
care for menuPerformer, when using newStyle menu in
Claus Gittinger <cg@exept.de>
parents:
2243
diff
changeset
|
6469 |
"Modified: / 14.8.1998 / 18:09:31 / cg" |
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6470 |
! |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6471 |
|
3241 | 6472 |
dispatchMenuSelection:menuSelection to:aMenuPerformerOrNil |
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6473 |
"dispatch a menu message. |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6474 |
This code will move into the controller ASAP" |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6475 |
|
1943 | 6476 |
|actionSelector actionArg1 actionArg2 app menuPerformer| |
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6477 |
|
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6478 |
actionSelector := menuSelection. |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6479 |
|
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6480 |
" |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6481 |
mhmh - kludge for selectors with argument |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6482 |
" |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6483 |
(menuSelection isMemberOf:Array) ifTrue:[ |
3762 | 6484 |
actionArg1 := menuSelection at:2. |
6485 |
actionSelector := menuSelection at:1. |
|
3241 | 6486 |
]. |
6487 |
||
6488 |
menuPerformer := aMenuPerformerOrNil ? self menuPerformer. |
|
1839 | 6489 |
|
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6490 |
" |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6491 |
mhmh - ST-80 seems to send some to the model and |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6492 |
others (copy/cut/paste) to the controller/view |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6493 |
Simulate this behavior, by looking what the model responds to. |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6494 |
" |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6495 |
actionSelector isSymbol ifTrue:[ |
3762 | 6496 |
(menuPerformer respondsTo:actionSelector) ifFalse:[ |
6497 |
((app := self application) respondsTo:actionSelector) ifTrue:[ |
|
6498 |
menuPerformer := app. |
|
6499 |
actionArg1 := self model. |
|
6500 |
actionArg2 := self controller. |
|
6501 |
] ifFalse:[ |
|
6502 |
(self respondsTo:actionSelector) ifTrue:[ |
|
6503 |
menuPerformer := self |
|
6504 |
] |
|
6505 |
] |
|
6506 |
]. |
|
6507 |
menuPerformer perform:actionSelector withOptionalArgument:actionArg1 and:actionArg2. |
|
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6508 |
]. |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6509 |
|
1943 | 6510 |
"Created: / 20.6.1997 / 11:47:42 / cg" |
6511 |
"Modified: / 1.11.1997 / 13:45:23 / cg" |
|
3533 | 6512 |
! |
6513 |
||
6514 |
menuFromSpec:aMenuOrMenuSpec |
|
6515 |
"create a menu for the receiver from a spec" |
|
6516 |
||
3559 | 6517 |
|spec| |
6518 |
||
6519 |
aMenuOrMenuSpec isNil ifTrue:[^ nil]. |
|
3533 | 6520 |
|
6521 |
aMenuOrMenuSpec isArray ifTrue:[ |
|
3762 | 6522 |
spec := aMenuOrMenuSpec decodeAsLiteralArray. |
3533 | 6523 |
] ifFalse:[ |
3762 | 6524 |
spec := aMenuOrMenuSpec. |
3533 | 6525 |
]. |
3556
eaea177415b0
findGuiResources... now sets the receiver, if not yet set
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
6526 |
"/ spec receiver:self. -- now done in findGuiResources ... |
3533 | 6527 |
spec findGuiResourcesIn:self. |
6528 |
^ spec. |
|
3752 | 6529 |
! |
6530 |
||
6531 |
startUpMenu:aMenu |
|
3753 | 6532 |
^ aMenu startUpFor:self |
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6533 |
! ! |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6534 |
|
140 | 6535 |
!SimpleView methodsFor:'private'! |
6536 |
||
659 | 6537 |
componentsContainingX:x y:y do:aBlock |
6538 |
components notNil ifTrue:[ |
|
3762 | 6539 |
components reverseDo:[:aComponent | |
6540 |
|thisFrame| |
|
6541 |
||
6542 |
thisFrame := aComponent bounds. |
|
6543 |
(thisFrame containsPointX:x y:y) ifTrue:[ |
|
6544 |
"/ prepare for masked/non-rectangular components ... |
|
6545 |
(aComponent perform:#containsPointX:y: with:x with:y ifNotUnderstood:true) |
|
6546 |
ifTrue:[ |
|
6547 |
aBlock value:aComponent |
|
6548 |
value:x - thisFrame left |
|
6549 |
value:y - thisFrame top. |
|
6550 |
] |
|
6551 |
] |
|
6552 |
] |
|
659 | 6553 |
]. |
6554 |
||
6555 |
"Created: 8.5.1996 / 23:40:59 / cg" |
|
6556 |
! |
|
6557 |
||
140 | 6558 |
computeInnerClip |
6559 |
"compute, but do not set the inside clip-area" |
|
6560 |
||
6561 |
|m2 nX nY nW nH| |
|
6562 |
||
4139 | 6563 |
margin isNil ifTrue:[margin := 0]. |
140 | 6564 |
(margin ~~ 0) ifTrue:[ |
4139 | 6565 |
m2 := margin + margin. |
6566 |
nX := nY := margin. |
|
6567 |
nW := width - m2. |
|
6568 |
nH := height - m2. |
|
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
6569 |
"/ transformation notNil ifTrue:[ |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
6570 |
"/ nX := transformation applyInverseToX:nX. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
6571 |
"/ nY := transformation applyInverseToY:nY. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
6572 |
"/ nW := transformation applyInverseScaleX:nW. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
6573 |
"/ nH := transformation applyInverseScaleY:nH. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
6574 |
"/ ]. |
4139 | 6575 |
innerClipRect := Rectangle |
6576 |
left:nX |
|
6577 |
top:nY |
|
6578 |
width:nW |
|
6579 |
height:nH |
|
140 | 6580 |
] ifFalse:[ |
4139 | 6581 |
"no clipping" |
6582 |
innerClipRect := nil |
|
140 | 6583 |
] |
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
6584 |
|
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
6585 |
"Modified: / 22.5.1999 / 16:50:58 / cg" |
140 | 6586 |
! |
6587 |
||
269 | 6588 |
cornerFromRelativeCorner |
6589 |
"compute & return pixel corner from relativeCorner" |
|
6590 |
||
6591 |
^ self cornerFromRelativeCorner:relativeCorner |
|
6592 |
! |
|
6593 |
||
6594 |
cornerFromRelativeCorner:aPoint |
|
6595 |
"compute & return pixel corner from a relativeCorner, aPoint" |
|
6596 |
||
6597 |
|p r b bw| |
|
6598 |
||
6599 |
p := self pointFromRelative:aPoint. |
|
6600 |
||
2382 | 6601 |
bw := borderWidth ? 0. |
269 | 6602 |
insets isNil ifTrue:[ |
3152 | 6603 |
bw == 0 ifTrue:[ |
6604 |
^ p |
|
6605 |
]. |
|
6606 |
^ (p x - bw) @ (p y - bw) |
|
269 | 6607 |
]. |
6608 |
r := (insets at:3) + bw. |
|
6609 |
b := (insets at:4) + bw. |
|
6610 |
||
6611 |
"/ r := b := bw. |
|
6612 |
"/ rightInset notNil ifTrue:[ |
|
6613 |
"/ r := rightInset + bw |
|
6614 |
"/ ]. |
|
6615 |
"/ bottomInset notNil ifTrue:[ |
|
6616 |
"/ b := bottomInset + bw |
|
6617 |
"/ ]. |
|
6618 |
((r ~~ 0) or:[b ~~ 0]) ifTrue:[ |
|
3152 | 6619 |
^ (p x - r) @ (p y - b) |
269 | 6620 |
]. |
6621 |
^ p |
|
2382 | 6622 |
|
6623 |
"Modified: / 1.10.1998 / 13:21:33 / cg" |
|
269 | 6624 |
! |
6625 |
||
3518
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
6626 |
detectViewAt:aPoint |
3540 | 6627 |
"find the subView which contains aPoint - invisible components are ignored. |
6628 |
This is almost the same as #componentContainingX:y: (if that existed) " |
|
6629 |
||
6630 |
^ self detectViewAt:aPoint ignoreInvisible:false |
|
6631 |
! |
|
6632 |
||
6633 |
detectViewAt:aPoint ignoreInvisible:ignoreInvisible |
|
6634 |
"find the subView which contains aPoint - invisible components are ignored if |
|
6635 |
the ignoreInvisible argument is false. |
|
3518
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
6636 |
This is almost the same as #componentContainingX:y: (if that existed) " |
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
6637 |
|
3642 | 6638 |
|subViews| |
3518
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
6639 |
|
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
6640 |
(subViews := self subViews) notNil ifTrue:[ |
3762 | 6641 |
subViews do:[:v| |p| |
6642 |
(ignoreInvisible or:[v shown]) ifTrue:[ |
|
6643 |
( (aPoint x between:(v left) and:(v right)) |
|
6644 |
and:[aPoint y between:(v top) and:(v bottom)] |
|
6645 |
) ifTrue:[ |
|
6646 |
"/ found a subview - the point is there |
|
6647 |
p := device translatePoint:aPoint fromView:self toView:v. |
|
6648 |
^ v detectViewAt:p ignoreInvisible:ignoreInvisible. |
|
6649 |
] |
|
6650 |
] |
|
6651 |
] |
|
3518
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
6652 |
]. |
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
6653 |
"/ no subview - the point is here |
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
6654 |
^ self |
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
6655 |
|
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
6656 |
"Modified: / 10.10.2001 / 13:45:26 / cg" |
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
6657 |
! |
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
6658 |
|
269 | 6659 |
extentFromRelativeExtent |
6660 |
"compute & return pixel extent from relativeExtent" |
|
6661 |
||
6662 |
^ self extentFromRelativeExtent:relativeExtent |
|
6663 |
! |
|
6664 |
||
6665 |
extentFromRelativeExtent:aPoint |
|
6666 |
"compute & return pixel extent from relativeExtent, aPoint" |
|
6667 |
||
6668 |
|rel newX newY inRect bw2 i| |
|
6669 |
||
6670 |
superView isNil ifTrue:[ |
|
3152 | 6671 |
inRect := 0@0 extent:device extent |
269 | 6672 |
] ifFalse:[ |
3152 | 6673 |
inRect := superView viewRectangle. |
269 | 6674 |
]. |
6675 |
||
6676 |
bw2 := borderWidth * 2. |
|
6677 |
||
6678 |
rel := aPoint x. |
|
6679 |
rel isInteger ifFalse:[ |
|
3152 | 6680 |
newX := (rel * (inRect width + bw2)) asInteger + inRect left. |
6681 |
(borderWidth ~~ 0) ifTrue:[ |
|
6682 |
newX := newX - borderWidth |
|
6683 |
]. |
|
269 | 6684 |
] ifTrue:[ |
3152 | 6685 |
newX := rel |
269 | 6686 |
]. |
6687 |
||
6688 |
rel := aPoint y. |
|
6689 |
rel isInteger ifFalse:[ |
|
3152 | 6690 |
newY := (rel * (inRect height + bw2)) asInteger + inRect top. |
6691 |
(borderWidth ~~ 0) ifTrue:[ |
|
6692 |
newY := newY - borderWidth |
|
6693 |
]. |
|
269 | 6694 |
] ifTrue:[ |
3152 | 6695 |
newY := rel |
269 | 6696 |
]. |
6697 |
||
6698 |
insets notNil ifTrue:[ |
|
3152 | 6699 |
i := insets at:1. "top" |
6700 |
(i ~~ 0) ifTrue:[ |
|
6701 |
newX := newX - i |
|
6702 |
]. |
|
6703 |
i := insets at:3. "left" |
|
6704 |
(i ~~ 0) ifTrue:[ |
|
6705 |
newX := newX - i |
|
6706 |
]. |
|
6707 |
i := insets at:2. "right" |
|
6708 |
(i ~~ 0) ifTrue:[ |
|
6709 |
newY := newY - i |
|
6710 |
]. |
|
6711 |
i := insets at:4. "bottom" |
|
6712 |
(i ~~ 0) ifTrue:[ |
|
6713 |
newY := newY - i |
|
6714 |
]. |
|
269 | 6715 |
]. |
6716 |
^ newX @ newY |
|
6717 |
! |
|
6718 |
||
6719 |
originFromRelativeOrigin |
|
6720 |
"compute & return pixel origin from relativeOrigin" |
|
6721 |
||
6722 |
^ self originFromRelativeOrigin:relativeOrigin |
|
6723 |
! |
|
6724 |
||
6725 |
originFromRelativeOrigin:aPoint |
|
6726 |
"compute & return pixel origin from relativeOrigin, aPoint" |
|
6727 |
||
6728 |
|p l t| |
|
6729 |
||
6730 |
p := self pointFromRelative:aPoint. |
|
6731 |
||
6732 |
insets isNil ifTrue:[ |
|
3152 | 6733 |
^ p |
269 | 6734 |
]. |
6735 |
l := insets at:1. |
|
6736 |
t := insets at:2. |
|
6737 |
||
6738 |
"/ l := t := 0. |
|
6739 |
"/ leftInset notNil ifTrue:[ |
|
6740 |
"/ l := leftInset |
|
6741 |
"/ ]. |
|
6742 |
"/ topInset notNil ifTrue:[ |
|
6743 |
"/ t := topInset |
|
6744 |
"/ ]. |
|
6745 |
((l ~~ 0) or:[t ~~ 0]) ifTrue:[ |
|
3152 | 6746 |
^ (p x + l) @ (p y + t) |
269 | 6747 |
]. |
6748 |
^ p |
|
6749 |
! |
|
6750 |
||
6751 |
pixelCorner:corner |
|
6752 |
"set the views corner in pixels" |
|
6753 |
||
6754 |
|w h| |
|
6755 |
||
6756 |
w := corner x - left + 1. |
|
6757 |
h := corner y - top + 1. |
|
6758 |
self pixelOrigin:(left @ top) extent:(w @ h) |
|
6759 |
||
6760 |
"Modified: 31.8.1995 / 18:20:22 / claus" |
|
6761 |
! |
|
6762 |
||
6763 |
pixelExtent:extent |
|
6764 |
"set the views extent in pixels" |
|
6765 |
||
6766 |
self pixelOrigin:(left @ top) extent:extent |
|
6767 |
! |
|
6768 |
||
1363 | 6769 |
pixelOrigin |
6770 |
"return the views origin in pixels. For subviews. the origin is relative |
|
6771 |
to the superviews top-left. For topViews, its the screen origin." |
|
6772 |
||
6773 |
^ self computeOrigin |
|
6774 |
! |
|
6775 |
||
269 | 6776 |
pixelOrigin:origin |
6777 |
"set the views origin in pixels. For subviews. the origin is relative |
|
6778 |
to the superviews top-left. For topViews, its the screen origin." |
|
6779 |
||
6780 |
|newLeft newTop| |
|
6781 |
||
6782 |
newLeft := origin x. |
|
6783 |
newTop := origin y. |
|
6784 |
((newTop ~~ top) or:[newLeft ~~ left]) ifTrue:[ |
|
3152 | 6785 |
top := newTop. |
6786 |
left := newLeft. |
|
6787 |
||
6788 |
" |
|
6789 |
if the receiver is visible, or is a topView, perform the |
|
6790 |
operation right away - otherwise, simply remember that the |
|
6791 |
origin has changed - will tell the display once we get realized |
|
6792 |
" |
|
269 | 6793 |
"/ (shown |
6794 |
"/ or:[superView isNil and:[drawableId notNil]]) ifTrue:[ |
|
6795 |
||
3152 | 6796 |
"/ no, have to do it if drawableId is there |
6797 |
"/ (otherwise, we could not move unmapped views around ... |
|
6798 |
"/ |
|
6799 |
drawableId notNil ifTrue:[ |
|
6800 |
device moveWindow:drawableId x:left y:top |
|
6801 |
] ifFalse:[ |
|
3375 | 6802 |
self originChangedFlag:true |
3152 | 6803 |
] |
269 | 6804 |
] |
6805 |
! |
|
6806 |
||
6807 |
pixelOrigin:origin corner:corner |
|
6808 |
"set the views origin and corner in pixels" |
|
6809 |
||
6810 |
|w h| |
|
6811 |
||
6812 |
w := corner x - origin x + 1. |
|
6813 |
h := corner y - origin y + 1. |
|
6814 |
self pixelOrigin:origin extent:(w @ h) |
|
6815 |
||
6816 |
"Modified: 31.8.1995 / 18:24:16 / claus" |
|
6817 |
! |
|
6818 |
||
140 | 6819 |
pixelOrigin:origin extent:extent |
6820 |
"set the views origin and extent in pixels" |
|
6821 |
||
6822 |
|newLeft newTop newWidth newHeight how |
|
6823 |
mustRedrawBottomEdge mustRedrawRightEdge mustRepaintBottom |
|
3340 | 6824 |
mustRepaintRight sameOrigin oldWidth oldHeight oldPaint| |
140 | 6825 |
|
6826 |
newLeft := origin x. |
|
6827 |
newTop := origin y. |
|
6828 |
sameOrigin := ((newTop == top) and:[newLeft == left]). |
|
6829 |
||
6830 |
newWidth := extent x. |
|
6831 |
newHeight := extent y. |
|
6832 |
||
6833 |
" |
|
6834 |
X complains badly if you try to create/resize a view with |
|
6835 |
a dimension <= 0 ... (although I think that 0 maks sense ...) |
|
6836 |
" |
|
6837 |
newWidth < 1 ifTrue:[ |
|
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6838 |
newWidth := 1. |
140 | 6839 |
]. |
6840 |
newHeight < 1 ifTrue:[ |
|
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6841 |
newHeight := 1 |
140 | 6842 |
]. |
6843 |
||
6844 |
((newWidth == width) and:[newHeight == height]) ifTrue:[ |
|
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6845 |
sameOrigin ifTrue:[^ self]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6846 |
self changed:#origin. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6847 |
^ self pixelOrigin:origin |
140 | 6848 |
]. |
6849 |
top := newTop. |
|
6850 |
left := newLeft. |
|
6851 |
||
6852 |
"/ shown ifTrue:[ "4-nov-94 actually correct," |
|
6853 |
drawableId notNil ifTrue:[ "but theres a bug in menus when resized while hidden" |
|
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6854 |
mustRedrawBottomEdge := (level ~~ 0) and:[newHeight < height]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6855 |
mustRedrawRightEdge := (level ~~ 0) and:[newWidth < width]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6856 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6857 |
((newHeight <= height) and:[newWidth <= width]) ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6858 |
how := #smaller |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6859 |
] ifFalse:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6860 |
((newHeight >= height) and:[newWidth >= width]) ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6861 |
how := #larger |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6862 |
] |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6863 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6864 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6865 |
mustRepaintRight := false. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6866 |
mustRepaintBottom := false. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6867 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6868 |
oldWidth := width. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6869 |
oldHeight := height. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6870 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6871 |
shown ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6872 |
(level ~~ 0) ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6873 |
"clear the old edges" |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6874 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6875 |
newWidth > width ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6876 |
self clippingRectangle:nil. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6877 |
oldPaint := paint. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6878 |
self paint:viewBackground. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6879 |
self fillDeviceRectangleX:(width - margin) |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6880 |
y:0 |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6881 |
width:margin |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6882 |
height:height. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6883 |
self paint:oldPaint. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6884 |
mustRepaintRight := true. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6885 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6886 |
newHeight > height ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6887 |
self clippingRectangle:nil. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6888 |
oldPaint := paint. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6889 |
self paint:viewBackground. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6890 |
self fillDeviceRectangleX:0 |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6891 |
y:(height - margin) |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6892 |
width:width |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6893 |
height:margin. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6894 |
self paint:oldPaint. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6895 |
mustRepaintBottom := true. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6896 |
] |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6897 |
] |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6898 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6899 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6900 |
width := newWidth. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6901 |
height := newHeight. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6902 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6903 |
self setInnerClip. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6904 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6905 |
"if view becomes smaller, send sizeChanged first" |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6906 |
true "(how == #smaller)" ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6907 |
self sizeChanged:how |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6908 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6909 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6910 |
"have to tell X, when extent of view is changed" |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6911 |
sameOrigin ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6912 |
device resizeWindow:drawableId width:width height:height. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6913 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6914 |
] ifFalse:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6915 |
"claus: some xservers seem to do better when resizing |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6916 |
first ...." |
140 | 6917 |
" |
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6918 |
(how == #smaller) ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6919 |
device resizeWindow:drawableId width:width height:height. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6920 |
device moveWindow:drawableId x:left y:top |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6921 |
] ifFalse:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6922 |
device moveResizeWindow:drawableId x:left y:top width:width height:height |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6923 |
]. |
140 | 6924 |
" |
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6925 |
device moveResizeWindow:drawableId x:left y:top |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6926 |
width:width height:height. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6927 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6928 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6929 |
"if view becomes bigger, send sizeChanged after" |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6930 |
false "(how ~~ #smaller)" ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6931 |
self sizeChanged:how |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6932 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6933 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6934 |
shown ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6935 |
(mustRedrawBottomEdge or:[mustRedrawRightEdge]) ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6936 |
self deviceClippingRectangle:nil. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6937 |
oldPaint := paint. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6938 |
mustRedrawBottomEdge ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6939 |
self drawBottomEdge |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6940 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6941 |
mustRedrawRightEdge ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6942 |
self drawRightEdge |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6943 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6944 |
self paint:oldPaint. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6945 |
self deviceClippingRectangle:innerClipRect |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6946 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6947 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6948 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6949 |
mustRepaintRight ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6950 |
self invalidateDeviceRectangle:(((oldWidth - margin) @ 0) |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6951 |
extent:margin@height) |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6952 |
repairNow:false. |
2400
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
6953 |
"/ self redrawDeviceX:(oldWidth - margin) |
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
6954 |
"/ y:0 |
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
6955 |
"/ width:margin |
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
6956 |
"/ height:height. |
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6957 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6958 |
mustRepaintBottom ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6959 |
self invalidateDeviceRectangle:((0 @ (oldHeight - margin)) |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6960 |
extent:width@margin) |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6961 |
repairNow:false. |
2400
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
6962 |
"/ self redrawDeviceX:0 |
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
6963 |
"/ y:(oldHeight - margin) |
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
6964 |
"/ width:width |
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
6965 |
"/ height:margin. |
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6966 |
]. |
140 | 6967 |
] ifFalse:[ |
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6968 |
"otherwise memorize the need for a sizeChanged message" |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6969 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6970 |
width := newWidth. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6971 |
height := newHeight. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6972 |
sameOrigin ifFalse:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6973 |
self originChangedFlag:true. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6974 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6975 |
self extentChangedFlag:true. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6976 |
subViews size > 0 ifTrue:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6977 |
self extentChangedBeforeCreatedFlag:true. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6978 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6979 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6980 |
sameOrigin ifFalse:[ |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6981 |
self changed:#origin. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
6982 |
]. |
739 | 6983 |
|
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
6984 |
"Modified: / 25.5.1999 / 14:49:56 / cg" |
140 | 6985 |
! |
6986 |
||
6987 |
pointFromRelative:p |
|
6988 |
"compute absolute coordinate from p" |
|
6989 |
||
6990 |
|newX newY rel inRect bw superWidth superHeight superLeft superTop | |
|
6991 |
||
2382 | 6992 |
bw := borderWidth ? 0. |
140 | 6993 |
|
6994 |
superView isNil ifTrue:[ |
|
3152 | 6995 |
superWidth := device width + bw. |
6996 |
superHeight := device height + bw. |
|
6997 |
superLeft := superTop := 0. |
|
140 | 6998 |
] ifFalse:[ |
3152 | 6999 |
inRect := superView viewRectangle. |
7000 |
superWidth := inRect width. |
|
7001 |
superHeight := inRect height. |
|
7002 |
superLeft := inRect left. |
|
7003 |
superTop := inRect top. |
|
140 | 7004 |
]. |
7005 |
||
7006 |
rel := p x. |
|
7007 |
rel isInteger ifTrue:[ |
|
3152 | 7008 |
newX := rel |
140 | 7009 |
] ifFalse:[ |
3152 | 7010 |
newX := (rel * superWidth) asInteger + superLeft. |
7011 |
(bw ~~ 0) ifTrue:[ |
|
7012 |
rel ~= 1.0 ifTrue:[ |
|
7013 |
newX := newX - bw |
|
7014 |
] |
|
7015 |
] |
|
140 | 7016 |
]. |
7017 |
||
7018 |
rel := p y. |
|
7019 |
rel isInteger ifTrue:[ |
|
3152 | 7020 |
newY := rel |
140 | 7021 |
] ifFalse:[ |
3152 | 7022 |
newY := (rel * superHeight) asInteger + superTop. |
7023 |
(bw ~~ 0) ifTrue:[ |
|
7024 |
rel ~= 1.0 ifTrue:[ |
|
7025 |
newY := newY - bw |
|
7026 |
] |
|
7027 |
] |
|
140 | 7028 |
]. |
7029 |
^ newX @ newY |
|
2382 | 7030 |
|
7031 |
"Modified: / 1.10.1998 / 13:21:14 / cg" |
|
140 | 7032 |
! |
7033 |
||
7034 |
setBorderColor |
|
7035 |
"set my borderColor" |
|
7036 |
||
7037 |
|id dither| |
|
7038 |
||
7039 |
drawableId notNil ifTrue:[ |
|
3152 | 7040 |
borderColor := borderColor onDevice:device. |
7041 |
id := borderColor colorId. |
|
7042 |
id notNil ifTrue:[ |
|
7043 |
device setWindowBorderColor:id in:drawableId |
|
7044 |
] ifFalse:[ |
|
7045 |
dither := borderColor ditherForm. |
|
7046 |
dither notNil ifTrue:[ |
|
7047 |
device setWindowBorderPixmap:(dither id) in:drawableId |
|
7048 |
] ifFalse:[ |
|
7049 |
'SimpleView [warning]: bad borderColor' errorPrintCR |
|
7050 |
] |
|
7051 |
] |
|
135 | 7052 |
] |
1172
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
7053 |
|
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
7054 |
"Modified: 10.1.1997 / 18:06:34 / cg" |
135 | 7055 |
! |
7056 |
||
269 | 7057 |
setInnerClip |
7058 |
"compute, and set the inside clip-area" |
|
7059 |
||
7060 |
self computeInnerClip. |
|
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
7061 |
self deviceClippingRectangle:innerClipRect. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
7062 |
|
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
7063 |
"Modified: / 25.5.1999 / 14:45:53 / cg" |
1903 | 7064 |
! |
7065 |
||
4139 | 7066 |
setShown:aState |
7067 |
shown := aState |
|
7068 |
||
7069 |
! |
|
7070 |
||
1903 | 7071 |
setViewShape |
7072 |
|form| |
|
7073 |
||
7074 |
(form := viewShape borderShapeForm) notNil ifTrue:[ |
|
3152 | 7075 |
device setWindowBorderShape:(form id) in:drawableId |
1903 | 7076 |
]. |
7077 |
(form := viewShape viewShapeForm) notNil ifTrue:[ |
|
3152 | 7078 |
device setWindowShape:(form id) in:drawableId |
1903 | 7079 |
]. |
7080 |
||
7081 |
"Created: 18.9.1997 / 11:09:00 / cg" |
|
4139 | 7082 |
! |
7083 |
||
7084 |
windowGroupClass |
|
7085 |
^ WindowGroup |
|
140 | 7086 |
! ! |
7087 |
||
269 | 7088 |
!SimpleView methodsFor:'queries'! |
7089 |
||
7090 |
canHandle:aKey |
|
7091 |
"return true, if I like to handle the key (from a keyPress event). |
|
7092 |
OBSOLETE: do not use & depend on this method, it is a historic |
|
7093 |
leftOver and will be removed. Use the delegation mechanism for this." |
|
7094 |
||
7095 |
^ false |
|
7096 |
! |
|
7097 |
||
7098 |
canHandle:aKey from:aView |
|
7099 |
"return true, if I like to handle the key (from a keyPress event) |
|
7100 |
in aView. |
|
7101 |
OBSOLETE: do not use & depend on this method, it is a historic |
|
7102 |
leftOver and will be removed. Use the delegation mechanism for this." |
|
7103 |
||
7104 |
^ self canHandle:aKey |
|
7105 |
! |
|
7106 |
||
3368
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7107 |
cornerChangedFlag |
3375 | 7108 |
"/ ^ cornerChangedFlag == true |
7109 |
^ flagBits bitTest:FlagCornerChanged |
|
7110 |
! |
|
7111 |
||
7112 |
cornerChangedFlag:aBoolean |
|
7113 |
"/ cornerChangedFlag := aBoolean |
|
7114 |
aBoolean ifTrue:[ |
|
7115 |
flagBits := flagBits bitOr:FlagCornerChanged |
|
7116 |
] ifFalse:[ |
|
7117 |
flagBits := flagBits bitClear:FlagCornerChanged |
|
7118 |
]. |
|
3368
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7119 |
! |
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7120 |
|
269 | 7121 |
delegatesTo:someone |
7122 |
"return true, if I delegate events to someone" |
|
7123 |
||
7124 |
delegate isNil ifTrue:[^ false]. |
|
7125 |
^ delegate delegatesTo:someone |
|
7126 |
! |
|
7127 |
||
3439 | 7128 |
escapeIsCancel |
7129 |
"return the escapeIsCancel setting - defaults to true for popupViews here." |
|
7130 |
||
7131 |
^ self isPopUpView |
|
7132 |
! |
|
7133 |
||
3394
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
7134 |
extentChangedBeforeCreatedFlag |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
7135 |
^ flagBits bitTest:FlagExtentChangedBeforeCreated |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
7136 |
! |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
7137 |
|
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
7138 |
extentChangedBeforeCreatedFlag:aBoolean |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
7139 |
aBoolean ifTrue:[ |
3762 | 7140 |
flagBits := flagBits bitOr:FlagExtentChangedBeforeCreated |
3394
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
7141 |
] ifFalse:[ |
3762 | 7142 |
flagBits := flagBits bitClear:FlagExtentChangedBeforeCreated |
3394
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
7143 |
]. |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
7144 |
! |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
7145 |
|
3368
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7146 |
extentChangedFlag |
3375 | 7147 |
"/ ^ extentChangedFlag == true |
7148 |
^ flagBits bitTest:FlagExtentChanged |
|
3368
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7149 |
! |
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7150 |
|
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7151 |
extentChangedFlag:aBoolean |
3375 | 7152 |
"/ extentChangedFlag := aBoolean |
7153 |
aBoolean ifTrue:[ |
|
7154 |
flagBits := flagBits bitOr:FlagExtentChanged |
|
7155 |
] ifFalse:[ |
|
7156 |
flagBits := flagBits bitClear:FlagExtentChanged |
|
7157 |
]. |
|
3368
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7158 |
! |
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7159 |
|
1748 | 7160 |
focusSequence |
7161 |
"return nil - for compatibility with StdSysView & SubCanvas. |
|
7162 |
In the future, subviews which want to slice their components into the |
|
7163 |
focusSequence may redefine this to return a list of their components." |
|
7164 |
||
7165 |
^ nil |
|
7166 |
! |
|
7167 |
||
269 | 7168 |
hasFocus |
7169 |
"return true, if the receiver has the keyboard focus |
|
7170 |
(either via the focusView mechanism in the windowGroup, |
|
7171 |
or via delegation)" |
|
7172 |
||
7173 |
|focusView delegate| |
|
7174 |
||
7175 |
windowGroup isNil ifTrue:[^ false]. |
|
7176 |
||
7177 |
(focusView := windowGroup focusView) == self ifTrue:[^ true]. |
|
2506 | 7178 |
|
269 | 7179 |
focusView notNil ifTrue:[ |
3152 | 7180 |
"mhmh - is there a delegation to me ?" |
7181 |
(delegate := focusView delegate) notNil ifTrue:[ |
|
7182 |
delegate == self ifTrue:[^ true]. |
|
7183 |
^ delegate delegatesTo:self |
|
7184 |
] |
|
135 | 7185 |
]. |
269 | 7186 |
^ false |
7187 |
! |
|
7188 |
||
370 | 7189 |
is3D |
7190 |
"return true, if my style is some kind of 3D style |
|
7191 |
This is OBSOLETE and will be removed." |
|
7192 |
||
7193 |
^ styleSheet is3D |
|
7194 |
! |
|
7195 |
||
794 | 7196 |
isBorderedWrapper |
7197 |
^ false |
|
7198 |
||
7199 |
"Created: 5.6.1996 / 14:11:15 / cg" |
|
7200 |
! |
|
7201 |
||
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
7202 |
isComponentOf:aViewOrComponent |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
7203 |
"return true, if I am a (direct or indirect) component of aViewOrComponent" |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
7204 |
|
3362 | 7205 |
|sview| |
7206 |
||
7207 |
sview := self. |
|
7208 |
||
3616 | 7209 |
[ (sview := sview container) notNil ] whileTrue:[ |
3762 | 7210 |
sview == aViewOrComponent ifTrue:[^ true]. |
3362 | 7211 |
]. |
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7212 |
^ false |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7213 |
! |
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
7214 |
|
3711
f74e461c8b31
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
3709
diff
changeset
|
7215 |
isCursorKeyConsumer |
f74e461c8b31
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
3709
diff
changeset
|
7216 |
"return true, if the receiver can be controlled by cursor keys; |
f74e461c8b31
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
3709
diff
changeset
|
7217 |
i.e. it can handle some keyboard input, |
f74e461c8b31
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
3709
diff
changeset
|
7218 |
isCursorKeyConsumer are potential candidates for getting the keyboard |
f74e461c8b31
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
3709
diff
changeset
|
7219 |
focus initially within dialogBoxes, or when the focus-follows-pointer |
f74e461c8b31
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
3709
diff
changeset
|
7220 |
mode is off. |
f74e461c8b31
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
3709
diff
changeset
|
7221 |
Return false here, this is redefined in SelectionInListView." |
f74e461c8b31
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
3709
diff
changeset
|
7222 |
|
f74e461c8b31
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
3709
diff
changeset
|
7223 |
^ false |
f74e461c8b31
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
3709
diff
changeset
|
7224 |
! |
f74e461c8b31
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
3709
diff
changeset
|
7225 |
|
2496 | 7226 |
isDefault |
7227 |
"return true, if I am a default widget; |
|
7228 |
Used with autoAccept. Currently only default buttons are supposed to return |
|
7229 |
true here" |
|
7230 |
||
7231 |
^ false |
|
7232 |
! |
|
7233 |
||
2430
fbce2378d686
added isExternalTopView query.
Claus Gittinger <cg@exept.de>
parents:
2425
diff
changeset
|
7234 |
isExternalTopView |
2454 | 7235 |
"return true, if this is an external topView - always false here" |
7236 |
||
2430
fbce2378d686
added isExternalTopView query.
Claus Gittinger <cg@exept.de>
parents:
2425
diff
changeset
|
7237 |
^ false |
fbce2378d686
added isExternalTopView query.
Claus Gittinger <cg@exept.de>
parents:
2425
diff
changeset
|
7238 |
|
fbce2378d686
added isExternalTopView query.
Claus Gittinger <cg@exept.de>
parents:
2425
diff
changeset
|
7239 |
|
fbce2378d686
added isExternalTopView query.
Claus Gittinger <cg@exept.de>
parents:
2425
diff
changeset
|
7240 |
! |
fbce2378d686
added isExternalTopView query.
Claus Gittinger <cg@exept.de>
parents:
2425
diff
changeset
|
7241 |
|
497 | 7242 |
isInputField |
7243 |
"return true, if the receiver is some kind of input view, |
|
7244 |
i.e. it should (can) be part of an enterGroup. |
|
7245 |
Return false here, this is redefined in EnterField." |
|
7246 |
||
7247 |
^ false |
|
7248 |
||
7249 |
"Created: 4.3.1996 / 11:34:07 / cg" |
|
7250 |
! |
|
7251 |
||
2410 | 7252 |
isJavaView |
7253 |
^ false |
|
7254 |
||
7255 |
"Created: / 4.12.1998 / 14:10:06 / cg" |
|
7256 |
! |
|
7257 |
||
2588 | 7258 |
isKeyboardConsumer |
2727 | 7259 |
"return true, if the receiver is a keyboard consumer; |
2588 | 7260 |
i.e. it can handle (non-shortkey) keyboard input, |
7261 |
keyboardConsumer are potential candidates for getting the keyboard |
|
7262 |
focus initially within dialogBoxes, or when the focus-follows-pointer |
|
7263 |
mode is off. |
|
7264 |
Return false here, this is redefined in EditTextView and EditField." |
|
7265 |
||
7266 |
^ false |
|
2727 | 7267 |
|
7268 |
"Modified: / 22.5.1999 / 16:19:27 / cg" |
|
2588 | 7269 |
! |
7270 |
||
964 | 7271 |
isLayoutWrapper |
7272 |
^ false |
|
7273 |
||
7274 |
"Created: 19.7.1996 / 17:51:04 / cg" |
|
7275 |
! |
|
7276 |
||
4184 | 7277 |
isModal |
7278 |
"return true, if the receiver has been opened modal. |
|
7279 |
For compatibility with topView (if regular views are the window of an application), |
|
7280 |
return false here." |
|
7281 |
||
7282 |
^ false |
|
7283 |
! |
|
7284 |
||
3653 | 7285 |
isSameOrComponentOf:aView |
7286 |
"return true, if I am aView or a (direct or indirect) component of aView" |
|
7287 |
||
7288 |
^ self == aView or:[self isComponentOf:aView]. |
|
7289 |
! |
|
7290 |
||
2161
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
7291 |
isScrollWrapper |
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
7292 |
^ false |
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
7293 |
|
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
7294 |
"Created: / 5.6.1996 / 14:11:15 / cg" |
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
7295 |
"Modified: / 20.6.1998 / 14:15:29 / cg" |
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
7296 |
! |
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
7297 |
|
269 | 7298 |
isSubViewOf:aView |
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
7299 |
"return true, if I am a (direct or indirect) subview of aView" |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
7300 |
|
3434 | 7301 |
<resource:#obsolete> |
7302 |
||
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
7303 |
self obsoleteMethodWarning:'use #isComponentOf:'. |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
7304 |
^ self isComponentOf:aView. |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
7305 |
|
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
7306 |
"Modified: 5.6.1996 / 14:25:35 / cg" |
269 | 7307 |
! |
7308 |
||
3754 | 7309 |
isTextView |
7310 |
"I am not showing text (showing lines)" |
|
7311 |
||
7312 |
^ false |
|
7313 |
! |
|
7314 |
||
4151 | 7315 |
isTransparentBox |
7316 |
^ false |
|
7317 |
! |
|
7318 |
||
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
7319 |
isWrapper |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
7320 |
^ false |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
7321 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
7322 |
"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
|
7323 |
! |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
7324 |
|
3368
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7325 |
originChangedFlag |
3375 | 7326 |
"/ ^ originChangedFlag == true |
7327 |
^ flagBits bitTest:FlagOriginChanged |
|
3368
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7328 |
! |
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7329 |
|
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7330 |
originChangedFlag:aBoolean |
3375 | 7331 |
"/ originChangedFlag := aBoolean |
7332 |
aBoolean ifTrue:[ |
|
7333 |
flagBits := flagBits bitOr:FlagOriginChanged |
|
7334 |
] ifFalse:[ |
|
7335 |
flagBits := flagBits bitClear:FlagOriginChanged |
|
7336 |
]. |
|
3368
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7337 |
! |
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7338 |
|
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7339 |
originOrExtentChanged |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7340 |
"/ ^ originChanged or:[extentChanged]. |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7341 |
^ flagBits bitTest:( FlagOriginChanged + FlagExtentChanged ) |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7342 |
! |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7343 |
|
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7344 |
originOrExtentOrCornerChanged |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7345 |
"/ ^ originChanged or:[extentChanged or:[cornerChanged]]. |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7346 |
^ flagBits bitTest:( FlagOriginChanged + FlagExtentChanged + FlagCornerChanged ) |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7347 |
! |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7348 |
|
269 | 7349 |
preferredBounds |
7350 |
"ST-80 compatibility." |
|
7351 |
||
971 | 7352 |
^ 0@0 extent:(self preferredExtent) |
7353 |
||
7354 |
"Modified: 19.7.1996 / 20:41:36 / cg" |
|
269 | 7355 |
! |
7356 |
||
7357 |
preferredExtent |
|
7358 |
"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
|
7359 |
If the preferredExtent has been set, that one is returned. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7360 |
Otherwise, if there are any components, a rectangle enclosing them |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7361 |
is returned. Otherwise, the actual extent is returned." |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7362 |
|
1063 | 7363 |
|maxX maxY| |
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7364 |
|
971 | 7365 |
"/ If I have an explicit preferredExtent .. |
7366 |
||
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7367 |
preferredExtent notNil ifTrue:[ |
3152 | 7368 |
^ preferredExtent |
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7369 |
]. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7370 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7371 |
"/ mhmh - if I have subViews, collect their |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7372 |
"/ preferred bounds ... |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7373 |
|
269 | 7374 |
subViews notNil ifTrue:[ |
3152 | 7375 |
maxX := maxY := 0. |
7376 |
subViews do:[:aSubView | |
|
7377 |
|org corn| |
|
7378 |
||
7379 |
org := aSubView computeOrigin. |
|
7380 |
corn := org + aSubView preferredExtent. |
|
7381 |
maxX := maxX max:corn x. |
|
7382 |
maxY := maxY max:corn y. |
|
7383 |
] |
|
140 | 7384 |
]. |
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7385 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7386 |
"/ mhmh - if I have components, collect their |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7387 |
"/ preferred bounds ... |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7388 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7389 |
components notNil ifTrue:[ |
3152 | 7390 |
maxX isNil ifTrue:[ |
7391 |
maxX := maxY := 0. |
|
7392 |
]. |
|
7393 |
components do:[:aComponent | |
|
7394 |
|bounds org corn| |
|
7395 |
||
7396 |
bounds := aComponent preferredBounds. |
|
7397 |
corn := bounds corner. |
|
7398 |
maxX := maxX max:corn x. |
|
7399 |
maxY := maxY max:corn y. |
|
7400 |
] |
|
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7401 |
]. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7402 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7403 |
"/ nothing found - return the actual size |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7404 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7405 |
maxX isNil ifTrue:[ |
3152 | 7406 |
^ self extent. |
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7407 |
]. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7408 |
|
269 | 7409 |
^ maxX @ maxY. |
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7410 |
|
971 | 7411 |
"Modified: 19.7.1996 / 20:43:32 / cg" |
269 | 7412 |
! |
7413 |
||
2956 | 7414 |
reallyRealized |
7415 |
"return true, if the receiver is realized and all containers |
|
7416 |
are realized." |
|
7417 |
||
7418 |
realized ifFalse:[^ false]. |
|
7419 |
superView isNil ifTrue:[^ true]. |
|
7420 |
^ superView reallyRealized |
|
7421 |
||
7422 |
||
7423 |
! |
|
7424 |
||
2130
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
7425 |
resources |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
7426 |
^ resources |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
7427 |
|
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
7428 |
"Created: / 25.5.1998 / 13:00:02 / cg" |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
7429 |
! |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
7430 |
|
269 | 7431 |
sizeFixed |
7432 |
"return true, if this vew wants its size to remain unchanged. |
|
7433 |
Used by panels, to check if their components want to keep their size." |
|
7434 |
||
7435 |
^ false |
|
7436 |
||
7437 |
"Created: 17.9.1995 / 20:29:20 / claus" |
|
3901 | 7438 |
! |
7439 |
||
7440 |
tabRequiresControl |
|
7441 |
"returns true, if a focus tabbing requires a control-key to be pressed. |
|
7442 |
The default is true for editTextView, false for other widgets, |
|
7443 |
to allow for easier text entry" |
|
7444 |
||
7445 |
^ false |
|
1699
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
7446 |
! ! |
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
7447 |
|
3266 | 7448 |
!SimpleView methodsFor:'queries-events'! |
2802 | 7449 |
|
7450 |
buttonMotionEventPending |
|
7451 |
"return true, if a button motion event is pending. |
|
7452 |
Normally, you dont want to use this, since no polling is needed |
|
7453 |
(not even for mouse-tracking). |
|
7454 |
Actually, its a historical leftover" |
|
7455 |
||
7456 |
windowGroup notNil ifTrue:[ |
|
3152 | 7457 |
^ windowGroup sensor hasButtonMotionEventFor:self |
2802 | 7458 |
]. |
7459 |
^ super buttonMotionEventPending |
|
7460 |
||
7461 |
"Modified: 1.11.1996 / 17:04:38 / cg" |
|
7462 |
! ! |
|
7463 |
||
3266 | 7464 |
!SimpleView methodsFor:'queries-internal'! |
1699
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
7465 |
|
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
7466 |
nativeWindowType |
1702 | 7467 |
"return a symbol describing my native window type - here, nil is returned |
7468 |
(may be used internally by the device as a native window creation hint)" |
|
7469 |
||
1699
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
7470 |
^ nil |
1354 | 7471 |
! |
7472 |
||
7473 |
specClass |
|
1943 | 7474 |
"fallback - heuristics to get a specClass for some viewClass. |
7475 |
Based upon my className, look for a corresponding Spec-class. |
|
7476 |
If there is none, return ArbiraryComponentSpec as a fallBack" |
|
7477 |
||
7478 |
|myClass myName cls| |
|
7479 |
||
4157 | 7480 |
myClass := self class. |
7481 |
(myClass == View or:[myClass == SimpleView]) ifTrue:[ |
|
7482 |
^ ViewSpec "/ CompositeSpecCollection |
|
1943 | 7483 |
]. |
7484 |
||
7485 |
"/ try: appending 'Spec' to my classes name |
|
1409
3818a8a85c16
use CompositeSpecCollection as specClass for
Claus Gittinger <cg@exept.de>
parents:
1402
diff
changeset
|
7486 |
|
1354 | 7487 |
myName := self class name. |
7488 |
cls := Smalltalk classNamed:(myName , 'Spec'). |
|
1943 | 7489 |
cls notNil ifTrue:[ |
4157 | 7490 |
cls := cls autoload. |
7491 |
(cls isSubclassOf:UISpecification) ifTrue:[^ cls]. |
|
1943 | 7492 |
]. |
1354 | 7493 |
|
7494 |
(myName endsWith:'View') ifTrue:[ |
|
1943 | 7495 |
"/ "/ try name without 'View' |
7496 |
"/ cls := Smalltalk classNamed:(myName copyWithoutLast:4). |
|
4157 | 7497 |
"/ cls notNil ifTrue:[ |
7498 |
"/ cls := cls autoload. |
|
7499 |
"/ (cls isSubclassOf:UISpecification) ifTrue:[^ cls]. |
|
1943 | 7500 |
"/ ]. |
4157 | 7501 |
|
7502 |
"/ try with 'View' replaced by 'Spec' |
|
7503 |
cls := Smalltalk classNamed:((myName copyWithoutLast:4) , 'View'). |
|
7504 |
cls notNil ifTrue:[ |
|
7505 |
cls := cls autoload. |
|
7506 |
(cls isSubclassOf:UISpecification) ifTrue:[^ cls]. |
|
7507 |
] |
|
7508 |
]. |
|
7509 |
||
7510 |
"/ fall back for all others |
|
1356 | 7511 |
^ ArbitraryComponentSpec |
7512 |
||
1354 | 7513 |
|
7514 |
" |
|
7515 |
FramedBox new specClass |
|
7516 |
" |
|
1409
3818a8a85c16
use CompositeSpecCollection as specClass for
Claus Gittinger <cg@exept.de>
parents:
1402
diff
changeset
|
7517 |
|
1943 | 7518 |
"Modified: / 31.10.1997 / 19:44:55 / cg" |
1699
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
7519 |
! |
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
7520 |
|
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
7521 |
windowStyle |
3715 | 7522 |
"return a symbol describing my style (one of: #dialog, #popUp or #normal)" |
1699
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
7523 |
|
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
7524 |
self isPopUpView ifTrue:[ |
3762 | 7525 |
^ #popUp |
1699
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
7526 |
]. |
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
7527 |
|
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
7528 |
^ #normal |
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
7529 |
|
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
7530 |
"Created: 2.5.1997 / 14:29:48 / cg" |
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
7531 |
"Modified: 2.5.1997 / 14:30:14 / cg" |
140 | 7532 |
! ! |
7533 |
||
7534 |
!SimpleView methodsFor:'realization'! |
|
7535 |
||
3459
d50728855052
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
3439
diff
changeset
|
7536 |
closeCancel |
d50728855052
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
3439
diff
changeset
|
7537 |
"for protocol compatibility with modal dialogs" |
d50728855052
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
3439
diff
changeset
|
7538 |
|
d50728855052
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
3439
diff
changeset
|
7539 |
self hideRequest |
d50728855052
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
3439
diff
changeset
|
7540 |
! |
d50728855052
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
3439
diff
changeset
|
7541 |
|
269 | 7542 |
create |
7543 |
"create (i.e. tell my device about me) if not already created. |
|
7544 |
This does not make the view visible (needs a #map for that)" |
|
7545 |
||
7546 |
drawableId isNil ifTrue:[ |
|
3967
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7547 |
" |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7548 |
make certain that superview is created also |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7549 |
" |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7550 |
superView notNil ifTrue:[ |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7551 |
superView view create. |
269 | 7552 |
|
7553 |
"/ "and put my controller into the superviews controller list" |
|
7554 |
"/ controller notNil ifTrue:[ |
|
7555 |
"/ superView controller notNil ifTrue:[ |
|
7556 |
"/ controller manager:(superView controller manager) |
|
7557 |
"/ ] |
|
7558 |
"/ ] |
|
3967
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7559 |
] ifFalse:[ |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7560 |
"/ |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7561 |
"/ if the display is not already dispatching events, |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7562 |
"/ this starts the event process. |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7563 |
"/ |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7564 |
device startDispatch |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7565 |
]. |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7566 |
|
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7567 |
cursor notNil ifTrue:[ |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7568 |
cursor := cursor onDevice:device. |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7569 |
]. |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7570 |
|
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7571 |
self extentChangedBeforeCreatedFlag ifTrue:[ |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7572 |
"/ this is true, if the extent was changed before |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7573 |
"/ this view was created (and therefore, no sizeChangeEvent |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7574 |
"/ was sent to me, which would notify children.) |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7575 |
"/ have to do this here. |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7576 |
self sizeChanged:nil. "/ must tell children (if any) |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7577 |
]. |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7578 |
explicitExtent ~~ true ifTrue:[ |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7579 |
self resize |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7580 |
]. |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7581 |
|
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7582 |
self physicalCreate. |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7583 |
|
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7584 |
viewBackground notNil ifTrue:[ |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7585 |
self setViewBackground |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7586 |
]. |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7587 |
|
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7588 |
"/ self initializeMiddleButtonMenu. |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7589 |
self initEvents. |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7590 |
|
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7591 |
" |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7592 |
this is the first create, |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7593 |
force sizechange messages to be sent to the view |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7594 |
" |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7595 |
self extentChangedFlag:true. |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
7596 |
self originChangedFlag:true |
151 | 7597 |
] |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
7598 |
|
1494
4faf11deec70
cursor #on: is obsoleted by #onDevice:.
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
7599 |
"Modified: 28.3.1997 / 13:50:17 / cg" |
151 | 7600 |
! |
7601 |
||
269 | 7602 |
createWithAllSubViews |
7603 |
"create, then create all subviews" |
|
7604 |
||
7605 |
drawableId isNil ifTrue:[self create]. |
|
7606 |
subViews notNil ifTrue:[ |
|
3152 | 7607 |
subViews do:[:subView | subView createWithAllSubViews] |
269 | 7608 |
] |
7609 |
! |
|
7610 |
||
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
7611 |
fetchDeviceResources |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
7612 |
"fetch all device specific resources. This is invoked, |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
7613 |
when the view is made visible on some device for the very first |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
7614 |
time, to allocate device specific colors, fonts, bitmaps etc. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
7615 |
The view may keep those in instance variables, to avoid reallocating |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
7616 |
those with every redraw. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
7617 |
If you ommit to do this, the views will still be able to display themself, |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
7618 |
but possibly slower, since resources are reallocated over and over. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
7619 |
If you redefine this method, make certain that 'super fetchDeviceResources' |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
7620 |
is always sent." |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
7621 |
|
2829 | 7622 |
shadowColor notNil ifTrue:[shadowColor := shadowColor onDevice:device]. |
7623 |
lightColor notNil ifTrue:[lightColor := lightColor onDevice:device]. |
|
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
7624 |
|
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
7625 |
"Created: 13.1.1997 / 21:51:59 / cg" |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
7626 |
! |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
7627 |
|
140 | 7628 |
fixSize |
7629 |
"This is called right before the view is made visible. |
|
7630 |
Adjust the size of the view according to either relative/abs or |
|
7631 |
block extent; also set origin. Also, subclasses may redefine this |
|
7632 |
method to adjust the size based on some extent (for example, PopUpMenus |
|
7633 |
do so to take care of changed number of menu entries)." |
|
7634 |
||
151 | 7635 |
|org ext r| |
7636 |
||
7637 |
" |
|
7638 |
slowly migrating to use layoutObjects ... |
|
7639 |
" |
|
7640 |
layout notNil ifTrue:[ |
|
4139 | 7641 |
superView notNil ifTrue:[ |
7642 |
(self originOrExtentOrCornerChanged) ifTrue:[ |
|
7643 |
r := (layout rectangleRelativeTo:(superView viewRectangle) |
|
7644 |
preferred:[self preferredBounds]). |
|
7645 |
org := r origin rounded. |
|
7646 |
ext := r extent rounded. |
|
7647 |
self pixelOrigin:org extent:ext. |
|
7648 |
]. |
|
7649 |
]. |
|
7650 |
^ self. |
|
151 | 7651 |
]. |
7652 |
||
140 | 7653 |
"if the extent is not the one we created the window with ..." |
3375 | 7654 |
"/ self extentChangedFlag ifTrue:[ |
890
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
7655 |
"/ self sizeChanged:nil. |
3375 | 7656 |
"/ self extentChangedFlag:false |
890
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
7657 |
"/ ]. |
140 | 7658 |
|
3375 | 7659 |
self originChangedFlag ifTrue:[ |
140 | 7660 |
"/ org := self computeOrigin. |
7661 |
"/ self pixelOrigin:org. |
|
4139 | 7662 |
originRule notNil ifTrue:[ |
7663 |
self pixelOrigin:self computeOrigin |
|
7664 |
] ifFalse:[ |
|
7665 |
relativeOrigin notNil ifTrue:[ |
|
7666 |
self originFromRelativeOrigin:relativeOrigin |
|
7667 |
] ifFalse:[ |
|
7668 |
shown ifTrue:[ |
|
7669 |
device moveWindow:drawableId x:left y:top. |
|
7670 |
] ifFalse:[ |
|
7671 |
self pixelOrigin:left@top |
|
7672 |
]. |
|
7673 |
]. |
|
7674 |
]. |
|
7675 |
self originChangedFlag:false |
|
140 | 7676 |
] |
890
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
7677 |
|
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
7678 |
"Modified: 18.6.1996 / 21:44:03 / cg" |
140 | 7679 |
! |
7680 |
||
393
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
7681 |
hide |
1356 | 7682 |
"only useful with modal views: hide the view and return control |
7683 |
back to the suspended main view. Ignored for non-modal views." |
|
7684 |
||
2579 | 7685 |
|masterGroup| |
1356 | 7686 |
|
7687 |
realized ifFalse:[^ self]. |
|
7688 |
windowGroup isNil ifTrue:[^ self]. |
|
7689 |
windowGroup isModal ifFalse:[^ self]. |
|
2579 | 7690 |
masterGroup := windowGroup previousGroup. |
1356 | 7691 |
|
7692 |
windowGroup notNil ifTrue:[windowGroup focusView:nil]. |
|
7693 |
||
7694 |
self unmap. |
|
7695 |
device flush. |
|
7696 |
||
2579 | 7697 |
masterGroup notNil ifTrue:[ |
3152 | 7698 |
" |
7699 |
this is a kludge for IRIS and others which do not provide backingstore: |
|
7700 |
when we hide a modalbox (such as a searchbox) which covered |
|
7701 |
a scrollbar, the scrollbars bitblt-method will copy from the |
|
7702 |
not-yet redrawn area - effectively clearing the scroller. |
|
7703 |
We need a short delay here, since at this time, the expose event has |
|
7704 |
not yet arrived. |
|
7705 |
" |
|
7706 |
Delay waitForSeconds:0.05. |
|
7707 |
masterGroup processExposeEvents |
|
2576 | 7708 |
]. |
7709 |
||
7710 |
"/ WindowGroup leaveSignal raise. |
|
7711 |
"/ "/ not reached |
|
7712 |
"/ ^ self |
|
393
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
7713 |
! |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
7714 |
|
3087 | 7715 |
hideForAction |
7716 |
"for popUpMenu compatibility; |
|
7717 |
this is invoked to hide a when it is going to perform its action |
|
7718 |
(in contrast to the generic hide)." |
|
7719 |
||
7720 |
^ self hide |
|
7721 |
! |
|
7722 |
||
393
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
7723 |
hideRequest |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
7724 |
"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
|
7725 |
ignored here." |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
7726 |
|
3439 | 7727 |
self isPopUpView ifTrue:[ |
3762 | 7728 |
self hide |
3439 | 7729 |
]. |
393
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
7730 |
^ self |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
7731 |
! |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
7732 |
|
269 | 7733 |
map |
1827 | 7734 |
"make the view visible on the screen. |
7735 |
For topViews, the windowManager will choose (or ask for) the |
|
2103
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
7736 |
views position on the screen. |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
7737 |
Notice: |
3152 | 7738 |
Actually, this method is only valid for topViews; |
7739 |
however, it is defined here to allow things like 'Button new realize'" |
|
1827 | 7740 |
|
7741 |
self mapAt:nil iconified:false |
|
7742 |
||
7743 |
"Modified: 24.7.1997 / 13:44:25 / cg" |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7744 |
! |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7745 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7746 |
mapAt:aPoint |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7747 |
"make the view visible on the screen. |
1827 | 7748 |
For topViews, if aPoint is nonNil, the views origin is located there |
2103
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
7749 |
(unless you have a dictator as windowManager ;-) |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
7750 |
Notice: |
3152 | 7751 |
Actually, this method is only valid for topViews; |
7752 |
however, it is defined here to allow things like 'Button new realize'" |
|
1827 | 7753 |
|
7754 |
self mapAt:aPoint iconified:false |
|
7755 |
||
7756 |
"Modified: 24.7.1997 / 13:45:02 / cg" |
|
7757 |
! |
|
7758 |
||
7759 |
mapAt:aPoint iconified:iconified |
|
7760 |
"make the view visible on the screen. |
|
7761 |
For topViews, if aPoint is nonNil, the views origin is located there |
|
7762 |
(unless you have a dictator as windowManager ;-). |
|
2103
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
7763 |
If the iconified argument is true, the window is created as icon initially. |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
7764 |
Notice: |
3152 | 7765 |
Actually, this method is only valid for topViews; |
7766 |
however, it is defined here to allow things like 'Button new realize'" |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7767 |
|
1809
fec93025e9e7
mapping trouble fixed (see mswindows scrollBar remap)
Claus Gittinger <cg@exept.de>
parents:
1808
diff
changeset
|
7768 |
|subs| |
fec93025e9e7
mapping trouble fixed (see mswindows scrollBar remap)
Claus Gittinger <cg@exept.de>
parents:
1808
diff
changeset
|
7769 |
|
269 | 7770 |
realized ifFalse:[ |
3152 | 7771 |
drawableId isNil ifTrue:[ |
7772 |
" |
|
7773 |
first time ? |
|
7774 |
yes, realize (implies a map) |
|
7775 |
" |
|
7776 |
self realizeKeepingGroup:false at:aPoint iconified:iconified |
|
7777 |
] ifFalse:[ |
|
7778 |
" |
|
7779 |
no, map only |
|
7780 |
" |
|
7781 |
realized := true. |
|
7782 |
aPoint isNil ifTrue:[ |
|
7783 |
iconified ifTrue:[ |
|
7784 |
device |
|
7785 |
mapView:self id:drawableId iconified:iconified |
|
7786 |
atX:0 y:0 |
|
7787 |
width:width height:height |
|
7788 |
minExtent:(self minExtent) maxExtent:(self maxExtent). |
|
7789 |
] ifFalse:[ |
|
7790 |
device mapWindow:drawableId. |
|
7791 |
] |
|
7792 |
] ifFalse:[ |
|
7793 |
left := aPoint x. |
|
7794 |
top := aPoint y. |
|
7795 |
device |
|
7796 |
mapView:self id:drawableId iconified:iconified |
|
7797 |
atX:left y:top |
|
7798 |
width:width height:height |
|
7799 |
minExtent:(self minExtent) maxExtent:(self maxExtent). |
|
7800 |
]. |
|
7801 |
||
7802 |
"/ |
|
7803 |
"/ implies that all realized subviews |
|
7804 |
"/ are now also mapped |
|
7805 |
"/ |
|
7806 |
"/ not needed for topViews - the mapped event does exactly the same |
|
7807 |
"/ however, X does not generate mapped events for non-topViews |
|
7808 |
"/ when a view gets deiconified. |
|
7809 |
||
7810 |
superView notNil ifTrue:[ |
|
7811 |
(subs := self subViews) notNil ifTrue:[ |
|
7812 |
subs do:[:v | |
|
7813 |
v shown ifFalse:[ |
|
7814 |
v mapped |
|
7815 |
] |
|
7816 |
] |
|
7817 |
] |
|
7818 |
] |
|
7819 |
]. |
|
140 | 7820 |
] |
654 | 7821 |
|
1039
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
7822 |
"Modified: 23.8.1996 / 14:53:55 / stefan" |
1827 | 7823 |
"Created: 24.7.1997 / 13:43:23 / cg" |
7824 |
"Modified: 24.7.1997 / 13:46:21 / cg" |
|
7825 |
! |
|
7826 |
||
7827 |
mapIconified |
|
7828 |
"make the view visible on the screen. |
|
7829 |
For topViews, the view is created in iconified state" |
|
7830 |
||
7831 |
self mapAt:nil iconified:true |
|
7832 |
||
7833 |
"Modified: 24.7.1997 / 13:44:25 / cg" |
|
7834 |
"Created: 24.7.1997 / 13:47:03 / cg" |
|
140 | 7835 |
! |
7836 |
||
269 | 7837 |
physicalCreate |
7838 |
"common code for create & recreate: |
|
7839 |
physically create (but do not map) the view on the device." |
|
7840 |
||
3642 | 7841 |
|sv isInputOnly| |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
7842 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
7843 |
sv := superView isNil ifTrue:[superView] ifFalse:[superView view]. |
269 | 7844 |
|
3008
81987f198808
let WindowSensor perform the preViewCreation/postViewCreation
Claus Gittinger <cg@exept.de>
parents:
3007
diff
changeset
|
7845 |
"/ give global eventListeners a chance to intercept windowCreation |
81987f198808
let WindowSensor perform the preViewCreation/postViewCreation
Claus Gittinger <cg@exept.de>
parents:
3007
diff
changeset
|
7846 |
"/ and provide another origin (by payching my origin via setOrigin:). |
81987f198808
let WindowSensor perform the preViewCreation/postViewCreation
Claus Gittinger <cg@exept.de>
parents:
3007
diff
changeset
|
7847 |
WindowSensor preViewCreateNotification:self. |
81987f198808
let WindowSensor perform the preViewCreation/postViewCreation
Claus Gittinger <cg@exept.de>
parents:
3007
diff
changeset
|
7848 |
|
2088 | 7849 |
isInputOnly := self isInputOnly. |
7850 |
||
269 | 7851 |
drawableId := device |
3762 | 7852 |
createWindowFor:self |
7853 |
type:nil |
|
7854 |
origin:(left @ top) |
|
7855 |
extent:(width @ height) |
|
7856 |
minExtent:nil |
|
7857 |
maxExtent:nil |
|
7858 |
borderWidth:borderWidth |
|
7859 |
subViewOf:sv |
|
7860 |
style:(self windowStyle) |
|
7861 |
inputOnly:isInputOnly |
|
7862 |
label:nil |
|
7863 |
owner:nil |
|
7864 |
icon:nil iconMask:nil |
|
7865 |
iconView:nil. |
|
269 | 7866 |
|
7867 |
Lobby registerChange:self. |
|
1716
d6bf8f0deb18
added werners eventListener hook for view creation
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
7868 |
|
3010
ea1a075505b4
Let #waitUntilVisible processExposeEvents
Stefan Vogel <sv@exept.de>
parents:
3008
diff
changeset
|
7869 |
"/ if there is a global eventListener, |
ea1a075505b4
Let #waitUntilVisible processExposeEvents
Stefan Vogel <sv@exept.de>
parents:
3008
diff
changeset
|
7870 |
"/ give it a chance to track views |
ea1a075505b4
Let #waitUntilVisible processExposeEvents
Stefan Vogel <sv@exept.de>
parents:
3008
diff
changeset
|
7871 |
|
3008
81987f198808
let WindowSensor perform the preViewCreation/postViewCreation
Claus Gittinger <cg@exept.de>
parents:
3007
diff
changeset
|
7872 |
"/ give global listeners a chance to track views |
81987f198808
let WindowSensor perform the preViewCreation/postViewCreation
Claus Gittinger <cg@exept.de>
parents:
3007
diff
changeset
|
7873 |
WindowSensor postViewCreateNotification:self. |
1716
d6bf8f0deb18
added werners eventListener hook for view creation
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
7874 |
|
3375 | 7875 |
self extentChangedFlag:false. |
7876 |
self originChangedFlag:false. |
|
269 | 7877 |
|
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
7878 |
(borderColor notNil and:[borderColor ~= Black]) ifTrue:[ |
3762 | 7879 |
isInputOnly ifFalse:[ |
2088 | 7880 |
"/ borderColor := borderColor on:device. |
3762 | 7881 |
self setBorderColor |
7882 |
] |
|
269 | 7883 |
]. |
7884 |
(viewGravity notNil "and:[viewGravity ~~ #NorthWest]") ifTrue:[ |
|
3762 | 7885 |
device setWindowGravity:viewGravity in:drawableId |
269 | 7886 |
]. |
7887 |
(bitGravity notNil "and:[bitGravity ~~ #NorthWest]") ifTrue:[ |
|
3762 | 7888 |
isInputOnly ifFalse:[ |
7889 |
device setBitGravity:bitGravity in:drawableId |
|
7890 |
] |
|
269 | 7891 |
]. |
7892 |
viewShape notNil ifTrue:[ |
|
3762 | 7893 |
self setViewShape |
269 | 7894 |
]. |
7895 |
(backed notNil and:[backed ~~ false]) ifTrue:[ |
|
3762 | 7896 |
device setBackingStore:backed in:drawableId |
3152 | 7897 |
]. |
7898 |
self saveUnder ifTrue:[ |
|
3762 | 7899 |
device setSaveUnder:true in:drawableId |
1903 | 7900 |
]. |
1960 | 7901 |
cursor notNil ifTrue:[ |
3762 | 7902 |
self setCursor |
2088 | 7903 |
]. |
7904 |
||
7905 |
"Modified: / 9.4.1998 / 20:18:12 / cg" |
|
269 | 7906 |
! |
7907 |
||
1827 | 7908 |
postRealize |
7909 |
"invoked after a view was realized. |
|
7910 |
Can be redefined in subclasses to perform delayed actions." |
|
7911 |
||
7912 |
"/ nothing done here |
|
7913 |
||
7914 |
"Created: 24.7.1997 / 14:35:36 / cg" |
|
7915 |
! |
|
7916 |
||
4126 | 7917 |
preRealize |
7918 |
"invoked right before a view is realized. |
|
7919 |
Can be redefined in subclasses to perform delayed actions." |
|
7920 |
||
7921 |
"/ nothing done here |
|
7922 |
||
7923 |
"Created: 24.7.1997 / 14:35:36 / cg" |
|
7924 |
! |
|
7925 |
||
269 | 7926 |
realize |
7927 |
"realize - make visible; |
|
7928 |
realizing is done very late (after layout is fixed) to avoid |
|
7929 |
visible rearranging of windows on the screen" |
|
7930 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7931 |
self realizeKeepingGroup:false at:nil iconified:false |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7932 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7933 |
"Modified: 24.7.1997 / 13:14:28 / cg" |
269 | 7934 |
! |
7935 |
||
7936 |
realizeAllSubViews |
|
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
7937 |
"realize all my subviews - but not myself." |
269 | 7938 |
|
7939 |
subViews notNil ifTrue:[ |
|
3762 | 7940 |
subViews do:[:subView | |
7941 |
subView realize |
|
7942 |
] |
|
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
7943 |
]. |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
7944 |
components notNil ifTrue:[ |
3762 | 7945 |
components do:[:component | |
7946 |
component realize |
|
7947 |
] |
|
269 | 7948 |
]. |
7949 |
||
7950 |
"Modified: 5.9.1995 / 23:30:47 / claus" |
|
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
7951 |
"Modified: 13.1.1997 / 21:25:49 / cg" |
269 | 7952 |
! |
7953 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7954 |
realizeAt:aPoint |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7955 |
"realize - make visible; |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7956 |
realizing is done very late (after layout is fixed) to avoid |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7957 |
visible rearranging of windows on the screen" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7958 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7959 |
self realizeKeepingGroup:false at:aPoint iconified:false |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7960 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7961 |
"Modified: 24.7.1997 / 13:14:28 / cg" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7962 |
"Created: 24.7.1997 / 13:21:04 / cg" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7963 |
! |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7964 |
|
269 | 7965 |
realizeInGroup |
7966 |
"special realize - leave windowgroup as is; |
|
7967 |
This allows a view to be realized in any windowgroup; |
|
7968 |
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
|
7969 |
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
|
7970 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
7971 |
windowGroup isForModalSubview:true. |
1877 | 7972 |
"/ self realize. |
7973 |
||
7974 |
self realizeKeepingGroup:true at:nil iconified:false |
|
7975 |
||
7976 |
"Modified: 20.8.1997 / 14:56:20 / cg" |
|
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
7977 |
! |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
7978 |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7979 |
realizeKeepingGroup:keepGroupAsIs at:position iconified:iconified |
151 | 7980 |
"common helper for realize and realizeInGroup. |
1877 | 7981 |
Create the view; if the keepGroupAsIs argument is not true, |
7982 |
assign my windowGroup." |
|
140 | 7983 |
|
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
7984 |
|superGroup groupChange keep| |
140 | 7985 |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7986 |
"/ fetch device colors, to avoid reallocation at redraw time |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7987 |
self fetchDeviceResources. |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
7988 |
|
2189
86284985c4c0
care for non-creatable views.
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
7989 |
drawableId isNil ifTrue:[ |
4049 | 7990 |
self create. |
7991 |
drawableId isNil ifTrue:[ |
|
7992 |
('SimpleView [warning]: could not create view: ' , self class name) errorPrintCR. |
|
7993 |
^ self |
|
7994 |
] |
|
2189
86284985c4c0
care for non-creatable views.
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
7995 |
]. |
140 | 7996 |
|
372 | 7997 |
groupChange := false. |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
7998 |
|
1877 | 7999 |
(windowGroup notNil |
8000 |
and:[superView isNil |
|
8001 |
and:[windowGroup isForModalSubview]]) ifTrue:[ |
|
4049 | 8002 |
keep := true. |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
8003 |
] ifFalse:[ |
4049 | 8004 |
keep := keepGroupAsIs |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
8005 |
]. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
8006 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
8007 |
keep ifFalse:[ |
4049 | 8008 |
" |
8009 |
put myself into superviews windowgroup if there is a superview |
|
8010 |
This is the default behavior, which may be suppressed by |
|
8011 |
passing true as keepGroupAsIs-argument. |
|
8012 |
(it may be useful to assign a separate windowGroup to |
|
8013 |
a childView to have it execute independent of the parent |
|
8014 |
-> an example is found in the fileBrowsers kill-button) |
|
8015 |
" |
|
8016 |
superView notNil ifTrue:[ |
|
8017 |
superGroup := superView windowGroup. |
|
8018 |
(windowGroup notNil and:[superGroup ~~ windowGroup]) ifTrue:[ |
|
8019 |
" |
|
8020 |
mhmh - seems that the windowgroup has changed .... |
|
8021 |
" |
|
145 | 8022 |
"/ 'oops - wgroup change on realize' printNL. |
4049 | 8023 |
groupChange := true. |
8024 |
||
8025 |
"/ |
|
8026 |
"/ recursively change the windowGroup of |
|
8027 |
"/ myself and all of my children |
|
8028 |
"/ |
|
8029 |
self windowGroup:superGroup. |
|
8030 |
] ifFalse:[ |
|
8031 |
windowGroup isNil ifTrue:[ |
|
8032 |
"/ |
|
8033 |
"/ only change the group of myself - |
|
8034 |
"/ subviews will fetch it when realized. |
|
8035 |
"/ |
|
8036 |
windowGroup := superGroup. |
|
8037 |
superGroup notNil ifTrue:[superGroup addView:self]. |
|
8038 |
] |
|
8039 |
]. |
|
8040 |
]. |
|
140 | 8041 |
]. |
8042 |
||
3375 | 8043 |
(self originOrExtentChanged) ifTrue:[ |
4049 | 8044 |
self fixSize. |
8045 |
self sizeChanged:nil. |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8046 |
]. |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8047 |
position notNil ifTrue:[ |
4049 | 8048 |
self origin:position. |
1039
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
8049 |
]. |
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
8050 |
|
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
8051 |
(subViews notNil or:[components notNil]) ifTrue:[ |
4049 | 8052 |
(realized not or:[groupChange]) ifTrue:[ |
2558 | 8053 |
hiddenOnRealize ifFalse:[ |
4049 | 8054 |
self realizeAllSubViews. |
2558 | 8055 |
]. |
4049 | 8056 |
]. |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8057 |
]. |
1874
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
8058 |
|
4126 | 8059 |
self preRealize. |
8060 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8061 |
iconified ifTrue:[ |
4049 | 8062 |
realized ifFalse:[ |
8063 |
self mapIconified |
|
8064 |
] |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8065 |
] ifFalse:[ |
4049 | 8066 |
hiddenOnRealize ifFalse:[ |
8067 |
self setInnerClip. |
|
8068 |
||
8069 |
realized ifFalse:[ |
|
8070 |
" |
|
8071 |
now, make the view visible |
|
8072 |
" |
|
8073 |
self mapAt:position |
|
8074 |
] |
|
8075 |
] |
|
140 | 8076 |
]. |
8077 |
||
8078 |
controller notNil ifTrue:[ |
|
4049 | 8079 |
controller startUp |
1827 | 8080 |
]. |
8081 |
||
8082 |
self postRealize |
|
654 | 8083 |
|
2189
86284985c4c0
care for non-creatable views.
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
8084 |
"Modified: / 23.8.1996 / 15:07:16 / stefan" |
86284985c4c0
care for non-creatable views.
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
8085 |
"Created: / 24.7.1997 / 13:10:17 / cg" |
86284985c4c0
care for non-creatable views.
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
8086 |
"Modified: / 27.7.1998 / 20:01:02 / cg" |
140 | 8087 |
! |
8088 |
||
8089 |
recreate |
|
3301 | 8090 |
"recreate (i.e. tell X about me) after a snapin or a migration" |
140 | 8091 |
|
8092 |
drawableId isNil ifTrue:[ |
|
3762 | 8093 |
super recreate. |
8094 |
self physicalCreate. |
|
8095 |
||
8096 |
viewBackground notNil ifTrue:[ |
|
8097 |
self setViewBackground |
|
8098 |
]. |
|
8099 |
||
8100 |
" |
|
8101 |
XXX has to be changed: eventmasks are device specific - |
|
8102 |
XXX will not allow restart on another Workstation-type. |
|
8103 |
XXX event masks must become symbolic |
|
8104 |
" |
|
8105 |
eventMask isNil ifTrue:[ |
|
8106 |
eventMask := device defaultEventMask |
|
8107 |
]. |
|
8108 |
device setEventMask:eventMask in:drawableId |
|
140 | 8109 |
] |
8110 |
! |
|
8111 |
||
654 | 8112 |
remap |
8113 |
"make the view visible on the screen at its previous position. |
|
8114 |
In contrast to map, this asks the windowManager to show the view |
|
8115 |
immediately (instead of asking for a frame). However, some windowManagers |
|
8116 |
are known to ignore this ..." |
|
8117 |
||
8118 |
realized ifFalse:[ |
|
3152 | 8119 |
" |
8120 |
now, make the view visible |
|
8121 |
" |
|
8122 |
realized := true. |
|
8123 |
device |
|
8124 |
mapView:self id:drawableId iconified:false |
|
8125 |
atX:left y:top width:width height:height |
|
8126 |
minExtent:(self minExtent) maxExtent:(self maxExtent) |
|
654 | 8127 |
] |
8128 |
||
8129 |
"Created: 8.5.1996 / 09:33:06 / cg" |
|
1379 | 8130 |
"Modified: 25.2.1997 / 22:44:33 / cg" |
654 | 8131 |
! |
8132 |
||
1109 | 8133 |
rerealize |
8134 |
"rerealize at old position in (a possibly different) windowGroup." |
|
8135 |
||
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8136 |
self fetchDeviceResources. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8137 |
|
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8138 |
self rerealizeInGroup:windowGroup. |
1109 | 8139 |
|
8140 |
"Created: 7.11.1996 / 16:27:09 / cg" |
|
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8141 |
"Modified: 13.1.1997 / 21:53:18 / cg" |
1109 | 8142 |
! |
8143 |
||
269 | 8144 |
rerealizeInGroup:aWindowGroup |
8145 |
"rerealize at old position in (a possibly different) windowGroup." |
|
8146 |
||
1837 | 8147 |
drawableId isNil ifTrue:[self create]. |
269 | 8148 |
drawableId notNil ifTrue:[ |
3152 | 8149 |
aWindowGroup ~~ windowGroup ifTrue:[ |
8150 |
windowGroup notNil ifTrue:[ |
|
8151 |
windowGroup removeView:self |
|
8152 |
]. |
|
8153 |
windowGroup := aWindowGroup. |
|
8154 |
aWindowGroup addTopView:self. |
|
8155 |
]. |
|
8156 |
self remap. |
|
269 | 8157 |
] |
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
8158 |
|
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
8159 |
"Modified: 3.5.1996 / 23:59:30 / stefan" |
1837 | 8160 |
"Modified: 28.7.1997 / 18:53:01 / cg" |
140 | 8161 |
! |
8162 |
||
8163 |
rerealizeWithAllSubViews |
|
8164 |
"rerealize myself with all subviews" |
|
8165 |
||
8166 |
drawableId notNil ifTrue:[ |
|
3152 | 8167 |
realized := true. |
8168 |
self realizeAllSubViews. |
|
8169 |
device |
|
8170 |
mapView:self id:drawableId iconified:false |
|
8171 |
atX:left y:top width:width height:height |
|
8172 |
minExtent:(self minExtent) maxExtent:(self maxExtent) |
|
140 | 8173 |
] |
1290
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
8174 |
|
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
8175 |
"Modified: 28.1.1997 / 17:59:28 / cg" |
180 | 8176 |
! |
8177 |
||
269 | 8178 |
resize |
8179 |
"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
|
8180 |
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
|
8181 |
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
|
8182 |
|
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
8183 |
explicitExtent ~~ true ifTrue:[ |
3152 | 8184 |
layout isNil ifTrue:[ |
8185 |
self extent:(self preferredExtent). |
|
8186 |
explicitExtent := false. |
|
8187 |
]. |
|
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
8188 |
] |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
8189 |
|
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
8190 |
"Modified: 15.7.1996 / 11:20:27 / cg" |
269 | 8191 |
! |
8192 |
||
8193 |
unmap |
|
2576 | 8194 |
"unmap the view - the view stays created (but invisible), and can be remapped again later." |
269 | 8195 |
|
8196 |
realized ifTrue:[ |
|
3762 | 8197 |
realized := false. |
8198 |
drawableId notNil ifTrue:[ |
|
8199 |
device unmapWindow:drawableId. |
|
8200 |
||
8201 |
"/ make it go away immediately |
|
8202 |
"/ (this hides the subview killing) |
|
8203 |
device flush. |
|
8204 |
]. |
|
8205 |
||
8206 |
"/ Normally, this is not correct with X, where the |
|
8207 |
"/ unmap is an asynchronous operation. |
|
8208 |
"/ (shown is cleared also in unmapped event) |
|
8209 |
"/ Do it anyway, to avoid synchronisation problems. |
|
8210 |
||
8211 |
shown := false. |
|
8212 |
self changed:#visibility. |
|
269 | 8213 |
]. |
190 | 8214 |
|
8215 |
" |
|
269 | 8216 |
|top sub| |
8217 |
||
8218 |
top := StandardSystemView new. |
|
8219 |
top extent:200@200. |
|
8220 |
||
8221 |
sub := View |
|
3762 | 8222 |
origin:0.2@0.2 |
8223 |
corner:0.8@0.8 |
|
8224 |
in:top. |
|
269 | 8225 |
|
8226 |
sub viewBackground:Color red. |
|
8227 |
sub hiddenOnRealize:true. |
|
8228 |
||
8229 |
top open. |
|
8230 |
(Delay forSeconds:5) wait. |
|
8231 |
sub map. |
|
8232 |
(Delay forSeconds:3) wait. |
|
8233 |
sub unmap. |
|
8234 |
sub viewBackground:(Color green). |
|
8235 |
(Delay forSeconds:3) wait. |
|
8236 |
sub map. |
|
151 | 8237 |
" |
1379 | 8238 |
|
2465
193a96bd94d7
clear shown when unmapped notification arrives
Claus Gittinger <cg@exept.de>
parents:
2454
diff
changeset
|
8239 |
"Modified: / 22.2.1999 / 20:10:58 / cg" |
269 | 8240 |
! |
8241 |
||
8242 |
unrealize |
|
8243 |
"alias for unmap, for historic reasons" |
|
8244 |
||
3434 | 8245 |
<resource:#obsolete> |
8246 |
||
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
8247 |
self obsoleteMethodWarning:'use unmap'. |
269 | 8248 |
self unmap. |
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
8249 |
|
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
8250 |
"Modified: 4.5.1996 / 00:07:48 / stefan" |
151 | 8251 |
! ! |
8252 |
||
8253 |
!SimpleView methodsFor:'redrawing'! |
|
8254 |
||
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8255 |
flash |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8256 |
"flash the view - fill it black, then white, finally |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8257 |
redraw completely. |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8258 |
Can be used to wakeup the user :-) |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8259 |
when problem or warning conditions arise. |
2174 | 8260 |
Someone may redefine this to flash its contents (instead of black/white)." |
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8261 |
|
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8262 |
self fill:Black. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8263 |
Delay waitForSeconds:0.1. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8264 |
self fill:White. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8265 |
Delay waitForSeconds:0.1. |
2173 | 8266 |
self fill:viewBackground. |
8267 |
"/ self clear. |
|
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8268 |
self invalidate |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8269 |
|
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8270 |
" |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8271 |
|v| |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8272 |
|
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8273 |
v := View new openAndWait. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8274 |
Delay waitForSeconds:2. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8275 |
v flash. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8276 |
Delay waitForSeconds:2. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8277 |
v destroy |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8278 |
" |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8279 |
|
2174 | 8280 |
"Modified: / 16.7.1998 / 18:46:48 / cg" |
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8281 |
! |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8282 |
|
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8283 |
invalidate |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8284 |
"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
|
8285 |
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
|
8286 |
the views process itself, and there is a possibilty to merge |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8287 |
multiple damage rectangles into single redraws. |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8288 |
However, be aware, that the redrawing may be delayed for some time, |
4057 | 8289 |
until the receivers windowGroupProcess gets rescheduled." |
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8290 |
|
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8291 |
shown ifFalse:[ |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8292 |
"/ no need to add damage - will get a full-redraw anyway, |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8293 |
"/ when I will be shown again. |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8294 |
^ self |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8295 |
]. |
2451 | 8296 |
self |
4049 | 8297 |
invalidateDeviceRectangle:(Rectangle left:0 top:0 width:width height:height) |
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8298 |
repairNow:false |
2394
cfb6434f1a9c
oops - invalidate must add deviceRectangles to the damage-list.
Claus Gittinger <cg@exept.de>
parents:
2382
diff
changeset
|
8299 |
|
cfb6434f1a9c
oops - invalidate must add deviceRectangles to the damage-list.
Claus Gittinger <cg@exept.de>
parents:
2382
diff
changeset
|
8300 |
"Modified: / 9.11.1998 / 21:04:16 / cg" |
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8301 |
! |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8302 |
|
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8303 |
invalidate:aRectangle |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8304 |
"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
|
8305 |
This is preferable to calling redraw directly, |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8306 |
in that the drawing is done by the views process itself, |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8307 |
and there is a possibilty to merge multiple damage rectangles into |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8308 |
single redraws. |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8309 |
However, be aware, that the redrawing may be delayed for some time, |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8310 |
intil the receivers windowGroupProcess gets rescheduled." |
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8311 |
|
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8312 |
shown ifFalse:[ |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8313 |
"/ no need to add damage - will get a full-redraw anyway, |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8314 |
"/ when I will be shown again. |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8315 |
^ self |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8316 |
]. |
2394
cfb6434f1a9c
oops - invalidate must add deviceRectangles to the damage-list.
Claus Gittinger <cg@exept.de>
parents:
2382
diff
changeset
|
8317 |
self invalidate:aRectangle repairNow:false |
cfb6434f1a9c
oops - invalidate must add deviceRectangles to the damage-list.
Claus Gittinger <cg@exept.de>
parents:
2382
diff
changeset
|
8318 |
|
cfb6434f1a9c
oops - invalidate must add deviceRectangles to the damage-list.
Claus Gittinger <cg@exept.de>
parents:
2382
diff
changeset
|
8319 |
"Modified: / 9.11.1998 / 21:03:14 / cg" |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8320 |
! |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8321 |
|
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8322 |
invalidate:aRectangle repairNow:doRepairNow |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8323 |
"add a damage to redraw part of the receiver, to its input event queue. |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8324 |
and (if repairNow is true), force the receiver to repair all of its |
2451 | 8325 |
damaged areas right now. |
8326 |
The given rectangle is in logical coordinate space." |
|
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8327 |
|
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
8328 |
|r| |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
8329 |
|
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8330 |
shown ifFalse:[ |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8331 |
"/ no need to add damage - will get a full-redraw anyway, |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8332 |
"/ when I will be shown again. |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8333 |
^ self |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8334 |
]. |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8335 |
|
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
8336 |
r := aRectangle. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
8337 |
transformation notNil ifTrue:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
8338 |
r := transformation applyTo:r. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
8339 |
]. |
4049 | 8340 |
self sensor addDamage:r view:self. |
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8341 |
doRepairNow ifTrue:[ |
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
8342 |
self repairDamage |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8343 |
] |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8344 |
|
2395 | 8345 |
"Modified: / 10.11.1998 / 01:55:03 / cg" |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8346 |
! |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8347 |
|
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8348 |
invalidateDeviceRectangle:aRectangle repairNow:doRepairNow |
2396
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
8349 |
"add a damage to redraw part of the receiver, to its input event queue. |
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
8350 |
and (if repairNow is true), force the receiver to repair all of its |
2451 | 8351 |
damaged areas right now. |
8352 |
The given rectangle is in device coordinate space." |
|
2396
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
8353 |
|
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8354 |
shown ifFalse:[ |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8355 |
"/ no need to add damage - will get a full-redraw anyway, |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8356 |
"/ when I will be shown again. |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8357 |
^ self |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8358 |
]. |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8359 |
|
4049 | 8360 |
self sensor addDamage:aRectangle view:self. |
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8361 |
doRepairNow ifTrue:[ |
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
8362 |
self repairDamage |
2396
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
8363 |
] |
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
8364 |
|
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
8365 |
"Modified: / 10.11.1998 / 01:55:03 / cg" |
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
8366 |
"Created: / 10.11.1998 / 19:02:01 / cg" |
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
8367 |
! |
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
8368 |
|
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8369 |
invalidateRepairNow:doRepair |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8370 |
"add a damage to redraw all of the receiver, to its input event queue. |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8371 |
and (if repairNow is true), force the receiver to repair all of its |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8372 |
damaged areas right now." |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8373 |
|
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8374 |
shown ifFalse:[ |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8375 |
"/ no need to add damage - will get a full-redraw anyway, |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8376 |
"/ when I will be shown again. |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8377 |
^ self |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8378 |
]. |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8379 |
self |
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8380 |
invalidateDeviceRectangle:(Rectangle left:0 top:0 width:width height:height) |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8381 |
repairNow:doRepair |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8382 |
|
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8383 |
"Created: 19.4.1997 / 11:58:04 / cg" |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8384 |
"Modified: 19.4.1997 / 12:00:00 / cg" |
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8385 |
! |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8386 |
|
3704 | 8387 |
invalidateX:x y:y width:w height:h |
8388 |
"add a damage to redraw all of the receiver, to its input event queue." |
|
8389 |
||
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8390 |
shown ifFalse:[ |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8391 |
"/ no need to add damage - will get a full-redraw anyway, |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8392 |
"/ when I will be shown again. |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8393 |
^ self |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8394 |
]. |
3704 | 8395 |
self invalidate:(Rectangle left:x top:y width:w height:h) |
8396 |
! |
|
8397 |
||
8398 |
invalidateX:x y:y width:w height:h repairNow:doRepair |
|
8399 |
"add a damage to redraw all of the receiver, to its input event queue. |
|
8400 |
and (if repairNow is true), force the receiver to repair all of its |
|
8401 |
damaged areas right now." |
|
8402 |
||
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8403 |
shown ifFalse:[ |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8404 |
"/ no need to add damage - will get a full-redraw anyway, |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8405 |
"/ when I will be shown again. |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8406 |
^ self |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8407 |
]. |
3704 | 8408 |
self invalidate:(Rectangle left:x top:y width:w height:h) repairNow:doRepair |
8409 |
! |
|
8410 |
||
269 | 8411 |
redraw |
782 | 8412 |
"redraw myself completely - this is sent by redrawX:y:width:height: |
8413 |
as a fallback. |
|
8414 |
Cannot do much here - is redefined in subclasses which dont care for |
|
8415 |
updating regions but instead update everything." |
|
8416 |
||
8417 |
"Modified: 29.5.1996 / 18:02:52 / cg" |
|
269 | 8418 |
! |
8419 |
||
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8420 |
redraw:aRectangle |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8421 |
"redraw a part of the view immediately." |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8422 |
|
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8423 |
self |
3152 | 8424 |
redrawX:(aRectangle left) |
8425 |
y:(aRectangle top) |
|
8426 |
width:(aRectangle width) |
|
8427 |
height:(aRectangle height) |
|
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8428 |
|
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8429 |
"Modified: 19.4.1997 / 11:54:23 / cg" |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8430 |
! |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8431 |
|
269 | 8432 |
redrawDeviceX:x y:y width:w height:h |
8433 |
"have to redraw part of the view. |
|
8434 |
The coordinates are in device space - if there is a transformation, |
|
8435 |
must inverse-transform back to logical coordinates. (since the view thinks |
|
8436 |
in its coordinate space)" |
|
8437 |
||
8438 |
|lx ly lw lh| |
|
8439 |
||
2822 | 8440 |
transformation isNil ifTrue:[ |
3152 | 8441 |
lx := x. |
8442 |
ly := y. |
|
8443 |
lw := w. |
|
8444 |
lh := h. |
|
2822 | 8445 |
] ifFalse:[ |
3152 | 8446 |
lx := transformation applyInverseToX:x. |
8447 |
ly := transformation applyInverseToY:y. |
|
8448 |
lw := transformation applyInverseScaleX:w. |
|
8449 |
lh := transformation applyInverseScaleY:h. |
|
269 | 8450 |
]. |
8451 |
self redrawX:lx y:ly width:lw height:lh |
|
8452 |
! |
|
8453 |
||
151 | 8454 |
redrawX:x y:y width:w height:h |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8455 |
"redraw part of myself immediately, given logical coordinates |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8456 |
(if transformation is nonNil) |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8457 |
The default here is to redraw everything |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8458 |
- subclasses usually redefine this, adding more intelligence" |
151 | 8459 |
|
738 | 8460 |
|area oldClip| |
151 | 8461 |
|
8462 |
shown ifFalse:[^ self]. |
|
8463 |
||
8464 |
area := Rectangle left:x top:y width:w height:h. |
|
738 | 8465 |
oldClip := clipRect. |
8466 |
self clippingRectangle:area. |
|
8467 |
||
8468 |
components notNil ifTrue:[ |
|
3152 | 8469 |
self clearRectangleX:x y:y width:w height:h. |
8470 |
components do:[:aComponent | |
|
8471 |
|thisFrame is| |
|
8472 |
||
8473 |
thisFrame := aComponent bounds. |
|
8474 |
(thisFrame intersects:area) ifTrue:[ |
|
8475 |
aComponent displayOn:self |
|
8476 |
] |
|
8477 |
] |
|
738 | 8478 |
] ifFalse:[ |
3152 | 8479 |
"/ redraw everything - a fallBack for lazy views. |
8480 |
self redraw |
|
738 | 8481 |
]. |
8482 |
||
8483 |
self clippingRectangle:oldClip. |
|
8484 |
||
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8485 |
"Modified: 19.4.1997 / 11:55:08 / cg" |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8486 |
! |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8487 |
|
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8488 |
repairDamage |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8489 |
"force the receiver to repair all of its |
2095 | 8490 |
damaged areas right now." |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8491 |
|
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8492 |
|wg| |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8493 |
|
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8494 |
shown ifTrue:[ |
3152 | 8495 |
(wg := self windowGroup) notNil ifTrue:[ |
8496 |
"/ wg processRealExposeEventsFor:self. "/ this ignores map/unmap |
|
8497 |
wg processExposeEventsFor:self. "/ this handles map/unmap |
|
8498 |
] |
|
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8499 |
] |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8500 |
|
2138
1800e9b5afe3
also handle map/unmap events in repairDamage.
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
8501 |
"Created: / 19.4.1997 / 12:01:13 / cg" |
2406 | 8502 |
"Modified: / 3.12.1998 / 14:02:06 / cg" |
151 | 8503 |
! |
8504 |
||
269 | 8505 |
showActive |
8506 |
"redraw myself as active (i.e. busy). |
|
8507 |
Nothing done here, but redefined in some classes." |
|
8508 |
||
8509 |
^ self |
|
135 | 8510 |
! |
8511 |
||
8512 |
showPassive |
|
8513 |
"redraw myself as inactive (i.e. nonbusy). |
|
151 | 8514 |
Nothing done here, but redefined in some classes." |
135 | 8515 |
|
8516 |
^ self |
|
8517 |
! ! |
|
8518 |
||
269 | 8519 |
!SimpleView methodsFor:'scrolling'! |
8520 |
||
2559
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
8521 |
halfPageDown |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
8522 |
"scroll down half a page |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
8523 |
" |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
8524 |
self scrollDown:(self innerHeight // 2) |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
8525 |
|
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
8526 |
|
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
8527 |
! |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
8528 |
|
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
8529 |
halfPageUp |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
8530 |
"scroll up half a page |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
8531 |
" |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
8532 |
self scrollUp:(self innerHeight // 2) |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
8533 |
|
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
8534 |
! |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
8535 |
|
269 | 8536 |
horizontalScrollStep |
8537 |
"return the amount to scroll when stepping left/right. |
|
8538 |
Subclasses may want to redefine this." |
|
8539 |
||
8540 |
^ (device horizontalPixelPerMillimeter * 20) asInteger |
|
8541 |
! |
|
8542 |
||
1052
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8543 |
pageDown |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8544 |
self scrollDown:(self innerHeight) |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8545 |
|
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8546 |
"Created: 13.9.1996 / 14:06:54 / cg" |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8547 |
! |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8548 |
|
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8549 |
pageUp |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8550 |
self scrollUp:(self innerHeight) |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8551 |
|
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8552 |
"Created: 13.9.1996 / 14:07:01 / cg" |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8553 |
! |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8554 |
|
269 | 8555 |
scrollDown |
8556 |
"scroll down by some amount; this is called when the scrollbars |
|
8557 |
scroll-step down button is pressed." |
|
8558 |
||
8559 |
self scrollDown:(self verticalScrollStep) |
|
8560 |
! |
|
8561 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8562 |
scrollDown:nPixels |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8563 |
"change origin to scroll down some pixels" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8564 |
|
1035
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
8565 |
|viewOrigin| |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
8566 |
|
2703 | 8567 |
nPixels ~~ 0 ifTrue:[ |
3152 | 8568 |
viewOrigin := self viewOrigin. |
8569 |
self scrollTo:(viewOrigin x @ (viewOrigin y + nPixels)) |
|
2703 | 8570 |
] |
8571 |
||
8572 |
"Modified: / 20.8.1996 / 17:34:36 / stefan" |
|
8573 |
"Modified: / 21.5.1999 / 15:57:56 / cg" |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8574 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8575 |
|
269 | 8576 |
scrollHorizontalTo:aPixelOffset |
8577 |
"change origin to make aPixelOffset be the left col" |
|
8578 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8579 |
|orgY| |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8580 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8581 |
orgY := self viewOrigin y. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8582 |
^ self scrollTo:(aPixelOffset @ orgY). |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8583 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8584 |
"Modified: 8.7.1996 / 15:34:54 / stefan" |
140 | 8585 |
! |
8586 |
||
269 | 8587 |
scrollHorizontalToPercent:percent |
8588 |
"scroll to a position given in percent of total" |
|
8589 |
||
8590 |
|wCont| |
|
8591 |
||
8592 |
wCont := self widthOfContents. |
|
8593 |
transformation notNil ifTrue:[ |
|
3152 | 8594 |
wCont := transformation applyScaleX:wCont. |
269 | 8595 |
]. |
8596 |
self scrollHorizontalTo: |
|
3152 | 8597 |
((((wCont * percent) / 100.0) + 0.5) asInteger) |
269 | 8598 |
! |
8599 |
||
8600 |
scrollLeft |
|
8601 |
"scroll left by some amount; this is called when the scrollbars |
|
8602 |
scroll-step left button is pressed." |
|
8603 |
||
8604 |
self scrollLeft:(self horizontalScrollStep) |
|
8605 |
! |
|
8606 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8607 |
scrollLeft:nPixels |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8608 |
"change origin to scroll left some pixels" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8609 |
|
1035
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
8610 |
|viewOrigin| |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
8611 |
|
2703 | 8612 |
nPixels ~~ 0 ifTrue:[ |
3152 | 8613 |
viewOrigin := self viewOrigin. |
8614 |
self scrollTo:((viewOrigin x - nPixels) @ viewOrigin y). |
|
2703 | 8615 |
] |
8616 |
||
8617 |
"Modified: / 20.8.1996 / 17:35:09 / stefan" |
|
8618 |
"Modified: / 21.5.1999 / 15:58:03 / cg" |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8619 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8620 |
|
269 | 8621 |
scrollRight |
8622 |
"scroll right by some amount; this is called when the scrollbars |
|
8623 |
scroll-step right button is pressed." |
|
8624 |
||
8625 |
self scrollRight:(self horizontalScrollStep) |
|
8626 |
! |
|
8627 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8628 |
scrollRight:nPixels |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8629 |
"change origin to scroll right some pixels" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8630 |
|
1035
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
8631 |
|viewOrigin| |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
8632 |
|
2703 | 8633 |
nPixels ~~ 0 ifTrue:[ |
3152 | 8634 |
viewOrigin := self viewOrigin. |
8635 |
self scrollTo:((viewOrigin x + nPixels) @ viewOrigin y) |
|
2703 | 8636 |
] |
8637 |
||
8638 |
"Modified: / 20.8.1996 / 17:35:37 / stefan" |
|
8639 |
"Modified: / 21.5.1999 / 15:58:08 / cg" |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8640 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8641 |
|
1052
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8642 |
scrollToBottom |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8643 |
self scrollTo:0 @ (self heightOfContents - self innerHeight) |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8644 |
|
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8645 |
"Created: 13.9.1996 / 14:08:03 / cg" |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8646 |
"Modified: 13.9.1996 / 14:09:32 / cg" |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8647 |
! |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8648 |
|
2371
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
8649 |
scrollToLeft |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
8650 |
"move viewOrigin to the left" |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
8651 |
|
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
8652 |
self scrollHorizontalTo:0 |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
8653 |
! |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
8654 |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8655 |
scrollToPercent:originAsPercent |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8656 |
"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
|
8657 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8658 |
|wCont hCont percent| |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8659 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8660 |
percent := originAsPercent asPoint. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8661 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8662 |
wCont := self widthOfContents. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8663 |
hCont := self heightOfContents. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8664 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8665 |
transformation notNil ifTrue:[ |
3152 | 8666 |
wCont := transformation applyScaleX:wCont. |
8667 |
hCont := transformation applyScaleY:hCont. |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8668 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8669 |
self scrollTo: |
3152 | 8670 |
((((wCont * percent x) / 100.0) + 0.5) asInteger) @ |
8671 |
((((hCont * percent y) / 100.0) + 0.5) asInteger) |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8672 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8673 |
"Created: 5.8.1996 / 12:15:53 / stefan" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8674 |
"Modified: 5.8.1996 / 12:42:57 / stefan" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8675 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8676 |
|
2371
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
8677 |
scrollToRight |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
8678 |
"move viewOrigin to the right" |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
8679 |
|
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
8680 |
|wCont| |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
8681 |
|
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
8682 |
wCont := self widthOfContents. |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
8683 |
transformation notNil ifTrue:[ |
3152 | 8684 |
wCont := transformation applyScaleX:wCont. |
2371
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
8685 |
]. |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
8686 |
self scrollHorizontalTo:((wCont - self innerWidth) max:0) |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
8687 |
|
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
8688 |
! |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
8689 |
|
269 | 8690 |
scrollToTop |
8691 |
"move viewOrigin to top" |
|
8692 |
||
8693 |
self scrollVerticalTo:0 |
|
8694 |
! |
|
8695 |
||
8696 |
scrollToTopLeft |
|
8697 |
"move viewOrigin to top/left" |
|
8698 |
||
8699 |
self scrollTo:(0 @ 0). |
|
8700 |
! |
|
8701 |
||
8702 |
scrollUp |
|
8703 |
"scroll up by some amount; this is called when the scrollbars |
|
8704 |
scroll-step up button is pressed." |
|
8705 |
||
8706 |
self scrollUp:(self verticalScrollStep) |
|
8707 |
! |
|
8708 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8709 |
scrollUp:nPixels |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8710 |
"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
|
8711 |
|
1035
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
8712 |
|viewOrigin| |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
8713 |
|
2703 | 8714 |
nPixels ~~ 0 ifTrue:[ |
3152 | 8715 |
viewOrigin := self viewOrigin. |
8716 |
self scrollTo:(viewOrigin x @ (viewOrigin y - nPixels)). |
|
2703 | 8717 |
] |
8718 |
||
8719 |
"Modified: / 20.8.1996 / 17:36:16 / stefan" |
|
8720 |
"Modified: / 21.5.1999 / 15:58:21 / cg" |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8721 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8722 |
|
269 | 8723 |
scrollVerticalTo:aPixelOffset |
8724 |
"change origin to make aPixelOffset be the top line" |
|
8725 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8726 |
|orgX| |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8727 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8728 |
orgX := self viewOrigin x. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8729 |
^ self scrollTo:(orgX @ aPixelOffset). |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8730 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8731 |
"Modified: 8.7.1996 / 15:35:40 / stefan" |
135 | 8732 |
! |
8733 |
||
269 | 8734 |
scrollVerticalToPercent:percent |
8735 |
"scroll to a position given in percent of total" |
|
8736 |
||
8737 |
|hCont| |
|
8738 |
||
8739 |
hCont := self heightOfContents. |
|
8740 |
transformation notNil ifTrue:[ |
|
3152 | 8741 |
hCont := transformation applyScaleY:hCont. |
140 | 8742 |
]. |
269 | 8743 |
self scrollVerticalTo: |
3152 | 8744 |
((((hCont * percent) / 100.0) + 0.5) asInteger) |
269 | 8745 |
! |
8746 |
||
8747 |
verticalScrollStep |
|
8748 |
"return the amount to scroll when stepping up/down. |
|
8749 |
Subclasses may want to redefine this." |
|
8750 |
||
8751 |
^ (device verticalPixelPerMillimeter * 20) asInteger |
|
8752 |
! |
|
8753 |
||
8754 |
widthForScrollBetween:yStart and:yEnd |
|
8755 |
"return the width in pixels for a scroll between yStart and yEnd |
|
8756 |
- return full width here since we do not know how wide contents is. |
|
8757 |
Views which only use part of their space (short lists, text) may redefine |
|
8758 |
this method and return the number of pixels that have to be scrolled. |
|
8759 |
On slow displays, this may make a difference; on fast ones you will probably |
|
8760 |
not notice any difference." |
|
8761 |
||
8762 |
^ (width - margin - margin) |
|
135 | 8763 |
! ! |
8764 |
||
8765 |
!SimpleView methodsFor:'scrolling-basic'! |
|
8766 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8767 |
scrollTo:newOrigin |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8768 |
"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
|
8769 |
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
|
8770 |
point." |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8771 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8772 |
^ self scrollTo:newOrigin redraw:true |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8773 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8774 |
"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
|
8775 |
"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
|
8776 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8777 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8778 |
scrollTo:newOrigin redraw:doRedraw |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8779 |
"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
|
8780 |
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
|
8781 |
point." |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8782 |
|
3704 | 8783 |
^ self |
3762 | 8784 |
scrollTo:newOrigin |
8785 |
redraw:doRedraw |
|
8786 |
allowScrollBehondContents:false |
|
3704 | 8787 |
! |
8788 |
||
8789 |
scrollTo:newOrigin redraw:doRedraw allowScrollBehondContents:allowScrollBehondContents |
|
8790 |
"change origin to have newOrigin be visible at the top-left. |
|
8791 |
The argument defines the integer device coordinates of the new top-left |
|
8792 |
point." |
|
8793 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8794 |
|dX "{ Class:SmallInteger }" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8795 |
dY "{ Class:SmallInteger }" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8796 |
orgX "{ Class:SmallInteger }" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8797 |
orgY "{ Class:SmallInteger }" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8798 |
x y iw ih |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8799 |
hCont wCont fromX toX fromY toY copyWidth copyHeight |
2649 | 8800 |
redrawX redrawY wg| |
135 | 8801 |
|
8802 |
hCont := self heightOfContents. |
|
8803 |
wCont := self widthOfContents. |
|
8804 |
transformation isNil ifTrue:[ |
|
3762 | 8805 |
orgY := orgX := 0 |
135 | 8806 |
] ifFalse:[ |
3762 | 8807 |
wCont := (transformation applyScaleX:wCont) rounded. |
8808 |
hCont := (transformation applyScaleY:hCont) rounded. |
|
8809 |
orgY := transformation translation y negated. |
|
8810 |
orgX := transformation translation x negated |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8811 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8812 |
|
135 | 8813 |
iw := self innerWidth. |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8814 |
ih := self innerHeight. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8815 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8816 |
"don't scroll outside of displayed area" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8817 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8818 |
x := newOrigin x. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8819 |
y := newOrigin y. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8820 |
|
3704 | 8821 |
allowScrollBehondContents ifFalse:[ |
3762 | 8822 |
x + iw > wCont ifTrue:[ |
8823 |
x := wCont - iw. |
|
8824 |
]. |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8825 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8826 |
x < 0 ifTrue:[ |
3762 | 8827 |
x := 0 |
3704 | 8828 |
]. |
8829 |
allowScrollBehondContents ifFalse:[ |
|
3762 | 8830 |
y + ih > hCont ifTrue:[ |
8831 |
y := hCont - ih. |
|
8832 |
]. |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8833 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8834 |
y < 0 ifTrue:[ |
3762 | 8835 |
y := 0. |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8836 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8837 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8838 |
dX := x - orgX. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8839 |
dY := y - orgY. |
135 | 8840 |
|
1066 | 8841 |
(dX == 0 and:[dY == 0]) ifTrue:[ |
8842 |
^ self |
|
8843 |
]. |
|
8844 |
||
2649 | 8845 |
(wg := self windowGroup) notNil ifTrue:[ |
3762 | 8846 |
wg processRealExposeEventsFor:self. |
2649 | 8847 |
]. |
2405
95e4a8e563d8
precess expose events before scroll
Claus Gittinger <cg@exept.de>
parents:
2400
diff
changeset
|
8848 |
|
135 | 8849 |
self originWillChange. |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
8850 |
(shown and:[doRedraw]) ifTrue:[ |
3762 | 8851 |
copyWidth := iw - dX abs. |
8852 |
copyHeight := ih - dY abs. |
|
8853 |
((copyWidth > 0) and:[copyHeight > 0]) ifTrue:[ |
|
8854 |
"/ some of the currently displayed pixels |
|
8855 |
"/ remain visible. Copy them |
|
8856 |
||
8857 |
dX < 0 ifTrue:[ |
|
8858 |
fromX := margin. |
|
8859 |
toX := margin - dX. |
|
8860 |
redrawX := margin |
|
8861 |
] ifFalse:[ |
|
8862 |
fromX := margin + dX. |
|
8863 |
toX := margin. |
|
8864 |
redrawX := margin + copyWidth. |
|
8865 |
]. |
|
8866 |
dY < 0 ifTrue:[ |
|
8867 |
fromY := margin. |
|
8868 |
toY := margin - dY. |
|
8869 |
redrawY := margin. |
|
8870 |
] ifFalse:[ |
|
8871 |
fromY := margin + dY. |
|
8872 |
toY := margin. |
|
8873 |
redrawY := margin + copyHeight. |
|
8874 |
]. |
|
8875 |
self catchExpose. |
|
8876 |
self setViewOrigin:(x @ y). |
|
8877 |
self |
|
8878 |
copyFrom:self |
|
8879 |
x:fromX y:fromY |
|
8880 |
toX:toX y:toY |
|
8881 |
width:copyWidth |
|
8882 |
height:copyHeight |
|
8883 |
async:true. |
|
8884 |
||
8885 |
self setInnerClip. |
|
8886 |
||
8887 |
"first redraw the rectangle above/below the |
|
8888 |
copied area (with full width)." |
|
8889 |
||
8890 |
copyHeight < ih ifTrue:[ |
|
8891 |
self invalidateDeviceRectangle:((margin@redrawY) extent:(iw@(ih - copyHeight))) repairNow:false. |
|
2381
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
8892 |
"/ self |
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
8893 |
"/ redrawDeviceX:margin y:redrawY |
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
8894 |
"/ width:iw height:(ih - copyHeight). |
3762 | 8895 |
]. |
8896 |
||
8897 |
"second redraw the rectangle left/right of the |
|
8898 |
copied area" |
|
8899 |
||
8900 |
copyWidth < iw ifTrue:[ |
|
8901 |
self invalidateDeviceRectangle:((redrawX@toY) extent:((iw-copyWidth)@copyHeight)) repairNow:false. |
|
2381
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
8902 |
"/ self redrawDeviceX:redrawX y:toY |
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
8903 |
"/ |
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
8904 |
"/ width:iw - copyWidth |
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
8905 |
"/ height:copyHeight. |
3762 | 8906 |
]. |
8907 |
self waitForExpose. |
|
8908 |
] ifFalse:[ |
|
8909 |
"redraw everything" |
|
8910 |
||
8911 |
self setViewOrigin:(x @ y). |
|
8912 |
self invalidateDeviceRectangle:((margin@margin) extent:(iw@ih)) repairNow:false. |
|
2381
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
8913 |
"/ self redrawDeviceX:margin y:margin |
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
8914 |
"/ width:iw |
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
8915 |
"/ height:ih. |
3762 | 8916 |
]. |
269 | 8917 |
] ifFalse:[ |
3762 | 8918 |
self setViewOrigin:(x @ y). |
2802 | 8919 |
]. |
8920 |
||
709 | 8921 |
self originChanged:(dX negated @ dY negated). |
8922 |
||
2381
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
8923 |
"Modified: / 5.8.1996 / 11:57:09 / stefan" |
2405
95e4a8e563d8
precess expose events before scroll
Claus Gittinger <cg@exept.de>
parents:
2400
diff
changeset
|
8924 |
"Modified: / 1.12.1998 / 22:35:18 / cg" |
135 | 8925 |
! ! |
8926 |
||
269 | 8927 |
!SimpleView methodsFor:'startup'! |
8928 |
||
8929 |
open |
|
8930 |
"open up the view - for normal views, this is a modeless open |
|
8931 |
(i.e. the new view comes up as independent process). |
|
8932 |
Although #open is only to be sent to topviews (i.e. it could have been |
|
8933 |
implemented in TopView), it is implemented here - therefore, every view |
|
8934 |
can be opened as a topView. |
|
8935 |
This is redefined in ModalBox, which comes up modal (i.e. |
|
8936 |
control is under the current process, so that interaction with the |
|
4131 | 8937 |
current group is blocked while the modalBox is active). |
8938 |
||
8939 |
Notice: after the open, you cannot be sure that the view is really open and |
|
8940 |
visible, since #open forks a new process, which does the actual window opening. |
|
8941 |
To ensure visibility, use #openAndWait or waitUntilVisible after the open." |
|
269 | 8942 |
|
8943 |
^ self openModeless |
|
8944 |
||
8945 |
" |
|
8946 |
View new open |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8947 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8948 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8949 |
" |
269 | 8950 |
(Button label:'hello') open |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8951 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8952 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8953 |
" |
269 | 8954 |
|top| |
8955 |
top := StandardSystemView new. |
|
8956 |
top extent:200@200. |
|
8957 |
Button label:'hello' in:top. |
|
8958 |
top open |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8959 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8960 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8961 |
" |
269 | 8962 |
YesNoBox new open |
8963 |
" |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8964 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8965 |
"Modified: 24.7.1997 / 13:26:42 / cg" |
269 | 8966 |
! |
8967 |
||
8968 |
openAndWait |
|
8969 |
"open up the view - wait until it is visible. |
|
8970 |
In normal applications, you do not need to wait till the view is |
|
8971 |
open - it should do all of its drawing itself when it gets the |
|
8972 |
first expose event. |
|
8973 |
However, if you want to 'manually' draw into the view (for example, |
|
8974 |
in doIt expressions) the view must be visible (realized) before doing so. |
|
8975 |
Use this open in those situations." |
|
8976 |
||
8977 |
self open. |
|
8978 |
self waitUntilVisible. |
|
8979 |
||
8980 |
"does not work: |
|
8981 |
||
3152 | 8982 |
|v| |
8983 |
||
8984 |
v := View new open. |
|
8985 |
v displayLineFrom:0@0 to:50@50 |
|
269 | 8986 |
|
8987 |
does work: |
|
8988 |
||
3152 | 8989 |
|v| |
8990 |
||
8991 |
v := View new openAndWait. |
|
8992 |
v displayLineFrom:0@0 to:50@50 |
|
269 | 8993 |
" |
8994 |
! |
|
8995 |
||
8996 |
openAt:aPoint |
|
8997 |
"open up the view modeless - positions the view" |
|
8998 |
||
8999 |
^self openModelessAt:aPoint |
|
9000 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9001 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9002 |
(Button label:'hello') open |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9003 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9004 |
(Button label:'hello') openAt:(100@100) |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9005 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9006 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9007 |
"Modified: 24.7.1997 / 13:26:23 / cg" |
269 | 9008 |
! |
9009 |
||
9010 |
openAtCenter |
|
9011 |
"open up the view modeless - positions the view" |
|
9012 |
||
9013 |
^self openModelessAtCenter |
|
9014 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9015 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9016 |
(Button label:'hello') open |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9017 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9018 |
(Button label:'hello') openAtCenter |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9019 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9020 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9021 |
"Modified: 24.7.1997 / 13:01:12 / cg" |
269 | 9022 |
! |
9023 |
||
9024 |
openAutonomous |
|
9025 |
"create and schedule a new windowgroup for me and open the view. |
|
9026 |
The view will be handled by its own process, effectively running in |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9027 |
parallel. |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9028 |
Notice: |
4139 | 9029 |
This entry is for NON-topviews, which want to be served |
9030 |
autonomous from their real topview. |
|
9031 |
(see the fileBrowsers kill-button |
|
9032 |
when executing unix commands as an example)" |
|
269 | 9033 |
|
1877 | 9034 |
|wg mainGroup| |
269 | 9035 |
|
4139 | 9036 |
wg := self windowGroupClass new. |
763 | 9037 |
self windowGroup:wg. |
1877 | 9038 |
|
9039 |
mainGroup := WindowGroup activeGroup. |
|
9040 |
mainGroup notNil ifTrue:[ |
|
4139 | 9041 |
mainGroup := mainGroup mainGroup. |
1877 | 9042 |
]. |
9043 |
||
9044 |
wg isForModalSubview:true. "/ make it handle update events for the main group |
|
9045 |
wg startupWith:[wg mainGroup:mainGroup. self realizeInGroup]. |
|
9046 |
||
9047 |
"/ wg startupModal:[true] forGroup:mainGroup |
|
9048 |
"/ self realizeInGroup. |
|
9049 |
||
9050 |
"Modified: 20.8.1997 / 17:57:38 / cg" |
|
269 | 9051 |
! |
9052 |
||
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9053 |
openInGroup:aGroup |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9054 |
"special open within another windowGroup. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9055 |
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
|
9056 |
for applications where multiple views act as a group |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9057 |
(i.e. close and iconify together)." |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9058 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9059 |
self windowGroup:aGroup. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9060 |
aGroup addTopView:self. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9061 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9062 |
"/ self realizeKeepingGroup:true |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9063 |
aGroup isForModalSubview:true. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9064 |
self realize. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9065 |
! |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9066 |
|
269 | 9067 |
openModal |
9068 |
"create a new windowgroup, but start processing in the current process |
|
9069 |
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
|
9070 |
Stay in the modalLoop while the view is visible. |
269 | 9071 |
(i.e. control is returned to the sender when the receiver is closed)" |
9072 |
||
9073 |
self openModal:[true] |
|
9074 |
||
9075 |
" |
|
9076 |
the same: |
|
3152 | 9077 |
YesNoBox new open |
9078 |
||
9079 |
YesNoBox new openModal |
|
269 | 9080 |
|
9081 |
different: |
|
3152 | 9082 |
(Button label:'hello') open |
9083 |
||
9084 |
(Button label:'hello') openModal |
|
269 | 9085 |
" |
9086 |
! |
|
9087 |
||
9088 |
openModal:aBlock |
|
9089 |
"create a new windowgroup, but start processing in the current process - |
|
9090 |
actually suspending event processing for the currently active group. |
|
9091 |
Stay in this modal loop while aBlock evaluates to true AND the receiver is |
|
9092 |
visible. |
|
9093 |
(i.e. control is returned to the sender when the receiver is closed) |
|
9094 |
This makes any interaction with the current window impossible - |
|
9095 |
however, other views (in other windowgroups) still work." |
|
9096 |
||
3642 | 9097 |
|masterGroup| |
2167
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
9098 |
|
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
9099 |
"/ mainGroup := WindowGroup activeGroup. |
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
9100 |
"/ mainGroup notNil ifTrue:[mainGroup := mainGroup mainGroup]. |
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
9101 |
|
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
9102 |
masterGroup := WindowGroup activeGroup. |
3345 | 9103 |
[masterGroup notNil and:[masterGroup isPopUp or:[masterGroup isModal]]] whileTrue:[ |
3762 | 9104 |
masterGroup := masterGroup previousGroup. |
2167
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
9105 |
]. |
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
9106 |
^ self openModal:aBlock inGroup:masterGroup "/ mainGroup. |
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
9107 |
|
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
9108 |
"Created: / 10.12.1995 / 14:06:45 / cg" |
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
9109 |
"Modified: / 9.7.1998 / 01:20:57 / cg" |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
9110 |
! |
299
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
9111 |
|
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
9112 |
openModal:aBlock inGroup:mainGroup |
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
9113 |
"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
|
9114 |
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
|
9115 |
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
|
9116 |
visible. |
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
9117 |
(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
|
9118 |
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
|
9119 |
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
|
9120 |
|
3345 | 9121 |
|tops mainView mainViewID previousGroup | |
1397
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
9122 |
|
1736 | 9123 |
self isPopUpView ifFalse:[ |
4139 | 9124 |
ModalBox usingTransientViews ifTrue:[ |
9125 |
"make view only transient, if there is a visible topView. |
|
9126 |
If none of them is visible, we do want an icon for ourself" |
|
3202
d455f6300f96
openModal:inGroup: makes view transient only if there are visible top views.
Stefan Vogel <sv@exept.de>
parents:
3196
diff
changeset
|
9127 |
|
4139 | 9128 |
mainGroup notNil ifTrue:[ |
9129 |
(tops := mainGroup topViews) notNil ifTrue:[ |
|
9130 |
tops notEmpty ifTrue:[ |
|
9131 |
mainView := tops detect:[:v| v shown] ifNone:nil. |
|
9132 |
mainView notNil ifTrue:[ |
|
9133 |
mainViewID := mainView id. |
|
9134 |
] |
|
9135 |
] |
|
9136 |
]. |
|
9137 |
]. |
|
9138 |
||
9139 |
mainViewID isNil ifTrue:[ |
|
9140 |
self origin:(device center - (self extent//2)) |
|
9141 |
]. |
|
9142 |
||
9143 |
drawableId isNil ifTrue:[self create]. |
|
9144 |
mainView notNil ifTrue:[ |
|
9145 |
device setTransient:drawableId for:mainViewID. |
|
9146 |
]. |
|
9147 |
]. |
|
1397
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
9148 |
]. |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
9149 |
|
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
9150 |
self raise. |
299
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
9151 |
|
269 | 9152 |
Processor activeProcessIsSystemProcess ifTrue:[ |
4139 | 9153 |
" |
9154 |
put myself into the modal group, let it handle events for |
|
9155 |
me as well. This is only a half way solution, since the view |
|
9156 |
is not modal at all ... however, the only situation |
|
9157 |
where this happens is with modal boxes popped while in a |
|
9158 |
modal browser. You will forgive me for that inconvenience. |
|
9159 |
" |
|
9160 |
windowGroup := mainGroup. |
|
9161 |
mainGroup notNil ifTrue:[mainGroup addTopView:self]. |
|
9162 |
self realize |
|
135 | 9163 |
] ifFalse:[ |
4139 | 9164 |
previousGroup := WindowGroup activeGroup. |
9165 |
||
9166 |
" |
|
9167 |
show a stop-cursor in the main group |
|
9168 |
" |
|
9169 |
mainGroup notNil ifTrue:[ |
|
9170 |
self isPopUpView ifFalse:[ |
|
9171 |
mainGroup showCursor:(Cursor stop). |
|
9172 |
(previousGroup notNil and:[previousGroup ~~ mainGroup]) ifTrue:[ |
|
9173 |
previousGroup showCursor:(Cursor stop). |
|
9174 |
]. |
|
9175 |
] |
|
9176 |
]. |
|
9177 |
||
9178 |
" |
|
9179 |
create a new window group and put myself into it |
|
9180 |
" |
|
9181 |
windowGroup := self windowGroupClass new. |
|
9182 |
windowGroup addTopView:self. |
|
9183 |
windowGroup setPreviousGroup:previousGroup. |
|
9184 |
||
9185 |
superView notNil ifTrue:[ |
|
9186 |
"/ |
|
9187 |
"/ special: this is a modal subview, |
|
9188 |
"/ prevent the view from reassigning its windowGroup when realized |
|
9189 |
"/ (subviews normally place themself into the superviews group) |
|
9190 |
"/ |
|
9191 |
windowGroup isForModalSubview:true. |
|
9192 |
]. |
|
9193 |
||
9194 |
" |
|
9195 |
go dispatch events in this new group |
|
9196 |
(thus current windowgroup is blocked from interaction) |
|
9197 |
" |
|
9198 |
AbortSignal handle:[:ex | |
|
9199 |
self hide. |
|
9200 |
ex return. |
|
9201 |
] do:[ |
|
9202 |
[ |
|
9203 |
[ |
|
9204 |
windowGroup startupModal:[realized and:aBlock] forGroup:mainGroup |
|
9205 |
] ifCurtailed:[ |
|
9206 |
self hide. |
|
9207 |
] |
|
9208 |
] ensure:[ |
|
9209 |
mainGroup notNil ifTrue:[ |
|
9210 |
mainGroup graphicsDevice sync. "thats a round trip - make sure that all drawing has been processed" |
|
9211 |
"/ ensure that eventListener runs here ... |
|
9212 |
Delay waitForSeconds:0.05. |
|
9213 |
mainGroup processExposeEvents. |
|
9214 |
||
9215 |
ReturnFocusWhenClosingModalBoxes ifTrue:[ |
|
9216 |
" |
|
9217 |
return input focus to previously active groups top. |
|
9218 |
This helps with windowmanagers which need an explicit click |
|
9219 |
on the view for the focus. |
|
9220 |
" |
|
9221 |
tops := mainGroup topViews. |
|
9222 |
(tops notNil and:[tops notEmpty]) ifTrue:[ |
|
9223 |
tops first getKeyboardFocus |
|
9224 |
]. |
|
9225 |
]. |
|
9226 |
||
9227 |
" |
|
9228 |
restore cursors in the main group & flush its buffered key & mouse events |
|
9229 |
" |
|
9230 |
mainGroup restoreCursors. |
|
9231 |
(previousGroup notNil and:[previousGroup ~~ mainGroup]) ifTrue:[ |
|
9232 |
previousGroup restoreCursors. |
|
9233 |
]. |
|
1329 | 9234 |
"/ mainGroup sensor flushUserEvents. |
4139 | 9235 |
] |
9236 |
] |
|
9237 |
]. |
|
135 | 9238 |
] |
299
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
9239 |
|
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
9240 |
"Created: 10.12.1995 / 14:06:14 / cg" |
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
9241 |
"Modified: 20.8.1997 / 15:14:44 / cg" |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
9242 |
! |
135 | 9243 |
|
269 | 9244 |
openModalAt:aPoint |
9245 |
"open up the view modeless - positions the view |
|
9246 |
(i.e. circumvents window managers positioning)" |
|
9247 |
||
9248 |
self origin:aPoint. |
|
1837 | 9249 |
drawableId isNil ifTrue:[self create]. |
560
968d062c79cb
oops - openAt did set transient; definitely wrong ...
Claus Gittinger <cg@exept.de>
parents:
527
diff
changeset
|
9250 |
"/ device setTransient:drawableId for:0. |
269 | 9251 |
^ self openModal |
9252 |
||
9253 |
" |
|
9254 |
View new openModal |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9255 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9256 |
" |
269 | 9257 |
View new openModalAt:100@100 |
9258 |
" |
|
9259 |
||
9260 |
"Created: 18.9.1995 / 23:21:42 / claus" |
|
9261 |
"Modified: 18.9.1995 / 23:32:26 / claus" |
|
1837 | 9262 |
"Modified: 28.7.1997 / 18:52:29 / cg" |
269 | 9263 |
! |
9264 |
||
9265 |
openModalAtCenter |
|
9266 |
"open up the view modeless - positions the view |
|
9267 |
(i.e. circumvents window managers positioning)" |
|
9268 |
||
9269 |
^ self openModalAt:(device center - (self extent//2)). |
|
9270 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9271 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9272 |
View new openModal |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9273 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9274 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9275 |
View new openModalAtCenter |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9276 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9277 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9278 |
"Modified: 24.7.1997 / 13:27:37 / cg" |
269 | 9279 |
! |
9280 |
||
9281 |
openModeless |
|
9282 |
"create and schedule a new windowgroup for me and open the view. |
|
9283 |
The view will be handled by its own process, effectively running in |
|
9284 |
parallel (i.e. control is returned to the sender immediately)." |
|
9285 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9286 |
self openModelessAt:nil |
269 | 9287 |
|
9288 |
" |
|
9289 |
the same: |
|
3152 | 9290 |
(Button label:'hello') open |
9291 |
||
9292 |
(Button label:'hello') openModeless |
|
269 | 9293 |
|
9294 |
different: |
|
3152 | 9295 |
YesNoBox new open |
9296 |
||
9297 |
YesNoBox new openModeless |
|
269 | 9298 |
" |
9299 |
" |
|
9300 |
(almost) the same: |
|
3152 | 9301 |
YesNoBox new open |
9302 |
||
9303 |
YesNoBox new openModal |
|
269 | 9304 |
|
9305 |
different: |
|
3152 | 9306 |
(Button label:'hello') open |
9307 |
||
9308 |
(Button label:'hello') openModal |
|
269 | 9309 |
" |
503
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
9310 |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9311 |
"Modified: 24.7.1997 / 13:17:49 / cg" |
269 | 9312 |
! |
9313 |
||
9314 |
openModelessAt:aPoint |
|
9315 |
"open up the view modeless - positions the view |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9316 |
(i.e. tries to circumvent the window managers positioning) |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9317 |
Notice: some windowManagers seem to ignore this and always |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9318 |
ask the user to position the view." |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9319 |
|
1827 | 9320 |
self openModelessAt:aPoint iconified:false |
9321 |
||
9322 |
" |
|
9323 |
View new openModeless |
|
9324 |
||
9325 |
View new openModelessAt:100@100 |
|
9326 |
" |
|
9327 |
||
9328 |
"Created: 18.9.1995 / 23:21:42 / claus" |
|
9329 |
"Modified: 24.7.1997 / 13:48:52 / cg" |
|
9330 |
! |
|
9331 |
||
9332 |
openModelessAt:aPoint iconified:iconified |
|
9333 |
"open up the view modeless - positions the view |
|
9334 |
(i.e. tries to circumvent the window managers positioning) |
|
9335 |
Notice: some windowManagers seem to ignore this and always |
|
9336 |
ask the user to position the view." |
|
9337 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9338 |
|newGroup| |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9339 |
|
1837 | 9340 |
drawableId isNil ifTrue:[self create]. |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9341 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9342 |
windowGroup isNil ifTrue:[ |
4139 | 9343 |
newGroup := true. |
9344 |
windowGroup := self windowGroupClass new. |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9345 |
] ifFalse:[ |
4139 | 9346 |
newGroup := false. |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9347 |
]. |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9348 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9349 |
windowGroup addTopView:self. |
3745 | 9350 |
newGroup ifTrue:[ |
4139 | 9351 |
(aPoint isNil and:[iconified not]) ifTrue:[ |
9352 |
windowGroup startupWith:[self realize]. |
|
9353 |
] ifFalse:[ |
|
9354 |
windowGroup startupWith:[self realizeKeepingGroup:false at:aPoint iconified:iconified]. |
|
9355 |
]. |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9356 |
] ifFalse:[ |
4139 | 9357 |
self realizeInGroup. |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9358 |
]. |
269 | 9359 |
|
9360 |
" |
|
1827 | 9361 |
StandardSystemView new openModeless |
9362 |
||
9363 |
StandardSystemView new openModelessAt:100@100 |
|
9364 |
||
9365 |
StandardSystemView new openModelessAt:100@100 iconified:true |
|
269 | 9366 |
" |
9367 |
||
9368 |
"Created: 18.9.1995 / 23:21:42 / claus" |
|
1837 | 9369 |
"Modified: 28.7.1997 / 18:52:26 / cg" |
269 | 9370 |
! |
9371 |
||
9372 |
openModelessAtCenter |
|
9373 |
"open up the view modeless - positions the view |
|
9374 |
(i.e. circumvents window managers positioning)" |
|
9375 |
||
9376 |
^ self openModelessAt:(device center - (self extent//2)). |
|
9377 |
||
9378 |
" |
|
9379 |
View new openModeless |
|
9380 |
||
9381 |
View new openModelessAtCenter |
|
9382 |
" |
|
9383 |
||
9384 |
"Created: 18.9.1995 / 23:21:42 / claus" |
|
9385 |
! |
|
9386 |
||
9387 |
waitUntilVisible |
|
9388 |
"wait until the receiver visible. |
|
9389 |
In normal applications, you do not need to wait till a view is |
|
9390 |
open - it should do all of its drawing itself when it gets the |
|
9391 |
first expose event. |
|
9392 |
However, if you want to 'manually' draw into the view (for example, |
|
9393 |
in doIt expressions), or subsequent views depend on some state of |
|
9394 |
another view (which is only available once visible), |
|
9395 |
use this to suspend the current process until the receiver is shown. |
|
9396 |
Caveat: |
|
4121 | 9397 |
we poll here for the view to be shown - we need a semaphore |
9398 |
which is raised by the view in order to do it right." |
|
3522
a98163edc25b
care for #waitUntilVisible to be called from within the event dispatcher
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
9399 |
|
a98163edc25b
care for #waitUntilVisible to be called from within the event dispatcher
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
9400 |
|wg n| |
a98163edc25b
care for #waitUntilVisible to be called from within the event dispatcher
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
9401 |
|
a98163edc25b
care for #waitUntilVisible to be called from within the event dispatcher
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
9402 |
n := 0. |
269 | 9403 |
[self shown] whileFalse:[ |
4121 | 9404 |
(device notNil and:[device isOpen not]) ifTrue:[^ self]. |
9405 |
||
9406 |
"/ this was added to avoid a deadlock, when called from within |
|
9407 |
"/ the event dispatch process (as when doing foo inspect there). |
|
9408 |
n > (10 / 0.05) ifTrue:[ |
|
4122 | 9409 |
'SimpleView [info]: View not visible after 10 seconds - will not wait any longer in waitUntilVisible' infoPrintCR. |
4121 | 9410 |
^ self |
9411 |
]. |
|
9412 |
n := n + 1. |
|
9413 |
Delay waitForSeconds:0.05. |
|
9414 |
(wg := self windowGroup) ifNotNil:[ |
|
9415 |
wg processExposeEvents. |
|
9416 |
]. |
|
269 | 9417 |
]. |
9418 |
||
9419 |
"does not work (the view is in its opening phase, |
|
9420 |
when we attempt to draw a line - this gives an error, since |
|
9421 |
its internals are not yet correctly setup): |
|
9422 |
||
4121 | 9423 |
|v| |
9424 |
||
9425 |
v := View new open. |
|
9426 |
v displayLineFrom:0@0 to:50@50 |
|
269 | 9427 |
|
9428 |
does work (since we wait until the view has completely finished |
|
9429 |
its startup phase): |
|
9430 |
||
4121 | 9431 |
|v| |
9432 |
||
9433 |
v := View new open. |
|
9434 |
v waitUntilVisible. |
|
9435 |
v displayLineFrom:0@0 to:50@50 |
|
269 | 9436 |
" |
135 | 9437 |
! ! |
9438 |
||
3276 | 9439 |
!SimpleView methodsFor:'user interaction & notifications'! |
135 | 9440 |
|
9441 |
warn:aString |
|
9442 |
"like Objects warn, but translates the string via the |
|
9443 |
resourcePack, thus giving a translated string automatically" |
|
9444 |
||
151 | 9445 |
super warn:(resources string:aString) withCRs |
135 | 9446 |
! |
9447 |
||
9448 |
warn:aString with:argument |
|
9449 |
"like Objects warn, but translates the string via the |
|
9450 |
resourcePack, thus giving a translated string automatically" |
|
9451 |
||
151 | 9452 |
super warn:(resources string:aString with:argument) withCRs |
9453 |
! |
|
9454 |
||
9455 |
warn:aString with:arg1 with:arg2 |
|
9456 |
"like Objects warn, but translates the string via the |
|
9457 |
resourcePack, thus giving a translated string automatically" |
|
9458 |
||
9459 |
super warn:(resources string:aString with:arg1 with:arg2) withCRs |
|
3182 | 9460 |
! |
9461 |
||
9462 |
warn:aString with:arg1 with:arg2 with:arg3 |
|
9463 |
"like Objects warn, but translates the string via the |
|
9464 |
resourcePack, thus giving a translated string automatically" |
|
9465 |
||
9466 |
super warn:(resources string:aString with:arg1 with:arg2 with:arg3) withCRs |
|
135 | 9467 |
! ! |
9468 |
||
2750
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
9469 |
!SimpleView::ViewShape methodsFor:'queries'! |
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
9470 |
|
3366 | 9471 |
isRoundShape |
9472 |
^ false |
|
9473 |
! ! |
|
2750
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
9474 |
|
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
9475 |
!SimpleView::RoundViewShape methodsFor:'queries'! |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
9476 |
|
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
9477 |
isRoundShape |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
9478 |
^ true |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
9479 |
|
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
9480 |
|
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
9481 |
! ! |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
9482 |
|
2750
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
9483 |
!SimpleView::ArbitraryViewShape methodsFor:'accessing'! |
1903 | 9484 |
|
3366 | 9485 |
borderShapeForm |
9486 |
"return the value of the instance variable 'borderShapeForm' (automatically generated)" |
|
9487 |
||
9488 |
^ borderShapeForm |
|
9489 |
||
9490 |
"Created: 18.9.1997 / 11:04:29 / cg" |
|
9491 |
! |
|
9492 |
||
9493 |
borderShapeForm:something |
|
9494 |
"set the value of the instance variable 'borderShapeForm' (automatically generated)" |
|
9495 |
||
9496 |
borderShapeForm := something. |
|
9497 |
||
9498 |
"Created: 18.9.1997 / 11:04:29 / cg" |
|
9499 |
! |
|
9500 |
||
9501 |
viewShapeForm |
|
9502 |
"return the value of the instance variable 'viewShapeForm' (automatically generated)" |
|
9503 |
||
9504 |
^ viewShapeForm |
|
9505 |
||
9506 |
"Created: 18.9.1997 / 11:04:29 / cg" |
|
9507 |
! |
|
9508 |
||
9509 |
viewShapeForm:something |
|
9510 |
"set the value of the instance variable 'viewShapeForm' (automatically generated)" |
|
9511 |
||
9512 |
viewShapeForm := something. |
|
9513 |
||
9514 |
"Created: 18.9.1997 / 11:04:29 / cg" |
|
9515 |
! ! |
|
1903 | 9516 |
|
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
9517 |
!SimpleView class methodsFor:'documentation'! |
269 | 9518 |
|
9519 |
version |
|
4189
e02b0c6dec2f
keep a menus receiver if #yellowButtonMenu
Claus Gittinger <cg@exept.de>
parents:
4184
diff
changeset
|
9520 |
^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.503 2004-06-09 09:44:21 cg Exp $' |
135 | 9521 |
! ! |
3745 | 9522 |
|
135 | 9523 |
SimpleView initialize! |