author | Claus Gittinger <cg@exept.de> |
Mon, 23 Jun 2008 17:29:03 +0200 | |
changeset 4978 | 72d873c3eb05 |
parent 4971 | d69d04717240 |
child 4990 | 0aec48bba22a |
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 |
" |
|
3196
43d42e7c388a
MUST invoke #postBuildWith: / #postBuildAsSubcanvasWith:,
tm
parents:
3191
diff
changeset
|
12 |
"{ Package: 'stx:libview' }" |
43d42e7c388a
MUST invoke #postBuildWith: / #postBuildAsSubcanvasWith:,
tm
parents:
3191
diff
changeset
|
13 |
|
727
bf23a306b6f2
renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents:
724
diff
changeset
|
14 |
DisplaySurface subclass:#SimpleView |
3055
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
15 |
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
|
16 |
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
|
17 |
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
|
18 |
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
|
19 |
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
|
20 |
controller windowGroup preferredExtent explicitExtent dependents |
4471 | 21 |
layoutManager visibilityChannel helpKey dropTarget' |
3055
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
22 |
classVariableNames:'Grey CentPoint ViewSpacing DefaultStyle StyleSheet |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
23 |
DefaultViewBackgroundColor DefaultBorderColor DefaultLightColor |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
24 |
DefaultShadowColor DefaultBorderWidth DefaultFocusColor |
3375 | 25 |
DefaultFocusBorderWidth ReturnFocusWhenClosingModalBoxes |
3394
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
26 |
FlagOriginChanged FlagExtentChanged FlagCornerChanged |
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
27 |
FlagExtentChangedBeforeCreated FlagCanTab |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
28 |
FlagRequestFocusOnPointerEnter |
4407 | 29 |
FlagDoNotRequestFocusOnPointerEnter FlagNativeWidget |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
30 |
FlagIsUnmappedModalBox FlagIsMDIChild FlagHiddenOnRealize |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
31 |
FlagHasExplicitExtent' |
3055
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
32 |
poolDictionaries:'' |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
33 |
category:'Views-Basic' |
135 | 34 |
! |
35 |
||
452
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
36 |
SimpleView class instanceVariableNames:'ClassResources DefaultFont' |
734 | 37 |
|
38 |
" |
|
3164
f3dce6ea8e3f
VW compatibility: closeAndUnschedule
Claus Gittinger <cg@exept.de>
parents:
3155
diff
changeset
|
39 |
No other class instance variables are inherited by this class. |
734 | 40 |
" |
140 | 41 |
! |
135 | 42 |
|
1903 | 43 |
Object subclass:#ViewShape |
3055
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
44 |
instanceVariableNames:'' |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
45 |
classVariableNames:'' |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
46 |
poolDictionaries:'' |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
47 |
privateIn:SimpleView |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
48 |
! |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
49 |
|
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
50 |
SimpleView::ViewShape subclass:#RoundViewShape |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
51 |
instanceVariableNames:'' |
3055
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
52 |
classVariableNames:'' |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
53 |
poolDictionaries:'' |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
54 |
privateIn:SimpleView |
2750
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
55 |
! |
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
56 |
|
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
57 |
SimpleView::ViewShape subclass:#ArbitraryViewShape |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
58 |
instanceVariableNames:'viewShapeForm borderShapeForm' |
3055
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
59 |
classVariableNames:'' |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
60 |
poolDictionaries:'' |
3a001a72cb9b
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
3010
diff
changeset
|
61 |
privateIn:SimpleView |
1903 | 62 |
! |
63 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
64 |
!SimpleView class methodsFor:'documentation'! |
135 | 65 |
|
66 |
copyright |
|
67 |
" |
|
68 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
3152 | 69 |
All Rights Reserved |
135 | 70 |
|
71 |
This software is furnished under a license and may be used |
|
72 |
only in accordance with the terms of that license and with the |
|
73 |
inclusion of the above copyright notice. This software may not |
|
74 |
be provided or otherwise made available to, or used by, any |
|
75 |
other person. No title to or ownership of the software is |
|
76 |
hereby transferred. |
|
77 |
" |
|
78 |
! |
|
79 |
||
80 |
documentation |
|
81 |
" |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
82 |
this class implements functions common to all Views which do not work on / show a model. |
135 | 83 |
Previously, all of this functionality used to be in the old View class, but has been |
4907 | 84 |
separated into this new SimpleView (which does not know about models) and the new View, |
4898 | 85 |
which does so. |
484 | 86 |
I'd prefer to call this class View and the current View class a ModelView, |
4898 | 87 |
but for backward compatibility it is better to leave things the way they are |
88 |
(there are simply too many subclasses of View around...). |
|
89 |
||
4907 | 90 |
Instances of SimpleView are seldom used directly, most views in the system inherit |
4898 | 91 |
from this class. However, sometimes a view is needed to create a dummy view for framing |
135 | 92 |
or layout purposes. |
93 |
||
616 | 94 |
[Instance variables:] |
135 | 95 |
|
4907 | 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 |
renderer <nil | Renderer> the renderer (if any) |
|
156 |
||
157 |
windowGroup <WindowGroup> the windowGroup |
|
484 | 158 |
|
135 | 159 |
|
160 |
||
616 | 161 |
[Class variables:] |
135 | 162 |
|
4907 | 163 |
Grey <Color> the color grey - its used so often |
164 |
||
165 |
ViewSpacing <Number> preferred spacing between views; 1mm |
|
166 |
||
167 |
CentPoint <Point> 100 @ 100 - its used so often |
|
168 |
||
169 |
StyleSheet <ResourcePack> contains all view-style specifics |
|
170 |
||
171 |
ReturnFocusWhenClosingModalBoxes if true, a closing modalBox returns |
|
172 |
<Boolean> the keyboard focus to the view which was |
|
173 |
active when the box was opened. |
|
174 |
If false (the default), it is left to |
|
175 |
window manager to assign a new focus. |
|
176 |
If running on olwm/olvwm (which requires an |
|
177 |
explicit click to reassign a focus), it is |
|
178 |
better to turn this on in a private.rc file. |
|
135 | 179 |
|
616 | 180 |
[styleSheet parameters:] |
135 | 181 |
|
4907 | 182 |
popupShadow <Boolean> if true, popupViews show a shadow below |
183 |
||
184 |
popupLevel <nil | Integer> 3D level |
|
185 |
||
186 |
borderWidth <nil | Integer> borderWidth (ignored in 3D styles) |
|
187 |
||
188 |
borderColor <nil | Color> borderColor (ignored in 3D styles) |
|
189 |
||
190 |
viewBackground <nil | Color> views background |
|
191 |
||
192 |
shadowColor <nil | Color> color for shadow edges (ignored in 2D styles) |
|
193 |
||
194 |
lightColor <nil | Color> color for light edges (ignored in 2D styles) |
|
195 |
||
196 |
font <nil | Font> font to use |
|
135 | 197 |
|
198 |
||
199 |
TODO: |
|
4907 | 200 |
get rid of relativeOrigin, relativeCorner, originRule, extentRule, |
201 |
and insets; replace by a single object which defines the size |
|
202 |
(mhmh - ST-80 seems to call this LayoutFrame ?) |
|
203 |
-> be prepared for a change here in the near future and ONLY use |
|
204 |
access methods to get those instance variables' values |
|
205 |
||
206 |
get rid of 3D level & margin, move it to extra wrappers |
|
207 |
(although this will make view setup more complicated, it will remove |
|
208 |
complexity from the internals of view. Also, it will allow for more |
|
209 |
varieties of borders.) |
|
210 |
||
211 |
add components (could also call them gadgets or lightweight views) |
|
212 |
- views are expensive in terms of X resources. This would make all |
|
213 |
framing/edge and panel helper views become cheap ST objects, instead |
|
214 |
of views. |
|
616 | 215 |
|
216 |
||
217 |
[see also:] |
|
4907 | 218 |
StandardSystemView DialogBox |
219 |
WindowGroup WindowEvent |
|
220 |
Layout |
|
221 |
( introduction to view programming :html: programming/viewintro.html ) |
|
616 | 222 |
|
223 |
[author:] |
|
4907 | 224 |
Claus Gittinger |
135 | 225 |
" |
151 | 226 |
! |
227 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
228 |
examples |
151 | 229 |
" |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
230 |
(all examples below use different viewBackgrounds, |
151 | 231 |
to make the individual subviews visible) |
232 |
||
616 | 233 |
a subView in a topView: |
3152 | 234 |
[exBegin] |
235 |
|top v| |
|
236 |
||
237 |
top := StandardSystemView new. |
|
238 |
v := View new. |
|
239 |
v origin:0.25 @ 0.25 corner:0.75 @ 0.75. |
|
240 |
top addSubView:v. |
|
241 |
top open |
|
242 |
[exEnd] |
|
616 | 243 |
|
244 |
||
245 |
the same, a bit more compact: |
|
3152 | 246 |
[exBegin] |
247 |
|top v| |
|
248 |
||
249 |
top := StandardSystemView new. |
|
250 |
v := View origin:0.25 @ 0.25 corner:0.75 @ 0.75 in:top. |
|
251 |
top open |
|
252 |
[exEnd] |
|
616 | 253 |
|
254 |
||
151 | 255 |
fixed position/size: |
3152 | 256 |
[exBegin] |
151 | 257 |
|top v1 v2| |
258 |
||
259 |
top := StandardSystemView new. |
|
260 |
top extent:300@300. |
|
261 |
||
262 |
v1 := View origin:10@10 |
|
3152 | 263 |
corner:50@50 |
264 |
in:top. |
|
151 | 265 |
v2 := View origin:60@10 |
3152 | 266 |
corner:150@100 |
267 |
in:top. |
|
151 | 268 |
|
269 |
v1 viewBackground:(Color red). |
|
270 |
v2 viewBackground:(Color yellow). |
|
271 |
||
272 |
top open |
|
3152 | 273 |
[exEnd] |
151 | 274 |
|
275 |
same, using ST-80 way of bulding up view hierarchies |
|
276 |
(recommended, if you plan to port applications later) |
|
3152 | 277 |
[exBegin] |
151 | 278 |
|top v1 v2| |
279 |
||
280 |
top := StandardSystemView new. |
|
281 |
top extent:300@300. |
|
282 |
||
283 |
v1 := View new. |
|
284 |
v1 origin:10@10 corner:50@50. |
|
285 |
||
286 |
v2 := View new. |
|
287 |
v2 origin:60@10 corner:150@100. |
|
288 |
||
289 |
v1 viewBackground:(Color red). |
|
290 |
v2 viewBackground:(Color yellow). |
|
291 |
||
292 |
top add:v1. |
|
293 |
top add:v2. |
|
294 |
||
295 |
v1 viewBackground:(Color red). |
|
296 |
v2 viewBackground:(Color yellow). |
|
297 |
||
298 |
top open |
|
3152 | 299 |
[exEnd] |
151 | 300 |
|
301 |
fixed origin, variable size: |
|
3152 | 302 |
[exBegin] |
151 | 303 |
|top v1 v2| |
304 |
||
305 |
top := StandardSystemView new. |
|
306 |
top extent:300@300. |
|
307 |
||
308 |
v1 := View new. |
|
309 |
v1 origin:10@10 corner:50@0.5. |
|
310 |
||
311 |
v2 := View new. |
|
312 |
v2 origin:60@10 corner:150@0.5. |
|
313 |
||
314 |
v1 viewBackground:(Color red). |
|
315 |
v2 viewBackground:(Color yellow). |
|
316 |
||
317 |
top add:v1. |
|
318 |
top add:v2. |
|
319 |
||
320 |
top open |
|
3152 | 321 |
[exEnd] |
151 | 322 |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
323 |
fixed origin, variable size, |
151 | 324 |
bottomInset for constant distance from bottom: |
3152 | 325 |
[exBegin] |
151 | 326 |
|top v1 v2| |
327 |
||
328 |
top := StandardSystemView new. |
|
329 |
top extent:300@300. |
|
330 |
||
331 |
v1 := View new. |
|
332 |
v1 origin:10@10 corner:50@1.0. |
|
333 |
v1 bottomInset:10. |
|
334 |
||
335 |
v2 := View new. |
|
336 |
v2 origin:60@10 corner:150@1.0. |
|
337 |
v2 bottomInset:10. |
|
338 |
||
339 |
v1 viewBackground:(Color red). |
|
340 |
v2 viewBackground:(Color yellow). |
|
341 |
||
342 |
top add:v1. |
|
343 |
top add:v2. |
|
344 |
||
345 |
top open |
|
3152 | 346 |
[exEnd] |
151 | 347 |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
348 |
variable origin, variable size, |
3152 | 349 |
[exBegin] |
151 | 350 |
|top v1 v2| |
351 |
||
352 |
top := StandardSystemView new. |
|
353 |
top extent:300@300. |
|
354 |
||
355 |
v1 := View new. |
|
356 |
v1 origin:0.0@0.0 corner:0.5@0.5. |
|
357 |
||
358 |
v2 := View new. |
|
359 |
v2 origin:0.5@0.0 corner:1.0@0.5. |
|
360 |
||
361 |
v1 viewBackground:(Color red). |
|
362 |
v2 viewBackground:(Color yellow). |
|
363 |
||
364 |
top add:v1. |
|
365 |
top add:v2. |
|
366 |
||
367 |
top open |
|
3152 | 368 |
[exEnd] |
151 | 369 |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
370 |
variable origin, variable size, |
151 | 371 |
insets for some constant distance |
3152 | 372 |
[exBegin] |
151 | 373 |
|top v1 v2| |
374 |
||
375 |
top := StandardSystemView new. |
|
376 |
top extent:300@300. |
|
377 |
||
378 |
v1 := View new. |
|
379 |
v1 origin:0.0@0.0 corner:0.5@0.5. |
|
380 |
v1 rightInset:5. |
|
381 |
||
382 |
v2 := View new. |
|
383 |
v2 origin:0.5@0.0 corner:1.0@0.5. |
|
384 |
v2 leftInset:5. |
|
385 |
||
386 |
v1 viewBackground:(Color red). |
|
387 |
v2 viewBackground:(Color yellow). |
|
388 |
||
389 |
top add:v1. |
|
390 |
top add:v2. |
|
391 |
||
392 |
top open |
|
3152 | 393 |
[exEnd] |
151 | 394 |
|
395 |
using layout objects (ST-80 style): |
|
396 |
fully specifying the frame |
|
3152 | 397 |
[exBegin] |
151 | 398 |
|top v1 v2| |
399 |
||
400 |
top := StandardSystemView new. |
|
401 |
top extent:300@300. |
|
402 |
||
403 |
v1 := View new. |
|
404 |
v2 := View new. |
|
405 |
||
406 |
v1 viewBackground:(Color red). |
|
407 |
v2 viewBackground:(Color yellow). |
|
408 |
||
409 |
top add:v1 in:(LayoutFrame new |
|
3152 | 410 |
leftFraction:0.25; |
411 |
rightFraction:0.75; |
|
412 |
topFraction:0.0; |
|
413 |
bottomFraction:0.5). |
|
151 | 414 |
top add:v2 in:(LayoutFrame new |
3152 | 415 |
leftFraction:0.5; |
416 |
rightFraction:1.0; |
|
417 |
topFraction:0.5; |
|
418 |
bottomFraction:0.75). |
|
151 | 419 |
|
420 |
top open |
|
3152 | 421 |
[exEnd] |
151 | 422 |
|
423 |
another one, with offsets: |
|
3152 | 424 |
[exBegin] |
151 | 425 |
|top v1 v2| |
426 |
||
427 |
top := StandardSystemView new. |
|
428 |
top extent:300@300. |
|
429 |
||
430 |
v1 := View new. |
|
431 |
v2 := View new. |
|
432 |
||
433 |
v1 viewBackground:(Color red). |
|
434 |
v2 viewBackground:(Color yellow). |
|
435 |
||
436 |
top add:v1 in:(LayoutFrame new |
|
3152 | 437 |
leftFraction:0.0 offset:10; |
438 |
rightFraction:1.0 offset:-10; |
|
439 |
topFraction:0.0 offset:10; |
|
440 |
bottomFraction:0.5). |
|
151 | 441 |
top add:v2 in:(LayoutFrame new |
3152 | 442 |
leftFraction:0.0 offset:30; |
443 |
rightFraction:1.0 offset:-30; |
|
444 |
topFraction:0.5 offset:10; |
|
445 |
bottomFraction:0.75). |
|
151 | 446 |
|
447 |
top open |
|
3152 | 448 |
[exEnd] |
151 | 449 |
|
450 |
specifying origin only. Extent is views preferred |
|
451 |
(notice, that plain views have some defaultExtent of 100@100) |
|
3152 | 452 |
[exBegin] |
151 | 453 |
|top v1 v2| |
454 |
||
455 |
top := StandardSystemView new. |
|
456 |
top extent:300@300. |
|
457 |
||
458 |
v1 := View new. |
|
459 |
v2 := View new. |
|
460 |
||
461 |
v1 viewBackground:(Color red). |
|
462 |
v2 viewBackground:(Color yellow). |
|
463 |
||
464 |
top add:v1 in:(LayoutOrigin new |
|
3152 | 465 |
leftFraction:0.25; |
466 |
topFraction:0.0). |
|
151 | 467 |
top add:v2 in:(LayoutOrigin new |
3152 | 468 |
leftFraction:0.5; |
469 |
topFraction:0.5). |
|
151 | 470 |
|
471 |
top open |
|
3152 | 472 |
[exEnd] |
151 | 473 |
|
474 |
same example, using buttons which compute their preferredBounds: |
|
3152 | 475 |
[exBegin] |
151 | 476 |
|top v1 v2| |
477 |
||
478 |
top := StandardSystemView new. |
|
479 |
top extent:300@300. |
|
480 |
||
481 |
v1 := Button label:'foo'. |
|
482 |
v2 := Button label:'a very long buttonLabel'. |
|
483 |
||
484 |
v1 backgroundColor:(Color red). |
|
485 |
v2 backgroundColor:(Color yellow). |
|
486 |
||
487 |
top add:v1 in:(LayoutOrigin new |
|
3152 | 488 |
leftFraction:0.25; |
489 |
topFraction:0.0). |
|
151 | 490 |
top add:v2 in:(LayoutOrigin new |
3152 | 491 |
leftFraction:0.5; |
492 |
topFraction:0.5). |
|
151 | 493 |
|
494 |
top open |
|
3152 | 495 |
[exEnd] |
151 | 496 |
" |
269 | 497 |
! |
498 |
||
4497 | 499 |
examples_MDI |
500 |
" |
|
501 |
Currently, these are experimental and work under Windows only |
|
502 |
||
503 |
an MDI child: |
|
4834 | 504 |
[exBegin] |
505 |
|top v1 v2| |
|
506 |
||
507 |
top := StandardSystemView new. |
|
508 |
top extent:450 @ 300. |
|
509 |
top name:'MDI Client'. |
|
510 |
top beMDIClientView. |
|
511 |
top open. |
|
512 |
||
513 |
v1 := View new. |
|
514 |
v1 viewBackground:Color red. |
|
515 |
v1 origin:50 @ 50 corner:150 @ 100. |
|
516 |
v1 beMDIChildView. |
|
517 |
top addSubView:v1. |
|
518 |
||
519 |
v2 := View new. |
|
520 |
v2 viewBackground:Color green. |
|
521 |
v2 origin:50 @ 50 corner:150 @ 100. |
|
522 |
v2 beMDIChildView. |
|
523 |
top addSubView:v2. |
|
524 |
[exEnd] |
|
4497 | 525 |
" |
526 |
! |
|
527 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
528 |
layoutComputation |
269 | 529 |
" |
530 |
Due to historic reasons, there are 2 mechanisms to resize a view: |
|
3152 | 531 |
- (old, to be eliminated mechanism) |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
532 |
based upon info found in |
3152 | 533 |
relativeOrigin / relativeCorner / relativeExtent |
534 |
originRule / cornerRule / extentRule |
|
535 |
||
536 |
- (new, will migrate to that one) |
|
537 |
letting a layoutObject compute things |
|
269 | 538 |
|
539 |
Actually, the old mechanism is just as powerful, as the new (layoutObject |
|
540 |
based) mechanism; with the help of block=rules, you can compute whatever |
|
541 |
geometry is desired. |
|
542 |
However, having 6 instance variables in every view creates some overhead, |
|
543 |
which can be avoided in most cases (most views are either fixed-size or |
|
544 |
relative-sized). |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
545 |
Therefore (and also to make porting of ST-80 apps easier), ST/X will migrate |
269 | 546 |
to use layoutObjects. |
547 |
You will not see a difference at the views protocol level, since |
|
548 |
existing interfaces will (silently) create layoutObjects as appropriate. |
|
549 |
However, you should remove all direct accesses to the above mentioned |
|
550 |
instance variables, to be prepared for that change. |
|
551 |
||
552 |
Notice, that a view recomputes its size whenever its superview |
|
553 |
changes size. This is done via: |
|
3152 | 554 |
sizeChanged |
555 |
-> allSubviews: superViewChangedSize |
|
269 | 556 |
|
557 |
If the geometry computation as performed in superViewChangedSize |
|
558 |
is not powerful enough for your application, you can either: |
|
3152 | 559 |
- redefine superViewChangedSize |
560 |
- create a special layoutObject which computes a new layout. |
|
269 | 561 |
" |
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
562 |
! |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
563 |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
564 |
popupMenus |
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
565 |
" |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
566 |
Due to historic reasons, there are multiple mechanisms for popupMenu |
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
567 |
definition: |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
568 |
|
3152 | 569 |
- static menus |
570 |
||
571 |
- dynamic menus from the view |
|
572 |
||
573 |
- dynamic menus from the model / menuHolder |
|
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
574 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
575 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
576 |
static menus |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
577 |
------------ |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
578 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
579 |
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
|
580 |
has a constant menu which never changes. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
581 |
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
|
582 |
The menu is defined with: |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
583 |
|
3152 | 584 |
someView middleButtonMenu:<aPopUpMenu> |
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
585 |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
586 |
Compatibility note: |
3152 | 587 |
static menus should no longer be used - their operation |
588 |
is incompatible with ST-80 and ST/X's dynamic menus. |
|
589 |
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
|
590 |
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
|
591 |
(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
|
592 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
593 |
example: |
3152 | 594 |
|top v1 v2| |
595 |
||
596 |
top := StandardSystemView new. |
|
597 |
top extent:300@300. |
|
598 |
||
599 |
v1 := View origin:0.0@0.0 corner:0.5@1.0 in:top. |
|
600 |
v1 viewBackground:Color red. |
|
601 |
||
602 |
v2 := View origin:0.5@0.0 corner:1.0@1.0 in:top. |
|
603 |
v2 viewBackground:Color yellow. |
|
604 |
||
605 |
v1 middleButtonMenu:( |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
606 |
PopUpMenu |
3152 | 607 |
labels:#('foo' 'bar') |
608 |
selectors:#(foo bar) |
|
609 |
receiver:v1 |
|
610 |
). |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
611 |
|
3152 | 612 |
top open. |
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
613 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
614 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
615 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
616 |
dynamic menus |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
617 |
------------- |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
618 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
619 |
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
|
620 |
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
|
621 |
(i.e. it may be different from the model). |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
622 |
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
|
623 |
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
|
624 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
625 |
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
|
626 |
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
|
627 |
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
|
628 |
by textViews. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
629 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
630 |
example: (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
|
631 |
Notice, that all menu messages are sent to the view (because no model was set) |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
632 |
- so the textView still performs the copy-function correctly |
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
633 |
(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
|
634 |
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
|
635 |
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
|
636 |
(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
|
637 |
|
3152 | 638 |
|top v1 v2 holder| |
639 |
||
640 |
holder := Plug new. |
|
641 |
holder respondTo:#menu1 |
|
642 |
with:[ |
|
643 |
v1 menuMessage:#otherMenu1. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
644 |
PopUpMenu |
3152 | 645 |
labels:#('foo' 'bar') |
646 |
selectors:#(foo bar). |
|
647 |
]. |
|
648 |
holder respondTo:#otherMenu1 |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
649 |
with:[ |
3152 | 650 |
v1 menuMessage:#menu1. |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
651 |
PopUpMenu |
3152 | 652 |
labels:#('other foo' 'other bar') |
653 |
selectors:#(foo bar). |
|
654 |
]. |
|
655 |
holder respondTo:#menu2 |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
656 |
with:[ PopUpMenu |
3152 | 657 |
labels:#('copy' 'bar2') |
658 |
selectors:#(copySelection bar2) |
|
659 |
]. |
|
660 |
||
661 |
top := StandardSystemView new. |
|
662 |
top extent:300@300. |
|
663 |
||
664 |
v1 := View origin:0.0@0.0 corner:0.5@1.0 in:top. |
|
665 |
v1 viewBackground:Color red. |
|
666 |
||
667 |
v2 := TextView origin:0.5@0.0 corner:1.0@1.0 in:top. |
|
668 |
v2 contents:'pop me up'. |
|
669 |
||
670 |
v1 model:holder; menuMessage:#menu1. |
|
671 |
v2 menuHolder:holder; menuMessage:#menu2. |
|
672 |
||
673 |
top open. |
|
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
674 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
675 |
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
|
676 |
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
|
677 |
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
|
678 |
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
|
679 |
|
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
680 |
example: |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
681 |
(Notice: the executor understands the #copySelection message - therefore, the |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
682 |
views built-in copy is NOT performed |
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
683 |
- it could be forwarded to the view, though. |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
684 |
This could be useful to intercept/filter things). |
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
685 |
|
3152 | 686 |
|top v menuProvider menuExecutor | |
687 |
||
688 |
menuProvider := Plug new. |
|
689 |
menuProvider respondTo:#menu |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
690 |
with:[ PopUpMenu |
3152 | 691 |
labels:#('copy' 'foo') |
692 |
selectors:#(copySelection foo) |
|
693 |
]. |
|
694 |
||
695 |
menuExecutor := Plug new. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
696 |
menuExecutor respondTo:#copySelection |
3152 | 697 |
with:[Transcript showCR:'copy function']. |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
698 |
menuExecutor respondTo:#foo |
3152 | 699 |
with:[Transcript showCR:'foo function']. |
700 |
||
701 |
top := StandardSystemView new. |
|
702 |
top extent:300@300. |
|
703 |
||
704 |
v := TextView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
705 |
v contents:'pop me up'. |
|
706 |
||
707 |
v menuHolder:menuProvider; menuMessage:#menu. |
|
708 |
v menuPerformer:menuExecutor. |
|
709 |
||
710 |
top open. |
|
522
1b041037c1ee
added docu on popUpMenu execution
Claus Gittinger <cg@exept.de>
parents:
520
diff
changeset
|
711 |
" |
135 | 712 |
! ! |
713 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
714 |
!SimpleView class methodsFor:'initialization'! |
135 | 715 |
|
716 |
initialize |
|
717 |
DefaultStyle isNil ifTrue:[ |
|
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
718 |
Font initialize. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
719 |
Form initialize. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
720 |
Color initialize. |
3378 | 721 |
]. |
722 |
self == SimpleView ifTrue:[ |
|
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
723 |
Smalltalk addDependent:self "/ to get language changes |
3378 | 724 |
]. |
725 |
||
365 | 726 |
ReturnFocusWhenClosingModalBoxes := false. |
696 | 727 |
|
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
728 |
FlagOriginChanged := 2r000000000001. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
729 |
FlagExtentChanged := 2r000000000010. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
730 |
FlagCornerChanged := 2r000000000100. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
731 |
|
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
732 |
FlagCanTab := 2r000000001000. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
733 |
FlagExtentChangedBeforeCreated := 2r000000010000. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
734 |
FlagRequestFocusOnPointerEnter := 2r000000100000. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
735 |
FlagDoNotRequestFocusOnPointerEnter := 2r000001000000. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
736 |
FlagNativeWidget := 2r000010000000. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
737 |
FlagIsUnmappedModalBox := 2r000100000000. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
738 |
FlagIsMDIChild := 2r001000000000. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
739 |
|
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
740 |
FlagHiddenOnRealize := 2r010000000000. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
741 |
FlagHasExplicitExtent := 2r100000000000. |
135 | 742 |
! |
743 |
||
744 |
postAutoload |
|
2994
c6be08b45a76
eliminated refs to Display (must use Screen current)
Stefan Vogel <sv@exept.de>
parents:
2985
diff
changeset
|
745 |
(Screen notNil and:[Screen current notNil]) ifTrue:[ |
3152 | 746 |
self updateStyleCache. |
2985
62552b74e805
do not read styleSheet if Display is nil
Stefan Vogel <sv@exept.de>
parents:
2979
diff
changeset
|
747 |
] |
135 | 748 |
! ! |
749 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
750 |
!SimpleView class methodsFor:'instance creation'! |
135 | 751 |
|
269 | 752 |
extent:extent |
753 |
"create a new view with given extent" |
|
754 |
||
755 |
^ self origin:nil extent:extent borderWidth:nil |
|
3152 | 756 |
font:nil label:nil in:nil |
269 | 757 |
! |
758 |
||
759 |
extent:extent in:aView |
|
760 |
"create a new view as a subview of aView with given extent" |
|
761 |
||
762 |
^ self origin:nil extent:extent borderWidth:nil |
|
3152 | 763 |
font:nil label:nil in:aView |
269 | 764 |
! |
765 |
||
766 |
extent:extent label:label |
|
767 |
"create a new view with given extent and label" |
|
768 |
||
769 |
^ self origin:nil extent:extent borderWidth:nil |
|
3152 | 770 |
font:nil label:label in:nil |
135 | 771 |
! |
772 |
||
773 |
in:aView |
|
774 |
"return a new view as a subview of aView. |
|
775 |
If aView is nil, it is left unspecified, in which superview |
|
776 |
the new view will be placed. The view can later be assigned |
|
777 |
by adding it to the superview via #addSubView:. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
778 |
If its later realized and no superview has ever been set, |
1918
a4042019bc8b
no need to set the container twice in SimpleView class>>in:
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
779 |
it will come up as a topview." |
135 | 780 |
|
781 |
|newView| |
|
782 |
||
783 |
newView := self basicNew. |
|
784 |
aView notNil ifTrue:[ |
|
3152 | 785 |
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
|
786 |
"/ newView container:aView. |
135 | 787 |
] ifFalse:[ |
3152 | 788 |
newView device:Screen current |
135 | 789 |
]. |
790 |
newView initialize. |
|
791 |
aView notNil ifTrue:[aView addSubView:newView]. |
|
792 |
^ newView |
|
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
793 |
|
743 | 794 |
"Modified: 28.5.1996 / 20:24:58 / cg" |
135 | 795 |
! |
796 |
||
140 | 797 |
label:label |
798 |
"create a new view with given label" |
|
135 | 799 |
|
800 |
^ self origin:nil extent:nil borderWidth:nil |
|
3152 | 801 |
font:nil label:label in:nil |
140 | 802 |
! |
803 |
||
269 | 804 |
label:label in:aView |
805 |
"create a new view as subview of aView with given label" |
|
806 |
||
807 |
^ self origin:nil extent:nil borderWidth:nil |
|
3152 | 808 |
font:nil label:label in:aView |
269 | 809 |
! |
810 |
||
1393
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
811 |
model:aModel |
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
812 |
"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
|
813 |
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
|
814 |
subclasses may." |
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
815 |
|
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
816 |
^ self new model:aModel |
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
817 |
|
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
818 |
"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
|
819 |
"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
|
820 |
! |
0af63b69b416
moved class>>model from View to here.
Claus Gittinger <cg@exept.de>
parents:
1389
diff
changeset
|
821 |
|
269 | 822 |
on:aModel |
823 |
"create a new drawable on aModel" |
|
824 |
||
825 |
"although this one does not know about models, |
|
826 |
it can still send the model-assign message. This was done |
|
827 |
to catch obsolete calls to on:aDevice. |
|
828 |
" |
|
829 |
^ self new model:aModel. |
|
830 |
! |
|
831 |
||
832 |
onSameDeviceAs:anotherView |
|
833 |
"create a view on the same device as anotherView. |
|
834 |
Used with popUpMenus, which should be created on the device of |
|
835 |
its masterView." |
|
836 |
||
837 |
|device| |
|
838 |
||
839 |
anotherView notNil ifTrue:[ |
|
3152 | 840 |
device := anotherView graphicsDevice. |
269 | 841 |
] ifFalse:[ |
3152 | 842 |
device := Screen current. |
269 | 843 |
]. |
844 |
^ self onDevice:device |
|
743 | 845 |
|
846 |
"Modified: 28.5.1996 / 20:25:05 / cg" |
|
269 | 847 |
! |
848 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
849 |
origin:origin corner:corner |
269 | 850 |
"create a new view with given origin and extent" |
135 | 851 |
|
140 | 852 |
^ self origin:origin corner:corner borderWidth:nil |
3152 | 853 |
font:nil label:nil in:nil |
135 | 854 |
! |
855 |
||
856 |
origin:anOrigin corner:aCorner borderWidth:bw font:aFont label:aLabel in:aView |
|
857 |
|newView| |
|
858 |
||
859 |
aView notNil ifTrue:[ |
|
3152 | 860 |
newView := self basicNew. |
861 |
newView device:(aView graphicsDevice). |
|
862 |
newView initialize. |
|
863 |
aView addSubView:newView. |
|
135 | 864 |
] ifFalse:[ |
3152 | 865 |
newView := self onDevice:Screen current |
135 | 866 |
]. |
867 |
bw notNil ifTrue:[newView borderWidth:bw]. |
|
868 |
anOrigin notNil ifTrue:[newView origin:anOrigin]. |
|
869 |
aCorner notNil ifTrue:[newView corner:aCorner]. |
|
870 |
aFont notNil ifTrue:[newView font:aFont]. |
|
871 |
aLabel notNil ifTrue:[newView label:aLabel]. |
|
872 |
^ newView |
|
743 | 873 |
|
874 |
"Modified: 28.5.1996 / 20:25:15 / cg" |
|
135 | 875 |
! |
876 |
||
269 | 877 |
origin:origin corner:corner borderWidth:bw in:aView |
878 |
"create a new view as a subview of aView with given origin and extent" |
|
879 |
||
880 |
^ self origin:origin corner:corner borderWidth:bw |
|
3152 | 881 |
font:nil label:nil in:aView |
269 | 882 |
! |
883 |
||
884 |
origin:origin corner:corner in:aView |
|
885 |
"create a new view as a subview of aView with given origin and extent" |
|
886 |
||
887 |
^ self origin:origin corner:corner borderWidth:nil |
|
3152 | 888 |
font:nil label:nil in:aView |
269 | 889 |
! |
890 |
||
891 |
origin:origin extent:extent |
|
892 |
"create a new view with given origin and extent" |
|
893 |
||
894 |
^ self origin:origin extent:extent borderWidth:nil |
|
3152 | 895 |
font:nil label:nil in:nil |
269 | 896 |
! |
897 |
||
898 |
origin:origin extent:extent borderWidth:bw |
|
899 |
"create a new view with given origin, extent and borderWidth" |
|
900 |
||
901 |
^ self origin:origin extent:extent borderWidth:bw |
|
3152 | 902 |
font:nil label:nil in:nil |
269 | 903 |
! |
904 |
||
905 |
origin:anOrigin extent:anExtent borderWidth:bw font:aFont label:aLabel in:aView |
|
906 |
|newView| |
|
907 |
||
908 |
aView notNil ifTrue:[ |
|
3152 | 909 |
newView := self basicNew. |
910 |
newView device:(aView graphicsDevice). |
|
911 |
newView initialize. |
|
912 |
aView addSubView:newView. |
|
140 | 913 |
] ifFalse:[ |
3152 | 914 |
newView := self onDevice:Screen current |
140 | 915 |
]. |
269 | 916 |
bw notNil ifTrue:[newView borderWidth:bw]. |
917 |
anExtent notNil ifTrue:[newView extent:anExtent]. |
|
918 |
anOrigin notNil ifTrue:[newView origin:anOrigin]. |
|
919 |
aFont notNil ifTrue:[newView font:aFont]. |
|
920 |
aLabel notNil ifTrue:[newView label:aLabel]. |
|
921 |
^ newView |
|
743 | 922 |
|
923 |
"Modified: 28.5.1996 / 20:25:19 / cg" |
|
269 | 924 |
! |
925 |
||
926 |
origin:origin extent:extent borderWidth:bw in:aView |
|
927 |
"create a new view as a subview of aView with given origin, extent |
|
928 |
and borderWidth" |
|
929 |
||
930 |
^ self origin:origin extent:extent borderWidth:bw |
|
3152 | 931 |
font:nil label:nil in:aView |
269 | 932 |
! |
933 |
||
934 |
origin:origin extent:extent font:aFont label:label |
|
935 |
^ self origin:origin extent:extent borderWidth:nil |
|
3152 | 936 |
font:nil label:label in:nil |
269 | 937 |
! |
938 |
||
939 |
origin:origin extent:extent font:aFont label:label in:aView |
|
940 |
^ self origin:origin extent:extent borderWidth:nil |
|
3152 | 941 |
font:aFont label:label in:aView |
269 | 942 |
! |
943 |
||
944 |
origin:origin extent:extent in:aView |
|
945 |
"create a new view as a subview of aView with given origin and extent" |
|
946 |
||
947 |
^ self origin:origin extent:extent borderWidth:nil |
|
3152 | 948 |
font:nil label:nil in:aView |
269 | 949 |
! |
950 |
||
951 |
origin:origin extent:extent label:label |
|
952 |
"create a new view with given origin, extent and label" |
|
953 |
||
954 |
^ self origin:origin extent:extent borderWidth:nil |
|
3152 | 955 |
font:nil label:label in:nil |
135 | 956 |
! |
957 |
||
958 |
origin:anOrigin extent:anExtent |
|
3152 | 959 |
label:aLabel icon:aForm |
960 |
minExtent:minExtent maxExtent:maxExtent |
|
135 | 961 |
|newView| |
962 |
||
2994
c6be08b45a76
eliminated refs to Display (must use Screen current)
Stefan Vogel <sv@exept.de>
parents:
2985
diff
changeset
|
963 |
newView := self onDevice:Screen current. |
135 | 964 |
anOrigin notNil ifTrue:[newView origin:anOrigin]. |
965 |
anExtent notNil ifTrue:[newView extent:anExtent]. |
|
966 |
aLabel notNil ifTrue:[newView label:aLabel]. |
|
967 |
aForm notNil ifTrue:[newView icon:aForm]. |
|
968 |
minExtent notNil ifTrue:[newView minExtent:minExtent]. |
|
969 |
maxExtent notNil ifTrue:[newView maxExtent:maxExtent]. |
|
970 |
^ newView |
|
971 |
! |
|
972 |
||
140 | 973 |
origin:origin in:aView |
974 |
"create a new view as a subview of aView with given origin" |
|
975 |
||
976 |
^ self origin:origin extent:nil borderWidth:nil |
|
3152 | 977 |
font:nil label:nil in:aView |
135 | 978 |
! ! |
979 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
980 |
!SimpleView class methodsFor:'change & update'! |
269 | 981 |
|
867 | 982 |
update:something with:aParameter from:changedObject |
3378 | 983 |
changedObject == Smalltalk ifTrue:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
984 |
(something == #Language or:[something == LanguageTerritory]) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
985 |
"flush resources on language changes" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
986 |
self flushAllClassResources. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
987 |
self allSubInstancesDo:[:eachView | eachView languageChanged]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
988 |
]. |
135 | 989 |
] |
867 | 990 |
|
991 |
"Created: 15.6.1996 / 15:23:04 / cg" |
|
135 | 992 |
! ! |
993 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
994 |
!SimpleView class methodsFor:'defaults'! |
135 | 995 |
|
140 | 996 |
defaultExtent |
586 | 997 |
"return the default extent of my instances. |
998 |
The value returned here is usually ignored, and |
|
999 |
the value from preferredExtent taken instead." |
|
140 | 1000 |
|
1001 |
CentPoint isNil ifTrue:[CentPoint := 100 @ 100]. |
|
1002 |
^ CentPoint |
|
586 | 1003 |
|
1004 |
"Modified: 22.4.1996 / 23:38:39 / cg" |
|
140 | 1005 |
! |
1006 |
||
269 | 1007 |
defaultFont |
990 | 1008 |
|f| |
1009 |
||
452
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
1010 |
DefaultFont notNil ifTrue:[^ DefaultFont]. |
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
1011 |
|
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
1012 |
DefaultFont isNil ifTrue:[ |
3152 | 1013 |
self == SimpleView ifFalse:[ |
1014 |
f := self superclass defaultFont. |
|
1015 |
] ifTrue:[ |
|
1016 |
f := super defaultFont |
|
1017 |
]. |
|
452
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
1018 |
]. |
997 | 1019 |
|
990 | 1020 |
f notNil ifTrue:[ |
3152 | 1021 |
DefaultFont := f. |
1022 |
f := f onDevice:(Screen current). |
|
1023 |
f notNil ifTrue:[ |
|
1024 |
DefaultFont := f. |
|
1025 |
] |
|
990 | 1026 |
]. |
452
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
1027 |
^ DefaultFont |
467 | 1028 |
|
1029 |
"Modified: 27.2.1996 / 02:20:54 / cg" |
|
269 | 1030 |
! |
1031 |
||
450 | 1032 |
defaultFont:aFont |
452
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
1033 |
"set the default font used for drawing" |
f38d70ba97a2
made DefaultFont a classINSTvariable
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
1034 |
|
997 | 1035 |
|f| |
1036 |
||
527
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1037 |
DefaultFont := aFont. |
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1038 |
aFont notNil ifTrue:[ |
3152 | 1039 |
f := aFont onDevice:(Screen current). |
1040 |
f notNil ifTrue:[ |
|
1041 |
DefaultFont := f. |
|
1042 |
] |
|
527
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1043 |
] |
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1044 |
|
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1045 |
"Modified: 18.3.1996 / 12:56:20 / cg" |
450 | 1046 |
! |
1047 |
||
269 | 1048 |
defaultStyle |
1049 |
"return the default view style" |
|
1050 |
||
1051 |
^ DefaultStyle |
|
1052 |
||
1053 |
" |
|
1054 |
View defaultStyle |
|
1055 |
" |
|
135 | 1056 |
! |
1057 |
||
1058 |
defaultStyle:aStyle |
|
1059 |
"set the view style for new views" |
|
1060 |
||
2985
62552b74e805
do not read styleSheet if Display is nil
Stefan Vogel <sv@exept.de>
parents:
2979
diff
changeset
|
1061 |
DefaultStyle := aStyle. |
2994
c6be08b45a76
eliminated refs to Display (must use Screen current)
Stefan Vogel <sv@exept.de>
parents:
2985
diff
changeset
|
1062 |
(Screen notNil and:[Screen current notNil]) ifTrue:[ |
3152 | 1063 |
self readStyleSheetAndUpdateAllStyleCaches. |
2985
62552b74e805
do not read styleSheet if Display is nil
Stefan Vogel <sv@exept.de>
parents:
2979
diff
changeset
|
1064 |
]. |
135 | 1065 |
|
1066 |
" |
|
1067 |
View defaultStyle:#next. SystemBrowser start |
|
1068 |
View defaultStyle:#motif. SystemBrowser start |
|
1069 |
View defaultStyle:#iris. SystemBrowser start |
|
1070 |
View defaultStyle:#st80. SystemBrowser start |
|
1071 |
View defaultStyle:#normal. SystemBrowser start |
|
1072 |
" |
|
2351
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 |
"Modified: / 15.9.1998 / 22:05:02 / cg" |
135 | 1075 |
! |
1076 |
||
1860
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1077 |
defaultViewBackgroundColor |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1078 |
"return the default view background" |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1079 |
|
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1080 |
^ DefaultViewBackgroundColor |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1081 |
|
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1082 |
" |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1083 |
View defaultViewBackgroundColor |
1860
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1084 |
" |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1085 |
|
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1086 |
"Modified: 13.8.1997 / 19:37:55 / cg" |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1087 |
! |
95ce8aa47451
added access to DefaultViewBackgroundColor
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1088 |
|
2351
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1089 |
readStyleSheet |
3181 | 1090 |
"(re)load the styleSheet." |
2351
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1091 |
|
4313
48fe65cf3fd2
iconLibrary-class from styleSheet
Claus Gittinger <cg@exept.de>
parents:
4295
diff
changeset
|
1092 |
|iconLibraryClass | |
48fe65cf3fd2
iconLibrary-class from styleSheet
Claus Gittinger <cg@exept.de>
parents:
4295
diff
changeset
|
1093 |
|
3762 | 1094 |
DefaultStyle isNil ifTrue:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1095 |
self setDefaultStyle |
3762 | 1096 |
]. |
3002 | 1097 |
|
2351
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1098 |
StyleSheet := ViewStyle fromFile:(DefaultStyle , '.style'). |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1099 |
StyleSheet fileReadFailed ifTrue:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1100 |
('SimpleView [warning]: ***** no styleSheet for ' , DefaultStyle , '-style.') errorPrintCR. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1101 |
DefaultStyle ~~ #normal ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1102 |
DefaultStyle := #normal. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1103 |
StyleSheet := ViewStyle fromFile:(DefaultStyle , '.style'). |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1104 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1105 |
StyleSheet fileReadFailed ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1106 |
'SimpleView [warning]: not even a styleSheet for normal-style (using ugly defaults).' errorPrintCR. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1107 |
] |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1108 |
] |
4313
48fe65cf3fd2
iconLibrary-class from styleSheet
Claus Gittinger <cg@exept.de>
parents:
4295
diff
changeset
|
1109 |
]. |
48fe65cf3fd2
iconLibrary-class from styleSheet
Claus Gittinger <cg@exept.de>
parents:
4295
diff
changeset
|
1110 |
|
48fe65cf3fd2
iconLibrary-class from styleSheet
Claus Gittinger <cg@exept.de>
parents:
4295
diff
changeset
|
1111 |
iconLibraryClass := StyleSheet at:#ToolbarIconLibrary. |
48fe65cf3fd2
iconLibrary-class from styleSheet
Claus Gittinger <cg@exept.de>
parents:
4295
diff
changeset
|
1112 |
ToolbarIconLibrary := iconLibraryClass ? GenericToolbarIconLibrary. |
2351
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1113 |
|
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1114 |
"Created: / 15.9.1998 / 22:03:06 / cg" |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1115 |
! |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1116 |
|
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1117 |
readStyleSheetAndUpdateAllStyleCaches |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1118 |
"reload all style caches in all view classes. |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1119 |
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
|
1120 |
|
3002 | 1121 |
DefaultStyle notNil ifTrue:[ |
3152 | 1122 |
self readStyleSheet. |
1123 |
self updateAllStyleCaches |
|
3002 | 1124 |
] |
2351
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1125 |
|
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1126 |
"Created: / 15.9.1998 / 22:03:59 / cg" |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1127 |
! |
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1128 |
|
362 | 1129 |
returnFocusWhenClosingModalBoxes |
364
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1130 |
"return the current focus-return behavior. |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1131 |
See #returnFocusWhenClosingModalBoxes: for a description." |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1132 |
|
362 | 1133 |
^ ReturnFocusWhenClosingModalBoxes |
1134 |
! |
|
1135 |
||
1136 |
returnFocusWhenClosingModalBoxes:aBoolean |
|
364
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1137 |
"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
|
1138 |
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
|
1139 |
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
|
1140 |
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
|
1141 |
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
|
1142 |
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
|
1143 |
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
|
1144 |
it may be better to turn the focus-return off. |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1145 |
You should add a corresponding expression into your private.rc or |
364
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1146 |
display.rc file." |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1147 |
|
362 | 1148 |
ReturnFocusWhenClosingModalBoxes := aBoolean |
364
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1149 |
|
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1150 |
" |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1151 |
Dialog returnFocusWhenClosingModalBoxes:false |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1152 |
Dialog returnFocusWhenClosingModalBoxes:true |
b44b425e3ee1
oops - forgot to initialize the value of ReturnFocusWhenClosing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1153 |
" |
362 | 1154 |
! |
1155 |
||
2294 | 1156 |
setDefaultStyle |
1157 |
|defStyle| |
|
1158 |
||
3185 | 1159 |
DefaultStyle isNil ifTrue:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1160 |
defStyle := OperatingSystem getEnvironment:'STX_VIEWSTYLE'. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1161 |
defStyle notNil ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1162 |
DefaultStyle := defStyle asSymbol. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1163 |
] ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1164 |
DefaultStyle := #mswindowsXP |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1165 |
]. |
2294 | 1166 |
]. |
1167 |
! |
|
1168 |
||
1161
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1169 |
styleSheet |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1170 |
"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
|
1171 |
|
3923 | 1172 |
StyleSheet isNil ifTrue:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1173 |
self updateAllStyleCaches. |
3923 | 1174 |
]. |
1161
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1175 |
^ StyleSheet |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1176 |
|
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1177 |
" |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1178 |
View styleSheet |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1179 |
" |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1180 |
|
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1181 |
"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
|
1182 |
! |
07570a2d9008
added access to the styleSheet (for App-models)
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1183 |
|
269 | 1184 |
styleSheet:aViewStyle |
1185 |
"set the view style from a style-sheet" |
|
1186 |
||
1187 |
StyleSheet := aViewStyle. |
|
1188 |
DefaultStyle := (StyleSheet at:'name' ifAbsent:'unknown') asSymbol. |
|
1189 |
self updateAllStyleCaches. |
|
1190 |
! |
|
1191 |
||
1192 |
updateAllStyleCaches |
|
1193 |
"reload all style caches in all view classes. |
|
1194 |
Needed after a style change or when a style file has been changed" |
|
1195 |
||
2994
c6be08b45a76
eliminated refs to Display (must use Screen current)
Stefan Vogel <sv@exept.de>
parents:
2985
diff
changeset
|
1196 |
(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
|
1197 |
|
269 | 1198 |
" |
1199 |
tell all view classes to flush any |
|
1200 |
cached style-data |
|
1201 |
" |
|
1202 |
self changed:#style. |
|
1203 |
SimpleView updateStyleCache. |
|
1204 |
SimpleView allSubclassesDo:[:aClass | |
|
3762 | 1205 |
aClass defaultFont:nil. |
1206 |
(aClass class includesSelector:#updateStyleCache) ifTrue:[ |
|
1207 |
aClass updateStyleCache |
|
1208 |
]. |
|
269 | 1209 |
] |
1210 |
||
1211 |
" |
|
1212 |
View updateAllStyleCaches |
|
1213 |
" |
|
527
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1214 |
|
2351
bb7cb7d8d723
separated style-handling into read-/update,
Claus Gittinger <cg@exept.de>
parents:
2302
diff
changeset
|
1215 |
"Modified: / 15.9.1998 / 22:04:15 / cg" |
269 | 1216 |
! |
1217 |
||
135 | 1218 |
updateStyleCache |
1219 |
"this method gets some heavily used style stuff and keeps |
|
1220 |
it in class-variables for faster access. |
|
1221 |
Subclasses should redefine this to load any cached style-values |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1222 |
into faster class variables as well. These should NOT do a |
135 | 1223 |
super updateStyleCache, since this method is called for all view-classes |
1224 |
anyway." |
|
1225 |
||
2492 | 1226 |
<resource: #style (#viewSpacing #font #borderWidth #borderColor |
3367 | 1227 |
#viewBackground #shadowColor #lightColor |
1228 |
#focusColor #focusBorderWidth)> |
|
2292
8efc5272cf0b
defaultStyle either from environmane (STX_VIEWSTYLE)
Claus Gittinger <cg@exept.de>
parents:
2274
diff
changeset
|
1229 |
|
2994
c6be08b45a76
eliminated refs to Display (must use Screen current)
Stefan Vogel <sv@exept.de>
parents:
2985
diff
changeset
|
1230 |
|bgGrey currentScreen| |
135 | 1231 |
|
1232 |
" |
|
1233 |
when coming here the first time, we read the styleSheet |
|
1234 |
and keep the values in fast class variables |
|
1235 |
" |
|
1236 |
StyleSheet isNil ifTrue:[ |
|
3367 | 1237 |
self setDefaultStyle. |
1238 |
self readStyleSheet. |
|
135 | 1239 |
]. |
1240 |
||
2994
c6be08b45a76
eliminated refs to Display (must use Screen current)
Stefan Vogel <sv@exept.de>
parents:
2985
diff
changeset
|
1241 |
currentScreen := Screen current. |
c6be08b45a76
eliminated refs to Display (must use Screen current)
Stefan Vogel <sv@exept.de>
parents:
2985
diff
changeset
|
1242 |
|
135 | 1243 |
Grey := StyleSheet viewGrey. |
1244 |
Grey isNil ifTrue:[ |
|
3367 | 1245 |
Grey := Color grey |
2829 | 1246 |
]. |
2994
c6be08b45a76
eliminated refs to Display (must use Screen current)
Stefan Vogel <sv@exept.de>
parents:
2985
diff
changeset
|
1247 |
Grey := Grey onDevice:currentScreen. |
135 | 1248 |
|
151 | 1249 |
StyleSheet fileReadFailed ifTrue:[ |
3367 | 1250 |
bgGrey := White |
135 | 1251 |
] ifFalse:[ |
3367 | 1252 |
currentScreen hasGrayscales ifTrue:[ |
1253 |
bgGrey := Grey |
|
1254 |
] ifFalse:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1255 |
bgGrey := White |
3367 | 1256 |
] |
2829 | 1257 |
]. |
2994
c6be08b45a76
eliminated refs to Display (must use Screen current)
Stefan Vogel <sv@exept.de>
parents:
2985
diff
changeset
|
1258 |
bgGrey := bgGrey onDevice:currentScreen. |
135 | 1259 |
|
2492 | 1260 |
ViewSpacing := StyleSheet at:#viewSpacing. |
135 | 1261 |
ViewSpacing isNil ifTrue:[ |
3367 | 1262 |
ViewSpacing := currentScreen defaultStyleValueFor:#viewSpacing. |
2492 | 1263 |
]. |
1264 |
||
1265 |
DefaultBorderColor := StyleSheet colorAt:#borderColor. |
|
1678
5c93a4791a8b
prepare to fetch style defaults from device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1617
diff
changeset
|
1266 |
DefaultBorderColor isNil ifTrue:[ |
3367 | 1267 |
DefaultBorderColor := currentScreen defaultStyleValueFor:#borderColor |
1678
5c93a4791a8b
prepare to fetch style defaults from device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1617
diff
changeset
|
1268 |
]. |
151 | 1269 |
|
1270 |
StyleSheet fileReadFailed ifTrue:[ |
|
3367 | 1271 |
DefaultBorderWidth := 1. |
1272 |
DefaultShadowColor := Black. |
|
1273 |
DefaultLightColor := White. |
|
1274 |
DefaultFocusColor := Black. |
|
1275 |
DefaultFocusBorderWidth := 2. |
|
1276 |
DefaultViewBackgroundColor := White. |
|
151 | 1277 |
] ifFalse:[ |
3367 | 1278 |
DefaultBorderWidth := StyleSheet at:#borderWidth default:0. |
1279 |
DefaultViewBackgroundColor := StyleSheet colorAt:#viewBackground default:bgGrey. |
|
1280 |
DefaultShadowColor := StyleSheet colorAt:#shadowColor. |
|
1281 |
DefaultLightColor := StyleSheet colorAt:#lightColor. |
|
1282 |
DefaultFocusColor := StyleSheet colorAt:#focusColor default:Color red. |
|
1283 |
DefaultFocusBorderWidth := StyleSheet at:'focusBorderWidth' default:2. |
|
151 | 1284 |
]. |
135 | 1285 |
|
526 | 1286 |
self == SimpleView ifTrue:[ |
3367 | 1287 |
DefaultFont := StyleSheet at:#font. |
1288 |
DefaultFont isNil ifTrue:[ |
|
1289 |
DefaultFont := Font family:'courier' face:'medium' style:'roman' size:12. |
|
1290 |
]. |
|
1291 |
DefaultFont := DefaultFont onDevice:currentScreen. |
|
527
743c5f8b932e
defaultFont style caching was wrong
Claus Gittinger <cg@exept.de>
parents:
526
diff
changeset
|
1292 |
] ifFalse:[ |
3367 | 1293 |
DefaultFont := nil |
135 | 1294 |
]. |
1295 |
||
1296 |
DefaultViewBackgroundColor isNil ifTrue:[ |
|
3367 | 1297 |
'SimpleView [warning]: bad viewBackground in style - using white' errorPrintCR. |
1298 |
DefaultViewBackgroundColor := White |
|
2492 | 1299 |
]. |
1300 |
||
1301 |
"Modified: / 29.4.1997 / 11:16:52 / dq" |
|
1302 |
"Modified: / 8.3.1999 / 01:36:05 / cg" |
|
135 | 1303 |
! |
1304 |
||
269 | 1305 |
viewSpacing |
1306 |
"return a convenient number of pixels used to separate views (usually 1mm). |
|
1307 |
Having this value here at a common place makes certain that all views |
|
1308 |
get a common look" |
|
1309 |
||
1310 |
^ ViewSpacing |
|
1311 |
! ! |
|
1312 |
||
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
1313 |
!SimpleView class methodsFor:'resources'! |
269 | 1314 |
|
1315 |
classResources |
|
4091
3995bf25130a
classResources now understood by all classes
Claus Gittinger <cg@exept.de>
parents:
4069
diff
changeset
|
1316 |
"if not already loaded, get the classes resourcePack and return it" |
269 | 1317 |
|
1318 |
ClassResources isNil ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1319 |
ClassResources := super classResources. |
140 | 1320 |
]. |
269 | 1321 |
^ ClassResources |
1322 |
! |
|
1323 |
||
1324 |
classResources:aResourcePack |
|
1325 |
"allow setting of the classResources" |
|
1326 |
||
1327 |
ClassResources := aResourcePack |
|
1328 |
! |
|
1329 |
||
1330 |
flushAllClassResources |
|
1331 |
"flush all classes resource translations. |
|
1332 |
Needed after a resource file has changed." |
|
1333 |
||
1334 |
ResourcePack flushCachedResourcePacks. |
|
3378 | 1335 |
SimpleView withAllSubclassesDo:[:aClass | |
3762 | 1336 |
aClass flushClassResources. |
140 | 1337 |
] |
1338 |
||
1339 |
" |
|
269 | 1340 |
View flushAllClassResources |
140 | 1341 |
" |
269 | 1342 |
"to change the language: |
3762 | 1343 |
Language := #en. |
1344 |
Smalltalk changed:#Language. |
|
1345 |
View flushAllClassResources |
|
269 | 1346 |
or: |
3762 | 1347 |
Language := #de. |
1348 |
Smalltalk changed:#Language. |
|
1349 |
View flushAllClassResources |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1350 |
" |
269 | 1351 |
! |
1352 |
||
1353 |
flushClassResources |
|
1354 |
"flush classes resource string translations. |
|
1355 |
Needed whenever a resource file or language has changed" |
|
1356 |
||
1357 |
ClassResources := nil. |
|
1358 |
! |
|
1359 |
||
2130
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
1360 |
resources |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
1361 |
^ self classResources |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
1362 |
|
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
1363 |
"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
|
1364 |
! |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
1365 |
|
269 | 1366 |
updateClassResources |
1367 |
"flush classes resource string translations and reload them. |
|
1368 |
Needed whenever a resource file or language has changed" |
|
1369 |
||
1370 |
ClassResources := nil. |
|
1371 |
self classResources |
|
135 | 1372 |
! ! |
1373 |
||
3781 | 1374 |
!SimpleView class methodsFor:'startup'! |
1375 |
||
1376 |
open |
|
1377 |
"create, realize the view - this topview and all its subviews will |
|
1378 |
run as a separate process with its own windowGroup" |
|
1379 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1380 |
^ self new open |
4054 | 1381 |
! |
1382 |
||
1383 |
openOnXScreenNamed:aScreenName |
|
1384 |
"create an instance of the view and open it |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1385 |
on some X display screen. The argument aScreenName must be |
4054 | 1386 |
a valid x-display name (i.e. of the form '<host>:<screenNr>' as in 'foo:0'). |
1387 |
For more info, read the document on multiple display |
|
1388 |
support and the documentation of the DeviceWorkstation class." |
|
1389 |
||
1390 |
|newDevice| |
|
1391 |
||
1392 |
[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1393 |
newDevice := XWorkstation newDispatchingFor:aScreenName. |
4054 | 1394 |
] on:Screen deviceOpenErrorSignal do:[:ex| |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1395 |
self warn:'Could not open display: ' , aScreenName. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1396 |
^ self |
4054 | 1397 |
]. |
1398 |
^ (self onDevice:newDevice) open. |
|
1399 |
||
1400 |
" |
|
1401 |
FileBrowser openOnXScreenNamed:'bitsy:0' |
|
1402 |
FileBrowser openOnXScreenNamed:':0' |
|
1403 |
View openOnXScreenNamed:'bitsy:0' |
|
1404 |
" |
|
1405 |
||
1406 |
"Modified: 13.1.1997 / 20:55:27 / cg" |
|
3781 | 1407 |
! ! |
1408 |
||
3880 | 1409 |
!SimpleView methodsFor:'Compatibility-ST80'! |
269 | 1410 |
|
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1411 |
bounds |
1182 | 1412 |
"ST-80 compatibility: return my bounds" |
1413 |
||
971 | 1414 |
^ (self origin) corner:(self corner) |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1415 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1416 |
"Created: 4.6.1996 / 21:23:27 / cg" |
1182 | 1417 |
"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
|
1418 |
! |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1419 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1420 |
bounds:aRectangle |
1182 | 1421 |
"ST-80 compatibility: change my bounds" |
1422 |
||
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
1423 |
self explicitExtent:true. |
971 | 1424 |
self pixelOrigin:aRectangle origin |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
1425 |
corner:aRectangle corner |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1426 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1427 |
"Created: 4.6.1996 / 21:44:27 / cg" |
1182 | 1428 |
"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
|
1429 |
! |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1430 |
|
269 | 1431 |
checkForEvents |
1182 | 1432 |
"ST-80 compatibility: |
1433 |
check for any pending events and process them" |
|
1434 |
||
269 | 1435 |
(shown and:[windowGroup notNil]) ifTrue:[windowGroup processEvents]. |
1182 | 1436 |
|
1437 |
"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
|
1438 |
! |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1439 |
|
3164
f3dce6ea8e3f
VW compatibility: closeAndUnschedule
Claus Gittinger <cg@exept.de>
parents:
3155
diff
changeset
|
1440 |
closeAndUnschedule |
f3dce6ea8e3f
VW compatibility: closeAndUnschedule
Claus Gittinger <cg@exept.de>
parents:
3155
diff
changeset
|
1441 |
"actually sent to a controller in VW... |
f3dce6ea8e3f
VW compatibility: closeAndUnschedule
Claus Gittinger <cg@exept.de>
parents:
3155
diff
changeset
|
1442 |
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
|
1443 |
|
3316 | 1444 |
self topView destroy |
3164
f3dce6ea8e3f
VW compatibility: closeAndUnschedule
Claus Gittinger <cg@exept.de>
parents:
3155
diff
changeset
|
1445 |
! |
f3dce6ea8e3f
VW compatibility: closeAndUnschedule
Claus Gittinger <cg@exept.de>
parents:
3155
diff
changeset
|
1446 |
|
3775 | 1447 |
displayOn:aGCOrStream |
1182 | 1448 |
"ST-80 compatibility: (re-)display myself" |
1449 |
||
3775 | 1450 |
"/ what a kludge - Dolphin and Squeak mean: printOn:; |
1451 |
"/ ST/X (and some old ST80's) mean: draw-yourself on. |
|
1452 |
(aGCOrStream isStream or:[aGCOrStream == Transcript]) ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1453 |
^ super displayOn:aGCOrStream |
3774 | 1454 |
]. |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1455 |
self redraw |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1456 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
1457 |
"Created: 4.6.1996 / 21:25:59 / cg" |
1182 | 1458 |
"Modified: 10.1.1997 / 19:46:58 / cg" |
1363 | 1459 |
! |
1460 |
||
1432 | 1461 |
displayPendingInvalidation |
1462 |
"dummy - for ST-80 compatibility" |
|
1463 |
||
1464 |
"Created: 6.3.1997 / 15:17:14 / cg" |
|
1465 |
"Modified: 6.3.1997 / 15:17:31 / cg" |
|
1466 |
! |
|
1467 |
||
4515
ecbf26955b5b
client:spec:builder: bogus masterApp handling
Claus Gittinger <cg@exept.de>
parents:
4502
diff
changeset
|
1468 |
invalidateRectangle:aRectangle repairNow:doRepairNow |
ecbf26955b5b
client:spec:builder: bogus masterApp handling
Claus Gittinger <cg@exept.de>
parents:
4502
diff
changeset
|
1469 |
self invalidate:aRectangle repairNow:doRepairNow |
ecbf26955b5b
client:spec:builder: bogus masterApp handling
Claus Gittinger <cg@exept.de>
parents:
4502
diff
changeset
|
1470 |
! |
ecbf26955b5b
client:spec:builder: bogus masterApp handling
Claus Gittinger <cg@exept.de>
parents:
4502
diff
changeset
|
1471 |
|
1363 | 1472 |
isEnabled |
1473 |
"return true, if this view is enabled (i.e. accepts user interaction). |
|
1474 |
Most views are enabled - only a few (buttons, SelectionInList etc.) can |
|
1475 |
be disabled. |
|
1476 |
#isEnabled is ST-80's equivalent of #enabled" |
|
1477 |
||
1478 |
^ self enabled |
|
1413 | 1479 |
! |
1480 |
||
2061
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1481 |
isOpen |
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1482 |
"ST80 compatibility" |
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1483 |
|
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1484 |
^ realized |
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1485 |
|
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1486 |
|
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1487 |
! |
25c1fcc1d7e8
added #isOpen for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2037
diff
changeset
|
1488 |
|
2159 | 1489 |
lookPreferences:prefs |
1490 |
"ignored - but required for some apps" |
|
1491 |
||
1492 |
"Created: / 19.6.1998 / 00:05:10 / cg" |
|
1493 |
! |
|
1494 |
||
1413 | 1495 |
newLayout:aLayoutObject |
1496 |
"set the layout object which controls my geometry. |
|
1497 |
ST80-compatibility." |
|
1498 |
||
1499 |
here layout:aLayoutObject. |
|
1500 |
||
1501 |
"Created: 3.3.1997 / 18:54:53 / cg" |
|
1427 | 1502 |
! |
1503 |
||
1504 |
refresh |
|
1505 |
self invalidate |
|
3909 | 1506 |
! |
1507 |
||
1508 |
takeKeyboardFocus |
|
1509 |
self requestFocus |
|
151 | 1510 |
! ! |
1511 |
||
3880 | 1512 |
!SimpleView methodsFor:'Compatibility-Squeak'! |
2956 | 1513 |
|
1514 |
insetDisplayBox |
|
1515 |
"Squeak mimicri: return my bounds" |
|
1516 |
||
1517 |
^ 0@0 corner:(self corner) |
|
1518 |
||
1519 |
! ! |
|
1520 |
||
2450 | 1521 |
!SimpleView methodsFor:'accessing'! |
1522 |
||
4483 | 1523 |
client:anApplicationModel |
1524 |
"release existing components and generate new components from |
|
1525 |
the applications windowSpec. |
|
1526 |
ATTENTION: this is a low level interface; postBuild is NOT invoked" |
|
1527 |
||
1528 |
^ self client:anApplicationModel spec:#windowSpec |
|
1529 |
||
1530 |
||
1531 |
! |
|
1532 |
||
1533 |
client:anApplication spec:aWindowSpecOrSelector |
|
1534 |
"release existing components and generate new components from |
|
1535 |
the applications windowSpec. |
|
1536 |
ATTENTION: this is a low level interface; postBuild is NOT invoked" |
|
1537 |
||
1538 |
^ self client:anApplication spec:aWindowSpecOrSelector builder:nil |
|
1539 |
||
1540 |
! |
|
1541 |
||
1542 |
client:anApplication spec:aWindowSpecOrSpecSymbol builder:aBuilder |
|
1543 |
"release existing components and generate new components from |
|
4484
97096c51797d
can now control if specs menu is wanted or not
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1544 |
the given windowSpec, using the given builder." |
97096c51797d
can now control if specs menu is wanted or not
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1545 |
|
97096c51797d
can now control if specs menu is wanted or not
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1546 |
self client:anApplication spec:aWindowSpecOrSpecSymbol builder:aBuilder withMenu:false |
97096c51797d
can now control if specs menu is wanted or not
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1547 |
! |
97096c51797d
can now control if specs menu is wanted or not
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1548 |
|
97096c51797d
can now control if specs menu is wanted or not
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1549 |
client:anApplication spec:aWindowSpecOrSpecSymbol builder:aBuilder withMenu:withMenuBoolean |
97096c51797d
can now control if specs menu is wanted or not
Claus Gittinger <cg@exept.de>
parents:
4483
diff
changeset
|
1550 |
"release existing components and generate new components from |
4483 | 1551 |
the given windowSpec, using the given builder. |
1552 |
ATTENTION: this is a low level interface. |
|
1553 |
TODO: this code is so ugly and badly designed - it must be redesigned |
|
1554 |
or at least well documented." |
|
1555 |
||
1556 |
|builder subSpec isApplicationModel thisApp savedView masterApp thisIsANewBuild| |
|
1557 |
||
1558 |
aWindowSpecOrSpecSymbol isNil ifTrue:[^ self]. |
|
1559 |
||
1560 |
isApplicationModel := true. |
|
1561 |
||
1562 |
(builder := aBuilder) isNil ifTrue:[ |
|
4942
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1563 |
"/ problem: anApplication could have no builder |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1564 |
"/ or anApplication could be a non-appModel (theoretically - only providing a spec) |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1565 |
builder := anApplication perform:#builder ifNotUnderstood:[isApplicationModel := false. nil]. |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1566 |
builder isNil ifTrue:[ |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1567 |
isApplicationModel ifTrue:[ |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1568 |
anApplication createBuilder. |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1569 |
builder := anApplication builder |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1570 |
] ifFalse:[ |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1571 |
builder := UIBuilder new. |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1572 |
] |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1573 |
] |
4483 | 1574 |
]. |
1575 |
||
1576 |
(subSpec := aWindowSpecOrSpecSymbol) isSymbol ifTrue:[ |
|
4942
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1577 |
anApplication isNil ifTrue:[^ self]. |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1578 |
subSpec := anApplication interfaceSpecFor:aWindowSpecOrSpecSymbol. |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1579 |
subSpec isNil ifTrue:[ |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1580 |
^ self |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1581 |
]. |
4483 | 1582 |
]. |
1583 |
||
1584 |
"/ if the appl is not the master, but the masters builder is used, |
|
1585 |
"/ we have to temporarily change the builders window |
|
1586 |
||
1587 |
masterApp := anApplication perform:#masterApplication ifNotUnderstood:[isApplicationModel := false. nil]. |
|
1588 |
thisApp := builder application. |
|
1589 |
(isApplicationModel and:[anApplication ~~ thisApp]) ifTrue:[ |
|
4942
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1590 |
masterApp ~~ thisApp ifTrue:[ |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1591 |
self error:'should not happen' mayProceed:true. |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1592 |
masterApp isNil ifTrue:[ |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1593 |
anApplication masterApplication:thisApp. |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1594 |
]. |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1595 |
]. |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1596 |
|
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1597 |
builder application:anApplication. |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1598 |
savedView := builder window. |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1599 |
builder window:self. |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1600 |
[ |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1601 |
anApplication buildSubCanvas:subSpec withMenu:withMenuBoolean withBuilder:builder. |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1602 |
] ensure:[ |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1603 |
builder window:savedView. |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1604 |
builder application:thisApp. |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1605 |
]. |
4483 | 1606 |
] ifFalse:[ |
4942
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1607 |
thisIsANewBuild := builder window isNil. |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1608 |
thisIsANewBuild ifTrue:[ |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1609 |
builder window:self. |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1610 |
anApplication buildSubCanvas:subSpec withMenu:withMenuBoolean withBuilder:builder. |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1611 |
] ifFalse:[ |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1612 |
"/ WARNING: in case of rebuilding, we do NOT invoke pre- and postBuilds |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1613 |
builder buildFromSpec:subSpec in:self. |
a8c7be861824
interfaceSpecFor: must go via the instance
Claus Gittinger <cg@exept.de>
parents:
4918
diff
changeset
|
1614 |
] |
4483 | 1615 |
]. |
1616 |
||
1617 |
"/ postBuildWith: will be called twice if code below is enabled |
|
1618 |
"/ notAnAppModel isNil ifTrue:[ |
|
1619 |
"/ notAnAppModel := (anApplication isKindOf:ApplicationModel) not |
|
1620 |
"/ ]. |
|
1621 |
"/ notAnAppModel ifTrue:[ |
|
1622 |
"/ builder buildFromSpec:subSpec in:self. |
|
1623 |
"/ ] ifFalse:[ |
|
1624 |
"/ savedView := builder window. |
|
1625 |
"/ builder window:self. |
|
1626 |
"/ [ |
|
1627 |
"/ anApplication buildSubCanvas:subSpec withBuilder:builder. |
|
1628 |
"/ ] ensure:[ |
|
1629 |
"/ savedView notNil ifTrue:[ |
|
1630 |
"/ builder window:savedView. |
|
1631 |
"/ ] |
|
1632 |
"/ ]. |
|
1633 |
"/ ]. |
|
1634 |
! |
|
1635 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1636 |
helpKey |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1637 |
^ helpKey |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1638 |
! |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1639 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1640 |
helpKey:something |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1641 |
helpKey := something. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1642 |
! |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1643 |
|
2450 | 1644 |
keyboardProcessor |
1645 |
"return my keyboard processor" |
|
1646 |
||
1647 |
^ nil |
|
1648 |
||
1649 |
"Created: / 13.2.1999 / 10:31:39 / cg" |
|
1650 |
! ! |
|
1651 |
||
2549
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1652 |
!SimpleView methodsFor:'accessing-behavior'! |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1653 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1654 |
disable |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1655 |
"alternative method; redirected to basic mechanism" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1656 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1657 |
self enabled:false |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1658 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1659 |
"Modified: / 30.3.1999 / 14:47:30 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1660 |
"Created: / 30.3.1999 / 15:54:11 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1661 |
! |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1662 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1663 |
enable |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1664 |
"alternative method; redirected to basic mechanism" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1665 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1666 |
self enabled:true |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1667 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1668 |
"Modified: / 30.3.1999 / 14:47:22 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1669 |
"Created: / 30.3.1999 / 15:54:16 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1670 |
! |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1671 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1672 |
enabled |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1673 |
"views are enabled by default" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1674 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1675 |
^ true |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1676 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1677 |
"Modified: / 30.3.1999 / 16:27:57 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1678 |
! |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1679 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1680 |
enabled:bool |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1681 |
"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
|
1682 |
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
|
1683 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1684 |
"Modified: / 30.3.1999 / 14:46:24 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1685 |
"Created: / 30.3.1999 / 15:54:21 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1686 |
! |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1687 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1688 |
isEnabled:aState |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1689 |
"ST-80 compatibility; set enabled state |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1690 |
" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1691 |
self enabled:aState |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1692 |
|
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1693 |
"Created: / 30.3.1999 / 15:54:29 / stefan" |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1694 |
! ! |
9c57f5897a90
Common enable/disable/enabled:/isEnabled: Protocol
Stefan Vogel <sv@exept.de>
parents:
2540
diff
changeset
|
1695 |
|
269 | 1696 |
!SimpleView methodsFor:'accessing-bg & border'! |
1697 |
||
3356
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1698 |
allSubViewsBackground:something |
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1699 |
"set the viewBackground to something, a color, image or form, |
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1700 |
recursively in all of my subviews" |
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1701 |
|
4958 | 1702 |
self allSubViewsBackground:something if:[:v |true] |
1703 |
! |
|
1704 |
||
1705 |
allSubViewsBackground:something if:condition |
|
1706 |
"set the viewBackground to something, a color, image or form, |
|
1707 |
recursively in all of my subviews" |
|
1708 |
||
3356
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1709 |
subViews notNil ifTrue:[ |
4958 | 1710 |
subViews do:[:v| |
1711 |
v allViewBackground:something if:condition |
|
1712 |
] |
|
3356
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1713 |
] |
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1714 |
|
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1715 |
"Modified: / 18.7.1996 / 13:34:26 / cg" |
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1716 |
"Created: / 31.10.2000 / 13:06:02 / bg" |
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1717 |
! |
d3f6fd88e766
extracted allSubViewsBackground: from allViewBackground:
Claus Gittinger <cg@exept.de>
parents:
3345
diff
changeset
|
1718 |
|
4897 | 1719 |
allSubViewsForeground:something |
1720 |
"set the foreground to something, a color, image or form, |
|
1721 |
recursively in all of my subviews" |
|
1722 |
||
1723 |
subViews notNil ifTrue:[ |
|
4907 | 1724 |
subViews do:[:v| |
1725 |
v allViewForeground:something |
|
1726 |
] |
|
4897 | 1727 |
] |
1728 |
! |
|
1729 |
||
955 | 1730 |
allViewBackground:something |
1731 |
"set the viewBackground to something, a color, image or form, |
|
1732 |
in myself and recursively in all of my subviews" |
|
1733 |
||
4958 | 1734 |
self allViewBackground:something if:[:v |true] |
1735 |
! |
|
1736 |
||
1737 |
allViewBackground:something if:condition |
|
1738 |
"set the viewBackground to something, a color, image or form, |
|
1739 |
in myself and recursively in all of my subviews" |
|
1740 |
||
1741 |
(condition value:self) ifTrue:[ |
|
1742 |
viewBackground ~~ something ifTrue:[ |
|
1743 |
self viewBackground:something. |
|
1744 |
self invalidate |
|
1745 |
]. |
|
1746 |
]. |
|
1747 |
self allSubViewsBackground:something if:condition |
|
955 | 1748 |
! |
1749 |
||
4897 | 1750 |
allViewForeground:something |
1751 |
"set the foreground to something, a color, image or form, |
|
1752 |
in myself and recursively in all of my subviews" |
|
1753 |
||
1754 |
self foregroundColor:something. |
|
1755 |
self allSubViewsForeground:something |
|
1756 |
||
1757 |
"Modified: / 31.10.2000 / 13:06:17 / bg" |
|
1758 |
! |
|
1759 |
||
2158
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1760 |
backgroundColor |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1761 |
"return the background color of the contents - |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1762 |
here, (since there is no contents), the viewBackground is returned." |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1763 |
|
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1764 |
^ self viewBackground |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1765 |
|
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1766 |
"Modified: / 3.5.1997 / 10:28:04 / cg" |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1767 |
"Created: / 18.6.1998 / 15:59:36 / cg" |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1768 |
! |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1769 |
|
1726
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1770 |
backgroundColor:aColor |
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1771 |
"set the background color of the contents - |
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1772 |
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
|
1773 |
|
4192 | 1774 |
self viewBackground:aColor. |
1775 |
shown ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1776 |
self clear; invalidate. |
4192 | 1777 |
]. |
1726
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1778 |
|
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1779 |
"Created: 3.5.1997 / 10:26:49 / cg" |
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1780 |
"Modified: 3.5.1997 / 10:28:04 / cg" |
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1781 |
! |
51b0f8ed7572
added #backgroundColor: - for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1716
diff
changeset
|
1782 |
|
269 | 1783 |
borderColor |
1784 |
"return my borderColor" |
|
1785 |
||
794 | 1786 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
3152 | 1787 |
^ superView borderColor |
794 | 1788 |
]. |
1789 |
||
269 | 1790 |
^ borderColor |
794 | 1791 |
|
1792 |
"Modified: 5.6.1996 / 14:11:44 / cg" |
|
269 | 1793 |
! |
1794 |
||
1795 |
borderColor:aColor |
|
1796 |
"set my borderColor" |
|
1797 |
||
794 | 1798 |
"/ backward compatibility |
1799 |
"/ superView will be renamed to container soon. |
|
1800 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
|
3152 | 1801 |
^ superView borderColor:aColor |
794 | 1802 |
]. |
1803 |
||
269 | 1804 |
(aColor ~~ borderColor) ifTrue:[ |
3152 | 1805 |
borderColor := aColor. |
1806 |
drawableId notNil ifTrue:[ |
|
1807 |
self setBorderColor |
|
1808 |
] |
|
269 | 1809 |
] |
794 | 1810 |
|
1811 |
"Modified: 5.6.1996 / 14:11:50 / cg" |
|
269 | 1812 |
! |
1813 |
||
1814 |
borderShape:aForm |
|
1815 |
"set the borderShape to aForm" |
|
1816 |
||
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
|
1817 |
aForm isNil ifTrue:[ |
3152 | 1818 |
viewShape := nil. |
1819 |
drawableId notNil ifTrue:[ |
|
1820 |
device setWindowBorderShape:nil in:drawableId |
|
1821 |
] |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1822 |
] ifFalse:[ |
3152 | 1823 |
viewShape isNil ifTrue:[ |
1824 |
viewShape := ArbitraryViewShape new |
|
1825 |
]. |
|
1826 |
viewShape borderShapeForm:aForm. |
|
1827 |
drawableId notNil ifTrue:[ |
|
1828 |
device setWindowBorderShape:(aForm id) in:drawableId |
|
1829 |
] |
|
269 | 1830 |
] |
1903 | 1831 |
|
1832 |
"Modified: 18.9.1997 / 11:09:40 / cg" |
|
269 | 1833 |
! |
1834 |
||
1835 |
borderWidth |
|
1836 |
"return my borderWidth" |
|
1837 |
||
794 | 1838 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
3152 | 1839 |
^ superView borderWidth |
794 | 1840 |
]. |
1841 |
||
269 | 1842 |
^ borderWidth |
794 | 1843 |
|
1844 |
"Modified: 5.6.1996 / 14:11:57 / cg" |
|
269 | 1845 |
! |
1846 |
||
1847 |
borderWidth:aNumber |
|
1848 |
"set my borderWidth" |
|
1849 |
||
2907
901ffdc575a8
ask device if it supports borders
Claus Gittinger <cg@exept.de>
parents:
2886
diff
changeset
|
1850 |
|bd| |
901ffdc575a8
ask device if it supports borders
Claus Gittinger <cg@exept.de>
parents:
2886
diff
changeset
|
1851 |
|
794 | 1852 |
"/ backward compatibility |
1853 |
"/ superView will be renamed to container soon. |
|
1854 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
|
3152 | 1855 |
^ superView borderWidth:aNumber |
794 | 1856 |
]. |
1857 |
||
269 | 1858 |
(aNumber ~~ borderWidth) ifTrue:[ |
3152 | 1859 |
bd := aNumber. |
1860 |
(device supportsWindowBorder:bd) ifFalse:[ |
|
1861 |
bd > 1 ifTrue:[ |
|
1862 |
(device supportsWindowBorder:(bd := 1)) ifFalse:[ |
|
1863 |
^ self |
|
1864 |
]. |
|
1865 |
] |
|
1866 |
]. |
|
1867 |
borderWidth := bd. |
|
1868 |
drawableId notNil ifTrue:[ |
|
1869 |
device setWindowBorderWidth:aNumber in:drawableId |
|
1870 |
] |
|
269 | 1871 |
] |
794 | 1872 |
|
1873 |
"Modified: 5.6.1996 / 14:12:05 / cg" |
|
269 | 1874 |
! |
1875 |
||
4150 | 1876 |
fillFormWithBorderShape:aForm |
1877 |
"fill aForm with my borderShape" |
|
1878 |
||
1879 |
aForm fillRectangle:(Rectangle origin:self origin corner:self corner). |
|
1880 |
! |
|
1881 |
||
2158
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1882 |
foregroundColor |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1883 |
"return the foreground color of the contents - |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1884 |
here, (since there is no contents), some default is returned." |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1885 |
|
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1886 |
^ Color black |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1887 |
|
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1888 |
"Modified: / 3.5.1997 / 10:28:04 / cg" |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1889 |
"Created: / 18.6.1998 / 16:57:33 / cg" |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1890 |
! |
948fe768cd36
added #foregroundColor & backgroundColor
Claus Gittinger <cg@exept.de>
parents:
2143
diff
changeset
|
1891 |
|
3392 | 1892 |
foregroundColor:aColor |
1893 |
"set the foreground color of the contents - |
|
1894 |
ignored here, since there is no contents." |
|
1895 |
! |
|
1896 |
||
4966
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
1897 |
foregroundColor:fgColor backgroundColor:bgColor |
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
1898 |
"set both the foreground and background colors of the contents" |
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
1899 |
|
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
1900 |
self |
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
1901 |
foregroundColor:fgColor; |
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
1902 |
backgroundColor:bgColor |
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
1903 |
! |
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
1904 |
|
269 | 1905 |
level |
1906 |
"return my level relative to superView (3D)" |
|
1907 |
||
794 | 1908 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
3152 | 1909 |
^ superView level |
794 | 1910 |
]. |
1911 |
||
269 | 1912 |
^ level |
794 | 1913 |
|
1914 |
"Modified: 5.6.1996 / 14:12:10 / cg" |
|
269 | 1915 |
! |
1916 |
||
1917 |
level:aNumber |
|
1918 |
"set my level relative to superView (3D)" |
|
1919 |
||
1920 |
|oldMargin how| |
|
1921 |
||
794 | 1922 |
"/ backward compatibility |
1923 |
"/ superView will be renamed to container soon. |
|
1924 |
(superView notNil and:[superView isBorderedWrapper]) ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1925 |
^ superView level:aNumber |
794 | 1926 |
]. |
1927 |
||
269 | 1928 |
(aNumber ~~ level and:[aNumber notNil]) ifTrue:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1929 |
self is3D ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1930 |
level := aNumber. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1931 |
oldMargin := margin. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1932 |
margin := level abs. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1933 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1934 |
realized ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1935 |
margin ~~ oldMargin ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1936 |
(margin > oldMargin) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1937 |
how := #smaller |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1938 |
] ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1939 |
how := #larger |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1940 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1941 |
self sizeChanged:how. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1942 |
self setInnerClip. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1943 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1944 |
shown ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1945 |
margin ~~ oldMargin ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1946 |
self clearView. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1947 |
self redrawX:margin y:margin |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1948 |
width:width-(margin*2) |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1949 |
height:height-(margin*2) |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1950 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1951 |
self redrawEdges. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1952 |
] |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1953 |
] |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1954 |
] |
135 | 1955 |
] |
794 | 1956 |
|
1957 |
"Modified: 5.6.1996 / 14:12:17 / cg" |
|
269 | 1958 |
! |
1959 |
||
3698 | 1960 |
lightColor |
1961 |
"returb the color to be used for lighted edges (3D only)" |
|
1962 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1963 |
^ lightColor |
3698 | 1964 |
! |
1965 |
||
269 | 1966 |
lightColor:aColorOrImage |
1967 |
"set the color to be used for lighted edges (3D only)" |
|
1968 |
||
1969 |
lightColor := aColorOrImage |
|
1970 |
! |
|
1971 |
||
1972 |
margin |
|
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1973 |
"return my inner margin - this is usually the level, |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1974 |
but can be more for some views |
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1975 |
(textViews which add more margin between the border and the text)" |
269 | 1976 |
|
1977 |
^ margin |
|
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1978 |
|
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1979 |
"Modified: 5.6.1996 / 14:37:54 / cg" |
269 | 1980 |
! |
1981 |
||
3698 | 1982 |
shadowColor |
1983 |
"returb the color to be used for shadowed edges (3D only)" |
|
1984 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
1985 |
^ shadowColor |
3698 | 1986 |
! |
1987 |
||
269 | 1988 |
shadowColor:aColorOrImage |
1989 |
"set the color to be used for shadowed edges (3D only)" |
|
1990 |
||
1991 |
shadowColor := aColorOrImage |
|
1992 |
! |
|
1993 |
||
1994 |
viewBackground:something |
|
1995 |
"set the viewBackground to something, a color, image or form. |
|
1996 |
If its a color and we run on a color display, also set shadow and light |
|
1997 |
colors - this means, that a red view will get light-red and dark-red |
|
1998 |
edges." |
|
1999 |
||
2584
55a405cec086
when lighting/darkening colors, take the average in the topLeft
Claus Gittinger <cg@exept.de>
parents:
2583
diff
changeset
|
2000 |
|avgColor| |
55a405cec086
when lighting/darkening colors, take the average in the topLeft
Claus Gittinger <cg@exept.de>
parents:
2583
diff
changeset
|
2001 |
|
1808 | 2002 |
"/ debug check only: |
4891 | 2003 |
self assert:(something notNil) message:'invalid viewBackground argument'. |
1808 | 2004 |
|
269 | 2005 |
something isColor ifTrue:[ |
4907 | 2006 |
device hasGrayscales ifTrue:[ |
2007 |
avgColor := something averageColorIn:(0@0 corner:7@7). |
|
2008 |
shadowColor := avgColor darkened "on:device". |
|
2009 |
lightColor := avgColor lightened "on:device". |
|
2010 |
] |
|
135 | 2011 |
]. |
269 | 2012 |
super viewBackground:something |
749 | 2013 |
|
1808 | 2014 |
"Modified: 4.7.1997 / 20:09:22 / cg" |
269 | 2015 |
! |
2016 |
||
2017 |
viewShape:aForm |
|
2018 |
"set the viewShape to aForm" |
|
2019 |
||
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
|
2020 |
aForm isNil ifTrue:[ |
3152 | 2021 |
viewShape := nil. |
2022 |
drawableId notNil ifTrue:[ |
|
2023 |
device setWindowShape:nil in:drawableId |
|
2024 |
] |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2025 |
] ifFalse:[ |
3152 | 2026 |
viewShape isNil ifTrue:[ |
2027 |
viewShape := ArbitraryViewShape new |
|
2028 |
]. |
|
2029 |
||
2030 |
viewShape viewShapeForm:aForm. |
|
2031 |
drawableId notNil ifTrue:[ |
|
2032 |
device setWindowShape:(aForm id) in:drawableId |
|
2033 |
] |
|
135 | 2034 |
] |
1903 | 2035 |
|
2036 |
"Modified: 18.9.1997 / 11:11:04 / cg" |
|
269 | 2037 |
! ! |
2038 |
||
3139 | 2039 |
!SimpleView methodsFor:'accessing-channels'! |
2040 |
||
2041 |
setupChannel:newChannel for:changeSelector withOld:oldChannel |
|
2042 |
"common code to change a channel. |
|
2043 |
If changeSelector is non-nil, arrange for it to be sent when |
|
2044 |
the channel changes its value; otherwise, arrange for a simple update. |
|
2045 |
This is so common, that ist worth a helper method: |
|
2046 |
release any old channel (if non-nil), |
|
2047 |
arrange for changeSelector (or #update) to be sent for the new channel." |
|
2048 |
||
2049 |
|oldValue| |
|
2050 |
||
2051 |
oldChannel == newChannel ifTrue:[^ self]. |
|
2052 |
||
2053 |
oldChannel notNil ifTrue:[ |
|
3152 | 2054 |
changeSelector isNil ifTrue:[ |
2055 |
oldChannel removeDependent:self |
|
2056 |
] ifFalse:[ |
|
2057 |
oldChannel retractInterestsFor:self. |
|
2058 |
]. |
|
2059 |
oldValue := oldChannel value. |
|
3139 | 2060 |
]. |
2061 |
newChannel notNil ifTrue:[ |
|
3152 | 2062 |
changeSelector isNil ifTrue:[ |
2063 |
newChannel addDependent:self. |
|
2064 |
newChannel value ~~ oldValue ifTrue:[ |
|
2065 |
self update:#value with:nil from:newChannel. |
|
2066 |
] |
|
2067 |
] ifFalse:[ |
|
2068 |
newChannel onChangeSend:changeSelector to:self. |
|
2069 |
newChannel value ~~ oldValue ifTrue:[ |
|
2070 |
self perform:changeSelector. |
|
2071 |
] |
|
2072 |
] |
|
3139 | 2073 |
]. |
2074 |
||
2075 |
^ newChannel |
|
2076 |
||
2077 |
"Modified: / 31.10.1997 / 14:47:21 / cg" |
|
2078 |
! ! |
|
2079 |
||
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2080 |
!SimpleView methodsFor:'accessing-contents'! |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2081 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2082 |
heightOfContents |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2083 |
"return the height of the contents in logical units |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2084 |
- defaults to views visible area here. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2085 |
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
|
2086 |
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
|
2087 |
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
|
2088 |
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
|
2089 |
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
|
2090 |
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
|
2091 |
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
|
2092 |
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
|
2093 |
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
|
2094 |
of this will scale as appropriate." |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2095 |
|
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2096 |
^ (self innerHeight max:(self maxSubViewBottom)) max:self maxComponentBottom |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2097 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2098 |
"Modified: 26.5.1996 / 12:44:21 / cg" |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2099 |
! |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2100 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2101 |
widthOfContents |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2102 |
"return the width of the contents in logical units |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2103 |
- defaults to views visible area here. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2104 |
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
|
2105 |
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
|
2106 |
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
|
2107 |
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
|
2108 |
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
|
2109 |
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
|
2110 |
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
|
2111 |
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
|
2112 |
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
|
2113 |
of this will scale as appropriate." |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2114 |
|
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2115 |
^ (self innerWidth max:(self maxSubViewRight)) max:self maxComponentRight |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2116 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
2117 |
"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
|
2118 |
! ! |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
2119 |
|
269 | 2120 |
!SimpleView methodsFor:'accessing-dimensions'! |
2121 |
||
2122 |
allInset:aNumber |
|
2123 |
"set all insets; positive makes the view smaller, |
|
4630 | 2124 |
negative makes it larger.. |
2125 |
Obsolete: please use a layout object." |
|
269 | 2126 |
|
2127 |
insets isNil ifTrue:[ |
|
3152 | 2128 |
insets := Array new:4. |
269 | 2129 |
]. |
2130 |
insets atAllPut:aNumber. |
|
2131 |
||
2132 |
"force recomputation" |
|
2133 |
"/ drawableId isNil ifTrue:[ |
|
3375 | 2134 |
"/ self originChangedFlag:true |
269 | 2135 |
"/ ] ifFalse:[ |
3152 | 2136 |
self containerChangedSize. |
269 | 2137 |
"/ ] |
964 | 2138 |
|
2139 |
"Modified: 19.7.1996 / 17:30:18 / cg" |
|
269 | 2140 |
! |
2141 |
||
2142 |
bottom |
|
2143 |
"return the y position of the actual bottom edge (in pixels)" |
|
2144 |
||
2145 |
^ top + height - 1 |
|
2146 |
! |
|
2147 |
||
2148 |
bottom:aNumber |
|
2149 |
"set the corners y position" |
|
2150 |
||
2151 |
self corner:(self corner x @ aNumber) |
|
2152 |
! |
|
2153 |
||
2154 |
bottomInset |
|
2155 |
"return the inset of the bottom edge; positive is to the top, |
|
4630 | 2156 |
negative to the bottom. |
2157 |
Obsolete: please use a layout object." |
|
269 | 2158 |
|
2159 |
insets isNil ifTrue:[^ 0]. |
|
2160 |
^ insets at:4 |
|
2161 |
! |
|
2162 |
||
2163 |
bottomInset:aNumber |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2164 |
"set the inset of the bottom edge; |
269 | 2165 |
positive is to the top (view becomes smaller), |
4630 | 2166 |
negative to the bottom (becomes larger). |
2167 |
Obsolete: please use a layout object." |
|
269 | 2168 |
|
4427 | 2169 |
|newInset| |
2170 |
||
269 | 2171 |
insets isNil ifTrue:[ |
4966
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
2172 |
insets := Array with:0 with:0 with:0 with:0 |
4426 | 2173 |
]. |
4427 | 2174 |
newInset := aNumber. |
2175 |
newInset isNil ifTrue:[ |
|
4966
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
2176 |
newInset := 0. |
4427 | 2177 |
]. |
2178 |
(insets at:4) ~= newInset ifTrue:[ |
|
4966
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
2179 |
insets at:4 put:newInset. |
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
2180 |
self containerChangedSize |
4427 | 2181 |
] |
964 | 2182 |
|
2183 |
"Modified: 19.7.1996 / 17:30:22 / cg" |
|
269 | 2184 |
! |
2185 |
||
2186 |
center |
|
2187 |
"return the point at the center of the receiver (in pixels)" |
|
2188 |
||
2189 |
^ (left + (width // 2)) @ (top + (height // 2)) |
|
2190 |
! |
|
2191 |
||
2192 |
center:newCenter |
|
2193 |
"move the receiver so that newCenter, aPoint becomes the center point" |
|
2194 |
||
2195 |
self origin:(newCenter - ((width // 2) @ (height // 2))) |
|
2196 |
! |
|
2197 |
||
2198 |
computeCorner |
|
2199 |
"compute my corner; if I have a layoutObject, |
|
2200 |
relative origins or blocks to evaluate, compute it now .. |
|
2201 |
Blocks may return relative values or nil; nil means: take current value. |
|
2202 |
Returns the corner point in device coordinates (pixels)." |
|
2203 |
||
2204 |
|org newCorner newExt x y| |
|
2205 |
||
2206 |
" |
|
2207 |
slowly migrating to use layoutObjects ... |
|
2208 |
" |
|
2209 |
layout notNil ifTrue:[ |
|
3152 | 2210 |
superView isNil ifTrue:[^ self preferredBounds corner]. |
2211 |
^ (layout rectangleRelativeTo:(superView viewRectangle) |
|
2212 |
preferred:[self preferredBounds]) corner rounded |
|
269 | 2213 |
]. |
2214 |
||
2215 |
(cornerRule notNil) ifTrue:[ |
|
3152 | 2216 |
newCorner := cornerRule value. |
2217 |
" |
|
2218 |
allow return of relative values ... |
|
2219 |
" |
|
2220 |
x := newCorner x. |
|
2221 |
y := newCorner y. |
|
2222 |
x isNil ifTrue:[x := self corner x]. |
|
2223 |
y isNil ifTrue:[y := self corner y]. |
|
2224 |
((x isInteger not) or:[y isInteger not]) ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2225 |
newCorner := self cornerFromRelativeCorner:x@y |
3152 | 2226 |
] |
269 | 2227 |
] ifFalse:[ |
3152 | 2228 |
(relativeCorner notNil) ifTrue:[ |
2229 |
newCorner := self cornerFromRelativeCorner:relativeCorner |
|
2230 |
] ifFalse:[ |
|
2231 |
org := self computeOrigin. |
|
2232 |
(extentRule notNil) ifTrue:[ |
|
2233 |
newExt := extentRule value |
|
2234 |
] ifFalse:[ |
|
2235 |
(relativeExtent notNil) ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2236 |
newExt := self extentFromRelativeExtent:relativeExtent |
3152 | 2237 |
] ifFalse:[ |
2238 |
newExt := self extent. |
|
2239 |
] |
|
2240 |
]. |
|
2241 |
newCorner := org + newExt |
|
2242 |
] |
|
269 | 2243 |
]. |
2244 |
^ newCorner |
|
1389 | 2245 |
|
2246 |
"Modified: 28.2.1997 / 10:33:39 / cg" |
|
269 | 2247 |
! |
2248 |
||
2249 |
computeExtent |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2250 |
"compute my extent; if I have a layoutObject, a relative extent |
269 | 2251 |
or blocks to evaluate, compute it now .. |
2252 |
There is one catch here, if the dimension was defined |
|
2253 |
by origin/corner, compute them here and take that value. |
|
2254 |
I.e. origin/corner definition has precedence over extent definition. |
|
2255 |
Returns the extent in device coordinates (pixels)." |
|
2256 |
||
2257 |
|newOrg newExt newCorner x y| |
|
2258 |
||
2259 |
" |
|
2260 |
slowly migrating to use layoutObjects ... |
|
2261 |
" |
|
2262 |
layout notNil ifTrue:[ |
|
3152 | 2263 |
^ (layout rectangleRelativeTo:(superView viewRectangle) |
2264 |
preferred:[self preferredBounds]) extent rounded |
|
135 | 2265 |
]. |
269 | 2266 |
|
2267 |
(cornerRule notNil) ifTrue:[ |
|
3152 | 2268 |
newCorner := cornerRule value. |
2269 |
" |
|
2270 |
allow return of relative values ... |
|
2271 |
" |
|
2272 |
x := newCorner x. |
|
2273 |
y := newCorner y. |
|
2274 |
x isNil ifTrue:[x := self corner x]. |
|
2275 |
y isNil ifTrue:[y := self corner y]. |
|
2276 |
((x isInteger not) or:[y isInteger not]) ifTrue:[ |
|
2277 |
newCorner := self cornerFromRelativeCorner:x@y |
|
2278 |
] |
|
269 | 2279 |
] ifFalse:[ |
3152 | 2280 |
(relativeCorner notNil) ifTrue:[ |
2281 |
newCorner := self cornerFromRelativeCorner:relativeCorner |
|
2282 |
] ifFalse:[ |
|
2283 |
(extentRule notNil) ifTrue:[ |
|
2284 |
newExt := extentRule value. |
|
2285 |
" |
|
2286 |
allow return of relative values ... |
|
2287 |
" |
|
2288 |
x := newExt x. |
|
2289 |
y := newExt y. |
|
2290 |
x isNil ifTrue:[x := width]. |
|
2291 |
y isNil ifTrue:[y := height]. |
|
2292 |
((x isInteger not) or:[y isInteger not]) ifTrue:[ |
|
2293 |
newExt := self extentFromRelativeExtent:x@y |
|
2294 |
] |
|
2295 |
] ifFalse:[ |
|
2296 |
(relativeExtent notNil) ifTrue:[ |
|
2297 |
newExt := self extentFromRelativeExtent:relativeExtent |
|
2298 |
] ifFalse:[ |
|
2299 |
newExt := (width @ height). |
|
2300 |
]. |
|
2301 |
]. |
|
2302 |
]. |
|
269 | 2303 |
]. |
2304 |
||
2305 |
newCorner notNil ifTrue:[ |
|
3152 | 2306 |
newOrg := self computeOrigin. |
2307 |
^ newCorner - newOrg. |
|
269 | 2308 |
]. |
2309 |
^ newExt. |
|
2310 |
! |
|
2311 |
||
2312 |
computeOrigin |
|
2313 |
"compute my origin; if I have a layoutObject, a relative origin |
|
2314 |
or blocks to evaluate, compute it now .. |
|
2315 |
Blocks may return relative values or nil; nil means: take current value. |
|
2316 |
Returns the origin point in device coordinates (pixels)." |
|
2317 |
||
2318 |
|newOrg x y| |
|
2319 |
||
2320 |
" |
|
2321 |
slowly migrating to use layoutObjects ... |
|
2322 |
" |
|
2323 |
layout notNil ifTrue:[ |
|
3152 | 2324 |
superView isNil ifTrue:[^ 0@0]. |
2325 |
^ (layout rectangleRelativeTo:(superView viewRectangle) |
|
2326 |
preferred:[self preferredBounds]) origin rounded |
|
269 | 2327 |
]. |
2328 |
||
2329 |
(originRule notNil) ifTrue:[ |
|
3152 | 2330 |
newOrg := originRule value. |
2331 |
" |
|
2332 |
allow return of relative values ... |
|
2333 |
" |
|
2334 |
x := newOrg x. |
|
2335 |
y := newOrg y. |
|
2336 |
x isNil ifTrue:[x := self origin x]. |
|
2337 |
y isNil ifTrue:[y := self origin y]. |
|
2338 |
((x isInteger not) or:[y isInteger not]) ifTrue:[ |
|
2339 |
newOrg := self originFromRelativeOrigin:x@y. |
|
2340 |
] |
|
269 | 2341 |
] ifFalse:[ |
3152 | 2342 |
(relativeOrigin notNil) ifTrue:[ |
2343 |
newOrg := self originFromRelativeOrigin:relativeOrigin. |
|
2344 |
] ifFalse:[ |
|
2345 |
^ (left @ top). |
|
2346 |
]. |
|
269 | 2347 |
]. |
2348 |
^ newOrg |
|
2349 |
! |
|
2350 |
||
2351 |
corner |
|
2352 |
"return the lower right corner-point (in pixels)" |
|
2353 |
||
2354 |
"/ ^ (left + width "- 1") @ (top + height "- 1") |
|
2355 |
^ (left + width - 1) @ (top + height - 1) |
|
2356 |
||
2357 |
"Modified: 31.8.1995 / 16:51:40 / claus" |
|
2358 |
! |
|
2359 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2360 |
corner:corner |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2361 |
"set the views corner; |
269 | 2362 |
the corner argument may be: |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2363 |
a point |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2364 |
where integer fields mean 'pixel-values' |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2365 |
and float values mean 'relative-to-superview' |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2366 |
and nil means 'take current value'; |
269 | 2367 |
or a block returning a point which is interpreted as above. |
2368 |
Please migrate to use layoutObjects, if possible." |
|
2369 |
||
2370 |
|x y pixelCorner c| |
|
2371 |
||
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2372 |
self explicitExtent:true. |
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2373 |
|
269 | 2374 |
corner isBlock ifTrue:[ |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2375 |
cornerRule := corner. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2376 |
drawableId notNil ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2377 |
pixelCorner := corner value |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2378 |
] ifFalse:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2379 |
self extentChangedFlag:true |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2380 |
] |
269 | 2381 |
] ifFalse:[ |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2382 |
x := corner x. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2383 |
y := corner y. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2384 |
x isNil ifTrue:[x := self corner x]. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2385 |
y isNil ifTrue:[y := self corner y]. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2386 |
c := x @ y. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2387 |
((x isInteger not) or:[y isInteger not]) ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2388 |
relativeCorner := c. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2389 |
pixelCorner := self cornerFromRelativeCorner. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2390 |
pixelCorner isNil ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2391 |
self extentChangedFlag:true |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2392 |
] |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2393 |
] ifFalse:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2394 |
pixelCorner := c |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2395 |
] |
269 | 2396 |
]. |
2397 |
||
2398 |
pixelCorner notNil ifTrue:[ |
|
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2399 |
self pixelCorner:pixelCorner |
269 | 2400 |
] |
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2401 |
|
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2402 |
"Modified: 15.7.1996 / 09:51:06 / cg" |
269 | 2403 |
! |
2404 |
||
1327 | 2405 |
cornerRule |
2406 |
"return the corner block - non public; this will vanish without notice" |
|
2407 |
||
2408 |
^ cornerRule |
|
2409 |
! |
|
2410 |
||
269 | 2411 |
extent:extent |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2412 |
"set the views extent; |
269 | 2413 |
extent may be: |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2414 |
a point |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2415 |
where integer fields mean 'pixel-values' |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2416 |
and float values mean 'relative-to-superview' |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2417 |
and nil means 'leave current value'; |
269 | 2418 |
or a block returning a point which is interpreted as above. |
2419 |
Be careful when using relative extents: rounding errors may |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2420 |
accumulate. Better use origin/corner. |
1048
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2421 |
Best: migrate to use layour objects. |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2422 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2423 |
Notice: this sets the views explicitExtent flag, which prevents it normally |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2424 |
from resizing itself to its preferredExtent. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2425 |
See initialExtent: for a variation." |
269 | 2426 |
|
2427 |
|w h pixelExtent e| |
|
2428 |
||
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2429 |
self explicitExtent:true. |
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2430 |
|
269 | 2431 |
extent isBlock ifTrue:[ |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2432 |
extentRule := extent. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2433 |
drawableId notNil ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2434 |
pixelExtent := extent value |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2435 |
] ifFalse:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2436 |
self extentChangedFlag:true |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2437 |
] |
135 | 2438 |
] ifFalse:[ |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2439 |
w := extent x. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2440 |
h := extent y. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2441 |
w isNil ifTrue:[w := width]. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2442 |
h isNil ifTrue:[h := height]. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2443 |
e := w@h. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2444 |
((w isInteger not) or:[h isInteger not]) ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2445 |
relativeExtent := e. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2446 |
pixelExtent := self extentFromRelativeExtent. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2447 |
pixelExtent isNil ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2448 |
self extentChangedFlag:true |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2449 |
] |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2450 |
] ifFalse:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2451 |
relativeExtent := nil. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2452 |
pixelExtent := e |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2453 |
] |
269 | 2454 |
]. |
2455 |
pixelExtent notNil ifTrue:[ |
|
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2456 |
self pixelExtent:pixelExtent |
269 | 2457 |
] |
573
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2458 |
|
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2459 |
"Modified: 15.7.1996 / 09:51:21 / cg" |
269 | 2460 |
! |
2461 |
||
1327 | 2462 |
extentRule |
2463 |
"return the extent block - non public; this will vanish without notice" |
|
2464 |
||
2465 |
^ extentRule |
|
2466 |
! |
|
2467 |
||
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
2468 |
frame |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
2469 |
"compatibility with displayObjects: returns my bounds" |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
2470 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
2471 |
^ self bounds |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
2472 |
! |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
2473 |
|
269 | 2474 |
geometryLayout |
2475 |
"this method will vanish, as soon as all implementations of |
|
2476 |
#layout: are removed ... |
|
2477 |
(conflict for example in label>>layout:). |
|
2478 |
DO NOT USE #geometryLayout: in your code; it will be removed without |
|
2479 |
notice." |
|
2480 |
||
2481 |
^ here layout |
|
2482 |
! |
|
2483 |
||
2484 |
geometryLayout:aLayoutObject |
|
2485 |
"this method will vanish, as soon as all implementations of |
|
2486 |
#layout: are removed ... |
|
2487 |
(conflict for example in label>>layout:). |
|
2488 |
DO NOT USE #geometryLayout: in your code; it will be removed without |
|
2489 |
notice." |
|
2490 |
||
2491 |
here layout:aLayoutObject |
|
2492 |
! |
|
2493 |
||
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2494 |
hasExplicitExtent |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2495 |
"/ ^ explicitExtent. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2496 |
^ flagBits bitTest:FlagHasExplicitExtent. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2497 |
! |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2498 |
|
269 | 2499 |
height:aNumber |
2500 |
"set the views height in pixels" |
|
2501 |
||
2502 |
self extent:(width @ aNumber) |
|
2503 |
! |
|
2504 |
||
2505 |
heightIncludingBorder |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2506 |
"return my height including border |
269 | 2507 |
(this is my height as seen from the outside view; |
2508 |
while #height returns the height as seen by myself)" |
|
2509 |
||
2510 |
^ height + (2*borderWidth) |
|
2511 |
! |
|
2512 |
||
2513 |
horizontalInset:aNumber |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2514 |
"set the insets of the left/right edge; |
4630 | 2515 |
positive makes it smaller, negative makes it larger. |
2516 |
Obsolete: please use a layout object." |
|
269 | 2517 |
|
4530
5afcace584e4
compact: #dropMessage:data:view:position:handle:
Stefan Vogel <sv@exept.de>
parents:
4524
diff
changeset
|
2518 |
|newInset| |
5afcace584e4
compact: #dropMessage:data:view:position:handle:
Stefan Vogel <sv@exept.de>
parents:
4524
diff
changeset
|
2519 |
|
269 | 2520 |
insets isNil ifTrue:[ |
4966
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
2521 |
insets := Array with:0 with:0 with:0 with:0 |
4426 | 2522 |
]. |
4530
5afcace584e4
compact: #dropMessage:data:view:position:handle:
Stefan Vogel <sv@exept.de>
parents:
4524
diff
changeset
|
2523 |
newInset := aNumber. |
4426 | 2524 |
aNumber isNil ifTrue:[ |
4966
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
2525 |
newInset := 0. |
4530
5afcace584e4
compact: #dropMessage:data:view:position:handle:
Stefan Vogel <sv@exept.de>
parents:
4524
diff
changeset
|
2526 |
]. |
5afcace584e4
compact: #dropMessage:data:view:position:handle:
Stefan Vogel <sv@exept.de>
parents:
4524
diff
changeset
|
2527 |
insets at:1 put:newInset. |
5afcace584e4
compact: #dropMessage:data:view:position:handle:
Stefan Vogel <sv@exept.de>
parents:
4524
diff
changeset
|
2528 |
insets at:3 put:newInset. |
269 | 2529 |
|
2530 |
"force recomputation" |
|
2531 |
"/ drawableId isNil ifTrue:[ |
|
3375 | 2532 |
"/ self originChangedFlag:true |
269 | 2533 |
"/ ] ifFalse:[ |
4966
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
2534 |
self containerChangedSize. |
269 | 2535 |
"/ ] |
964 | 2536 |
|
4630 | 2537 |
"Modified: / 30-09-2006 / 15:19:28 / cg" |
269 | 2538 |
! |
2539 |
||
1048
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2540 |
initialExtent:extent |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2541 |
"set the views extent, but dont change its explicitExtent setting. |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2542 |
a variant of #extent." |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2543 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2544 |
|expl| |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2545 |
|
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2546 |
expl := self hasExplicitExtent. |
1048
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2547 |
self extent:extent. |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2548 |
self explicitExtent:expl |
1048
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2549 |
! |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2550 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2551 |
initialHeight:aNumber |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2552 |
"set the views height in pixels, but dont change its explicitExtent setting" |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2553 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2554 |
self initialExtent:(width @ aNumber) |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2555 |
! |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2556 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2557 |
initialWidth:aNumber |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2558 |
"set the views width in pixels, but dont change its explicitExtent setting" |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2559 |
|
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2560 |
self initialExtent:(aNumber @ height) |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2561 |
! |
f6d383b7f113
kludge interface added: #initialExtent / initialWidth & initialHeight
dq
parents:
1039
diff
changeset
|
2562 |
|
269 | 2563 |
innerHeight |
2564 |
"return the height of the view minus any 3D-shadow-borders" |
|
2565 |
||
2566 |
(margin == 0) ifTrue:[^ height]. |
|
2567 |
^ height - (2 * margin) |
|
2568 |
! |
|
2569 |
||
369 | 2570 |
innerHeight:pixels |
2571 |
"set the height of the view plus any 3D-shadow-borders. |
|
2572 |
This does not work with a relative size." |
|
2573 |
||
2574 |
^ self height:( pixels + (margin + self innerVerticalMargin * 2) ). |
|
2575 |
! |
|
2576 |
||
2577 |
innerHorizontalMargin |
|
2578 |
"return any additional inner margin (i.e. contents margin). |
|
2579 |
This should be redefined by views which do add margins |
|
2580 |
(for example: textViews do this)" |
|
2581 |
||
2582 |
^ 0 |
|
2583 |
! |
|
2584 |
||
2585 |
innerVerticalMargin |
|
2586 |
"return any additional inner margin (i.e. contents margin). |
|
2587 |
This should be redefined by views which do add margins |
|
2588 |
(for example: textViews do this)" |
|
2589 |
||
2590 |
^ 0 |
|
2591 |
! |
|
2592 |
||
269 | 2593 |
innerWidth |
2594 |
"return the width of the view minus any 3D-shadow-borders" |
|
2595 |
||
2596 |
(level == 0) ifTrue:[^ width]. |
|
2597 |
^ width - (2 * margin) |
|
2598 |
! |
|
2599 |
||
369 | 2600 |
innerWidth:pixels |
2601 |
"set the width of the view plus any 3D-shadow-borders. |
|
2602 |
This does not work with a relative size." |
|
2603 |
||
2604 |
^ self width:( pixels + (margin + self innerHorizontalMargin * 2) ). |
|
2605 |
! |
|
2606 |
||
269 | 2607 |
inset:aNumber |
2608 |
"set all insets; positive makes the view smaller, |
|
4630 | 2609 |
negative makes it larger.. |
2610 |
Obsolete: please use a layout object." |
|
269 | 2611 |
|
2612 |
self allInset:aNumber |
|
2613 |
! |
|
2614 |
||
2615 |
layout |
|
2616 |
"return the layout object which controls my geometry. |
|
2617 |
Currently, this is nil in most cases, and my geometry is |
|
2618 |
defined by relativeOrigin/relativeCorner/relativeExtent, |
|
2619 |
originRule/extentRule/cornerRule and inset. |
|
2620 |
Applications should be changed to use layoutObjects, |
|
2621 |
since the above listed instance variables will vanish." |
|
2622 |
||
2623 |
^ layout |
|
2624 |
! |
|
2625 |
||
2626 |
layout:aLayoutObject |
|
2627 |
"set the layout object which controls my geometry. |
|
2628 |
Currently, this is almost nowhere used but views will be |
|
2629 |
incrementally changed to use this new geometry management." |
|
2630 |
||
2631 |
layout := aLayoutObject. |
|
2632 |
superView isNil ifTrue:[ |
|
3375 | 2633 |
self originChangedFlag:true. |
2634 |
self cornerChangedFlag:true. |
|
2635 |
self extentChangedFlag:true. |
|
269 | 2636 |
] ifFalse:[ |
3152 | 2637 |
self containerChangedSize. |
269 | 2638 |
] |
2639 |
||
2640 |
"Modified: 19.9.1995 / 16:17:25 / claus" |
|
964 | 2641 |
"Modified: 19.7.1996 / 17:30:27 / cg" |
269 | 2642 |
! |
2643 |
||
2644 |
left |
|
2645 |
"return the x position of the left border (in pixels)" |
|
2646 |
||
2647 |
^ left |
|
2648 |
! |
|
2649 |
||
2650 |
left:aNumber |
|
2651 |
"set the x position" |
|
2652 |
||
2653 |
self origin:(aNumber @ top) |
|
2654 |
! |
|
2655 |
||
2656 |
left:newLeft top:newTop width:newWidth height:newHeight |
|
2657 |
"another way of specifying origin and extent" |
|
2658 |
||
2659 |
self origin:(newLeft @ newTop) extent:(newWidth @ newHeight) |
|
2660 |
! |
|
2661 |
||
2662 |
leftInset |
|
2663 |
"return the inset of the left edge; positive is to the right, |
|
4630 | 2664 |
negative to the left. |
2665 |
Obsolete: please use a layout object." |
|
269 | 2666 |
|
2667 |
insets isNil ifTrue:[^ 0]. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2668 |
^ insets at:1 |
269 | 2669 |
! |
2670 |
||
2671 |
leftInset:aNumber |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2672 |
"set the inset of the left edge; |
269 | 2673 |
positive is to the right (view becomes smaller), |
4630 | 2674 |
negative to the left (becomes larger). |
2675 |
Obsolete: please use a layout object." |
|
269 | 2676 |
|
4427 | 2677 |
|newInset| |
2678 |
||
269 | 2679 |
insets isNil ifTrue:[ |
4966
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
2680 |
insets := Array with:0 with:0 with:0 with:0 |
4426 | 2681 |
]. |
4427 | 2682 |
newInset := aNumber. |
2683 |
newInset isNil ifTrue:[ |
|
4966
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
2684 |
newInset := 0. |
4427 | 2685 |
]. |
2686 |
(insets at:1) ~= newInset ifTrue:[ |
|
4966
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
2687 |
insets at:1 put:newInset. |
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
2688 |
self containerChangedSize. |
4427 | 2689 |
] |
964 | 2690 |
|
2691 |
"Modified: 19.7.1996 / 17:30:30 / cg" |
|
269 | 2692 |
! |
2693 |
||
2694 |
makeFullyVisible |
|
2695 |
"make sure, that the view is fully visible by shifting it |
|
2696 |
into the visible screen area if nescessary. |
|
2697 |
This method will be moved to StandardSystemView ..." |
|
2698 |
||
2699 |
|devBot devRight newTop newLeft| |
|
2700 |
||
2701 |
newTop := top. |
|
2702 |
newLeft := left. |
|
2703 |
||
1703 | 2704 |
((top + height) > (devBot := device usableHeight)) ifTrue:[ |
3152 | 2705 |
newTop := devBot - height |
269 | 2706 |
]. |
1703 | 2707 |
((left + width) > (devRight := device usableWidth)) ifTrue:[ |
3152 | 2708 |
newLeft := devRight - width |
269 | 2709 |
]. |
2710 |
(newTop < 0) ifTrue:[ |
|
3152 | 2711 |
newTop := 0. |
269 | 2712 |
]. |
2713 |
(newLeft < 0) ifTrue:[ |
|
3152 | 2714 |
newLeft := 0 |
269 | 2715 |
]. |
2716 |
((newTop ~~ top) or:[newLeft ~~ left]) ifTrue:[ |
|
3152 | 2717 |
self origin:newLeft @ newTop |
269 | 2718 |
] |
2719 |
! |
|
2720 |
||
2750
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2721 |
makeRoundViewShapeWithBorder:bw |
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2722 |
"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
|
2723 |
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
|
2724 |
|
3167
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2725 |
self makeRoundViewShapeWithBorder:bw opaque:true. |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2726 |
|
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2727 |
! |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2728 |
|
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2729 |
makeRoundViewShapeWithBorder:bw opaque:opaque |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2730 |
"setup my window for a round shaped view; |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2731 |
this is not supported by all devices" |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2732 |
|
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2733 |
|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
|
2734 |
|
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2735 |
device supportsRoundShapedViews ifTrue:[ |
3762 | 2736 |
"/ 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
|
2737 |
]. |
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2738 |
|
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2739 |
device supportsArbitraryShapedViews ifTrue:[ |
3762 | 2740 |
extent := self extent. |
2741 |
w := extent x. |
|
2742 |
h := extent y. |
|
2743 |
borderForm := Form extent:extent. |
|
2744 |
shapeForm := Form extent:extent. |
|
2745 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2746 |
borderForm fillArcX:0 y:0 |
3762 | 2747 |
width:w |
2748 |
height:h |
|
2749 |
from:0 |
|
2750 |
angle:360. |
|
2751 |
||
2752 |
opaque ifFalse:[ |
|
2753 |
f := borderForm. |
|
2754 |
borderForm foreground:(Color colorId:0). |
|
2755 |
] ifTrue:[ |
|
2756 |
f := shapeForm. |
|
2757 |
shapeForm foreground:(Color colorId:1). |
|
2758 |
]. |
|
2759 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2760 |
f fillArcX:lineWidth y:lineWidth |
3762 | 2761 |
width:w - (bw * 2) |
2762 |
height:h - (bw * 2) |
|
2763 |
from:0 |
|
2764 |
angle:360. |
|
2765 |
||
2766 |
self borderShape:borderForm. |
|
2767 |
self viewShape:shapeForm. |
|
2768 |
^ self. |
|
3474 | 2769 |
|
2770 |
"/ |
|
2771 |
"/ extent := self extent. |
|
3167
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2772 |
"/ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2773 |
"/ w := extent x. |
3474 | 2774 |
"/ h := extent y. |
2775 |
"/ borderForm := Form width:w height:h. |
|
2776 |
"/ "/ borderForm fill:(Color colorId:0). |
|
2777 |
"/ |
|
2778 |
"/ shapeForm := Form width:w height:h. |
|
2779 |
"/ "/ shapeForm fill:(Color colorId:0). |
|
2780 |
"/ |
|
2781 |
"/ borderForm foreground:(Color colorId:1). |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2782 |
"/ borderForm |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2783 |
"/ fillArcX:0 y:0 |
3474 | 2784 |
"/ width:w |
2785 |
"/ height:h |
|
2786 |
"/ from:0 |
|
2787 |
"/ angle:360. |
|
2788 |
"/ |
|
2789 |
"/ opaque ifFalse:[ |
|
2790 |
"/ f := borderForm. |
|
2791 |
"/ borderForm foreground:(Color colorId:0). |
|
2792 |
"/ ] ifTrue:[ |
|
2793 |
"/ f := shapeForm. |
|
2794 |
"/ shapeForm foreground:(Color colorId:1). |
|
2795 |
"/ ]. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2796 |
"/ f |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2797 |
"/ fillArcX:bw y:bw |
3474 | 2798 |
"/ width:(w - (bw * 2)) |
2799 |
"/ height:(h - (bw * 2)) |
|
2800 |
"/ from:0 |
|
2801 |
"/ angle:360. |
|
2802 |
"/ |
|
2803 |
"/ self borderShape:borderForm. |
|
2804 |
"/ self viewShape:shapeForm |
|
3167
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2805 |
] |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2806 |
! |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2807 |
|
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2808 |
makeTransparentRectangularViewShapeWithBorder:bw |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2809 |
"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
|
2810 |
this is not supported by all devices" |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2811 |
|
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2812 |
|extent shapeForm borderForm w h f| |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2813 |
|
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2814 |
"/ device supportsPolygonShapedViews ifTrue:[ |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2815 |
"/ "/ TODO: add code for mswin |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2816 |
"/ ]. |
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2817 |
|
9dc9abd86ba2
fixed round shaped transparent views (Region)
Claus Gittinger <cg@exept.de>
parents:
3165
diff
changeset
|
2818 |
device supportsArbitraryShapedViews ifTrue:[ |
3367 | 2819 |
extent := self extent. |
2820 |
w := extent x. |
|
2821 |
h := extent y. |
|
2822 |
borderForm := Form extent:extent. |
|
2823 |
shapeForm := Form extent:extent. |
|
2824 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2825 |
borderForm |
3367 | 2826 |
fillRectangleX:0 y:0 |
2827 |
width:w |
|
2828 |
height:h. |
|
2829 |
||
2830 |
f := borderForm. |
|
2831 |
borderForm foreground:(Color colorId:0). |
|
2832 |
||
2833 |
borderForm |
|
2834 |
fillRectangleX:bw y:bw |
|
2835 |
width:w - (bw * 2) |
|
2836 |
height:h - (bw * 2). |
|
2837 |
||
2838 |
self borderShape:borderForm. |
|
2839 |
self viewShape:shapeForm. |
|
2840 |
^ self. |
|
2750
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2841 |
] |
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2842 |
|
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2843 |
! |
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
2844 |
|
2127 | 2845 |
minExtent |
2103
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2846 |
"for compatibility with StdSysView" |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2847 |
|
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2848 |
^ nil |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2849 |
! |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
2850 |
|
269 | 2851 |
origin |
2852 |
"return the origin (in pixels)" |
|
2853 |
||
2854 |
^ left@top |
|
2855 |
! |
|
2856 |
||
2857 |
origin:origin |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2858 |
"set the views origin; |
269 | 2859 |
origin may be: |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2860 |
a point |
3152 | 2861 |
where integer fields mean 'pixel-values' |
2862 |
and float values mean 'relative-to-superview' |
|
2863 |
and nil means 'take current value'; |
|
269 | 2864 |
or a block returning a point which is interpreted as above. |
2865 |
Please migrate to use layout objects." |
|
2866 |
||
2867 |
|newLeft newTop pixelOrigin o| |
|
2868 |
||
2869 |
origin isBlock ifTrue:[ |
|
3152 | 2870 |
originRule := origin. |
2871 |
drawableId notNil ifTrue:[ |
|
2872 |
pixelOrigin := origin value |
|
2873 |
] ifFalse:[ |
|
3375 | 2874 |
self originChangedFlag:true |
3152 | 2875 |
] |
269 | 2876 |
] ifFalse:[ |
3152 | 2877 |
o := origin. |
2878 |
newLeft := origin x. |
|
2879 |
newTop := origin y. |
|
2880 |
newLeft isNil ifTrue:[newLeft := left]. |
|
2881 |
newTop isNil ifTrue:[newTop := top]. |
|
2882 |
o := newLeft @ newTop. |
|
2883 |
((newLeft isInteger not) or:[newTop isInteger not]) ifTrue:[ |
|
2884 |
relativeOrigin := o. |
|
2885 |
pixelOrigin := self originFromRelativeOrigin. |
|
2886 |
pixelOrigin isNil ifTrue:[ |
|
3375 | 2887 |
self originChangedFlag:true |
3152 | 2888 |
] |
2889 |
] ifFalse:[ |
|
2890 |
relativeOrigin := nil. |
|
2891 |
pixelOrigin := o |
|
2892 |
] |
|
269 | 2893 |
]. |
2894 |
pixelOrigin notNil ifTrue:[ |
|
3152 | 2895 |
self pixelOrigin:pixelOrigin |
269 | 2896 |
]. |
573
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2897 |
|
578ae7a2f7fa
clear any relative origin/extent, if set to an absolute
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
2898 |
"Modified: 19.4.1996 / 15:12:36 / cg" |
269 | 2899 |
! |
2900 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2901 |
origin:origin corner:corner |
269 | 2902 |
"set both origin and extent" |
2903 |
||
2904 |
|newLeft newTop newRight newBot| |
|
2905 |
||
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2906 |
self explicitExtent:true. |
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2907 |
|
269 | 2908 |
"do it as one operation if possible" |
2909 |
||
2910 |
origin isBlock ifFalse:[ |
|
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2911 |
corner isBlock ifFalse:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2912 |
newLeft := origin x. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2913 |
newLeft isInteger ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2914 |
newTop := origin y. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2915 |
newTop isInteger ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2916 |
newRight := corner x. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2917 |
newRight isInteger ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2918 |
newBot := corner y. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2919 |
newBot isInteger ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2920 |
self pixelOrigin:origin corner:corner |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2921 |
] |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2922 |
] |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2923 |
] |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2924 |
] |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2925 |
] |
135 | 2926 |
]. |
269 | 2927 |
self origin:origin. |
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2928 |
self corner:corner |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2929 |
|
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2930 |
"Modified: 15.7.1996 / 09:52:43 / cg" |
269 | 2931 |
! |
2932 |
||
2933 |
origin:origin extent:extent |
|
2934 |
"set both origin and extent" |
|
2935 |
||
2936 |
|newLeft newTop newWidth newHeight| |
|
2937 |
||
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2938 |
self explicitExtent:true. |
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2939 |
|
269 | 2940 |
"do it as one operation if possible" |
2941 |
||
2942 |
origin isBlock ifFalse:[ |
|
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2943 |
extent isBlock ifFalse:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2944 |
newLeft := origin x. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2945 |
newLeft isInteger ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2946 |
newTop := origin y. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2947 |
newTop isInteger ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2948 |
newWidth := extent x. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2949 |
newWidth isInteger ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2950 |
newHeight := extent y. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2951 |
newHeight isInteger ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2952 |
self pixelOrigin:origin extent:extent |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2953 |
] |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2954 |
] |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2955 |
] |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2956 |
] |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
2957 |
] |
269 | 2958 |
]. |
2959 |
self extent:extent. |
|
2960 |
self origin:origin |
|
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2961 |
|
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
2962 |
"Modified: 15.7.1996 / 09:52:39 / cg" |
269 | 2963 |
! |
2964 |
||
2965 |
originRelativeTo:aView |
|
2966 |
"return the origin (in pixels) relative to a superView, |
|
2967 |
or relative to the rootView (if the aView argument is nil). |
|
2968 |
If the receiver is nonNil and not a subview of aView, return nil." |
|
2969 |
||
2970 |
|currentView |
|
2414 | 2971 |
bw "{ Class: SmallInteger }" |
269 | 2972 |
sumX "{ Class: SmallInteger }" |
2973 |
sumY "{ Class: SmallInteger }" | |
|
2974 |
||
2975 |
currentView := self. |
|
2976 |
sumX := 0. |
|
2977 |
sumY := 0. |
|
2978 |
[currentView notNil] whileTrue:[ |
|
3152 | 2979 |
(currentView == aView) ifTrue:[ |
2980 |
^ (sumX @ sumY) |
|
2981 |
]. |
|
2982 |
bw := currentView borderWidth. |
|
2983 |
sumX := sumX + (currentView left) + bw. |
|
2984 |
sumY := sumY + (currentView top) + bw. |
|
2985 |
currentView := currentView superView |
|
269 | 2986 |
]. |
729
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
2987 |
(aView isNil or:[aView == device rootView]) ifTrue:[ |
3152 | 2988 |
"return relative to screen ..." |
2989 |
^ (sumX @ sumY) |
|
269 | 2990 |
]. |
2991 |
^ nil |
|
2992 |
||
2993 |
" |
|
2994 |
|top sub1 sub2| |
|
2995 |
||
2996 |
top := StandardSystemView new. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
2997 |
top extent:200@200. |
269 | 2998 |
sub1 := View origin:0.2 @ 0.2 corner:0.8 @ 0.8 in:top. |
2999 |
sub2 := Button origin:0.3 @ 0.3 corner:0.7 @ 0.7 in:sub1. |
|
3000 |
top openAndWait. |
|
697 | 3001 |
Transcript show:'button in top:'; showCR:(sub2 originRelativeTo:top). |
3002 |
Transcript show:'button on screen:'; showCR:(sub2 originRelativeTo:nil). |
|
269 | 3003 |
" |
2171
df6af7cc7a62
fixed #originRelativeTo: when borderWidth ~~ 0
Claus Gittinger <cg@exept.de>
parents:
2167
diff
changeset
|
3004 |
|
2414 | 3005 |
"Modified: / 5.12.1998 / 14:30:57 / cg" |
269 | 3006 |
! |
3007 |
||
1327 | 3008 |
originRule |
3009 |
"return the origin block - non public; this will vanish without notice" |
|
3010 |
||
3011 |
^ originRule |
|
3012 |
! |
|
3013 |
||
763 | 3014 |
preferredExtent:anExtentPoint |
3015 |
"override the views own preferredExtent computation, |
|
3016 |
and let it prefer the size given by the argument." |
|
3017 |
||
3018 |
preferredExtent := anExtentPoint. |
|
1038
fb193cba16b6
#preferredExtent: no longer changes the extent
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
3019 |
|
fb193cba16b6
#preferredExtent: no longer changes the extent
Claus Gittinger <cg@exept.de>
parents:
1035
diff
changeset
|
3020 |
"Modified: 22.8.1996 / 13:41:47 / cg" |
763 | 3021 |
! |
3022 |
||
269 | 3023 |
relativeCorner |
4630 | 3024 |
"return the relative corner or nil. |
3025 |
Obsolete: please use a layout object." |
|
269 | 3026 |
|
3027 |
^ relativeCorner |
|
3028 |
! |
|
3029 |
||
3030 |
relativeCorner:aPoint |
|
4630 | 3031 |
"set the relative corner. |
3032 |
Obsolete: please use a layout object." |
|
269 | 3033 |
|
3627
eefbbc5c3d04
when setting a relativeExtent, clear any relativeCorner
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
3034 |
aPoint notNil ifTrue:[relativeExtent := nil]. |
269 | 3035 |
relativeCorner := aPoint |
3036 |
! |
|
3037 |
||
3038 |
relativeExtent |
|
4630 | 3039 |
"return the relative extent or nil. |
3040 |
Obsolete: please use a layout object." |
|
269 | 3041 |
|
3042 |
^ relativeExtent |
|
3043 |
! |
|
3044 |
||
3045 |
relativeExtent:aPoint |
|
4630 | 3046 |
"set the relative extent. |
3047 |
Obsolete: please use a layout object." |
|
269 | 3048 |
|
3627
eefbbc5c3d04
when setting a relativeExtent, clear any relativeCorner
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
3049 |
aPoint notNil ifTrue:[relativeCorner := nil]. |
269 | 3050 |
relativeExtent := aPoint |
3051 |
! |
|
3052 |
||
3053 |
relativeOrigin |
|
4630 | 3054 |
"return the relative origin or nil. |
3055 |
Obsolete: please use a layout object." |
|
269 | 3056 |
|
3057 |
^ relativeOrigin |
|
3058 |
! |
|
3059 |
||
3060 |
relativeOrigin:aPoint |
|
4630 | 3061 |
"set the relative origin. |
3062 |
Obsolete: please use a layout object." |
|
269 | 3063 |
|
3064 |
relativeOrigin := aPoint |
|
3065 |
! |
|
3066 |
||
3067 |
right |
|
3068 |
"return the x position of the right edge (in pixels)" |
|
3069 |
||
3070 |
^ left + width - 1 |
|
3071 |
||
3072 |
"Modified: 31.8.1995 / 19:31:10 / claus" |
|
3073 |
! |
|
3074 |
||
3075 |
right:aNumber |
|
3076 |
"set the corners x position" |
|
3077 |
||
3078 |
self corner:(aNumber @ self corner y) |
|
3079 |
! |
|
3080 |
||
3081 |
rightInset |
|
3082 |
"return the inset of the right edge; positive is to the left, |
|
4630 | 3083 |
negative to the right. |
3084 |
Obsolete: please use a layout object." |
|
269 | 3085 |
|
3086 |
insets isNil ifTrue:[^ 0]. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3087 |
^ insets at:3 |
269 | 3088 |
! |
3089 |
||
3090 |
rightInset:aNumber |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3091 |
"set the inset of the right edge; |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3092 |
positive is to the left (view becomes smaller), |
4630 | 3093 |
negative to the right (becomes larger). |
3094 |
Obsolete: please use a layout object." |
|
269 | 3095 |
|
4427 | 3096 |
|newInset| |
3097 |
||
269 | 3098 |
insets isNil ifTrue:[ |
4966
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
3099 |
insets := Array with:0 with:0 with:0 with:0 |
4426 | 3100 |
]. |
4427 | 3101 |
newInset := aNumber. |
3102 |
newInset isNil ifTrue:[ |
|
4966
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
3103 |
newInset := 0. |
4427 | 3104 |
]. |
3105 |
(insets at:3) ~= newInset ifTrue:[ |
|
4966
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
3106 |
insets at:3 put:newInset. |
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
3107 |
self containerChangedSize. |
4427 | 3108 |
] |
964 | 3109 |
|
3110 |
"Modified: 19.7.1996 / 17:30:32 / cg" |
|
269 | 3111 |
! |
3112 |
||
3007 | 3113 |
setOrigin:aPoint |
3114 |
"set the origin only" |
|
3115 |
||
3116 |
left := aPoint x. |
|
3117 |
top := aPoint y. |
|
3118 |
! |
|
3119 |
||
269 | 3120 |
sizeFixed:aBoolean |
3121 |
"set/clear the fix-size attribute, if supported by concrete subclasses. |
|
3122 |
Views which want to resize themselfes as appropriate to their contents |
|
3123 |
should cease to do so and take their current size if sizeFixed is set to |
|
3124 |
true. Currently, only supported by Labels. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3125 |
This does NOT prevent the window manager from resizing the view, |
269 | 3126 |
instead it tell the view to NOT resize ITSELF. |
3127 |
Added here to provide a common protocol for all views." |
|
3128 |
||
3129 |
^ self |
|
3130 |
! |
|
3131 |
||
3132 |
top |
|
3133 |
"return the y position of the top border" |
|
3134 |
||
3135 |
^ top |
|
3136 |
! |
|
3137 |
||
3138 |
top:aNumber |
|
3139 |
"set the y position" |
|
3140 |
||
3141 |
self origin:(left @ aNumber) |
|
3142 |
! |
|
3143 |
||
3144 |
topInset |
|
3145 |
"return the inset of the top edge; positive is to the bottom, |
|
4630 | 3146 |
negative to the top. |
3147 |
Obsolete: please use a layout object." |
|
269 | 3148 |
|
3149 |
insets isNil ifTrue:[^ 0]. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3150 |
^ insets at:2 |
269 | 3151 |
! |
3152 |
||
3153 |
topInset:aNumber |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3154 |
"set the inset of the top edge; |
269 | 3155 |
positive is to the bottom (view becomes smaller), |
4630 | 3156 |
negative to the top (becomes larger). |
3157 |
Obsolete: please use a layout object." |
|
269 | 3158 |
|
4427 | 3159 |
|newInset| |
3160 |
||
269 | 3161 |
insets isNil ifTrue:[ |
4966
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
3162 |
insets := Array with:0 with:0 with:0 with:0 |
4426 | 3163 |
]. |
4427 | 3164 |
newInset := aNumber. |
3165 |
newInset isNil ifTrue:[ |
|
4966
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
3166 |
newInset := 0. |
4427 | 3167 |
]. |
3168 |
(insets at:2) ~= newInset ifTrue:[ |
|
4966
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
3169 |
insets at:2 put:newInset. |
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
3170 |
self containerChangedSize. |
4427 | 3171 |
] |
964 | 3172 |
|
3173 |
"Modified: 19.7.1996 / 17:30:45 / cg" |
|
269 | 3174 |
! |
3175 |
||
3176 |
verticalInset:aNumber |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3177 |
"set the insets of the top/bottom edge; |
4630 | 3178 |
positive makes it smaller, negative makes it larger. |
3179 |
Obsolete: please use a layout object." |
|
269 | 3180 |
|
4530
5afcace584e4
compact: #dropMessage:data:view:position:handle:
Stefan Vogel <sv@exept.de>
parents:
4524
diff
changeset
|
3181 |
|newInset| |
5afcace584e4
compact: #dropMessage:data:view:position:handle:
Stefan Vogel <sv@exept.de>
parents:
4524
diff
changeset
|
3182 |
|
269 | 3183 |
insets isNil ifTrue:[ |
4966
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
3184 |
insets := Array with:0 with:0 with:0 with:0 |
4426 | 3185 |
]. |
4530
5afcace584e4
compact: #dropMessage:data:view:position:handle:
Stefan Vogel <sv@exept.de>
parents:
4524
diff
changeset
|
3186 |
newInset := aNumber. |
4426 | 3187 |
aNumber isNil ifTrue:[ |
4966
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
3188 |
newInset := 0. |
4530
5afcace584e4
compact: #dropMessage:data:view:position:handle:
Stefan Vogel <sv@exept.de>
parents:
4524
diff
changeset
|
3189 |
]. |
5afcace584e4
compact: #dropMessage:data:view:position:handle:
Stefan Vogel <sv@exept.de>
parents:
4524
diff
changeset
|
3190 |
insets at:2 put:newInset. |
5afcace584e4
compact: #dropMessage:data:view:position:handle:
Stefan Vogel <sv@exept.de>
parents:
4524
diff
changeset
|
3191 |
insets at:4 put:newInset. |
269 | 3192 |
|
3193 |
"force recomputation" |
|
3194 |
"/ drawableId isNil ifTrue:[ |
|
3375 | 3195 |
"/ self originChangedFlag:true |
269 | 3196 |
"/ ] ifFalse:[ |
4966
3a8ffabd2fa3
changed #foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
3197 |
self containerChangedSize. |
269 | 3198 |
"/ ] |
964 | 3199 |
|
4630 | 3200 |
"Modified: / 30-09-2006 / 15:19:45 / cg" |
269 | 3201 |
! |
3202 |
||
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
3203 |
viewRectangle |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
3204 |
"return the inside area. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
3205 |
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
|
3206 |
to base relative coordinates on. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
3207 |
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
|
3208 |
margins required for 3D levels) is ok. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
3209 |
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
|
3210 |
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
|
3211 |
(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
|
3212 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
3213 |
|m2| |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
3214 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
3215 |
m2 := margin + margin. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
3216 |
^ (margin @ margin) extent:((width - m2) @ (height - m2)) |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
3217 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
3218 |
"Modified: 8.2.1996 / 20:05:00 / cg" |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
3219 |
! |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
3220 |
|
269 | 3221 |
width:aNumber |
3222 |
"set the views width in pixels" |
|
3223 |
||
3224 |
self extent:(aNumber @ height) |
|
3225 |
! |
|
3226 |
||
3227 |
widthIncludingBorder |
|
3228 |
"return my width including border |
|
3229 |
(this is my width as seen from the outside view; |
|
3230 |
while #width returns the width as seen by myself)" |
|
3231 |
||
3232 |
^ width + (2*borderWidth) |
|
3233 |
! ! |
|
3234 |
||
3918
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3235 |
!SimpleView methodsFor:'accessing-display attributes'! |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3236 |
|
4497 | 3237 |
beMDIChildView |
3238 |
flagBits := flagBits bitOr:FlagIsMDIChild |
|
3239 |
! |
|
3240 |
||
4230 | 3241 |
beNativeWidget |
3242 |
flagBits := flagBits bitOr:FlagNativeWidget |
|
3243 |
! |
|
3244 |
||
4262 | 3245 |
beNonNativeWidget |
3246 |
flagBits := flagBits bitClear:FlagNativeWidget |
|
3247 |
! |
|
3248 |
||
4497 | 3249 |
isMDIChildView |
3250 |
^ flagBits bitTest:FlagIsMDIChild |
|
3251 |
! |
|
3252 |
||
4407 | 3253 |
isMarkedAsUnmappedModalBox |
3254 |
^ flagBits bitTest:FlagIsUnmappedModalBox |
|
3255 |
! |
|
3256 |
||
4230 | 3257 |
isNativeWidget |
3258 |
^ flagBits bitTest:FlagNativeWidget |
|
3259 |
! |
|
3260 |
||
4407 | 3261 |
markAsUnmappedModalBox |
3262 |
flagBits := flagBits bitOr:FlagIsUnmappedModalBox |
|
3263 |
! |
|
3264 |
||
3918
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3265 |
setWindowClass:windowClassNameString name:nameString |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3266 |
"define class and name of a window. |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3267 |
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
|
3268 |
select client specific resources." |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3269 |
|
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3270 |
device setWindowClass:windowClassNameString name:nameString in:drawableId. |
4407 | 3271 |
! |
3272 |
||
3273 |
unmarkAsUnmappedModalBox |
|
3274 |
flagBits := flagBits bitClear:FlagIsUnmappedModalBox |
|
3918
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3275 |
! ! |
f708df11e804
Set windowClasses based on application class name.
Stefan Vogel <sv@exept.de>
parents:
3909
diff
changeset
|
3276 |
|
269 | 3277 |
!SimpleView methodsFor:'accessing-hierarchy'! |
3278 |
||
756 | 3279 |
components |
3280 |
"return the collection of non-view components" |
|
3281 |
||
4516 | 3282 |
^ components ? #() |
756 | 3283 |
|
3284 |
"Created: 28.5.1996 / 23:59:37 / cg" |
|
3285 |
! |
|
3286 |
||
1182 | 3287 |
container |
3288 |
"return my container" |
|
3289 |
||
3290 |
^ superView |
|
3291 |
||
3292 |
"Created: 5.6.1996 / 01:08:36 / cg" |
|
3293 |
"Modified: 10.1.1997 / 19:47:59 / cg" |
|
3294 |
! |
|
3295 |
||
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3296 |
container:aContainer |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3297 |
"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
|
3298 |
|
3558
5b0c805753aa
fixed container: (no error if same container is given)
martin
parents:
3556
diff
changeset
|
3299 |
superView == aContainer ifTrue:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3300 |
"/ no change |
3762 | 3301 |
^ self. |
3558
5b0c805753aa
fixed container: (no error if same container is given)
martin
parents:
3556
diff
changeset
|
3302 |
]. |
5b0c805753aa
fixed container: (no error if same container is given)
martin
parents:
3556
diff
changeset
|
3303 |
|
3485 | 3304 |
(drawableId notNil) ifTrue:[ |
3762 | 3305 |
"/ actually, this is worth an exception |
3306 |
"/ ('View [error]: ' , self printString , ' already realized - cannot change container') errorPrintCR. |
|
3307 |
self error:'already realized - cannot change container' mayProceed:true. |
|
3485 | 3308 |
]. |
1296 | 3309 |
(superView notNil and:[superView ~~ aContainer]) ifTrue:[ |
3762 | 3310 |
"/ actually, this is worth an exception |
3311 |
('View [warning]: ' , self printString , ' already has a container') errorPrintCR. |
|
3312 |
superView removeComponent:self. |
|
1296 | 3313 |
]. |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3314 |
superView := aContainer |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3315 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3316 |
"Created: 9.5.1996 / 00:40:56 / cg" |
1297 | 3317 |
"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
|
3318 |
! |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3319 |
|
269 | 3320 |
lower |
3321 |
"bring to back" |
|
3322 |
||
3323 |
drawableId isNil ifTrue:[self create]. |
|
3324 |
device lowerWindow:drawableId |
|
3325 |
||
3326 |
" |
|
3327 |
Transcript topView lower |
|
3328 |
" |
|
3329 |
! |
|
3330 |
||
3331 |
raise |
|
3332 |
"bring to front" |
|
3333 |
||
3334 |
drawableId isNil ifTrue:[self create]. |
|
3335 |
device raiseWindow:drawableId |
|
3336 |
||
3337 |
" |
|
3338 |
Transcript topView raise |
|
3339 |
" |
|
3340 |
! |
|
3341 |
||
3625 | 3342 |
setContainer:aContainer |
3343 |
"set my container (i.e. superView) to be aContainer" |
|
3344 |
||
3345 |
superView := aContainer |
|
3346 |
! |
|
3347 |
||
269 | 3348 |
subViews |
3349 |
"return the collection of subviews" |
|
3350 |
||
3626
fa436ffc8ae7
subViews always returns a collection
Claus Gittinger <cg@exept.de>
parents:
3625
diff
changeset
|
3351 |
^ subViews ? #() |
269 | 3352 |
! |
3353 |
||
3354 |
subViews:aListOfViews |
|
3355 |
"set the collection of subviews" |
|
3356 |
||
3616 | 3357 |
self obsoleteMethodWarning. |
3358 |
||
269 | 3359 |
subViews := aListOfViews. |
135 | 3360 |
subViews notNil ifTrue:[ |
3762 | 3361 |
subViews do:[:view | |
3362 |
view container:self |
|
3363 |
] |
|
135 | 3364 |
] |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3365 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3366 |
"Modified: 9.5.1996 / 00:42:28 / cg" |
135 | 3367 |
! |
3368 |
||
269 | 3369 |
superView |
3370 |
"return my superView" |
|
3371 |
||
3372 |
^ superView |
|
3373 |
! |
|
3374 |
||
3375 |
superView:aView |
|
3376 |
"set my superView to be aView" |
|
3377 |
||
3434 | 3378 |
<resource:#obsolete> |
3379 |
||
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3380 |
self obsoleteMethodWarning:'use #container:'. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3381 |
self container:aView. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3382 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
3383 |
"Modified: 9.5.1996 / 00:46:24 / cg" |
269 | 3384 |
! |
3385 |
||
662
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
3386 |
topComponent |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
3387 |
"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
|
3388 |
For ST-80 compatibility." |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
3389 |
|
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
3390 |
^ self topView |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
3391 |
|
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
3392 |
"Modified: 9.5.1996 / 01:40:24 / cg" |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
3393 |
! |
8263420fe544
added #topComponent for VisualPart protocol compatibility
Claus Gittinger <cg@exept.de>
parents:
660
diff
changeset
|
3394 |
|
269 | 3395 |
topView |
3396 |
"return the topView - thats the one with no superview" |
|
3397 |
||
3425 | 3398 |
|v next n| |
3399 |
||
3400 |
n := 1. |
|
269 | 3401 |
v := self. |
3402 |
[v notNil] whileTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3403 |
(next := v container) isNil ifTrue:[^ v]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3404 |
v := next. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3405 |
n := n + 1. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3406 |
n > 1000 ifTrue:[self error:'circular superView chain']. |
135 | 3407 |
]. |
3408 |
||
269 | 3409 |
^ nil |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3410 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3411 |
"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
|
3412 |
! |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3413 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3414 |
view |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3415 |
"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
|
3416 |
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
|
3417 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3418 |
^ self |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3419 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3420 |
"Created: 4.6.1996 / 21:32:11 / cg" |
269 | 3421 |
! ! |
3422 |
||
3423 |
!SimpleView methodsFor:'accessing-menus'! |
|
3424 |
||
3425 |
menuHolder |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3426 |
"who has the menu ? |
269 | 3427 |
By default, I have it." |
3428 |
||
3429 |
^ self |
|
3430 |
! |
|
3431 |
||
3432 |
menuMessage |
|
3433 |
"Return the symbol sent to myself to aquire the menu" |
|
3434 |
||
3435 |
^ #middleButtonMenu |
|
3436 |
! |
|
3437 |
||
3438 |
menuPerformer |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3439 |
"who should perform the menu actions ? |
269 | 3440 |
By default, I do it." |
3441 |
||
3442 |
^ self |
|
3443 |
! |
|
3444 |
||
3445 |
yellowButtonMenu |
|
3446 |
"actually, this should be called 'middleButtonMenu'. |
|
3447 |
But for ST-80 compatibility .... |
|
3448 |
This method will vanish, once all views have controllers |
|
3449 |
associated with them; for now, duplicate some code also found in |
|
3450 |
controller." |
|
3451 |
||
3821 | 3452 |
|sym menuHolder| |
269 | 3453 |
|
3454 |
"/ middleButtonMenu notNil ifTrue:[ |
|
3455 |
"/ "/ |
|
3456 |
"/ "/ has been assigned a static middleButtonMenu |
|
3457 |
"/ "/ (or a cached menu) |
|
3458 |
"/ "/ |
|
3459 |
"/ ^ middleButtonMenu |
|
3460 |
"/ ]. |
|
3461 |
||
3462 |
menuHolder := self menuHolder. |
|
3821 | 3463 |
menuHolder isNil ifTrue:[^ nil]. |
3464 |
||
3465 |
(menuHolder isKindOf:Menu) ifTrue:[^ menuHolder]. |
|
3466 |
||
3467 |
sym := self menuMessage. |
|
3468 |
sym isNil ifTrue:[^ nil]. |
|
3469 |
||
3470 |
" |
|
3471 |
mhmh - for backward compatibility, try to ask |
|
3472 |
the model first, then use the views menu. |
|
3473 |
" |
|
3474 |
(menuHolder respondsTo:sym) ifFalse:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3475 |
(self respondsTo:sym) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3476 |
menuHolder := self |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3477 |
] |
3821 | 3478 |
]. |
3894 | 3479 |
|
3480 |
sym numArgs == 1 ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3481 |
"/ squeak compatibility: create the menu here, let model add items |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3482 |
^ menuHolder perform:sym with:(Menu new). |
3894 | 3483 |
]. |
3484 |
sym numArgs == 2 ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3485 |
"/ squeak compatibility: create the menu here, let model add items |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3486 |
^ menuHolder perform:sym with:(Menu new) with:(device shiftDown). |
3894 | 3487 |
]. |
3488 |
||
3821 | 3489 |
" |
3490 |
ask the menuHolder for the menu |
|
3491 |
" |
|
3492 |
^ menuHolder perform:sym. |
|
135 | 3493 |
! ! |
3494 |
||
3495 |
!SimpleView methodsFor:'accessing-misc'! |
|
3496 |
||
3497 |
bitGravity |
|
3498 |
"return the bitGravity - thats the direction where the contents will move |
|
3499 |
when the the view is resized." |
|
3500 |
||
3501 |
^ bitGravity |
|
3502 |
! |
|
3503 |
||
3504 |
bitGravity:gravity |
|
3505 |
"set the bitGravity - thats the direction where the contents will move |
|
3506 |
when the view is resized." |
|
3507 |
||
3508 |
bitGravity ~~ gravity ifTrue:[ |
|
3152 | 3509 |
bitGravity := gravity. |
3510 |
drawableId notNil ifTrue:[ |
|
3511 |
device setBitGravity:gravity in:drawableId |
|
3512 |
] |
|
135 | 3513 |
] |
3514 |
! |
|
3515 |
||
737 | 3516 |
clippingRectangle:aRectangle |
153 | 3517 |
"set the clipping rectangle for drawing (in logical coordinates); |
754 | 3518 |
a nil argument turns off clipping (i.e. whole view is drawable). |
153 | 3519 |
Redefined to care for any margin." |
3520 |
||
3521 |
|x y w h| |
|
3522 |
||
3523 |
aRectangle isNil ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3524 |
clipRect isNil ifTrue:[^ self]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3525 |
gcId notNil ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3526 |
device noClipIn:drawableId gc:gcId |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3527 |
] |
153 | 3528 |
] ifFalse:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3529 |
clipRect notNil ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3530 |
(clipRect = aRectangle) ifTrue:[^ self] |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3531 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3532 |
gcId notNil ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3533 |
x := aRectangle left. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3534 |
y := aRectangle top. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3535 |
w := aRectangle width. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3536 |
h := aRectangle height. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3537 |
transformation notNil ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3538 |
x := transformation applyToX:x. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3539 |
y := transformation applyToY:y. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3540 |
w := transformation applyScaleX:w. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3541 |
h := transformation applyScaleY:h. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3542 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3543 |
(x isMemberOf:SmallInteger) ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3544 |
w := w + (x - x truncated). |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3545 |
x := x truncated |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3546 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3547 |
(y isMemberOf:SmallInteger) ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3548 |
h := h + (y - y truncated). |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3549 |
y := y truncated |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3550 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3551 |
(w isMemberOf:SmallInteger) ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3552 |
w := w truncated + 1 |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3553 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3554 |
(h isMemberOf:SmallInteger) ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3555 |
h := h truncated + 1 |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3556 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3557 |
x < margin ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3558 |
x := margin. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3559 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3560 |
y < margin ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3561 |
y := margin. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3562 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3563 |
x + w - 1 >= (width-margin) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3564 |
w := width - margin - x |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3565 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3566 |
y + h - 1 >= (height-margin) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3567 |
h := height - margin - y |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3568 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3569 |
w := w max:0. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3570 |
h := h max:0. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3571 |
device setClipX:x y:y width:w height:h in:drawableId gc:gcId |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3572 |
] |
153 | 3573 |
]. |
3574 |
clipRect := aRectangle |
|
737 | 3575 |
|
3576 |
"Created: 28.5.1996 / 19:50:03 / cg" |
|
754 | 3577 |
"Modified: 28.5.1996 / 22:32:15 / cg" |
153 | 3578 |
! |
3579 |
||
3580 |
fullName |
|
3581 |
"return my full name to be used for resource-access" |
|
3582 |
||
3583 |
superView notNil ifTrue:[ |
|
3152 | 3584 |
^ superView fullName , '.' , name |
153 | 3585 |
]. |
3586 |
^ name |
|
3587 |
! |
|
3588 |
||
269 | 3589 |
name |
3590 |
"return my name component to be used for resource-access" |
|
3591 |
||
3592 |
^ name |
|
3593 |
! |
|
3594 |
||
3595 |
name:aString |
|
3596 |
"set my name component to be used for resource-access" |
|
3597 |
||
3598 |
name := aString |
|
3599 |
! |
|
3600 |
||
153 | 3601 |
processName |
3602 |
"return a string to be shown in the process monitor" |
|
3603 |
||
3604 |
^ self name |
|
269 | 3605 |
! |
3606 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3607 |
styleSheet |
269 | 3608 |
"return the styleSheet. This is set at early view-creation time, |
3609 |
from the defaultStyleSheet which is valid at that time. |
|
3610 |
It is not affected by later defaultStyle changes" |
|
3611 |
||
3612 |
^ styleSheet |
|
3613 |
||
3614 |
"Created: 10.9.1995 / 11:02:20 / claus" |
|
3615 |
! |
|
3616 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3617 |
styleSheet:aStyleSheet |
3384 | 3618 |
"change the styleSheet. Knowledgable users only, please." |
3619 |
||
3620 |
styleSheet := aStyleSheet. |
|
3621 |
! |
|
3622 |
||
269 | 3623 |
viewGravity |
3624 |
"return the viewGravity - thats the direction where the view will move |
|
3625 |
when the superView is resized." |
|
3626 |
||
3627 |
^ viewGravity |
|
3628 |
! |
|
3629 |
||
3630 |
viewGravity:gravity |
|
3631 |
"set the viewGravity - thats the direction where the view will move |
|
3632 |
when the superView is resized." |
|
3633 |
||
3634 |
viewGravity ~~ gravity ifTrue:[ |
|
3152 | 3635 |
viewGravity := gravity. |
3636 |
drawableId notNil ifTrue:[ |
|
3637 |
device setWindowGravity:gravity in:drawableId |
|
3638 |
] |
|
269 | 3639 |
] |
140 | 3640 |
! ! |
3641 |
||
3642 |
!SimpleView methodsFor:'accessing-mvc'! |
|
3643 |
||
1187
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
3644 |
application |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
3645 |
"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
|
3646 |
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
|
3647 |
|
1751 | 3648 |
superView notNil ifTrue:[ |
3152 | 3649 |
^ superView application |
1187
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
3650 |
]. |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
3651 |
^ nil |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
3652 |
|
1190 | 3653 |
"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
|
3654 |
! |
c41d3a2591fd
added #application - in case a non-topView is opened as topView,
Claus Gittinger <cg@exept.de>
parents:
1182
diff
changeset
|
3655 |
|
269 | 3656 |
aspect:aspectSymbol |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3657 |
"ST-80 style updating: If a views aspectSymbol is nonNil, |
269 | 3658 |
it will respond to changes of this aspect from the model. |
3659 |
Alias for aspectMessage: for ST-80 compatibility." |
|
3660 |
||
3661 |
self aspectMessage:aspectSymbol |
|
3662 |
! |
|
3663 |
||
140 | 3664 |
controller |
1943 | 3665 |
"return the controller. For views which implement the controller |
3666 |
functionality themself, return the receiver itself" |
|
3667 |
||
3668 |
^ controller ? self |
|
3669 |
||
3670 |
"Modified: / 31.10.1997 / 19:58:10 / cg" |
|
140 | 3671 |
! |
3672 |
||
3673 |
controller:aController |
|
1943 | 3674 |
"set the controller - thats the one handling user events" |
140 | 3675 |
|
3676 |
controller := aController. |
|
3677 |
controller notNil ifTrue:[ |
|
3152 | 3678 |
controller view:self. |
135 | 3679 |
] |
1943 | 3680 |
|
3681 |
"Modified: / 31.10.1997 / 19:58:33 / cg" |
|
135 | 3682 |
! |
3683 |
||
140 | 3684 |
model |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3685 |
"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
|
3686 |
|
135 | 3687 |
^ nil |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3688 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
3689 |
"Modified: 5.6.1996 / 14:17:29 / cg" |
135 | 3690 |
! |
3691 |
||
1182 | 3692 |
sensor |
3693 |
"return the views sensor" |
|
3694 |
||
3695 |
windowGroup notNil ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3696 |
^ windowGroup sensor. |
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
3697 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
3698 |
|
4209 | 3699 |
"there is no window group. Deliver events synchronously" |
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
3700 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
3701 |
^ SynchronousWindowSensor new. |
1182 | 3702 |
|
3703 |
"Modified: 10.1.1997 / 19:47:13 / cg" |
|
3704 |
! |
|
3705 |
||
954 | 3706 |
setController:aController |
3707 |
"set the controller but do not affect the model/view releationship" |
|
3708 |
||
3709 |
controller := aController. |
|
3710 |
||
3711 |
"Created: 18.7.1996 / 11:43:40 / cg" |
|
3712 |
! |
|
3713 |
||
1874
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3714 |
setWindowGroup:aGroup |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3715 |
"set the window group." |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3716 |
|
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3717 |
windowGroup := aGroup |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3718 |
|
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3719 |
"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
|
3720 |
! |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3721 |
|
269 | 3722 |
windowGroup |
3723 |
"return the window group. For old style views, return nil" |
|
3724 |
||
3725 |
^ windowGroup |
|
3726 |
! |
|
3727 |
||
1874
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3728 |
windowGroup:newGroup |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3729 |
"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
|
3730 |
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
|
3731 |
|
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3732 |
windowGroup notNil ifTrue:[ |
3152 | 3733 |
windowGroup removeView:self. |
3734 |
windowGroup := nil |
|
1874
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3735 |
]. |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3736 |
windowGroup := newGroup. |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3737 |
newGroup notNil ifTrue:[ |
3152 | 3738 |
newGroup addView:self. |
1877 | 3739 |
|
3740 |
]. |
|
1874
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3741 |
subViews notNil ifTrue:[ |
3152 | 3742 |
subViews do:[:aSubview | |
3743 |
aSubview windowGroup:newGroup |
|
3744 |
] |
|
1874
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3745 |
]. |
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
3746 |
|
1877 | 3747 |
"Modified: 20.8.1997 / 13:26:37 / cg" |
269 | 3748 |
! ! |
3749 |
||
3750 |
!SimpleView methodsFor:'accessing-transformation'! |
|
3751 |
||
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3752 |
maxComponentBottom |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3753 |
"return the maximum of all components bottom" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3754 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3755 |
components isNil ifTrue:[^ 0]. |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3756 |
^ components inject:0 into:[:maxSoFar :sub |
3152 | 3757 |
| (sub bottom) max:maxSoFar]. |
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3758 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3759 |
"Created: 26.5.1996 / 12:44:05 / cg" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3760 |
"Modified: 26.5.1996 / 12:56:39 / cg" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3761 |
! |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3762 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3763 |
maxComponentRight |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3764 |
"return the maximum of all components rights" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3765 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3766 |
components isNil ifTrue:[^ 0]. |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3767 |
^ components inject:0 into:[:maxSoFar :sub |
3152 | 3768 |
| (sub right) max:maxSoFar]. |
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3769 |
|
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3770 |
"Modified: 26.5.1996 / 12:56:39 / cg" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3771 |
"Created: 26.5.1996 / 13:02:19 / cg" |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3772 |
! |
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
3773 |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3774 |
maxSubViewBottom |
269 | 3775 |
"/ subViews isNil ifTrue:[^ 0]. |
3776 |
"/ ^ subViews inject:0 into:[:maxSoFar :sub | (sub top + sub height) max:maxSoFar]. |
|
3777 |
^ 0 |
|
3778 |
! |
|
3779 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3780 |
maxSubViewRight |
269 | 3781 |
"/ subViews isNil ifTrue:[^ 0]. |
3782 |
"/ ^ subViews inject:0 into:[:maxSoFar :sub | (sub left + sub width) max:maxSoFar]. |
|
3783 |
^ 0 |
|
3784 |
! |
|
3785 |
||
3786 |
scale:aPoint |
|
3787 |
"set the scale factor of the transformation" |
|
3788 |
||
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
3789 |
super scale:aPoint. |
269 | 3790 |
self computeInnerClip |
3791 |
! |
|
3792 |
||
3793 |
setViewOrigin:aPoint |
|
3794 |
"set the viewOrigin - i.e. virtually scroll without redrawing" |
|
3795 |
||
3796 |
|p| |
|
3797 |
||
3798 |
p := aPoint negated. |
|
3799 |
transformation isNil ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3800 |
transformation := WindowingTransformation scale:1 translation:p |
269 | 3801 |
] ifFalse:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3802 |
transformation translation:p |
269 | 3803 |
]. |
3804 |
clipRect notNil ifTrue:[ |
|
3152 | 3805 |
self setInnerClip. |
269 | 3806 |
]. |
3807 |
! |
|
3808 |
||
3809 |
viewOrigin |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3810 |
"return the viewOrigin; thats the coordinate of the contents |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3811 |
which is shown topLeft in the view |
269 | 3812 |
(i.e. the origin of the visible part of the contents)." |
3813 |
||
3814 |
transformation isNil ifTrue:[ |
|
3152 | 3815 |
^ 0@0 |
269 | 3816 |
]. |
3817 |
^ transformation translation negated |
|
3818 |
! |
|
3819 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3820 |
visibleArea |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3821 |
"return the rectangle that contains the visible part |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3822 |
of the view in user coordinates." |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3823 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3824 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3825 |
transformation isNil ifTrue:[ |
3152 | 3826 |
^ 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
|
3827 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3828 |
^ Rectangle origin:(transformation translation negated) |
3152 | 3829 |
extent:((width @ height) scaledBy:(transformation scale)). |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3830 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3831 |
"Created: 12.7.1996 / 11:57:04 / stefan" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3832 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
3833 |
|
269 | 3834 |
xOriginOfContents |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3835 |
"return the x coordinate of the viewOrigin in pixels; |
269 | 3836 |
used by scrollBars to compute thumb position within the document." |
3837 |
||
3838 |
^ self viewOrigin x |
|
3839 |
! |
|
3840 |
||
3841 |
yOriginOfContents |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3842 |
"return the y coordinate of the viewOrigin in pixels; |
269 | 3843 |
used by scrollBars to compute thumb position within the document." |
3844 |
||
3845 |
^ self viewOrigin y |
|
3846 |
! ! |
|
3847 |
||
370 | 3848 |
!SimpleView methodsFor:'accessing-visibility'! |
3849 |
||
3850 |
beInvisible |
|
1524 | 3851 |
"make the view invisible; if my container is visible, |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3852 |
change visibility immediately; |
1524 | 3853 |
otherwise, arrange for the receiver to be not realized, |
3854 |
when the container is made visible." |
|
3855 |
||
370 | 3856 |
self hiddenOnRealize:true. |
3857 |
realized ifTrue:[ |
|
3367 | 3858 |
(superView isNil "/ I am a topView |
3859 |
or:[superView realized "/ superview already shown |
|
3860 |
or:[superView id notNil]]) "/ superview already created |
|
3861 |
ifTrue:[ |
|
3862 |
self unmap |
|
3863 |
] |
|
370 | 3864 |
] |
3865 |
||
1524 | 3866 |
"Modified: 3.4.1997 / 21:20:40 / cg" |
370 | 3867 |
! |
3868 |
||
3869 |
beVisible |
|
1524 | 3870 |
"make the view visible; if my container is already visible, |
3871 |
change visibility immediately; otherwise, arrange for the receiver |
|
3872 |
to be made visible when the container is made visible. |
|
3873 |
Notice, that the command may not be sent immediately to the display, |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3874 |
and that ST/X considers the view to be still invisible until a |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
3875 |
visibility event arrives from the display. |
1754 | 3876 |
Thus, the view may remain logically invisible |
1524 | 3877 |
for a while. (see #beVisibleNow for more on this)" |
3878 |
||
370 | 3879 |
self hiddenOnRealize:false. |
3880 |
realized ifFalse:[ |
|
3762 | 3881 |
superView isNil ifTrue:[ "/ I am a topView |
3882 |
drawableId isNil ifTrue:[ |
|
3883 |
"this once was: |
|
3884 |
self realize. |
|
3885 |
but we don't want Topviews to realize implicitly. |
|
3886 |
BTW. the code doesn't work anyway" |
|
3887 |
] ifFalse:[ |
|
3888 |
self remap. |
|
3889 |
]. |
|
3890 |
] ifFalse:[ |
|
3891 |
(superView realized "/ superview already shown |
|
3892 |
or:[superView id notNil]) "/ superview already created |
|
3893 |
ifTrue:[ |
|
3894 |
self realize |
|
3895 |
] |
|
3896 |
]. |
|
370 | 3897 |
] |
3898 |
||
3899 |
" |
|
3900 |
|top topFrame check list| |
|
3901 |
||
3902 |
top := StandardSystemView new. |
|
3903 |
top extent:150@400. |
|
3904 |
topFrame := VerticalPanelView origin:0.0@0.0 corner:1.0@0.4 in:top. |
|
3905 |
topFrame horizontalLayout:#leftSpace. |
|
3906 |
||
3907 |
topFrame add:(check := CheckBox label:'hidden'). |
|
3908 |
check pressAction:[list beInvisible]. |
|
3909 |
check releaseAction:[list beVisible]. |
|
3910 |
||
3911 |
list := ScrollableView for:SelectionInListView. |
|
3912 |
list origin:0.0@0.4 corner:1.0@1.0. |
|
3913 |
list list:#('foo' 'bar' 'baz'). |
|
3914 |
top add:list. |
|
3915 |
||
3916 |
check turnOn. |
|
3917 |
list beInvisible. |
|
3918 |
||
3919 |
top open |
|
3920 |
" |
|
3921 |
||
1981
0c3b8ef42df8
Take care of views with nil visibleID in #beVisible
Stefan Vogel <sv@exept.de>
parents:
1960
diff
changeset
|
3922 |
"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
|
3923 |
"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
|
3924 |
"Modified: / 14.1.1998 / 17:33:15 / stefan" |
1524 | 3925 |
! |
3926 |
||
3927 |
beVisibleNow |
|
3928 |
"make the view visible immediately. |
|
3929 |
In contrast to #beVisible, this waits until the view is really |
|
3930 |
visible." |
|
3931 |
||
3932 |
self beVisible. |
|
3648 | 3933 |
device sync. "thats a round-trip; when returning, the view is definitely visible" |
3934 |
||
2721 | 3935 |
"/ realized := true. |
3936 |
"/ shown := true. |
|
1524 | 3937 |
|
3938 |
"Created: 3.4.1997 / 21:23:28 / cg" |
|
370 | 3939 |
! |
3940 |
||
3941 |
hidden |
|
3942 |
"return true, if the view does not want to be realized |
|
3943 |
automatically when superview is realized" |
|
3944 |
||
3434 | 3945 |
<resource:#obsolete> |
3946 |
||
370 | 3947 |
self obsoleteMethodWarning:'use #isHiddenOnRealize'. |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
3948 |
^ self isHiddenOnRealize |
370 | 3949 |
|
1754 | 3950 |
"Modified: 17.6.1997 / 11:19:55 / cg" |
370 | 3951 |
! |
3952 |
||
3953 |
hidden:aBoolean |
|
3954 |
"if the argument is true, the receiver view will not |
|
3955 |
be realized automatically when superview is realized" |
|
3956 |
||
3434 | 3957 |
<resource:#obsolete> |
3958 |
||
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
3959 |
self obsoleteMethodWarning:'use #hiddenOnRealize:'. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
3960 |
self hiddenOnRealize:aBoolean |
370 | 3961 |
|
3962 |
"Modified: 17.1.1996 / 11:45:06 / cg" |
|
3963 |
! |
|
3964 |
||
3965 |
hiddenOnRealize:aBoolean |
|
3966 |
"if the argument is true, the receiver view will not |
|
1754 | 3967 |
be mapped (i.e. shown) automatically when the superview is realized. |
370 | 3968 |
The hiddenOnRealize flag is useful to create views which are |
1524 | 3969 |
to be made visible conditionally or later. |
3970 |
For ST-80 compatibility, please use #beVisible / #beInvisible." |
|
370 | 3971 |
|
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
3972 |
"/ hiddenOnRealize := aBoolean |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
3973 |
aBoolean ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
3974 |
flagBits := flagBits bitOr:FlagHiddenOnRealize |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
3975 |
] ifFalse:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
3976 |
flagBits := flagBits bitClear:FlagHiddenOnRealize |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
3977 |
]. |
1524 | 3978 |
|
1754 | 3979 |
"Modified: 17.6.1997 / 11:23:26 / cg" |
3980 |
! |
|
3981 |
||
3982 |
isHiddenOnRealize |
|
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
3983 |
"return true, if the receiver will NOT be mapped when realized. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
3984 |
False otherwise. |
370 | 3985 |
The hiddenOnRealize flag is useful to create views which are |
3986 |
to be made visible conditionally or later." |
|
3987 |
||
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
3988 |
"/ ^ hiddenOnRealize |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
3989 |
^ flagBits bitTest:FlagHiddenOnRealize. |
1754 | 3990 |
|
3991 |
"Created: 17.6.1997 / 11:21:42 / cg" |
|
370 | 3992 |
! |
3993 |
||
3516 | 3994 |
isVisible |
3995 |
"return true, if the view is visible" |
|
3996 |
||
3997 |
^ self realized |
|
3998 |
! |
|
3999 |
||
1938
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
4000 |
isVisible:aBoolean |
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
4001 |
"make the view visible or invisible" |
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
4002 |
|
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
4003 |
aBoolean ifTrue:[ |
3152 | 4004 |
self beVisible |
1938
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
4005 |
] ifFalse:[ |
3152 | 4006 |
self beInvisible |
1938
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
4007 |
] |
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
4008 |
|
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
4009 |
"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
|
4010 |
! |
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
4011 |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4012 |
setVisibilityChannel:aValueHolder |
3139 | 4013 |
"set the valueHolder, which holds the visible boolean value" |
4014 |
||
3367 | 4015 |
visibilityChannel := aValueHolder |
3139 | 4016 |
! |
4017 |
||
370 | 4018 |
shown |
4019 |
"return true if the view is shown; false if not. |
|
4020 |
Shown means: the view is mapped and is not completely covered." |
|
4021 |
||
4022 |
^ shown |
|
3366 | 4023 |
! |
4024 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4025 |
visibilityChannel |
3367 | 4026 |
"return a valueHolder for visible/invisible" |
4027 |
||
4028 |
^ visibilityChannel |
|
4029 |
||
4030 |
"Modified: / 30.3.1999 / 13:49:56 / stefan" |
|
3366 | 4031 |
! |
4032 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4033 |
visibilityChannel:aValueHolder |
3367 | 4034 |
"set the valueHolder, which holds the visible boolean value" |
4035 |
||
3366 | 4036 |
|
4037 |
|prev| |
|
4038 |
||
3367 | 4039 |
prev := visibilityChannel. |
4040 |
visibilityChannel := aValueHolder. |
|
3366 | 4041 |
self setupChannel:aValueHolder for:#visibilityStateChanged withOld:prev |
4042 |
||
3367 | 4043 |
" |
4044 |
|v h| |
|
4045 |
||
4046 |
v := View new. |
|
4047 |
v visibilityChannel:(h := ValueHolder with:true). |
|
4048 |
v open. |
|
4049 |
Delay waitForSeconds:2. |
|
4050 |
h value:false. |
|
4051 |
Delay waitForSeconds:2. |
|
4052 |
h value:true. |
|
4053 |
Delay waitForSeconds:2. |
|
4054 |
" |
|
4055 |
||
4056 |
"Created: / 14.1.1998 / 17:11:15 / stefan" |
|
4057 |
"Modified: / 14.1.1998 / 17:33:40 / stefan" |
|
370 | 4058 |
! ! |
4059 |
||
269 | 4060 |
!SimpleView methodsFor:'adding & removing components'! |
4061 |
||
4062 |
add:aComponent |
|
4063 |
"add a component (either a view or gadget) to the collection of |
|
4064 |
subComponents." |
|
4065 |
||
4066 |
self addComponent:aComponent |
|
4067 |
! |
|
4068 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4069 |
add:aComponent at:anOrigin |
1335 | 4070 |
"for ST-80 compatibility. |
4071 |
add a component at some origin" |
|
4072 |
||
4073 |
|l comp| |
|
4074 |
||
1614 | 4075 |
comp := aComponent. |
4076 |
||
4077 |
"/ (comp isWrapper not |
|
4078 |
"/ or:[comp isLayoutWrapper not]) ifTrue:[ |
|
4079 |
"/ comp := LayoutWrapper on:comp |
|
4080 |
"/ ]. |
|
1335 | 4081 |
|
4082 |
l := anOrigin asLayout. |
|
4083 |
comp layout:l. |
|
4084 |
||
4085 |
self addComponent:comp |
|
4086 |
||
1614 | 4087 |
"Modified: 18.4.1997 / 20:00:20 / cg" |
1335 | 4088 |
! |
4089 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4090 |
add:aComponentOrCollection in:aRectangleOrLayoutFrame |
269 | 4091 |
"for ST-80 compatibility. |
4092 |
add a component in some frame; the argument may be either a rectangle |
|
4093 |
with relative coordinates, or an instance of LayoutFrame, specifying |
|
4094 |
both relative coordinates and the insets." |
|
4095 |
||
1617
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
4096 |
|l wrapper| |
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
4097 |
|
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
4098 |
aComponentOrCollection isCollection ifTrue:[ |
3152 | 4099 |
wrapper := View new. |
4100 |
aComponentOrCollection do:[:aComponent | |
|
4101 |
wrapper add:aComponent |
|
4102 |
] |
|
1617
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
4103 |
] ifFalse:[ |
3152 | 4104 |
wrapper := aComponentOrCollection |
1617
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
4105 |
]. |
269 | 4106 |
|
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
4107 |
l := aRectangleOrLayoutFrame asLayout. |
269 | 4108 |
|
4109 |
"/ will soon be replaced by: |
|
4110 |
"/ aComponent layout:l. |
|
1617
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
4111 |
wrapper geometryLayout:l. |
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
4112 |
|
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
4113 |
self addComponent:wrapper. |
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
4114 |
|
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
4115 |
^ wrapper |
7a9eba5beeed
add:in: changed to handle collections
Claus Gittinger <cg@exept.de>
parents:
1615
diff
changeset
|
4116 |
|
1756 | 4117 |
"Modified: 17.6.1997 / 18:03:34 / cg" |
269 | 4118 |
! |
4119 |
||
4120 |
addComponent:aComponent |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4121 |
"components (i.e. gadgets or lightweight views) are being prepared. |
269 | 4122 |
Dont use this right now for non-views" |
4123 |
||
4124 |
aComponent isView ifTrue:[ |
|
3152 | 4125 |
self addSubView:aComponent |
269 | 4126 |
] ifFalse:[ |
3152 | 4127 |
components isNil ifTrue:[ |
4128 |
components := OrderedCollection new |
|
4129 |
]. |
|
4130 |
components add:aComponent. |
|
4131 |
aComponent container:self. |
|
4132 |
shown ifTrue:[ |
|
4133 |
aComponent displayOn:self |
|
4134 |
] |
|
269 | 4135 |
] |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4136 |
|
683
ecc5d13f22b2
redraw new components if already visible
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
4137 |
"Modified: 13.5.1996 / 21:19:51 / cg" |
269 | 4138 |
! |
4139 |
||
4140 |
addSubView:newView |
|
4141 |
"add a view to the collection of subviews" |
|
4142 |
||
4143 |
subViews isNil ifTrue:[ |
|
3653 | 4144 |
subViews := OrderedCollection with:newView |
269 | 4145 |
] ifFalse:[ |
3653 | 4146 |
(subViews includesIdentical:newView) ifTrue:[ |
4147 |
self error:'trying to add a view twice' mayProceed:true. |
|
4148 |
^ self. |
|
4149 |
]. |
|
4150 |
subViews add:newView. |
|
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4151 |
]. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4152 |
self setContainerIn:newView. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4153 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4154 |
"Modified: 9.5.1996 / 00:47:16 / cg" |
269 | 4155 |
! |
4156 |
||
4157 |
addSubView:newView after:aView |
|
4158 |
"add a view to the collection of subviews after another view. |
|
4159 |
This makes sense, in Panels and other layout views, to enter a new |
|
4160 |
element at some defined place." |
|
4161 |
||
4162 |
subViews isNil ifTrue:[ |
|
3653 | 4163 |
subViews := OrderedCollection with:newView |
269 | 4164 |
] ifFalse:[ |
3653 | 4165 |
(subViews includesIdentical:newView) ifTrue:[ |
4166 |
self error:'trying to add a view twice' mayProceed:true. |
|
4167 |
^ self. |
|
4168 |
]. |
|
4169 |
aView isNil ifTrue:[ |
|
4170 |
subViews add:newView |
|
4171 |
] ifFalse:[ |
|
4172 |
subViews add:newView after:aView. |
|
4173 |
] |
|
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4174 |
]. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4175 |
self setContainerIn:newView. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4176 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4177 |
"Modified: 9.5.1996 / 00:47:20 / cg" |
269 | 4178 |
! |
4179 |
||
4180 |
addSubView:newView before:aView |
|
4181 |
"add a view to the collection of subviews before another view. |
|
4182 |
This makes sense, in Panels and other layout views, to enter a new |
|
4183 |
element at some defined place." |
|
4184 |
||
4185 |
subViews isNil ifTrue:[ |
|
3653 | 4186 |
subViews := OrderedCollection with:newView |
269 | 4187 |
] ifFalse:[ |
3653 | 4188 |
(subViews includesIdentical:newView) ifTrue:[ |
4189 |
self error:'trying to add a view twice' mayProceed:true. |
|
4190 |
^ self. |
|
4191 |
]. |
|
4192 |
aView isNil ifTrue:[ |
|
4193 |
subViews addFirst:newView |
|
4194 |
] ifFalse:[ |
|
4195 |
subViews add:newView before:aView. |
|
4196 |
] |
|
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4197 |
]. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4198 |
self setContainerIn:newView. |
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4199 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4200 |
"Modified: 9.5.1996 / 00:47:23 / cg" |
269 | 4201 |
! |
4202 |
||
4203 |
addSubView:aView in:bounds borderWidth:bw |
|
4204 |
"for ST-80 V2.x compatibility" |
|
4205 |
||
4206 |
aView borderWidth:bw. |
|
4207 |
self add:aView in:bounds. |
|
4208 |
! |
|
4209 |
||
1439 | 4210 |
addSubViewFirst:newView |
4211 |
"add a view to the front of the collection of subviews" |
|
4212 |
||
4213 |
subViews isNil ifTrue:[ |
|
3653 | 4214 |
subViews := OrderedCollection with:newView |
1439 | 4215 |
] ifFalse:[ |
3653 | 4216 |
(subViews includesIdentical:newView) ifTrue:[ |
4217 |
self error:'trying to add a view twice' mayProceed:true. |
|
4218 |
^ self. |
|
4219 |
]. |
|
4220 |
subViews addFirst:newView. |
|
1439 | 4221 |
]. |
4222 |
self setContainerIn:newView. |
|
4223 |
||
4224 |
"Modified: 9.5.1996 / 00:47:16 / cg" |
|
4225 |
"Created: 6.3.1997 / 18:43:38 / cg" |
|
4226 |
! |
|
4227 |
||
269 | 4228 |
component:aComponent |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4229 |
"components (i.e. gadgets or lightweight views) are being prepared. |
269 | 4230 |
Dont use this right now for non-views" |
4231 |
||
4232 |
aComponent origin:0.0@0.0 corner:1.0@1.0. |
|
4233 |
aComponent isView ifTrue:[ |
|
3152 | 4234 |
self addSubView:aComponent |
269 | 4235 |
] ifFalse:[ |
3152 | 4236 |
components := OrderedCollection with:aComponent. |
4237 |
aComponent container:self. |
|
4238 |
||
4239 |
shown ifTrue:[ |
|
4240 |
aComponent displayOn:self |
|
4241 |
] |
|
269 | 4242 |
] |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4243 |
|
683
ecc5d13f22b2
redraw new components if already visible
Claus Gittinger <cg@exept.de>
parents:
662
diff
changeset
|
4244 |
"Modified: 13.5.1996 / 21:20:29 / cg" |
269 | 4245 |
! |
4246 |
||
4247 |
destroySubViews |
|
4248 |
"remove all subviews" |
|
4249 |
||
4250 |
subViews notNil ifTrue:[ |
|
3152 | 4251 |
subViews copy do:[:aSubView | |
4252 |
aSubView destroy. |
|
4253 |
]. |
|
4254 |
||
4255 |
"/ paranoia ;-) |
|
4256 |
subViews size ~~ 0 ifTrue:[ |
|
4257 |
(self class name , ' >>View [warning]: some subView(s) did not destroy: ' , subViews printString) infoPrintCR. |
|
4258 |
subViews := nil |
|
4259 |
]. |
|
269 | 4260 |
] |
4261 |
||
4262 |
"Modified: 5.9.1995 / 22:35:36 / claus" |
|
1296 | 4263 |
"Modified: 29.1.1997 / 17:07:45 / cg" |
269 | 4264 |
! |
4265 |
||
4266 |
removeComponent:aComponent |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4267 |
"components (i.e. gadgets or lightweight views) are being prepared. |
269 | 4268 |
Dont use this right now for non-views" |
4269 |
||
4270 |
aComponent isView ifTrue:[ |
|
4834 | 4271 |
self removeSubView:aComponent |
269 | 4272 |
] ifFalse:[ |
4834 | 4273 |
components isNil ifTrue:[^self]. |
4274 |
components remove:aComponent ifAbsent:[]. |
|
4275 |
aComponent container:nil |
|
269 | 4276 |
] |
4579 | 4277 |
|
4278 |
"Modified: / 11-09-2006 / 17:14:30 / User" |
|
269 | 4279 |
! |
4280 |
||
4281 |
removeSubView:aView |
|
4282 |
"remove a view from the collection of subviews" |
|
4283 |
||
4284 |
subViews notNil ifTrue:[ |
|
3762 | 4285 |
subViews remove:aView ifAbsent:[nil]. |
4286 |
aView setContainer:nil. |
|
4287 |
||
4288 |
(subViews size == 0) ifTrue:[ |
|
4289 |
subViews := nil |
|
4290 |
] |
|
269 | 4291 |
] |
4292 |
! |
|
4293 |
||
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4294 |
setContainerIn:aView |
269 | 4295 |
"common code for addSubView* methods" |
4296 |
||
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4297 |
aView container:self. |
743 | 4298 |
(aView graphicsDevice ~~ device) ifTrue:[ |
3762 | 4299 |
'SimpleView [warning]: subview (' errorPrint. aView class name errorPrint. |
4300 |
') has different device than me (' errorPrint. |
|
4301 |
self class name errorPrint. ').' errorPrintCR. |
|
4302 |
aView device:device |
|
3616 | 4303 |
]. |
660
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4304 |
|
2ae938f29875
renamed #superView: to #container (migration towards ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
659
diff
changeset
|
4305 |
"Created: 9.5.1996 / 00:46:59 / cg" |
1172
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
4306 |
"Modified: 10.1.1997 / 18:06:49 / cg" |
269 | 4307 |
! ! |
4308 |
||
4309 |
!SimpleView methodsFor:'change & update'! |
|
4310 |
||
1437
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
4311 |
changedPreferredBounds:someArgument |
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
4312 |
"tell any dependents, that I have changed my preferred bounds; |
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
4313 |
Interface is provided mostly provided for ST80 compatibility; |
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
4314 |
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
|
4315 |
|
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
4316 |
^ self changed:#preferredExtent |
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
4317 |
|
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
4318 |
"Modified: 6.3.1997 / 16:12:02 / cg" |
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
4319 |
! |
9fb2c38adb79
added #changedPreferredBounds for compatibility
Claus Gittinger <cg@exept.de>
parents:
1432
diff
changeset
|
4320 |
|
4038
538491244f6f
preps for handling language changes
Claus Gittinger <cg@exept.de>
parents:
3968
diff
changeset
|
4321 |
languageChanged |
538491244f6f
preps for handling language changes
Claus Gittinger <cg@exept.de>
parents:
3968
diff
changeset
|
4322 |
! |
538491244f6f
preps for handling language changes
Claus Gittinger <cg@exept.de>
parents:
3968
diff
changeset
|
4323 |
|
269 | 4324 |
update:aspect with:aParameter from:changedObject |
4325 |
"an update request" |
|
4326 |
||
4327 |
aspect == #sizeOfView ifTrue:[ |
|
3762 | 4328 |
"one of the views we depend on changed its size" |
4329 |
^ self containerChangedSize. |
|
3730 | 4330 |
]. |
4331 |
super update:aspect with:aParameter from:changedObject |
|
964 | 4332 |
|
4333 |
"Modified: 19.7.1996 / 17:30:48 / cg" |
|
269 | 4334 |
! ! |
4335 |
||
4336 |
!SimpleView methodsFor:'cursor animation'! |
|
4337 |
||
4338 |
showBusyWhile:aBlock |
|
4339 |
"evaluate some time consuming block, while doing this, |
|
1943 | 4340 |
show a spinning wheel cursor. If those bitmaps are not found, |
4341 |
fallback to the standard busy cursor. |
|
4342 |
Experimental." |
|
269 | 4343 |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4344 |
|ok bitmaps cursors maskForm process oldCursor| |
269 | 4345 |
|
4346 |
oldCursor := cursor. |
|
4347 |
||
4348 |
ok := true. |
|
4834 | 4349 |
bitmaps := #('wheel1' 'wheel2' 'wheel3' 'wheel4') |
4350 |
collect:[:name | |
|
4351 |
|f| |
|
4352 |
||
4353 |
f := Smalltalk imageFromFileNamed:(name , '.xbm') forClass:self class. |
|
4354 |
f isNil ifTrue:[ |
|
4355 |
('SimpleView [warning]: no bitmap file: ' , name , '.xbm') errorPrintCR. |
|
4356 |
ok := false |
|
4357 |
]. |
|
4358 |
f |
|
4359 |
]. |
|
1141 | 4360 |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4361 |
ok ifTrue:[ |
4834 | 4362 |
maskForm := Smalltalk imageFromFileNamed:'wheelm.xbm' forClass:self class. |
4363 |
maskForm isNil ifTrue:[ |
|
4364 |
('SimpleView [warning]: no bitmap file: wheelm.xbm') errorPrintCR. |
|
4365 |
ok := false |
|
4366 |
]. |
|
269 | 4367 |
]. |
4368 |
||
4369 |
ok ifFalse:[ |
|
4834 | 4370 |
self cursor:Cursor wait. |
4371 |
aBlock ensure:[ |
|
4372 |
self cursor:oldCursor |
|
4373 |
] |
|
269 | 4374 |
] ifTrue:[ |
4834 | 4375 |
cursors := bitmaps collect:[:form | (Cursor sourceForm:form |
4376 |
maskForm:maskForm |
|
4377 |
hotX:8 |
|
4378 |
hotY:8) onDevice:device]. |
|
4379 |
||
4380 |
process := [ |
|
4381 |
Delay waitForSeconds:0.25. |
|
4382 |
[true] whileTrue:[ |
|
4383 |
cursors do:[:curs | |
|
4384 |
self cursor:curs. |
|
4385 |
Delay waitForSeconds:0.05 |
|
4386 |
] |
|
4387 |
] |
|
4388 |
] forkAt:(Processor activeProcess priority + 1). |
|
4389 |
||
4390 |
aBlock ensure:[ |
|
4391 |
process terminate. |
|
4392 |
self cursor:oldCursor |
|
4393 |
] |
|
269 | 4394 |
]. |
4395 |
||
4396 |
" |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4397 |
View new realize showBusyWhile:[ Delay waitForSeconds:5 ] |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4398 |
Transcript showBusyWhile:[ Delay waitForSeconds:5 ] |
269 | 4399 |
" |
1141 | 4400 |
|
1943 | 4401 |
"Modified: / 31.10.1997 / 19:59:49 / cg" |
269 | 4402 |
! ! |
4403 |
||
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4404 |
!SimpleView methodsFor:'dependents access'! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4405 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4406 |
addDependent:anObject |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4407 |
"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
|
4408 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4409 |
|wasBlocked| |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4410 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4411 |
wasBlocked := OperatingSystem blockInterrupts. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4412 |
[ |
3762 | 4413 |
|deps| |
4414 |
||
4415 |
deps := dependents. |
|
4416 |
"/ |
|
4417 |
"/ store the very first dependent directly in |
|
4418 |
"/ the dependents instVar |
|
4419 |
"/ |
|
4420 |
(deps isNil and:[anObject isCollection not]) ifTrue:[ |
|
4421 |
dependents := anObject |
|
4422 |
] ifFalse:[ |
|
4423 |
"/ |
|
4424 |
"/ store more dependents in the dependents collection |
|
4425 |
"/ |
|
4426 |
deps isCollection ifTrue:[ |
|
4427 |
deps add:anObject |
|
4428 |
] ifFalse:[ |
|
4429 |
deps == anObject ifFalse:[ |
|
4430 |
deps isNil ifTrue:[ |
|
4431 |
dependents := (IdentitySet with:anObject) |
|
4432 |
] ifFalse:[ |
|
4433 |
dependents := (IdentitySet with:deps with:anObject) |
|
4434 |
] |
|
4435 |
] |
|
4436 |
] |
|
4437 |
] |
|
3604
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3601
diff
changeset
|
4438 |
] ensure:[ |
3762 | 4439 |
wasBlocked ifFalse:[ |
4440 |
OperatingSystem unblockInterrupts |
|
4441 |
] |
|
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4442 |
] |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4443 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4444 |
"Modified: 8.1.1997 / 23:40:30 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4445 |
"Created: 11.6.1997 / 13:10:40 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4446 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4447 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4448 |
dependents |
2015 | 4449 |
"return a Collection of dependents" |
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4450 |
|
1938
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
4451 |
dependents isNil ifTrue:[^ #()]. |
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4452 |
dependents isCollection ifTrue:[ |
3152 | 4453 |
^ dependents |
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4454 |
]. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4455 |
^ IdentitySet with:dependents |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4456 |
|
1938
8c7584b4d61f
empty dependents are returned as an empty collection.
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
4457 |
"Created: / 11.6.1997 / 13:10:44 / cg" |
2015 | 4458 |
"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
|
4459 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4460 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4461 |
dependents:aCollection |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4462 |
"set the collection of dependents" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4463 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4464 |
|dep| |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4465 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4466 |
aCollection size == 1 ifTrue:[ |
3152 | 4467 |
dep := aCollection first. |
4468 |
dep isCollection ifFalse:[ |
|
4469 |
dependents := aCollection first. |
|
4470 |
^ self |
|
4471 |
] |
|
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4472 |
]. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4473 |
dependents := aCollection |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4474 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4475 |
"Modified: 19.4.1996 / 12:23:05 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4476 |
"Created: 11.6.1997 / 13:10:47 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4477 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4478 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4479 |
dependentsDo:aBlock |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4480 |
"evaluate aBlock for all of my dependents" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4481 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4482 |
|deps| |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4483 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4484 |
deps := dependents. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4485 |
deps notNil ifTrue:[ |
3152 | 4486 |
deps isCollection ifTrue:[ |
4487 |
deps do:aBlock |
|
4488 |
] ifFalse:[ |
|
4489 |
aBlock value:deps |
|
4490 |
] |
|
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4491 |
] |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4492 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4493 |
"Created: 11.6.1997 / 13:10:51 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4494 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4495 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4496 |
removeDependent:anObject |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4497 |
"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
|
4498 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4499 |
|wasBlocked| |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4500 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4501 |
"/ 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
|
4502 |
"/ is possibly accessed from multiple threads. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4503 |
"/ 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
|
4504 |
"/ faster execution. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4505 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4506 |
wasBlocked := OperatingSystem blockInterrupts. |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4507 |
[ |
3762 | 4508 |
|deps sz dep| |
4509 |
||
4510 |
deps := dependents. |
|
4511 |
deps notNil ifTrue:[ |
|
4512 |
deps isCollection ifTrue:[ |
|
4513 |
deps remove:anObject ifAbsent:[]. |
|
4514 |
(sz := deps size) == 0 ifTrue:[ |
|
4515 |
dependents := nil |
|
4516 |
] ifFalse:[ |
|
4517 |
sz == 1 ifTrue:[ |
|
4518 |
(dep := deps first) isCollection ifFalse:[ |
|
4519 |
dependents := dep |
|
4520 |
] |
|
4521 |
] |
|
4522 |
] |
|
4523 |
] ifFalse:[ |
|
4524 |
deps == anObject ifTrue:[ |
|
4525 |
dependents := nil |
|
4526 |
] |
|
4527 |
] |
|
4528 |
] |
|
3604
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3601
diff
changeset
|
4529 |
] ensure:[ |
3762 | 4530 |
wasBlocked ifFalse:[ |
4531 |
OperatingSystem unblockInterrupts |
|
4532 |
] |
|
1747
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4533 |
] |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4534 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4535 |
"Modified: 8.1.1997 / 23:41:39 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4536 |
"Created: 11.6.1997 / 13:11:58 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4537 |
! ! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4538 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4539 |
!SimpleView methodsFor:'dependents access (non weak)'! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4540 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4541 |
addNonWeakDependent:anObject |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4542 |
"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
|
4543 |
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
|
4544 |
forwarded to addDependent:" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4545 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4546 |
^ self addDependent:anObject |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4547 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4548 |
"Created: 11.6.1997 / 13:15:40 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4549 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4550 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4551 |
interests |
2037
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
4552 |
"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
|
4553 |
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
|
4554 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4555 |
^ self dependents |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4556 |
|
2037
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
4557 |
"Modified: / 14.10.1996 / 22:19:58 / stefan" |
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
4558 |
"Created: / 11.6.1997 / 13:15:44 / cg" |
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
4559 |
"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
|
4560 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4561 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4562 |
nonWeakDependents |
2037
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
4563 |
"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
|
4564 |
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
|
4565 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4566 |
^ self dependents |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4567 |
|
2037
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
4568 |
"Created: / 11.6.1997 / 13:15:48 / cg" |
25c7b949b117
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
2015
diff
changeset
|
4569 |
"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
|
4570 |
! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4571 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4572 |
removeNonWeakDependent:anObject |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4573 |
"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
|
4574 |
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
|
4575 |
forwarded to removeDependent:" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4576 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4577 |
^ self removeDependent:anObject |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4578 |
|
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4579 |
"Created: 11.6.1997 / 13:15:52 / cg" |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4580 |
! ! |
355fdbae0104
keep dependents locally - for faster access.
Claus Gittinger <cg@exept.de>
parents:
1743
diff
changeset
|
4581 |
|
1308 | 4582 |
!SimpleView methodsFor:'drag & drop'! |
4583 |
||
4649 | 4584 |
canDrop:aDropContext |
4585 |
"return true, if we can drop using a dropContexts information (the new drop interface). |
|
4647
a13c63aed017
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
4630
diff
changeset
|
4586 |
This method should be redefined in views which can take objects" |
a13c63aed017
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
4630
diff
changeset
|
4587 |
|
1308 | 4588 |
^ false |
1581
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
4589 |
|
4649 | 4590 |
"Modified: / 13-10-2006 / 16:05:23 / cg" |
4591 |
! |
|
4592 |
||
4593 |
canDrop:aDropContext at:positionInView |
|
4594 |
"return true, if we can drop using a dropContexts information (the new drop interface). |
|
4595 |
This method should be redefined in views which can take objects" |
|
4596 |
||
4597 |
^ self canDrop:aDropContext |
|
4598 |
||
4599 |
"Modified: / 13-10-2006 / 16:05:42 / cg" |
|
4600 |
! |
|
4601 |
||
4602 |
canDropObjects:aCollectionOfDropObjects |
|
4603 |
"return true, if we can drop aCollectionOfDropObjects (the OLD drop interface). |
|
4604 |
This method should be redefined in views which can take objects" |
|
4605 |
||
4606 |
^ false |
|
4607 |
||
4608 |
"Modified: / 13-10-2006 / 16:06:03 / cg" |
|
4609 |
! |
|
4610 |
||
4611 |
canDropObjects:aCollectionOfDropObjects at:positionInView |
|
4612 |
"return true, if we can drop aCollectionOfDropObjects (the OLD drop interface). |
|
4613 |
This method should be redefined in views which can take objects" |
|
4614 |
||
4615 |
^ self canDropObjects:aCollectionOfDropObjects |
|
4616 |
||
4617 |
"Modified: / 13-10-2006 / 16:06:15 / cg" |
|
1581
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
4618 |
! |
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
4619 |
|
3947 | 4620 |
dragAutoScroll:aContext |
4621 |
"called by the DragAndDropManager to scroll during a drag/drop operation |
|
4834 | 4622 |
if necassery (decided by the widget itself); |
4460 | 4623 |
If a scroll is done, return true otherwise false (used to restore the background). |
4624 |
By default false is returned." |
|
4625 |
||
3947 | 4626 |
^ false |
4627 |
! |
|
4628 |
||
4649 | 4629 |
drop:aDropContext |
4630 |
"drop manager wants to drop using info in aDropContext (the new drop interface). |
|
4647
a13c63aed017
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
4630
diff
changeset
|
4631 |
An error here, because this is only sent, if #canDrop: returned true; |
a13c63aed017
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
4630
diff
changeset
|
4632 |
if you redefined #canDrop: in a subclass, #drop: must also be redefined." |
a13c63aed017
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
4630
diff
changeset
|
4633 |
|
a13c63aed017
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
4630
diff
changeset
|
4634 |
self subclassResponsibility |
a13c63aed017
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
4630
diff
changeset
|
4635 |
|
4649 | 4636 |
"Modified: / 13-10-2006 / 16:07:58 / cg" |
4637 |
! |
|
4638 |
||
4639 |
drop:aDropContext at:aPoint |
|
4640 |
"drop manager wants to drop using info in aDropContext (the new drop interface). |
|
1308 | 4641 |
If I have an application, forward the request. |
4642 |
Otherwise, ignore it. This is only sent, if #canDrop: returned true; |
|
4643 |
if you redefined #canDrop: in a subclass, #drop:at: must also be redefined." |
|
4644 |
||
4649 | 4645 |
self drop:aDropContext |
4646 |
||
4647 |
"Modified: / 13-10-2006 / 16:07:41 / cg" |
|
4648 |
! |
|
4649 |
||
4650 |
dropObjects:aCollectionOfDropObjects |
|
4651 |
"someone wants to drop aCollectionOfDropObjects (the OLD drop interface). |
|
4652 |
An error here, because this is only sent, if #canDrop: returned true; |
|
4653 |
if you redefined #canDropObjects: in a subclass, #dropObjects: must also be redefined." |
|
4654 |
||
4655 |
self subclassResponsibility |
|
4656 |
||
4657 |
"Created: / 13-10-2006 / 16:06:48 / cg" |
|
4658 |
! |
|
4659 |
||
4660 |
dropObjects:aCollectionOfDropObjects at:aPoint |
|
4661 |
"someone wants to drop aCollectionOfDropObjects (the OLD drop interface). |
|
4662 |
An error here, because this is only sent, if #canDrop: returned true; |
|
4663 |
if you redefined #canDropObjects: in a subclass, #dropObjects: must also be redefined." |
|
4664 |
||
4665 |
self dropObjects:aCollectionOfDropObjects |
|
4666 |
||
4667 |
"Created: / 13-10-2006 / 16:07:03 / cg" |
|
3591 | 4668 |
! |
4669 |
||
4670 |
dropTarget |
|
4460 | 4671 |
"returns the dropTarget or nil" |
4672 |
||
4471 | 4673 |
^ dropTarget |
4674 |
! |
|
4675 |
||
4676 |
dropTarget:aDropTragetOrNil |
|
4677 |
"set the dropTarget" |
|
4678 |
||
4679 |
dropTarget := aDropTragetOrNil. |
|
1308 | 4680 |
! ! |
4681 |
||
269 | 4682 |
!SimpleView methodsFor:'edge drawing'! |
4683 |
||
4684 |
drawBottomEdge |
|
4685 |
"draw bottom 3D edge into window frame" |
|
4686 |
||
4687 |
self drawBottomEdgeLevel:level |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4688 |
shadow:shadowColor |
3152 | 4689 |
light:lightColor |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4690 |
halfShadow:nil |
3152 | 4691 |
halfLight:nil |
4692 |
style:nil. |
|
269 | 4693 |
! |
4694 |
||
4695 |
drawBottomEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle |
|
4696 |
|botFg |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4697 |
count "{ Class: SmallInteger }" |
269 | 4698 |
b r| |
4699 |
||
4700 |
count := level. |
|
4701 |
count == 0 ifTrue:[^ self]. |
|
4702 |
||
4703 |
(count < 0) ifTrue:[ |
|
3152 | 4704 |
botFg := lightColor. |
4705 |
count := count negated |
|
269 | 4706 |
] ifFalse:[ |
3152 | 4707 |
((edgeStyle == #soft) and:[level > 1]) ifTrue:[ |
4708 |
botFg := halfShadowColor |
|
4709 |
] ifFalse:[ |
|
4710 |
botFg := shadowColor |
|
4711 |
]. |
|
269 | 4712 |
]. |
4713 |
super paint:botFg. |
|
4714 |
super lineWidth:0. |
|
4715 |
||
4716 |
r := width - 1. |
|
4717 |
0 to:(count - 1) do:[:i | |
|
3152 | 4718 |
b := height - 1 - i. |
4719 |
super displayDeviceLineFromX:i y:b toX:(r - i) y:b |
|
269 | 4720 |
]. |
4721 |
||
4722 |
((edgeStyle == #soft) and:[level > 1]) ifTrue:[ |
|
3152 | 4723 |
b := height - 1. |
4724 |
super paint:shadowColor. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4725 |
super displayDeviceLineFromX:1 y:b toX:r y:b. |
1444 | 4726 |
]. |
4727 |
||
4728 |
self edgeDrawn:#bottom. |
|
4729 |
||
4730 |
"Modified: 7.3.1997 / 17:59:39 / cg" |
|
269 | 4731 |
! |
4732 |
||
4733 |
drawEdges |
|
4734 |
"draw all of my 3D edges" |
|
4735 |
||
4736 |
self drawEdgesForX:0 y:0 width:width height:height level:level |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4737 |
shadow:shadowColor |
3152 | 4738 |
light:lightColor |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4739 |
halfShadow:nil |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4740 |
halfLight:nil |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4741 |
style:nil |
269 | 4742 |
! |
4743 |
||
4744 |
drawEdgesForX:x y:y width:w height:h level:l |
|
4745 |
"draw 3D edges into a rectangle" |
|
4746 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4747 |
self |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4748 |
drawEdgesForX:x y:y width:w height:h level:l |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4749 |
shadow:shadowColor light:lightColor |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4750 |
halfShadow:nil halfLight:nil |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4751 |
style:nil |
714
2679dd9318ef
clear area under components in redraw
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
4752 |
! |
269 | 4753 |
|
4754 |
drawLeftEdge |
|
4755 |
"draw left 3D edge into window frame" |
|
4756 |
||
4757 |
self drawLeftEdgeLevel:level |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4758 |
shadow:shadowColor |
3152 | 4759 |
light:lightColor |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4760 |
halfShadow:nil |
3152 | 4761 |
halfLight:nil |
4762 |
style:nil. |
|
269 | 4763 |
! |
4764 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4765 |
drawLeftEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle |
269 | 4766 |
|leftFg leftHalfFg paint b |
4767 |
count "{ Class: SmallInteger }" | |
|
4768 |
||
4769 |
count := level. |
|
4770 |
count == 0 ifTrue:[^ self]. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4771 |
|
269 | 4772 |
(count < 0) ifTrue:[ |
3152 | 4773 |
leftFg := shadowColor. |
4774 |
leftHalfFg := halfShadowColor. |
|
4775 |
count := count negated. |
|
269 | 4776 |
] ifFalse:[ |
3152 | 4777 |
leftFg := lightColor. |
4778 |
leftHalfFg := halfLightColor. |
|
269 | 4779 |
]. |
4780 |
leftHalfFg isNil ifTrue:[ |
|
3152 | 4781 |
leftHalfFg := leftFg |
269 | 4782 |
]. |
4783 |
||
4784 |
((edgeStyle == #soft) and:[level > 0]) ifTrue:[ |
|
3152 | 4785 |
paint := leftHalfFg |
269 | 4786 |
] ifFalse:[ |
3152 | 4787 |
paint := leftFg |
269 | 4788 |
]. |
4789 |
super paint:paint. |
|
4790 |
super lineWidth:0. |
|
4791 |
||
4792 |
b := height - 1. |
|
4793 |
0 to:(count - 1) do:[:i | |
|
3152 | 4794 |
super displayDeviceLineFromX:i y:i toX:i y:(b - i) |
269 | 4795 |
]. |
4796 |
||
4797 |
((edgeStyle == #soft) and:[level > 2]) ifTrue:[ |
|
3152 | 4798 |
super paint:(device blackColor). |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4799 |
super displayDeviceLineFromX:0 y:0 toX:0 y:b. |
1444 | 4800 |
]. |
4801 |
||
4802 |
self edgeDrawn:#left. |
|
4803 |
||
4804 |
"Modified: 7.3.1997 / 17:59:53 / cg" |
|
269 | 4805 |
! |
4806 |
||
4807 |
drawRightEdge |
|
4808 |
"draw right 3D edge into window frame" |
|
4809 |
||
4810 |
self drawRightEdgeLevel:level |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4811 |
shadow:shadowColor |
3152 | 4812 |
light:lightColor |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4813 |
halfShadow:nil |
3152 | 4814 |
halfLight:nil |
4815 |
style:nil. |
|
269 | 4816 |
! |
4817 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4818 |
drawRightEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle |
269 | 4819 |
|rightFg |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4820 |
count "{ Class: SmallInteger }" |
269 | 4821 |
r b| |
4822 |
||
4823 |
count := level. |
|
4824 |
count == 0 ifTrue:[^ self]. |
|
4825 |
||
4826 |
(count < 0) ifTrue:[ |
|
3152 | 4827 |
rightFg := lightColor. |
4828 |
count := count negated |
|
269 | 4829 |
] ifFalse:[ |
3152 | 4830 |
((edgeStyle == #soft) and:[level > 1]) ifTrue:[ |
4831 |
rightFg := halfShadowColor |
|
4832 |
] ifFalse:[ |
|
4833 |
rightFg := shadowColor |
|
4834 |
]. |
|
269 | 4835 |
]. |
4836 |
super paint:rightFg. |
|
4837 |
super lineWidth:0. |
|
4838 |
||
4839 |
b := height - 1. |
|
4840 |
0 to:(count - 1) do:[:i | |
|
3152 | 4841 |
r := width - 1 - i. |
4842 |
super displayDeviceLineFromX:r y:i toX:r y:(b - i) |
|
269 | 4843 |
]. |
4844 |
((edgeStyle == #soft) and:[level > 1]) ifTrue:[ |
|
3152 | 4845 |
r := width - 1. |
4846 |
super paint:shadowColor. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4847 |
super displayDeviceLineFromX:r y:1 toX:r y:b. |
1444 | 4848 |
]. |
4849 |
||
4850 |
self edgeDrawn:#right. |
|
4851 |
||
4852 |
"Modified: 7.3.1997 / 18:00:02 / cg" |
|
269 | 4853 |
! |
4854 |
||
4855 |
drawTopEdge |
|
4856 |
"draw top 3D edge into window frame" |
|
4857 |
||
4858 |
self drawTopEdgeLevel:level |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4859 |
shadow:shadowColor |
3152 | 4860 |
light:lightColor |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4861 |
halfShadow:nil |
3152 | 4862 |
halfLight:nil |
4863 |
style:nil. |
|
269 | 4864 |
! |
4865 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4866 |
drawTopEdgeLevel:level shadow:shadowColor light:lightColor halfShadow:halfShadowColor halfLight:halfLightColor style:edgeStyle |
269 | 4867 |
|topFg topHalfFg paint r |
4868 |
count "{ Class: SmallInteger }" | |
|
4869 |
||
4870 |
count := level. |
|
4871 |
count == 0 ifTrue:[^ self]. |
|
4872 |
||
4873 |
(count < 0) ifTrue:[ |
|
3152 | 4874 |
topFg := shadowColor. |
4875 |
topHalfFg := halfShadowColor. |
|
4876 |
count := count negated |
|
269 | 4877 |
] ifFalse:[ |
3152 | 4878 |
topFg := lightColor. |
4879 |
topHalfFg := halfLightColor. |
|
269 | 4880 |
]. |
4881 |
topHalfFg isNil ifTrue:[ |
|
3152 | 4882 |
topHalfFg := topFg |
269 | 4883 |
]. |
4884 |
||
4885 |
((edgeStyle == #soft) and:[level > 0]) ifTrue:[ |
|
3152 | 4886 |
paint := topHalfFg |
269 | 4887 |
] ifFalse:[ |
3152 | 4888 |
paint := topFg |
269 | 4889 |
]. |
4890 |
super paint:paint. |
|
4891 |
super lineWidth:0. |
|
4892 |
||
4893 |
r := width - 1. |
|
4894 |
0 to:(count - 1) do:[:i | |
|
3152 | 4895 |
super displayDeviceLineFromX:i y:i toX:(r - i) y:i |
269 | 4896 |
]. |
4897 |
((edgeStyle == #soft) and:[level > 2]) ifTrue:[ |
|
3152 | 4898 |
super paint:(device blackColor). |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4899 |
super displayDeviceLineFromX:0 y:0 toX:r y:0. |
1444 | 4900 |
]. |
4901 |
||
4902 |
self edgeDrawn:#top. |
|
4903 |
||
4904 |
"Modified: 7.3.1997 / 18:00:11 / cg" |
|
269 | 4905 |
! |
4906 |
||
4907 |
redrawEdges |
|
4908 |
"redraw my edges (if any)" |
|
4909 |
||
4910 |
(level ~~ 0) ifTrue:[ |
|
3152 | 4911 |
shown ifTrue:[ |
4912 |
self clippingRectangle:nil. |
|
4913 |
self drawEdges. |
|
4914 |
self deviceClippingRectangle:innerClipRect |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
4915 |
] |
739 | 4916 |
] |
4917 |
||
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
4918 |
"Modified: / 25.5.1999 / 14:50:25 / cg" |
269 | 4919 |
! ! |
4920 |
||
4921 |
!SimpleView methodsFor:'enumerating subviews'! |
|
4922 |
||
4720 | 4923 |
allSubViewsDetect:aBlock ifNone:exceptionBlock |
4924 |
"find a subview for which aBlock returns true (recursively)" |
|
4925 |
||
4926 |
subViews notNil ifTrue:[ |
|
4834 | 4927 |
subViews do:[:aSubview | |
4928 |
|v| |
|
4929 |
||
4930 |
(aBlock value:aSubview) ifTrue:[ ^ aSubview ]. |
|
4931 |
v := aSubview allSubViewsDetect:aBlock ifNone:nil. |
|
4932 |
v notNil ifTrue:[^ v]. |
|
4933 |
] |
|
4934 |
]. |
|
4935 |
^ exceptionBlock value. |
|
4720 | 4936 |
|
4937 |
"Modified: 12.2.1997 / 12:23:38 / cg" |
|
4938 |
! |
|
4939 |
||
269 | 4940 |
allSubViewsDo:aBlock |
4941 |
"evaluate aBlock for all subviews (recursively)" |
|
4942 |
||
1335 | 4943 |
subViews notNil ifTrue:[ |
3653 | 4944 |
subViews do:[:aSubview | |
4945 |
aSubview withAllSubViewsDo:aBlock |
|
4946 |
] |
|
269 | 4947 |
] |
1335 | 4948 |
|
4949 |
"Modified: 12.2.1997 / 12:23:38 / cg" |
|
269 | 4950 |
! |
4951 |
||
1363 | 4952 |
changeSequenceOrderFor:aSubView to:anIndex |
1984 | 4953 |
"change a subview's position in the subviews collection. |
4954 |
Usually, this only affects the order of components in a panelView. |
|
1363 | 4955 |
" |
4956 |
|aView| |
|
4957 |
||
4958 |
(subViews notNil and:[subViews size >= anIndex]) ifTrue:[ |
|
3152 | 4959 |
aView := subViews remove:aSubView ifAbsent:nil. |
4960 |
||
4961 |
aView notNil ifTrue:[ |
|
4962 |
subViews add:aView beforeIndex:anIndex. |
|
4963 |
^ true |
|
4964 |
] |
|
1363 | 4965 |
]. |
4966 |
^ false |
|
4967 |
! |
|
4968 |
||
269 | 4969 |
withAllSubViewsDo:aBlock |
4970 |
"evaluate aBlock for the receiver and all subviews (recursively)" |
|
4971 |
||
4972 |
aBlock value:self. |
|
4973 |
self allSubViewsDo:aBlock |
|
135 | 4974 |
! ! |
4975 |
||
4976 |
!SimpleView methodsFor:'event handling'! |
|
4977 |
||
4455 | 4978 |
alienDrop:aCollectionOfDropObjects position:positionOrNil |
1581
45908e82a49d
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1559
diff
changeset
|
4979 |
"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
|
4980 |
|
4834 | 4981 |
|view positionInView tDelayed |
4982 |
anyNonExisting whichNonExisting checkForAnyNonExisting |
|
4654 | 4983 |
app target dropContext| |
4652 | 4984 |
|
4985 |
"/ mhmh - sometimes, the dropped file is not present. |
|
4986 |
"/ how comes ? And what should be done to avoid this ? |
|
4463
d61225317fe6
oops - must wait for a while after a drop - sigh (win32)
Claus Gittinger <cg@exept.de>
parents:
4460
diff
changeset
|
4987 |
|
d61225317fe6
oops - must wait for a while after a drop - sigh (win32)
Claus Gittinger <cg@exept.de>
parents:
4460
diff
changeset
|
4988 |
checkForAnyNonExisting := |
4834 | 4989 |
[ |
4990 |
anyNonExisting := false. |
|
4991 |
aCollectionOfDropObjects do:[:eachDropObject | |
|
4992 |
eachDropObject isFileObject ifTrue:[ |
|
4993 |
eachDropObject isDirectory ifFalse:[ |
|
4994 |
eachDropObject theObject asFilename exists ifFalse:[ |
|
4995 |
anyNonExisting := true. |
|
4996 |
whichNonExisting := eachDropObject theObject asFilename. |
|
4997 |
] |
|
4998 |
] |
|
4999 |
]. |
|
5000 |
]. |
|
5001 |
anyNonExisting |
|
5002 |
]. |
|
4463
d61225317fe6
oops - must wait for a while after a drop - sigh (win32)
Claus Gittinger <cg@exept.de>
parents:
4460
diff
changeset
|
5003 |
|
4652 | 5004 |
self withWaitCursorDo:[ |
4834 | 5005 |
tDelayed := 0. |
5006 |
checkForAnyNonExisting doWhile:[ |
|
5007 |
anyNonExisting ifTrue:[ |
|
5008 |
Delay waitForSeconds:0.3. |
|
5009 |
tDelayed := tDelayed + 0.3. |
|
5010 |
]. |
|
5011 |
anyNonExisting and:[ tDelayed <= 3]. |
|
5012 |
]. |
|
4463
d61225317fe6
oops - must wait for a while after a drop - sigh (win32)
Claus Gittinger <cg@exept.de>
parents:
4460
diff
changeset
|
5013 |
]. |
d61225317fe6
oops - must wait for a while after a drop - sigh (win32)
Claus Gittinger <cg@exept.de>
parents:
4460
diff
changeset
|
5014 |
|
d61225317fe6
oops - must wait for a while after a drop - sigh (win32)
Claus Gittinger <cg@exept.de>
parents:
4460
diff
changeset
|
5015 |
(anyNonExisting and:[checkForAnyNonExisting value]) ifTrue:[ |
4834 | 5016 |
Dialog warn:('Dropfile not present: %1' bindWith:whichNonExisting pathName). |
5017 |
^ self |
|
4463
d61225317fe6
oops - must wait for a while after a drop - sigh (win32)
Claus Gittinger <cg@exept.de>
parents:
4460
diff
changeset
|
5018 |
]. |
4455 | 5019 |
|
5020 |
view := self. |
|
5021 |
positionInView := positionOrNil. |
|
4647
a13c63aed017
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
4630
diff
changeset
|
5022 |
|
a13c63aed017
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
4630
diff
changeset
|
5023 |
app := view application. |
4649 | 5024 |
(app canDropObjects:aCollectionOfDropObjects in:view at:positionInView) ifTrue:[ |
4834 | 5025 |
app dropObjects:aCollectionOfDropObjects in:view at:positionInView. |
5026 |
^ self. |
|
4647
a13c63aed017
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
4630
diff
changeset
|
5027 |
]. |
a13c63aed017
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
4630
diff
changeset
|
5028 |
|
4455 | 5029 |
[view notNil] whileTrue:[ |
4834 | 5030 |
"new mechanism to get a dropTarget" |
5031 |
target := view dropTarget. |
|
5032 |
target notNil ifTrue:[ |
|
5033 |
dropContext := DropContext new. |
|
5034 |
dropContext dropObjects:aCollectionOfDropObjects. |
|
5035 |
dropContext dropTarget:target. |
|
5036 |
||
5037 |
(target canDrop:dropContext) ifTrue:[ |
|
5038 |
target drop:dropContext. |
|
5039 |
^ self. |
|
5040 |
]. |
|
5041 |
]. |
|
5042 |
||
5043 |
(view canDropObjects:aCollectionOfDropObjects at:positionInView) ifTrue:[ |
|
5044 |
view dropObjects:aCollectionOfDropObjects at:positionInView. |
|
5045 |
^ self. |
|
5046 |
]. |
|
5047 |
view := view superView. |
|
5048 |
positionInView := nil. |
|
1555
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
5049 |
] |
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
5050 |
|
4654 | 5051 |
"Modified: / 17-10-2006 / 18:00:46 / cg" |
1555
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
5052 |
! |
6280ab9b914d
alien drop - converts to ST/X drop
Claus Gittinger <cg@exept.de>
parents:
1544
diff
changeset
|
5053 |
|
4579 | 5054 |
buttonMultiPress:button x:x y:y |
5055 |
"button was pressed quickly again - check my components for a hit." |
|
5056 |
||
5057 |
components notNil ifTrue:[ |
|
4834 | 5058 |
self componentsContainingX:x y:y do:[:comp :cx :cy | |
5059 |
comp buttonMultiPress:button x:cx y:cy. |
|
5060 |
^ self |
|
5061 |
] |
|
4579 | 5062 |
]. |
5063 |
||
5064 |
super buttonMultiPress:button x:x y:y |
|
5065 |
||
5066 |
"Modified: / 08-05-1996 / 23:43:41 / cg" |
|
5067 |
"Created: / 13-09-2006 / 16:34:23 / User" |
|
5068 |
! |
|
5069 |
||
269 | 5070 |
buttonPress:button x:x y:y |
659 | 5071 |
"button was pressed - check my components for a hit." |
269 | 5072 |
|
5073 |
components notNil ifTrue:[ |
|
3152 | 5074 |
self componentsContainingX:x y:y do:[:comp :cx :cy | |
5075 |
comp buttonPress:button x:cx y:cy. |
|
5076 |
^ self |
|
5077 |
] |
|
140 | 5078 |
]. |
5079 |
||
269 | 5080 |
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
|
5081 |
|
659 | 5082 |
"Modified: 8.5.1996 / 23:43:41 / cg" |
5083 |
! |
|
5084 |
||
5085 |
buttonRelease:button x:x y:y |
|
5086 |
"button was released - check my components for a hit." |
|
5087 |
||
5088 |
components notNil ifTrue:[ |
|
3152 | 5089 |
self componentsContainingX:x y:y do:[:comp :cx :cy | |
5090 |
comp buttonRelease:button x:cx y:cy. |
|
5091 |
^ self |
|
5092 |
] |
|
659 | 5093 |
]. |
5094 |
||
5095 |
super buttonRelease:button x:x y:y |
|
5096 |
||
5097 |
"Modified: 8.5.1996 / 23:41:58 / cg" |
|
5098 |
"Created: 8.5.1996 / 23:43:25 / cg" |
|
193 | 5099 |
! |
5100 |
||
1544
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
5101 |
clientMessage:msgType format:msgFormat eventData:msgData |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
5102 |
"a client message - very X-specific and only useful |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
5103 |
for special applications. |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
5104 |
Ignored here" |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
5105 |
|
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
5106 |
"Created: 4.4.1997 / 18:56:52 / cg" |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
5107 |
! |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
5108 |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5109 |
closeRequest |
2216
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
5110 |
"programmatic close request" |
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
5111 |
|
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
5112 |
self destroy |
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
5113 |
|
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
5114 |
"Modified: / 3.8.1998 / 19:50:50 / cg" |
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
5115 |
! |
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
5116 |
|
140 | 5117 |
configureX:x y:y width:newWidth height:newHeight |
5118 |
"my size has changed by window manager action" |
|
5119 |
||
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
5120 |
|how anyEdge mustRedrawBottomEdge mustRedrawRightEdge p originChanged| |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
5121 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
5122 |
originChanged := (left ~= x) or:[top ~= y]. |
180 | 5123 |
|
2966 | 5124 |
left := x. |
5125 |
top := y. |
|
5126 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5127 |
(superView isNil |
180 | 5128 |
and:[drawableId notNil]) ifTrue:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5129 |
"/ have to be careful - some window managers (motif) wrap another |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5130 |
"/ view around and the reported origin is relative to that. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5131 |
"/ not relative to the screen. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5132 |
p := device translatePoint:0@0 fromView:self toView:nil. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5133 |
p := p + self borderWidth. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5134 |
left := p x. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5135 |
top := p y. |
2414 | 5136 |
]. |
5137 |
||
140 | 5138 |
((width ~~ newWidth) or:[height ~~ newHeight]) ifTrue:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5139 |
realized ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5140 |
width := newWidth. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5141 |
height := newHeight. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5142 |
self extentChangedFlag:true. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5143 |
^ self |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5144 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5145 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5146 |
((newWidth <= width) and:[newHeight <= height]) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5147 |
how := #smaller |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5148 |
] ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5149 |
((newWidth >= width) and:[newHeight >= height]) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5150 |
how := #larger |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5151 |
] |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5152 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5153 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5154 |
level ~~ 0 ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5155 |
mustRedrawBottomEdge := newHeight < height. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5156 |
mustRedrawRightEdge := newWidth < width. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5157 |
anyEdge := mustRedrawBottomEdge or:[mustRedrawRightEdge] |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5158 |
] ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5159 |
anyEdge := false |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5160 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5161 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5162 |
width := newWidth. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5163 |
height := newHeight. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5164 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5165 |
"recompute inner-clip if needed" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5166 |
self setInnerClip. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5167 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5168 |
" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5169 |
must first process pending exposes; |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5170 |
otherwise, those may be drawn at a wrong position |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5171 |
" |
971 | 5172 |
"/ claus: no; expose events are in the same queue as configure events; |
5173 |
"/ which is exactly for that reason ... |
|
5174 |
||
5175 |
"/ windowGroup notNil ifTrue:[ |
|
5176 |
"/ windowGroup processExposeEvents |
|
5177 |
"/ ]. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5178 |
self sizeChanged:how. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5179 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5180 |
(anyEdge and:[shown]) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5181 |
mustRedrawBottomEdge ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5182 |
self invalidateDeviceRectangle:((0 @ (height-1-margin)) extent:width@margin) repairNow:false. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5183 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5184 |
mustRedrawRightEdge ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5185 |
self invalidateDeviceRectangle:((width-1-margin)@0 extent:margin@height) repairNow:false. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5186 |
]. |
2821
8eda25202d32
async border redraw when size changes
Claus Gittinger <cg@exept.de>
parents:
2816
diff
changeset
|
5187 |
"/ OLD code: |
8eda25202d32
async border redraw when size changes
Claus Gittinger <cg@exept.de>
parents:
2816
diff
changeset
|
5188 |
"/ self clippingRectangle:nil. |
8eda25202d32
async border redraw when size changes
Claus Gittinger <cg@exept.de>
parents:
2816
diff
changeset
|
5189 |
"/ mustRedrawBottomEdge ifTrue:[ |
8eda25202d32
async border redraw when size changes
Claus Gittinger <cg@exept.de>
parents:
2816
diff
changeset
|
5190 |
"/ self drawBottomEdge |
8eda25202d32
async border redraw when size changes
Claus Gittinger <cg@exept.de>
parents:
2816
diff
changeset
|
5191 |
"/ ]. |
8eda25202d32
async border redraw when size changes
Claus Gittinger <cg@exept.de>
parents:
2816
diff
changeset
|
5192 |
"/ mustRedrawRightEdge ifTrue:[ |
8eda25202d32
async border redraw when size changes
Claus Gittinger <cg@exept.de>
parents:
2816
diff
changeset
|
5193 |
"/ self drawRightEdge |
8eda25202d32
async border redraw when size changes
Claus Gittinger <cg@exept.de>
parents:
2816
diff
changeset
|
5194 |
"/ ]. |
8eda25202d32
async border redraw when size changes
Claus Gittinger <cg@exept.de>
parents:
2816
diff
changeset
|
5195 |
"/ self deviceClippingRectangle:innerClipRect |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5196 |
] |
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
5197 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
5198 |
|
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
5199 |
originChanged ifTrue:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5200 |
self changed:#origin. |
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
5201 |
]. |
739 | 5202 |
|
3518
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
5203 |
"Modified: / 10.10.2001 / 14:14:19 / cg" |
138 | 5204 |
! |
5205 |
||
964 | 5206 |
containerChangedSize |
5207 |
"my container has changed size; if I have relative |
|
5208 |
origin/extent or blocks to evaluate, do it now .." |
|
5209 |
||
1063 | 5210 |
|oldWidth oldHeight oldTop oldLeft newExt newOrg r| |
964 | 5211 |
|
5212 |
oldWidth := width. |
|
5213 |
oldHeight := height. |
|
5214 |
oldTop := top. |
|
5215 |
oldLeft := left. |
|
5216 |
||
5217 |
" |
|
5218 |
slowly migrating to use layoutObjects ... |
|
5219 |
" |
|
5220 |
layout isNil ifTrue:[ |
|
3762 | 5221 |
newOrg := self computeOrigin. |
5222 |
newExt := self computeExtent. |
|
964 | 5223 |
] ifFalse:[ |
3762 | 5224 |
r := (layout rectangleRelativeTo:(superView viewRectangle) |
5225 |
preferred:[self preferredBounds]). |
|
5226 |
newOrg := r origin rounded. |
|
5227 |
newExt := r extent rounded. |
|
964 | 5228 |
"/ newOrg printNL. |
5229 |
"/ newExt printNL. |
|
5230 |
]. |
|
5231 |
||
3394
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
5232 |
"/ newOrg notNil ifTrue:[ |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
5233 |
"/ ((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
|
5234 |
"/ newOrg := nil |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
5235 |
"/ ] |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
5236 |
"/ ]. |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
5237 |
"/ newExt notNil ifTrue:[ |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
5238 |
"/ ((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
|
5239 |
"/ newExt := nil |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
5240 |
"/ ] |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
5241 |
"/ ]. |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
5242 |
"/ |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
5243 |
"/ newExt isNil ifTrue:[ |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
5244 |
"/ newOrg notNil ifTrue:[ |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
5245 |
"/ self pixelOrigin:newOrg |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
5246 |
"/ ] |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
5247 |
"/ ] ifFalse:[ |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
5248 |
"/ newOrg isNil ifTrue:[ |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
5249 |
"/ self pixelExtent:newExt |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
5250 |
"/ ] ifFalse:[ |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
5251 |
"/ 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
|
5252 |
"/ ] |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
5253 |
"/ ] |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
5254 |
self pixelOrigin:newOrg extent:newExt |
964 | 5255 |
|
5256 |
"Modified: 19.7.1996 / 17:32:50 / cg" |
|
5257 |
! |
|
5258 |
||
5259 |
containerMapped |
|
5260 |
"my container was mapped (became visible). |
|
5261 |
If I was previously realized, this implies that I myself |
|
5262 |
am now mapped as well." |
|
5263 |
||
5264 |
"/ if I was not previously shown, tell it to all of |
|
5265 |
"/ my subviews (they remember this in the shown instVar) |
|
5266 |
||
5267 |
realized ifTrue:[ |
|
3152 | 5268 |
shown ifFalse:[ |
964 | 5269 |
"/ old: |
5270 |
"/ shown := true. |
|
5271 |
"/ subViews notNil ifTrue:[ |
|
5272 |
"/ subViews do:[:v | |
|
5273 |
"/ v containerMapped |
|
5274 |
"/ ] |
|
5275 |
"/ ] |
|
5276 |
||
5277 |
"/ which is equivalent to: |
|
3152 | 5278 |
self mapped. |
5279 |
] |
|
964 | 5280 |
]. |
5281 |
||
5282 |
"Modified: 30.5.1996 / 11:41:02 / cg" |
|
5283 |
"Created: 19.7.1996 / 17:41:10 / cg" |
|
5284 |
! |
|
5285 |
||
5286 |
containerUnmapped |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5287 |
"my container was unmapped |
964 | 5288 |
- this implies that the recevier is now also unmapped." |
5289 |
||
5290 |
"/ if I was previously shown, tell it to all of |
|
5291 |
"/ my subviews (they remember this in the shown instVar) |
|
5292 |
||
5293 |
realized ifTrue:[ |
|
3152 | 5294 |
shown ifTrue:[ |
5295 |
self unmapped |
|
5296 |
] |
|
964 | 5297 |
] |
5298 |
||
5299 |
"Modified: 30.5.1996 / 11:41:25 / cg" |
|
5300 |
"Created: 19.7.1996 / 17:43:50 / cg" |
|
5301 |
! |
|
5302 |
||
269 | 5303 |
destroyed |
5304 |
"view has been destroyed by someone else (usually window system)" |
|
5305 |
||
5306 |
shown := false. |
|
5307 |
super destroyed |
|
3183
e55c249cd6e5
kludge: remove objectAttributes when destroyed.
Claus Gittinger <cg@exept.de>
parents:
3182
diff
changeset
|
5308 |
|
e55c249cd6e5
kludge: remove objectAttributes when destroyed.
Claus Gittinger <cg@exept.de>
parents:
3182
diff
changeset
|
5309 |
"Modified: / 18.2.2000 / 11:20:34 / cg" |
269 | 5310 |
! |
5311 |
||
4460 | 5312 |
dropMessage:dropTypeSymbol data:dropValue position:dropPosition handle:dropHandle |
4455 | 5313 |
"a drop from some other window (X: DND or Win32 drag&drop). |
1544
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
5314 |
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
|
5315 |
|
1559 | 5316 |
|dropObjects| |
5317 |
||
4834 | 5318 |
(dropTypeSymbol == WindowEvent dropType_file |
4647
a13c63aed017
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
4630
diff
changeset
|
5319 |
or:[dropTypeSymbol == WindowEvent dropType_directory]) ifTrue:[ |
4834 | 5320 |
dropObjects := Array with:(DropObject newFile:dropValue) |
1559 | 5321 |
] ifFalse:[ |
4834 | 5322 |
dropTypeSymbol == WindowEvent dropType_files ifTrue:[ |
5323 |
dropObjects := (dropValue collect:[:fn | DropObject newFile:fn]) |
|
5324 |
] ifFalse:[ |
|
5325 |
dropTypeSymbol == WindowEvent dropType_text ifTrue:[ |
|
5326 |
dropObjects := Array with:(DropObject newText:dropValue) |
|
5327 |
] ifFalse:[ |
|
5328 |
dropObjects := Array with:(DropObject new:dropValue) |
|
5329 |
] |
|
5330 |
] |
|
4455 | 5331 |
]. |
5332 |
||
4460 | 5333 |
"/ Transcript showCR:'Drop:'. |
5334 |
"/ Transcript show:' View:'; showCR:self. |
|
5335 |
"/ Transcript show:' Position:'; showCR:dropPosition. |
|
5336 |
"/ Transcript show:' Data:'; showCR:dropObjects. |
|
5337 |
||
5338 |
self alienDrop:dropObjects position:dropPosition. |
|
5339 |
device dragFinish:dropHandle. |
|
1559 | 5340 |
|
4647
a13c63aed017
drop: canDrop:at:/drop:at: now invoke canDrop:/drop:;
Claus Gittinger <cg@exept.de>
parents:
4630
diff
changeset
|
5341 |
"Modified: / 13-10-2006 / 10:10:23 / cg" |
1544
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
5342 |
! |
4b78320b98fe
dummy client- and dropMessage handling
Claus Gittinger <cg@exept.de>
parents:
1524
diff
changeset
|
5343 |
|
135 | 5344 |
exposeX:x y:y width:w height:h |
5345 |
"a low level redraw event from device |
|
5346 |
- let subclass handle the redraw and take care of edges here" |
|
5347 |
||
3340 | 5348 |
|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
|
5349 |
|
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5350 |
shown ifFalse:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5351 |
^ self |
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5352 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5353 |
|
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5354 |
nw := dw := w. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5355 |
nh := dh := h. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5356 |
nx := dx := x. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5357 |
ny := dy := y. |
135 | 5358 |
|
5359 |
anyEdge := false. |
|
5360 |
||
5361 |
" |
|
5362 |
check if there is a need to draw an edge (i.e. if margin is hit) |
|
5363 |
" |
|
5364 |
(margin ~~ 0) ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5365 |
leftEdge := false. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5366 |
topEdge := false. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5367 |
rightEdge := false. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5368 |
botEdge := false. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5369 |
transformation notNil ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5370 |
" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5371 |
need device coordinates for this test |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5372 |
" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5373 |
nx := transformation applyToX:nx. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5374 |
ny := transformation applyToY:ny. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5375 |
nw := transformation applyScaleX:nw. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5376 |
nh := transformation applyScaleY:nh. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5377 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5378 |
" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5379 |
adjust expose rectangle, to exclude the margin. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5380 |
Care for rounding errors ... |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5381 |
" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5382 |
(nx isMemberOf:SmallInteger) ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5383 |
old := nx. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5384 |
nx := nx truncated. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5385 |
nw := nw + (nx - old). |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5386 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5387 |
(ny isMemberOf:SmallInteger) ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5388 |
old := ny. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5389 |
ny := ny truncated. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5390 |
nh := nh + (ny - old). |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5391 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5392 |
(nw isMemberOf:SmallInteger) ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5393 |
nw := nw truncated + 1 |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5394 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5395 |
(nh isMemberOf:SmallInteger) ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5396 |
nh := nh truncated + 1 |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5397 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5398 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5399 |
dx := nx. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5400 |
dy := ny. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5401 |
dw := nw. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5402 |
dh := nh. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5403 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5404 |
(nx < margin) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5405 |
old := nx. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5406 |
nx := margin. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5407 |
nw := nw - (nx - old). |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5408 |
leftEdge := anyEdge := true. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5409 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5410 |
((nx + nw - 1) >= (width - margin)) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5411 |
nw := (width - margin - nx). |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5412 |
rightEdge := anyEdge := true. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5413 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5414 |
(ny < margin) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5415 |
old := ny. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5416 |
ny := margin. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5417 |
nh := nh - (ny - old). |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5418 |
topEdge := anyEdge := true. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5419 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5420 |
((ny + nh - 1) >= (height - margin)) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5421 |
nh := (height - margin - ny). |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5422 |
botEdge := anyEdge := true. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5423 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5424 |
transformation notNil ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5425 |
" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5426 |
need logical coordinates for redraw |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5427 |
" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5428 |
nx := transformation applyInverseToX:nx. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5429 |
ny := transformation applyInverseToY:ny. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5430 |
nw := transformation applyInverseScaleX:nw. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5431 |
nh := transformation applyInverseScaleY:nh. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5432 |
]. |
135 | 5433 |
]. |
5434 |
||
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5435 |
(nw > 0 and:[nh > 0]) ifTrue:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5436 |
" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5437 |
redraw inside area |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5438 |
" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5439 |
self clippingRectangle:(Rectangle left:nx top:ny width:nw height:nh). |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5440 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5441 |
device supportsAnyViewBackgroundPixmaps ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5442 |
"/ workaround: non-existing bg-pixmap support (win95) |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5443 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5444 |
viewBackground isImageOrForm ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5445 |
(device supportsViewBackgroundPixmap:viewBackground) ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5446 |
self fillRectangleWithViewBackgroundX:nx y:ny width:nw height:nh |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5447 |
] |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5448 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5449 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5450 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5451 |
self redrawX:nx y:ny width:nw height:nh. |
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
5452 |
]. |
135 | 5453 |
|
5454 |
" |
|
5455 |
redraw edge(s) |
|
5456 |
" |
|
5457 |
anyEdge ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5458 |
self deviceClippingRectangle:nil. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5459 |
oldPaint := paint. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5460 |
(topEdge and:[leftEdge and:[botEdge and:[rightEdge]]]) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5461 |
self drawEdges |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5462 |
] ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5463 |
topEdge ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5464 |
self drawTopEdge |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5465 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5466 |
leftEdge ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5467 |
self drawLeftEdge |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5468 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5469 |
botEdge ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5470 |
self drawBottomEdge |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5471 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5472 |
rightEdge ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5473 |
self drawRightEdge |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5474 |
] |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5475 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5476 |
self paint:oldPaint. |
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5477 |
]. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5478 |
self deviceClippingRectangle:innerClipRect. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5479 |
|
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
5480 |
"Modified: / 25.5.1999 / 14:57:38 / cg" |
135 | 5481 |
! |
5482 |
||
269 | 5483 |
focusIn |
2506 | 5484 |
"got keyboard focus (via the window manager). |
5485 |
Nothing done here" |
|
5486 |
||
269 | 5487 |
! |
5488 |
||
5489 |
focusOut |
|
2506 | 5490 |
"lost keyboard focus (via the window manager). |
5491 |
Nothing done here" |
|
269 | 5492 |
! |
5493 |
||
5494 |
hasKeyboardFocus:aBoolean |
|
2506 | 5495 |
"notification from the windowGroup that I got the keyboardFocus." |
5496 |
||
5497 |
delegate notNil ifTrue:[ |
|
3152 | 5498 |
delegate perform:#hasKeyboardFocus: with:aBoolean ifNotUnderstood:nil |
2506 | 5499 |
]. |
140 | 5500 |
^ self |
5501 |
! |
|
5502 |
||
5503 |
keyPress:key x:x y:y |
|
5504 |
"a key has been pressed. If there are components, |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5505 |
pass it to the corresponding one. |
140 | 5506 |
Otherwise, forward it to the superview, if there is any." |
5507 |
||
510 | 5508 |
<resource: #keyboard ( #Menu ) > |
5509 |
||
3247
d6e631975bd1
forward Menu-key (CMD-Z) to focusView if there is one.
Claus Gittinger <cg@exept.de>
parents:
3242
diff
changeset
|
5510 |
|focusView| |
d6e631975bd1
forward Menu-key (CMD-Z) to focusView if there is one.
Claus Gittinger <cg@exept.de>
parents:
3242
diff
changeset
|
5511 |
|
140 | 5512 |
components notNil ifTrue:[ |
3367 | 5513 |
components notNil ifTrue:[ |
5514 |
self componentsContainingX:x y:y do:[:comp :cx :cy | |
|
5515 |
comp keyPress:key x:cx y:cy. |
|
5516 |
^ self |
|
5517 |
] |
|
5518 |
]. |
|
490
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
5519 |
]. |
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
5520 |
|
494 | 5521 |
key == #Menu ifTrue:[ |
3367 | 5522 |
((focusView := self windowGroup focusView) notNil |
5523 |
and:[focusView ~~ self]) |
|
5524 |
ifTrue:[ |
|
5525 |
"/ forward to the focusView |
|
5526 |
focusView keyPress:key x:-1 y:-1. |
|
5527 |
^ self |
|
5528 |
]. |
|
5529 |
^ self activateMenu. |
|
135 | 5530 |
]. |
5531 |
||
490
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
5532 |
x isNil ifTrue:[ |
3367 | 5533 |
"/ already redelegated, but nowhere handled |
5534 |
superView notNil ifTrue:[ |
|
5535 |
superView keyPress:key x:nil y:nil. |
|
5536 |
]. |
|
5537 |
^ self |
|
490
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
5538 |
]. |
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
5539 |
|
1d2ed059a063
delegated keyboardMessages get nil as x/y
Claus Gittinger <cg@exept.de>
parents:
489
diff
changeset
|
5540 |
superView notNil ifTrue:[ |
3367 | 5541 |
superView |
5542 |
dispatchEvent:#keyPress:x:y: |
|
5543 |
arguments:(Array with:key with:0 with:0) |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5544 |
|
2127 | 5545 |
"/ WindowEvent |
5546 |
"/ sendEvent:#keyPress:x:y: |
|
5547 |
"/ arguments:(Array with:key with:0 with:0) |
|
5548 |
"/ view:superView |
|
411
2d5deb02d8f8
if not already forwarded, let keyEvents be handled by superView
Claus Gittinger <cg@exept.de>
parents:
393
diff
changeset
|
5549 |
] ifFalse:[ |
3367 | 5550 |
super keyPress:key x:x y:y |
135 | 5551 |
] |
411
2d5deb02d8f8
if not already forwarded, let keyEvents be handled by superView
Claus Gittinger <cg@exept.de>
parents:
393
diff
changeset
|
5552 |
|
2127 | 5553 |
"Modified: / 20.5.1998 / 22:55:08 / cg" |
659 | 5554 |
! |
5555 |
||
5556 |
keyRelease:key x:x y:y |
|
5557 |
"a key has been released. If there are components, |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5558 |
pass it to the corresponding one. |
659 | 5559 |
Otherwise, do whatever my superclass would do." |
5560 |
||
5561 |
components notNil ifTrue:[ |
|
3152 | 5562 |
components notNil ifTrue:[ |
5563 |
self componentsContainingX:x y:y do:[:comp :cx :cy | |
|
5564 |
comp keyRelease:key x:cx y:cy. |
|
5565 |
^ self |
|
5566 |
] |
|
5567 |
]. |
|
659 | 5568 |
]. |
5569 |
||
5570 |
super keyRelease:key x:x y:y |
|
5571 |
||
5572 |
"Modified: 8.5.1996 / 23:44:36 / cg" |
|
5573 |
"Created: 8.5.1996 / 23:45:28 / cg" |
|
135 | 5574 |
! |
5575 |
||
269 | 5576 |
mapped |
5577 |
"the view has been mapped (by some outside |
|
5578 |
action - i.e. window manager de-iconified me)" |
|
5579 |
||
5580 |
" |
|
5581 |
the old code was: |
|
5582 |
||
3152 | 5583 |
realized := true. |
5584 |
shown := true. |
|
5585 |
... |
|
269 | 5586 |
|
5587 |
this created a race condition, if the view was |
|
5588 |
realized and shortly after unrealized - before the mapped event |
|
1379 | 5589 |
arrived. This lead to realized being set to true even thought the |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5590 |
view was not. |
1379 | 5591 |
Boy - that was a bad one (hard to reproduce and hard to find). |
269 | 5592 |
" |
5593 |
||
5594 |
realized ifTrue:[ |
|
769 | 5595 |
|
3152 | 5596 |
"/ currently, the 'shown ifFalse:' optimization is |
5597 |
"/ not ok, since 'shown' is also modified by visibilityChanges. |
|
5598 |
"/ Also, when remapped, X11 only sends a mapped event for the topView. |
|
5599 |
"/ Therefore, synthetically generate those #superViewMapped messages |
|
5600 |
"/ in any case. |
|
5601 |
||
5602 |
shown := true. |
|
5603 |
" |
|
5604 |
backed views will not get expose events - have |
|
5605 |
to force a redraw here to get things drawn into |
|
5606 |
backing store. |
|
5607 |
" |
|
5608 |
backed ifTrue:[ |
|
5609 |
self redrawX:0 y:0 width:width height:height |
|
5610 |
]. |
|
5611 |
||
5612 |
"/ tell my subViews ... |
|
5613 |
subViews notNil ifTrue:[ |
|
5614 |
subViews do:[:v | v mapped |
|
2721 | 5615 |
"/ v shown ifFalse:[ |
5616 |
"/ v mapped |
|
5617 |
"/ ] |
|
3152 | 5618 |
] |
5619 |
]. |
|
5620 |
self changed:#visibility. |
|
269 | 5621 |
] |
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5622 |
|
1379 | 5623 |
"Modified: 25.2.1997 / 22:41:34 / cg" |
269 | 5624 |
! |
5625 |
||
2733
5af2417bc450
pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents:
2727
diff
changeset
|
5626 |
mouseWheelMotion:buttonState x:x y:y amount:amount deltaTime:dTime |
2701 | 5627 |
"the mouseWheel was turned - handle as a scroll operation. |
5628 |
Specialized application windows may redefine this for any other |
|
2709 | 5629 |
operation. |
5630 |
Here, we scroll some amount which depends upon the views contents height |
|
5631 |
(but never too much); |
|
5632 |
if shift is pressed, always scroll a single scroll-step; |
|
5633 |
if ctrl is pressed, always scroll one page." |
|
5634 |
||
4674 | 5635 |
|pageScroll amountToScroll sensor| |
2709 | 5636 |
|
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5637 |
sensor := self sensor. |
4855 | 5638 |
pageScroll := sensor ctrlDown. |
2709 | 5639 |
|
5640 |
pageScroll ifFalse:[ |
|
4907 | 5641 |
amountToScroll := self verticalScrollStep. |
5642 |
sensor shiftDown ifFalse:[ |
|
5643 |
amountToScroll := self scaleMouseWheelScrollAmount:amountToScroll. |
|
5644 |
] |
|
2709 | 5645 |
]. |
2701 | 5646 |
|
2699 | 5647 |
amount > 0 ifTrue:[ |
4907 | 5648 |
pageScroll ifTrue:[ |
5649 |
self pageUp |
|
5650 |
] ifFalse:[ |
|
5651 |
self scrollUp:amountToScroll |
|
5652 |
] |
|
2699 | 5653 |
] ifFalse:[ |
4907 | 5654 |
pageScroll ifTrue:[ |
5655 |
self pageDown |
|
5656 |
] ifFalse:[ |
|
5657 |
self scrollDown:amountToScroll |
|
5658 |
] |
|
2709 | 5659 |
]. |
5660 |
||
5661 |
"Modified: / 21.5.1999 / 19:58:42 / cg" |
|
2699 | 5662 |
! |
5663 |
||
1381 | 5664 |
pointerEnter:state x:x y:y |
3087 | 5665 |
"mouse pointer entered - request the keyboard focus (sometimes)" |
5666 |
||
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5667 |
|doRequestFocus| |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5668 |
|
4968 | 5669 |
"/ first ask my flags if its enforced or forbidden |
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5670 |
self requestFocusOnPointerEnter ifTrue:[ |
4968 | 5671 |
doRequestFocus := true |
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5672 |
] ifFalse:[ |
4968 | 5673 |
self doNotRequestFocusOnPointerEnter ifTrue:[ |
5674 |
doRequestFocus := false |
|
5675 |
] ifFalse:[ |
|
5676 |
"/ then look for the settings. |
|
5677 |
doRequestFocus := self wantsFocusWithPointerEnter |
|
5678 |
] |
|
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5679 |
]. |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5680 |
|
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
5681 |
doRequestFocus ifTrue:[ |
4968 | 5682 |
self requestFocus. |
5683 |
]. |
|
1381 | 5684 |
! |
5685 |
||
269 | 5686 |
reparented |
5687 |
"the view has changed its parent by some outside |
|
5688 |
action - i.e. window manager has added a frame. |
|
5689 |
nothing done here" |
|
5690 |
||
5691 |
^ self |
|
5692 |
! |
|
5693 |
||
5694 |
saveAndTerminate |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5695 |
"window manager wants me to save and go away; |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5696 |
- notice, that not all window managers are nice enough to |
269 | 5697 |
send this event, but simply destroy the view instead. |
5698 |
Can be redefined in subclasses to do whatever is required |
|
5699 |
to prepare for restart." |
|
5700 |
||
2216
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
5701 |
self closeRequest |
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
5702 |
|
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
5703 |
"Modified: / 3.8.1998 / 19:51:26 / cg" |
269 | 5704 |
! |
5705 |
||
4674 | 5706 |
scaleMouseWheelScrollAmount:amountToScroll |
4739 | 5707 |
|hCont factor innerHeight| |
5708 |
||
5709 |
"/ test whether innerHeight == 0 |
|
4855 | 5710 |
"/ could happen if the view is resized to 0 (panel) |
4739 | 5711 |
innerHeight := self innerHeight. |
5712 |
innerHeight > 0 ifFalse:[ ^ 1 ]. |
|
4674 | 5713 |
|
5714 |
hCont := self heightOfContents. |
|
4739 | 5715 |
hCont > (innerHeight * 3) ifTrue:[ |
4907 | 5716 |
factor := (hCont // innerHeight) min:4. |
5717 |
^ amountToScroll * factor. |
|
4834 | 5718 |
]. |
5719 |
^ amountToScroll |
|
4674 | 5720 |
! |
5721 |
||
269 | 5722 |
sizeChanged:how |
5723 |
"tell subviews if I change size. |
|
5724 |
How is either #smaller, #larger or nil, and is used to control the order, |
|
5725 |
in which subviews are notified (possibly reducing redraw activity)" |
|
5726 |
||
1290
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
5727 |
|subViews| |
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
5728 |
|
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
5729 |
(subViews := self subViews) notNil ifTrue:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5730 |
(how isNil "false" |
3152 | 5731 |
or:[how == #smaller]) ifTrue:[ |
5732 |
subViews do:[:view | |
|
5733 |
view notNil ifTrue:[ |
|
5734 |
view containerChangedSize |
|
5735 |
] |
|
5736 |
] |
|
5737 |
] ifFalse:[ |
|
5738 |
"doing it reverse speeds up resizing - usually subviews |
|
5739 |
are created from top-left to bottom-right; therefore |
|
5740 |
bottom-right views will be moved/resized first, then top-left ones; |
|
5741 |
this avoids multiple redraws of subviews" |
|
5742 |
||
5743 |
subViews reverseDo:[:view | |
|
5744 |
view notNil ifTrue:[ |
|
5745 |
view containerChangedSize |
|
5746 |
] |
|
5747 |
] |
|
5748 |
] |
|
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5749 |
]. |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5750 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5751 |
components notNil ifTrue:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5752 |
(how isNil "false" |
3152 | 5753 |
or:[how == #smaller]) ifTrue:[ |
5754 |
components do:[:view | |
|
5755 |
view containerChangedSize |
|
5756 |
] |
|
5757 |
] ifFalse:[ |
|
5758 |
"doing it reverse speeds up resizing - usually subviews |
|
5759 |
are created from top-left to bottom-right; therefore |
|
5760 |
bottom-right views will be moved/resized first, then top-left ones; |
|
5761 |
this avoids multiple redraws of subviews" |
|
5762 |
||
5763 |
components reverseDo:[:view | |
|
5764 |
view containerChangedSize |
|
5765 |
] |
|
5766 |
] |
|
135 | 5767 |
]. |
1290
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
5768 |
|
269 | 5769 |
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
|
5770 |
|
269 | 5771 |
superView notNil ifTrue:[ |
3152 | 5772 |
superView subViewChangedSize |
269 | 5773 |
] |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
5774 |
|
2084
e997f6ea54c2
also pass down #larger to sizeCanged: method.
Claus Gittinger <cg@exept.de>
parents:
2061
diff
changeset
|
5775 |
"Modified: / 2.4.1998 / 13:59:59 / cg" |
269 | 5776 |
! |
5777 |
||
5778 |
subViewChangedSize |
|
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
5779 |
"some subview has changed its size; we are not interested |
269 | 5780 |
in that here, but some geometry managers redefine this, to reorganize |
5781 |
components if that happens." |
|
5782 |
||
5783 |
^ self |
|
5784 |
||
5785 |
"Created: 22.9.1995 / 14:44:59 / claus" |
|
5786 |
! |
|
5787 |
||
5788 |
terminate |
|
5789 |
"window manager wants me to go away; |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5790 |
- notice, that not all window managers are nice enough to |
269 | 5791 |
send this event, but simply destroy the view instead. |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5792 |
Can be redefined in subclasses to do whatever cleanup is |
269 | 5793 |
required." |
5794 |
||
2216
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
5795 |
self closeRequest |
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
5796 |
|
a9d902b2cc4b
#terminate -> #closeRequest -> #destroy
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
5797 |
"Modified: / 3.8.1998 / 19:51:23 / cg" |
269 | 5798 |
! |
5799 |
||
5800 |
unmapped |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5801 |
"the view has been unmapped |
269 | 5802 |
(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
|
5803 |
or due to unmapping of my parentView)." |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5804 |
|
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5805 |
"/ 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
|
5806 |
"/ my subviews (they remember this in the shown instVar) |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
5807 |
|
769 | 5808 |
"/ currently, the 'shown ifTrue:' optimization is |
964 | 5809 |
"/ not ok, since 'shown' is also modified by visibilityChanges. |
5810 |
"/ Also, when remapped, X11 only sends a mapped event for the topView. |
|
769 | 5811 |
"/ Therefore, synthetically generate those #superViewUnmapped messages |
5812 |
"/ in any case. |
|
4736 | 5813 |
|wdgr| |
769 | 5814 |
|
1379 | 5815 |
shown := false. |
4736 | 5816 |
(wdgr := self windowGroup) notNil ifTrue:[ |
4834 | 5817 |
wdgr focusView == self ifTrue:[ |
5818 |
wdgr focusViewUnmapped. |
|
5819 |
]. |
|
4736 | 5820 |
]. |
5821 |
||
1379 | 5822 |
subViews notNil ifTrue:[ |
4834 | 5823 |
subViews do:[:v | |
5824 |
v containerUnmapped |
|
5825 |
]. |
|
5826 |
self changed:#visibility. |
|
1379 | 5827 |
] |
5828 |
||
5829 |
"Modified: 25.2.1997 / 22:40:52 / cg" |
|
135 | 5830 |
! |
5831 |
||
5832 |
visibilityChange:how |
|
5833 |
"the visibility of the view has changed (by some outside |
|
5834 |
action - i.e. window manager rearranged things). |
|
5835 |
Using this knowledge avoids useless redraw in obsucred views." |
|
5836 |
||
5837 |
how == #fullyObscured ifTrue:[ |
|
3152 | 5838 |
shown := false |
135 | 5839 |
] ifFalse:[ |
3152 | 5840 |
shown := true. |
135 | 5841 |
] |
3139 | 5842 |
! |
5843 |
||
5844 |
visibilityStateChanged |
|
5845 |
"this is called when our visibilityChannel changes" |
|
5846 |
||
3410 | 5847 |
self isVisible:visibilityChannel value |
4833
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5848 |
! |
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5849 |
|
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5850 |
win32NativeScroll:scrollCode position:newPosition |
4834 | 5851 |
"this is generated by a native scrollBar widget. |
5852 |
We should never arrive here, as its only supposed to be |
|
5853 |
sent to scrollableViews..." |
|
4833
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5854 |
|
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5855 |
scrollCode == #SB_LINEDOWN ifTrue:[ |
4834 | 5856 |
self scrollDown. |
5857 |
^ self. |
|
4833
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5858 |
]. |
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5859 |
scrollCode == #SB_LINEUP ifTrue:[ |
4834 | 5860 |
self scrollUp. |
5861 |
^ self. |
|
4833
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5862 |
]. |
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5863 |
scrollCode == #SB_LINELEFT ifTrue:[ |
4834 | 5864 |
self scrollLeft. |
5865 |
^ self. |
|
4833
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5866 |
]. |
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5867 |
scrollCode == #SB_LINERIGHT ifTrue:[ |
4834 | 5868 |
self scrollRight. |
5869 |
^ self. |
|
4833
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5870 |
]. |
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5871 |
scrollCode == #SB_PAGEDOWN ifTrue:[ |
4834 | 5872 |
self pageDown. |
5873 |
^ self. |
|
4833
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5874 |
]. |
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5875 |
scrollCode == #SB_PAGEUP ifTrue:[ |
4834 | 5876 |
self pageUp. |
5877 |
^ self. |
|
4833
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5878 |
]. |
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5879 |
scrollCode == #SB_PAGELEFT ifTrue:[ |
4834 | 5880 |
self pageLeft. |
5881 |
^ self. |
|
4833
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5882 |
]. |
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5883 |
scrollCode == #SB_PAGERIGHT ifTrue:[ |
4834 | 5884 |
self pageRight. |
5885 |
^ self. |
|
4833
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5886 |
]. |
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5887 |
scrollCode == #SB_THUMBPOSITIONVERTICAL ifTrue:[ |
4834 | 5888 |
self scrollVerticalToPercent:newPosition. |
5889 |
^ self. |
|
4833
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5890 |
]. |
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5891 |
scrollCode == #SB_THUMBPOSITIONHORIZONTAL ifTrue:[ |
4834 | 5892 |
self scrollHorizontalToPercent:newPosition. |
5893 |
^ self. |
|
4833
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5894 |
]. |
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5895 |
scrollCode == #SB_THUMBTRACKVERTICAL ifTrue:[ |
4834 | 5896 |
self scrollVerticalToPercent:newPosition. |
5897 |
^ self. |
|
4833
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5898 |
]. |
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5899 |
scrollCode == #SB_THUMBTRACKHORIZONTAL ifTrue:[ |
4834 | 5900 |
self scrollHorizontalToPercent:newPosition. |
5901 |
^ self. |
|
4833
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5902 |
]. |
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5903 |
|
384612cc7d37
win32NativeScroll:position: moved from ScrollableView
Claus Gittinger <cg@exept.de>
parents:
4825
diff
changeset
|
5904 |
scrollCode == #SB_ENDSCROLL ifTrue:[ |
4834 | 5905 |
^ self. |
5906 |
]. |
|
269 | 5907 |
! ! |
5908 |
||
1302 | 5909 |
!SimpleView methodsFor:'event simulation'! |
5910 |
||
5911 |
pushEvent:aSelector |
|
5912 |
"push some messageSend into my event queue - |
|
5913 |
I will perform the corresponding method when its time |
|
5914 |
to handle events (useful to update low-prio views from |
|
5915 |
a higher prio process, to avoid blocking in the high prio one)" |
|
5916 |
||
2143
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5917 |
^ self pushEvent:aSelector withArguments:#() |
1302 | 5918 |
|
5919 |
" |
|
5920 |
|v| |
|
5921 |
||
5922 |
v := View new openAndWait. |
|
5923 |
v fill:Color red. |
|
5924 |
v pushEvent:#redraw |
|
5925 |
" |
|
5926 |
||
2143
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5927 |
"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
|
5928 |
! |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5929 |
|
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5930 |
pushEvent:aSelector with:arg |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5931 |
"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
|
5932 |
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
|
5933 |
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
|
5934 |
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
|
5935 |
|
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5936 |
^ self pushEvent:aSelector withArguments:(Array with:arg) |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5937 |
|
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5938 |
"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
|
5939 |
! |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5940 |
|
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5941 |
pushEvent:aSelector with:arg1 with:arg2 |
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5942 |
"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
|
5943 |
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
|
5944 |
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
|
5945 |
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
|
5946 |
|
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5947 |
^ 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
|
5948 |
|
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5949 |
"Created: / 10.6.1998 / 17:27:41 / cg" |
1302 | 5950 |
! |
5951 |
||
5952 |
pushEvent:aSelector withArguments:args |
|
5953 |
"push some messageSend into my event queue - |
|
5954 |
I will perform the corresponding method when its time |
|
5955 |
to handle events (useful to update low-prio views from |
|
5956 |
a higher prio process, to avoid blocking in the high prio one)" |
|
5957 |
||
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
5958 |
self sensor pushUserEvent:aSelector for:self withArguments:args |
1302 | 5959 |
|
5960 |
" |
|
5961 |
|v| |
|
5962 |
||
5963 |
v := (Button label:'hello') openAndWait. |
|
5964 |
Delay waitForSeconds:1. |
|
5965 |
v pushEvent:#buttonPress:x:y: withArguments:#(1 10 10). |
|
5966 |
Delay waitForSeconds:1. |
|
5967 |
v pushEvent:#buttonRelease:x:y: withArguments:#(1 10 10). |
|
5968 |
" |
|
5969 |
||
2143
d5b9c2e64ce9
added #pushEvent:with: and #pushEvent:with:with:
Claus Gittinger <cg@exept.de>
parents:
2138
diff
changeset
|
5970 |
"Modified: / 10.6.1998 / 17:28:16 / cg" |
4347 | 5971 |
! |
5972 |
||
5973 |
startButtonLongPressedHandlerProcess |
|
5974 |
"start a process, which simulates a right-button press if the left-button |
|
5975 |
has been pressed, but not released, and stayed pressed for a while. |
|
5976 |
This is very handy for single-button-mice, as used with the MAC" |
|
5977 |
||
5978 |
|p| |
|
5979 |
||
5980 |
self stopButtonLongPressedHandlerProcess. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5981 |
p := |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5982 |
[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5983 |
Delay waitForSeconds:0.7. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5984 |
self sensor leftButtonPressed ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5985 |
"/ simulate a right-button press |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5986 |
self buttonPress:2 x:0 y:0 |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5987 |
] |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
5988 |
] newProcess. |
4347 | 5989 |
|
5990 |
device buttonLongPressedHandlerProcess:p. |
|
5991 |
p resume. |
|
5992 |
! |
|
5993 |
||
5994 |
stopButtonLongPressedHandlerProcess |
|
5995 |
"stop any long-button-pressed process" |
|
5996 |
||
5997 |
|p| |
|
5998 |
||
5999 |
(p := device buttonLongPressedHandlerProcess) notNil ifTrue:[ |
|
6000 |
"/ Transcript showCR:'stop'. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6001 |
device buttonLongPressedHandlerProcess:nil. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6002 |
p terminate. |
4347 | 6003 |
]. |
1302 | 6004 |
! ! |
6005 |
||
2506 | 6006 |
!SimpleView methodsFor:'focus handling'! |
6007 |
||
3150 | 6008 |
canTab |
4446
49376dd5489f
dont want 'em ugly comments !!!!!
Claus Gittinger <cg@exept.de>
parents:
4433
diff
changeset
|
6009 |
"returns true if the widget is tabable" |
49376dd5489f
dont want 'em ugly comments !!!!!
Claus Gittinger <cg@exept.de>
parents:
4433
diff
changeset
|
6010 |
|
3375 | 6011 |
"/ ^ canTab == true |
6012 |
^ flagBits bitTest:FlagCanTab |
|
6013 |
! |
|
6014 |
||
6015 |
canTab:aBoolean |
|
4446
49376dd5489f
dont want 'em ugly comments !!!!!
Claus Gittinger <cg@exept.de>
parents:
4433
diff
changeset
|
6016 |
"set widget tabable or not" |
49376dd5489f
dont want 'em ugly comments !!!!!
Claus Gittinger <cg@exept.de>
parents:
4433
diff
changeset
|
6017 |
|
3375 | 6018 |
"/ canTab := aBoolean |
6019 |
aBoolean ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6020 |
flagBits := flagBits bitOr:FlagCanTab |
3375 | 6021 |
] ifFalse:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6022 |
flagBits := flagBits bitClear:FlagCanTab |
3375 | 6023 |
]. |
3150 | 6024 |
! |
6025 |
||
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6026 |
doNotRequestFocusOnPointerEnter |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6027 |
"returns true if widget SHOULD NOT request the focus on pointer enter; |
4446
49376dd5489f
dont want 'em ugly comments !!!!!
Claus Gittinger <cg@exept.de>
parents:
4433
diff
changeset
|
6028 |
if false is returned, the behavior depends upon the settings." |
49376dd5489f
dont want 'em ugly comments !!!!!
Claus Gittinger <cg@exept.de>
parents:
4433
diff
changeset
|
6029 |
|
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6030 |
^ flagBits bitTest:FlagDoNotRequestFocusOnPointerEnter |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6031 |
! |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6032 |
|
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6033 |
doNotRequestFocusOnPointerEnter:aBoolean |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6034 |
"if true, setup that the widget SHOULD NOT request the focus on pointer enter; |
4446
49376dd5489f
dont want 'em ugly comments !!!!!
Claus Gittinger <cg@exept.de>
parents:
4433
diff
changeset
|
6035 |
if false, the behavior depends upon the settings." |
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6036 |
|
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6037 |
aBoolean ifTrue:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6038 |
flagBits := flagBits bitOr:FlagDoNotRequestFocusOnPointerEnter |
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6039 |
] ifFalse:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6040 |
flagBits := flagBits bitClear:FlagDoNotRequestFocusOnPointerEnter |
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6041 |
]. |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6042 |
! |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6043 |
|
3155 | 6044 |
focusNext |
6045 |
"get next focus view to self |
|
4734
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6046 |
Skip invisible, disabled or widgets the extent is to small" |
4446
49376dd5489f
dont want 'em ugly comments !!!!!
Claus Gittinger <cg@exept.de>
parents:
4433
diff
changeset
|
6047 |
|
4736 | 6048 |
shown ifFalse:[^ nil]. |
6049 |
||
6050 |
^ self focusNextForWhich:[:v | v shown] |
|
4734
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6051 |
! |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6052 |
|
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6053 |
focusNextChildAfter:aChildView |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6054 |
"get the next focus view after aChildView in mySelf or nil, |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6055 |
if there is none. |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6056 |
Skip invisible or disabled widgets" |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6057 |
|
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6058 |
|viewInSubView index subviewsInFocusOrder| |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6059 |
|
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6060 |
shown ifFalse:[ ^ nil ]. |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6061 |
subViews isNil ifTrue:[ ^ nil ]. |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6062 |
subviewsInFocusOrder := self subviewsInFocusOrder. |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6063 |
|
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6064 |
index := subviewsInFocusOrder identityIndexOf:aChildView. |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6065 |
index == 0 ifTrue:[ ^ nil ]. |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6066 |
|
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6067 |
subviewsInFocusOrder from:(index + 1) do:[:eachChildAfterTheOne | |
4834 | 6068 |
eachChildAfterTheOne shown ifTrue:[ |
6069 |
(eachChildAfterTheOne canTab and:[eachChildAfterTheOne enabled]) ifTrue:[ |
|
6070 |
^ eachChildAfterTheOne |
|
6071 |
]. |
|
6072 |
||
6073 |
(viewInSubView := eachChildAfterTheOne focusNext) notNil ifTrue:[ |
|
6074 |
^ viewInSubView |
|
6075 |
]. |
|
6076 |
]. |
|
3155 | 6077 |
]. |
6078 |
^ nil |
|
6079 |
! |
|
6080 |
||
4736 | 6081 |
focusNextForWhich:aCondition |
6082 |
"get next focus view to self |
|
6083 |
Skip invisible, disabled or widgets the extent is to small" |
|
6084 |
||
6085 |
|viewInSubView| |
|
6086 |
||
6087 |
self subviewsInFocusOrder do:[:aSubView| |
|
4834 | 6088 |
(aSubView canTab |
6089 |
and:[aSubView enabled |
|
6090 |
and:[aCondition value:aSubView]]) ifTrue:[ |
|
6091 |
^ aSubView |
|
6092 |
]. |
|
6093 |
||
6094 |
(viewInSubView := aSubView focusNextForWhich:aCondition) notNil ifTrue:[ |
|
6095 |
^ viewInSubView |
|
6096 |
] |
|
4736 | 6097 |
]. |
6098 |
^ nil |
|
6099 |
! |
|
6100 |
||
3155 | 6101 |
focusPrevious |
6102 |
"get previous focus view to self |
|
4446
49376dd5489f
dont want 'em ugly comments !!!!!
Claus Gittinger <cg@exept.de>
parents:
4433
diff
changeset
|
6103 |
Skip invisible & disabled widgets." |
49376dd5489f
dont want 'em ugly comments !!!!!
Claus Gittinger <cg@exept.de>
parents:
4433
diff
changeset
|
6104 |
|
3155 | 6105 |
|viewInSubView| |
6106 |
||
4734
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6107 |
shown ifTrue:[ |
4834 | 6108 |
self subviewsInFocusOrder reverseDo:[:aSubView| |
6109 |
aSubView shown ifTrue:[ |
|
6110 |
viewInSubView := aSubView focusPrevious. |
|
6111 |
||
6112 |
viewInSubView notNil ifTrue:[ |
|
6113 |
^ viewInSubView |
|
6114 |
]. |
|
6115 |
(aSubView canTab and:[aSubView enabled]) ifTrue:[ |
|
6116 |
^ aSubView |
|
6117 |
]. |
|
6118 |
] |
|
6119 |
] |
|
4734
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6120 |
]. |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6121 |
^ nil |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6122 |
! |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6123 |
|
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6124 |
focusPreviousChildBefore:aChildView |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6125 |
"get the previous focus view before aChildView in mySelf or nil, if there is none. |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6126 |
Skip invisible or disabled widgets" |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6127 |
|
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6128 |
|viewInSubView index subviewsInFocusOrder| |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6129 |
|
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6130 |
shown ifFalse:[ ^ nil ]. |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6131 |
subViews isNil ifTrue:[ ^ nil ]. |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6132 |
subviewsInFocusOrder := self subviewsInFocusOrder. |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6133 |
|
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6134 |
index := subviewsInFocusOrder identityIndexOf:aChildView. |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6135 |
index == 0 ifTrue:[ ^ nil ]. |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6136 |
|
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6137 |
subviewsInFocusOrder from:1 to:(index - 1) reverseDo:[:eachChildBeforeTheOne | |
4834 | 6138 |
eachChildBeforeTheOne shown ifTrue:[ |
6139 |
(viewInSubView := eachChildBeforeTheOne focusPrevious) notNil ifTrue:[ |
|
6140 |
^ viewInSubView |
|
6141 |
]. |
|
6142 |
||
6143 |
(eachChildBeforeTheOne canTab and:[eachChildBeforeTheOne enabled]) ifTrue:[ |
|
6144 |
^ eachChildBeforeTheOne |
|
6145 |
]. |
|
6146 |
]. |
|
4734
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6147 |
]. |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6148 |
"/ the code below allows for a notebooks tab-list to be reached |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6149 |
(self canTab and:[self enabled]) ifTrue:[ |
4834 | 6150 |
^ self |
4734
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6151 |
]. |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6152 |
|
3155 | 6153 |
^ nil |
6154 |
! |
|
6155 |
||
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6156 |
requestDoNotFocusOnPointerEnter |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6157 |
"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
|
6158 |
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
|
6159 |
" |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6160 |
^ flagBits bitTest:FlagDoNotRequestFocusOnPointerEnter |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6161 |
! |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6162 |
|
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6163 |
requestDoNotFocusOnPointerEnter:aBoolean |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6164 |
"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
|
6165 |
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
|
6166 |
" |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6167 |
|
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6168 |
aBoolean ifTrue:[ |
3762 | 6169 |
flagBits := flagBits bitOr:FlagDoNotRequestFocusOnPointerEnter |
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6170 |
] ifFalse:[ |
3762 | 6171 |
flagBits := flagBits bitClear:FlagDoNotRequestFocusOnPointerEnter |
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6172 |
]. |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6173 |
! |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6174 |
|
2506 | 6175 |
requestFocus |
6176 |
"request focus from my windowGroup; |
|
6177 |
typically, this is invoked when the mouse pointer enters a |
|
6178 |
widget. The request may or may not be ignored by the wGroup |
|
6179 |
(it will be ignored, if an explicit focus-change is currently |
|
6180 |
active - i.e. if the user tabbed into a widget)" |
|
6181 |
||
6182 |
windowGroup notNil ifTrue:[ |
|
3152 | 6183 |
^ windowGroup focusRequestFrom:self |
2506 | 6184 |
]. |
6185 |
^ true |
|
6186 |
! |
|
6187 |
||
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6188 |
requestFocusOnPointerEnter |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6189 |
"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
|
6190 |
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
|
6191 |
" |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6192 |
^ flagBits bitTest:FlagRequestFocusOnPointerEnter |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6193 |
! |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6194 |
|
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6195 |
requestFocusOnPointerEnter:aBoolean |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6196 |
"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
|
6197 |
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
|
6198 |
" |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6199 |
|
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6200 |
aBoolean ifTrue:[ |
3762 | 6201 |
flagBits := flagBits bitOr:FlagRequestFocusOnPointerEnter |
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6202 |
] ifFalse:[ |
3762 | 6203 |
flagBits := flagBits bitClear:FlagRequestFocusOnPointerEnter |
3590
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6204 |
]. |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6205 |
! |
8e942a9ff4aa
two more flags: request / doNotRequest focus on pointer enter
Claus Gittinger <cg@exept.de>
parents:
3586
diff
changeset
|
6206 |
|
2506 | 6207 |
showFocus:explicit |
6208 |
"highlight myself somehow to tell user that I have the focus. |
|
6209 |
If explicit is true, the focus came via focusStepping (i.e. tabbing); |
|
6210 |
if false, it came via the window manager (i.e. pointer entering). |
|
6211 |
Only change my border, if this is an explicit focusChange." |
|
6212 |
||
2907
901ffdc575a8
ask device if it supports borders
Claus Gittinger <cg@exept.de>
parents:
2886
diff
changeset
|
6213 |
|delta clrId bd| |
2506 | 6214 |
|
6215 |
explicit ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6216 |
(drawableId notNil |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6217 |
and:[superView notNil |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6218 |
and:[styleSheet notNil]]) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6219 |
(styleSheet at:#'focus.showBorder' default:true) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6220 |
(device supportsWindowBorder:(bd := DefaultFocusBorderWidth)) ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6221 |
(device supportsWindowBorder:(bd := 1)) ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6222 |
bd := 0. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6223 |
] |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6224 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6225 |
delta := bd - borderWidth. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6226 |
delta ~~ 0 ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6227 |
(left == 0 or:[top == 0]) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6228 |
device resizeWindow:drawableId width:width-delta-delta height:height-delta-delta. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6229 |
] ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6230 |
device moveWindow:drawableId x:left-delta y:top-delta. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6231 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6232 |
device setWindowBorderWidth:bd in:drawableId. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6233 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6234 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6235 |
clrId := (DefaultFocusColor onDevice:device) colorId. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6236 |
clrId isNil ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6237 |
clrId := device blackpixel |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6238 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6239 |
device setWindowBorderColor:clrId in:drawableId. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6240 |
] |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6241 |
] |
2506 | 6242 |
] ifFalse:[ |
2560 | 6243 |
"/ superView notNil ifTrue:[ |
6244 |
"/ superView showFocus:explicit |
|
6245 |
"/ ] |
|
2506 | 6246 |
] |
6247 |
||
6248 |
"Modified: / 17.9.1998 / 15:08:34 / cg" |
|
6249 |
! |
|
6250 |
||
6251 |
showNoFocus:explicit |
|
6252 |
"undo the effect of showFocus. |
|
6253 |
Explicit tells if the focus came via focusStepping (i.e. tabbing) |
|
6254 |
or via the window manager (i.e. pointer entering). |
|
6255 |
Only change my border, if this is an explicit focusChange." |
|
6256 |
||
2907
901ffdc575a8
ask device if it supports borders
Claus Gittinger <cg@exept.de>
parents:
2886
diff
changeset
|
6257 |
|delta bd| |
2506 | 6258 |
|
6259 |
explicit ifTrue:[ |
|
3367 | 6260 |
(drawableId notNil and:[superView notNil]) ifTrue:[ |
6261 |
(styleSheet at:#'focus.showBorder' default:true) ifTrue:[ |
|
6262 |
(device supportsWindowBorder:(bd := borderWidth)) ifFalse:[ |
|
6263 |
(device supportsWindowBorder:(bd := 1)) ifFalse:[ |
|
6264 |
bd := 0. |
|
6265 |
] |
|
6266 |
]. |
|
6267 |
delta := DefaultFocusBorderWidth - bd. |
|
6268 |
delta ~~ 0 ifTrue:[ |
|
6269 |
device setWindowBorderWidth:bd in:drawableId. |
|
6270 |
device moveWindow:drawableId x:left y:top. |
|
6271 |
device resizeWindow:drawableId width:width height:height. |
|
6272 |
]. |
|
6273 |
self setBorderColor. |
|
6274 |
] |
|
6275 |
] |
|
2506 | 6276 |
] |
6277 |
||
6278 |
"Modified: / 17.9.1998 / 15:08:02 / cg" |
|
6279 |
! |
|
6280 |
||
4734
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6281 |
subviewsInFocusOrder |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6282 |
^ subViews ? #() |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6283 |
! |
cad9cacb9cde
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4720
diff
changeset
|
6284 |
|
4425 | 6285 |
takeFocus |
6286 |
"Unconditionally take the focus from my windowGroup" |
|
6287 |
||
6288 |
windowGroup notNil ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6289 |
windowGroup focusView:self byTab:false. |
4425 | 6290 |
]. |
6291 |
! |
|
6292 |
||
2506 | 6293 |
wantsFocusWithButtonPress |
2741
7e85a327ce98
added extra query: #wantsFocusWithButtonPress
Claus Gittinger <cg@exept.de>
parents:
2733
diff
changeset
|
6294 |
"views which do not like to take the keyboard focus |
7e85a327ce98
added extra query: #wantsFocusWithButtonPress
Claus Gittinger <cg@exept.de>
parents:
2733
diff
changeset
|
6295 |
with buttonPress can do so by redefining this |
7e85a327ce98
added extra query: #wantsFocusWithButtonPress
Claus Gittinger <cg@exept.de>
parents:
2733
diff
changeset
|
6296 |
to return false" |
7e85a327ce98
added extra query: #wantsFocusWithButtonPress
Claus Gittinger <cg@exept.de>
parents:
2733
diff
changeset
|
6297 |
|
3087 | 6298 |
(self class == SimpleView) ifTrue:[ |
3762 | 6299 |
"/ a pure filler/geometric layout view |
6300 |
^ false |
|
3581
72e09769d372
do not take focus when disabled
Claus Gittinger <cg@exept.de>
parents:
3559
diff
changeset
|
6301 |
]. |
72e09769d372
do not take focus when disabled
Claus Gittinger <cg@exept.de>
parents:
3559
diff
changeset
|
6302 |
^ self enabled |
2741
7e85a327ce98
added extra query: #wantsFocusWithButtonPress
Claus Gittinger <cg@exept.de>
parents:
2733
diff
changeset
|
6303 |
! |
7e85a327ce98
added extra query: #wantsFocusWithButtonPress
Claus Gittinger <cg@exept.de>
parents:
2733
diff
changeset
|
6304 |
|
7e85a327ce98
added extra query: #wantsFocusWithButtonPress
Claus Gittinger <cg@exept.de>
parents:
2733
diff
changeset
|
6305 |
wantsFocusWithPointerEnter |
2506 | 6306 |
"views which like to take the keyboard focus |
2741
7e85a327ce98
added extra query: #wantsFocusWithButtonPress
Claus Gittinger <cg@exept.de>
parents:
2733
diff
changeset
|
6307 |
when the pointer enters can do so by redefining this |
2506 | 6308 |
to return true" |
6309 |
||
2741
7e85a327ce98
added extra query: #wantsFocusWithButtonPress
Claus Gittinger <cg@exept.de>
parents:
2733
diff
changeset
|
6310 |
^ false |
2506 | 6311 |
! ! |
6312 |
||
3087 | 6313 |
!SimpleView methodsFor:'grabbing'! |
6314 |
||
6315 |
forceUngrabKeyboard |
|
6316 |
"force a keyboard ungrab - even if was not the grabber" |
|
6317 |
||
6318 |
device ungrabKeyboard. |
|
6319 |
||
6320 |
! |
|
6321 |
||
6322 |
forceUngrabPointer |
|
6323 |
"force a pointer ungrab - even if was not the grabber" |
|
6324 |
||
6325 |
device ungrabPointer |
|
6326 |
||
6327 |
! |
|
6328 |
||
6329 |
grabKeyboard |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6330 |
"grab the keayboard - that is: report all keyboard events to myself, |
3087 | 6331 |
even if the mouse moved out of myself. |
6332 |
Returns true, if the grab was sucessfull (could fail, if some other |
|
6333 |
application has a grab - but thats very unlikely)." |
|
6334 |
||
6335 |
^ device grabKeyboardInView:self. |
|
6336 |
! |
|
6337 |
||
6338 |
grabPointer |
|
6339 |
"grab the pointer - that is: report all motion events relative to |
|
6340 |
myself, even if moved out of myself. |
|
6341 |
Returns true, if the grab was sucessfull (could fail, if some other |
|
6342 |
application has a grab - but thats very unlikely)." |
|
6343 |
||
6344 |
^ self grabPointerWithCursor:nil |
|
6345 |
! |
|
6346 |
||
6347 |
grabPointerWithCursor:aCursorOrNil |
|
6348 |
"grab the pointer - that is: report all motion events relative to |
|
6349 |
myself, even if moved out of myself. |
|
6350 |
Show aCursor during the grab, if the cursor argument is not nil. |
|
6351 |
Returns true, if the grab was sucessfull (could fail, if some other |
|
6352 |
application has a grab - but thats very unlikely)." |
|
6353 |
||
6354 |
||
6355 |
"/ (sensor := self sensor) notNil ifTrue:[ |
|
6356 |
"/ "/ make certain all X events have been received |
|
6357 |
"/ device sync. |
|
6358 |
"/ "/ now all events have been received. |
|
6359 |
"/ "/ now, flush all pointer events |
|
6360 |
"/ sensor flushMotionEventsFor:nil |
|
6361 |
"/ ]. |
|
6362 |
||
6363 |
aCursorOrNil notNil ifTrue:[ |
|
3762 | 6364 |
cursor := (aCursorOrNil onDevice:device). |
6365 |
^ device grabPointerInView:self withCursor:cursor |
|
3087 | 6366 |
]. |
6367 |
^ device grabPointerInView:self |
|
6368 |
! |
|
6369 |
||
6370 |
ungrabKeyboard |
|
6371 |
"ungrab the keyboard - but only if I was the grabber" |
|
6372 |
||
6373 |
|sensor| |
|
6374 |
||
6375 |
device activeKeyboardGrab == self ifTrue:[ |
|
3152 | 6376 |
(sensor := self sensor) notNil ifTrue:[ |
6377 |
"/ make certain all X events have been received |
|
6378 |
device sync. |
|
6379 |
"/ now all events have been received. |
|
6380 |
"/ now, flush all pointer events |
|
6381 |
sensor flushKeyboardFor:self |
|
6382 |
]. |
|
6383 |
device ungrabKeyboard. |
|
3087 | 6384 |
]. |
6385 |
||
6386 |
! |
|
6387 |
||
6388 |
ungrabPointer |
|
6389 |
"ungrab the pointer - but only if I was the grabber" |
|
6390 |
||
6391 |
|sensor| |
|
6392 |
||
6393 |
device activePointerGrab == self ifTrue:[ |
|
3152 | 6394 |
(sensor := self sensor) notNil ifTrue:[ |
6395 |
"/ make certain all X events have been received |
|
6396 |
device sync. |
|
6397 |
"/ now all events have been received. |
|
6398 |
"/ now, flush all pointer events |
|
6399 |
sensor flushMotionEventsFor:self |
|
6400 |
]. |
|
6401 |
device ungrabPointer. |
|
3087 | 6402 |
] |
6403 |
! ! |
|
6404 |
||
269 | 6405 |
!SimpleView methodsFor:'informing others of changes'! |
6406 |
||
6407 |
contentsChanged |
|
6408 |
"this one is sent, whenever contents changes size - |
|
6409 |
tell dependents about the change (i.e. scrollers)." |
|
6410 |
||
6411 |
self changed:#sizeOfContents |
|
6412 |
! |
|
6413 |
||
3383
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
6414 |
noticeOfWindowClose |
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
6415 |
|app| |
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
6416 |
|
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
6417 |
(app := self application) notNil ifTrue:[ |
3762 | 6418 |
app noticeOfWindowClose:self |
3383
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
6419 |
]. |
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
6420 |
! |
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
6421 |
|
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
6422 |
noticeOfWindowOpen |
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
6423 |
|app| |
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
6424 |
|
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
6425 |
(app := self application) notNil ifTrue:[ |
3762 | 6426 |
app noticeOfWindowOpen:self |
3383
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
6427 |
]. |
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
6428 |
! |
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
6429 |
|
269 | 6430 |
originChanged:delta |
6431 |
"this one is sent, after the origin of my contents has changed - |
|
6432 |
tell dependents (i.e. scrollers) about this" |
|
6433 |
||
3510 | 6434 |
(delta = (0@0)) ifTrue:[^ self]. |
269 | 6435 |
self changed:#originOfContents with:delta. |
6436 |
"/ subViews notNil ifTrue:[ |
|
6437 |
"/ subViews do:[:aSubView | |
|
6438 |
"/ aSubView pixelOrigin:((aSubView left @ aSubView top) - delta) |
|
6439 |
"/ ] |
|
6440 |
"/ ] |
|
6441 |
! |
|
6442 |
||
6443 |
originWillChange |
|
6444 |
"this one is sent, just before viewOrigin changes - |
|
6445 |
gives subclasses a chance to catch scrolls easily |
|
6446 |
(for example to hide cursor before scroll)" |
|
6447 |
||
6448 |
^ self |
|
6449 |
! ! |
|
6450 |
||
3165 | 6451 |
!SimpleView methodsFor:'initialization & release'! |
269 | 6452 |
|
6453 |
defaultControllerClass |
|
6454 |
^ nil "/ Controller |
|
6455 |
! |
|
6456 |
||
483
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
6457 |
defaultExtent |
586 | 6458 |
"return the default extent of my instances." |
6459 |
||
483
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
6460 |
^ self class defaultExtent |
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
6461 |
|
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
6462 |
"Created: 1.3.1996 / 19:20:46 / cg" |
586 | 6463 |
"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
|
6464 |
! |
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
6465 |
|
3662 | 6466 |
defaultFont |
6467 |
^ self class defaultFont |
|
6468 |
! |
|
6469 |
||
2573 | 6470 |
destroy |
6471 |
"unmap & destroy - make me invisible, destroy subviews then |
|
6472 |
make me unknown to the device" |
|
6473 |
||
6474 |
realized ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6475 |
self unmap. |
2573 | 6476 |
]. |
6477 |
shown := false. |
|
6478 |
||
6479 |
"/ controller notNil ifTrue:[ |
|
6480 |
"/ controller release. |
|
6481 |
"/ controller := nil. |
|
6482 |
"/ ]. |
|
6483 |
||
6484 |
subViews notNil ifTrue:[ |
|
3762 | 6485 |
self destroySubViews. |
2573 | 6486 |
]. |
6487 |
superView notNil ifTrue:[ |
|
3762 | 6488 |
superView removeSubView:self. |
6489 |
superView := nil |
|
2573 | 6490 |
]. |
6491 |
super destroy. |
|
6492 |
||
3709 | 6493 |
self release. |
6494 |
||
2573 | 6495 |
"/ superView isNil ifTrue:[ |
6496 |
"/ device flush |
|
6497 |
"/ ]. |
|
6498 |
||
6499 |
controller notNil ifTrue:[ |
|
3762 | 6500 |
controller release. |
6501 |
controller := nil. |
|
2573 | 6502 |
]. |
6503 |
||
6504 |
windowGroup notNil ifTrue:[ |
|
3762 | 6505 |
windowGroup removeView:self. |
6506 |
windowGroup := nil |
|
3383
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
6507 |
]. |
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
6508 |
|
111b54361247
postOpenedWith, windowEvent and noticeOfWindow-Whatever
tm
parents:
3382
diff
changeset
|
6509 |
self noticeOfWindowClose. |
2573 | 6510 |
! |
6511 |
||
269 | 6512 |
initEvents |
6513 |
"will be sent by create - can be redefined by subclasses to enable |
|
6514 |
view events" |
|
6515 |
||
6516 |
^ self |
|
6517 |
! |
|
6518 |
||
6519 |
initStyle |
|
6520 |
"this method sets up all style dependent things" |
|
6521 |
||
6522 |
self initStyleSheet. |
|
6523 |
||
6524 |
borderWidth := DefaultBorderWidth. |
|
6525 |
borderWidth isNil ifTrue:[borderWidth := 1]. |
|
6526 |
||
6527 |
viewBackground := DefaultViewBackgroundColor. |
|
6528 |
||
6529 |
DefaultLightColor notNil ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6530 |
lightColor := DefaultLightColor. |
269 | 6531 |
] ifFalse:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6532 |
device hasGrayscales ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6533 |
(viewBackground isImageOrForm and:[viewBackground colorMap isNil]) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6534 |
lightColor := viewBackground averageColor lightened. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6535 |
] ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6536 |
lightColor := viewBackground lightened. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6537 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6538 |
DefaultLightColor := lightColor. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6539 |
] ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6540 |
" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6541 |
this seems strange: on B&W screens, we create the light color |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6542 |
darker than normal viewBackground (White) - |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6543 |
to make the boundary of the view visible |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6544 |
" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6545 |
lightColor := Color gray:50 |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6546 |
] |
269 | 6547 |
]. |
6548 |
DefaultShadowColor notNil ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6549 |
shadowColor := DefaultShadowColor. |
269 | 6550 |
] ifFalse:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6551 |
shadowColor := Black |
3669 | 6552 |
]. |
6553 |
||
269 | 6554 |
borderColor := DefaultBorderColor. |
3669 | 6555 |
"/ font := self defaultFont. -- already done in #initialize |
2829 | 6556 |
font := font onDevice:device. |
747 | 6557 |
|
749 | 6558 |
"Modified: 28.5.1996 / 21:13:58 / cg" |
269 | 6559 |
! |
6560 |
||
6561 |
initStyleSheet |
|
6562 |
"this method gets the styleSheet" |
|
6563 |
||
6564 |
" |
|
6565 |
when coming here the first time, we read the styleSheet |
|
6566 |
and keep the values in fast class variables |
|
6567 |
" |
|
6568 |
StyleSheet isNil ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6569 |
DefaultStyle isNil ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6570 |
"/ the very-very first time (no styleSheet yet) |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6571 |
View setDefaultStyle. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6572 |
View defaultStyle:DefaultStyle. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6573 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6574 |
SimpleView updateAllStyleCaches |
269 | 6575 |
]. |
6576 |
||
6577 |
styleSheet := StyleSheet. |
|
1005
03041f7fb340
init styleSheet (in case no startup file did it)
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
6578 |
|
03041f7fb340
init styleSheet (in case no startup file did it)
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
6579 |
"Modified: 25.7.1996 / 22:00:06 / cg" |
269 | 6580 |
! |
6581 |
||
6582 |
initialize |
|
6583 |
"initialize all state of the view - usually redefined in subclasses, |
|
6584 |
but always doing a 'super initialize'. Each class should setup its |
|
6585 |
locals - and not forget the others. |
|
6586 |
View setup is separated into two parts, the general setup done here |
|
6587 |
and the style specific setup in initStyle. Each view should be prepared |
|
6588 |
for a stylechange by being sent another initStyle with a new style value. |
|
6589 |
(in this case, it should set all of its style-dependent things, but |
|
6590 |
leave the state and contents as-is)" |
|
6591 |
||
6592 |
|ext myClass controllerClass| |
|
6593 |
||
3375 | 6594 |
flagBits := 0. |
6595 |
||
269 | 6596 |
super initialize. |
6597 |
||
3662 | 6598 |
font := self defaultFont. |
4123 | 6599 |
font := font onDevice:device. |
269 | 6600 |
|
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
6601 |
shown := realized := false. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
6602 |
"/ hiddenOnRealize := false. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
6603 |
"/ explicitExtent := false. |
269 | 6604 |
|
6605 |
"fill in some defaults - some of them are usually redefined in subclasses |
|
6606 |
initialize methods" |
|
6607 |
||
6608 |
myClass := self class. |
|
6609 |
name := myClass name "asString" asLowercaseFirst. |
|
6610 |
resources := myClass classResources. |
|
6611 |
||
2382 | 6612 |
level := borderWidth := margin := 0. |
269 | 6613 |
|
6614 |
self initStyle. |
|
6615 |
||
483
32537786bca6
change defaultExtent protocol (ask inst first, then class)
Claus Gittinger <cg@exept.de>
parents:
472
diff
changeset
|
6616 |
ext := self defaultExtent. |
269 | 6617 |
left := top := 0. |
6618 |
width := ext x. |
|
6619 |
height := ext y. |
|
6620 |
||
3375 | 6621 |
self originChangedFlag:false. |
6622 |
self extentChangedFlag:false. |
|
6623 |
self cornerChangedFlag:false. |
|
2084
e997f6ea54c2
also pass down #larger to sizeCanged: method.
Claus Gittinger <cg@exept.de>
parents:
2061
diff
changeset
|
6624 |
bitGravity := #NorthWest. "/ nil. |
269 | 6625 |
viewGravity := nil. |
6626 |
||
6627 |
controllerClass := self defaultControllerClass. |
|
6628 |
controllerClass notNil ifTrue:[ |
|
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
6629 |
controller := controllerClass new. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
6630 |
controller view:self. |
3967
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
6631 |
]. |
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
6632 |
|
ed1e413b0ded
invoke #initializeMiddleButtonMenu from #initialize;
Claus Gittinger <cg@exept.de>
parents:
3947
diff
changeset
|
6633 |
self initializeMiddleButtonMenu. |
2382 | 6634 |
|
6635 |
"Modified: / 1.10.1998 / 14:31:05 / cg" |
|
269 | 6636 |
! |
6637 |
||
6638 |
initializeMiddleButtonMenu |
|
3968 | 6639 |
"a place to initialize menu - this one is sent once when the view-object is initialized. |
6640 |
usually redefined in subclasses; default here is no menu. |
|
269 | 6641 |
Notice, that static middleButtonmenus are a historic thing in ST/X; |
3968 | 6642 |
you may prefer to create the menu dynamically." |
269 | 6643 |
|
6644 |
^ self |
|
6645 |
! |
|
6646 |
||
6647 |
prepareForReinit |
|
6648 |
super prepareForReinit. |
|
6649 |
windowGroup notNil ifTrue:[ |
|
3152 | 6650 |
windowGroup reinitialize |
269 | 6651 |
] |
6652 |
! |
|
6653 |
||
6654 |
reinitStyle |
|
6655 |
"this method is called for a style change" |
|
6656 |
||
6657 |
|t| |
|
6658 |
||
6659 |
self initStyle. |
|
3945
bdbc16f787dc
systemColorChange on windows
Claus Gittinger <cg@exept.de>
parents:
3926
diff
changeset
|
6660 |
(drawableId notNil and:[gcId notNil]) ifTrue:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6661 |
"force a change" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6662 |
t := borderWidth. borderWidth := nil. self borderWidth:t. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6663 |
t := viewBackground. viewBackground := nil. self viewBackground:t. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6664 |
self clearView. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
6665 |
self invalidate. |
2357
29a966362aad
clear and invalidate in reinitStyle.
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
6666 |
]. |
29a966362aad
clear and invalidate in reinitStyle.
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
6667 |
|
29a966362aad
clear and invalidate in reinitStyle.
Claus Gittinger <cg@exept.de>
parents:
2355
diff
changeset
|
6668 |
"Modified: / 18.9.1998 / 21:15:33 / cg" |
269 | 6669 |
! |
6670 |
||
6671 |
reinitialize |
|
795 | 6672 |
"this is called right after snapIn" |
269 | 6673 |
|
2649 | 6674 |
|myController sv| |
269 | 6675 |
|
6676 |
"if I have already been reinited - return" |
|
6677 |
drawableId notNil ifTrue:[ |
|
4907 | 6678 |
^ self |
269 | 6679 |
]. |
6680 |
||
6681 |
" |
|
6682 |
superView must be there, first |
|
6683 |
" |
|
6684 |
superView notNil ifTrue:[ |
|
4907 | 6685 |
(sv := superView view) id isNil ifTrue:[ |
6686 |
sv reinitialize |
|
6687 |
] |
|
2452
0c63e21efd57
(re)initCursor in reinitialize (i.e. after snapIn)
Claus Gittinger <cg@exept.de>
parents:
2451
diff
changeset
|
6688 |
]. |
0c63e21efd57
(re)initCursor in reinitialize (i.e. after snapIn)
Claus Gittinger <cg@exept.de>
parents:
2451
diff
changeset
|
6689 |
|
0c63e21efd57
(re)initCursor in reinitialize (i.e. after snapIn)
Claus Gittinger <cg@exept.de>
parents:
2451
diff
changeset
|
6690 |
"reinit cursor" |
0c63e21efd57
(re)initCursor in reinitialize (i.e. after snapIn)
Claus Gittinger <cg@exept.de>
parents:
2451
diff
changeset
|
6691 |
self initCursor. |
269 | 6692 |
|
6693 |
myController := controller. |
|
6694 |
controller := nil. |
|
6695 |
self recreate. |
|
6696 |
||
6697 |
"if I was mapped, do it again" |
|
6698 |
realized ifTrue:[ |
|
4907 | 6699 |
"only remap if I have a superview - otherwise, I might be |
6700 |
a hidden iconView or menu ..." |
|
6701 |
superView notNil ifTrue:[ |
|
269 | 6702 |
"/ shown ifTrue:[ |
4907 | 6703 |
device |
6704 |
moveResizeWindow:drawableId x:left y:top width:width height:height; |
|
6705 |
mapWindow:drawableId |
|
6706 |
"/ mapView:self id:drawableId iconified:false |
|
6707 |
"/ atX:left y:top width:width height:height |
|
6708 |
"/ minExtent:(self minExtent) maxExtent:(self maxExtent) |
|
269 | 6709 |
"/ ]. |
4907 | 6710 |
]. |
269 | 6711 |
]. |
6712 |
||
6713 |
"restore controller" |
|
2452
0c63e21efd57
(re)initCursor in reinitialize (i.e. after snapIn)
Claus Gittinger <cg@exept.de>
parents:
2451
diff
changeset
|
6714 |
controller := myController. |
795 | 6715 |
|
2649 | 6716 |
"Modified: / 6.5.1999 / 13:11:07 / cg" |
4372
30c22dddafcf
Moved up #restarted to SimpleView
Stefan Vogel <sv@exept.de>
parents:
4352
diff
changeset
|
6717 |
! |
30c22dddafcf
Moved up #restarted to SimpleView
Stefan Vogel <sv@exept.de>
parents:
4352
diff
changeset
|
6718 |
|
4978
72d873c3eb05
must retract an interest - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4971
diff
changeset
|
6719 |
release |
72d873c3eb05
must retract an interest - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4971
diff
changeset
|
6720 |
"remove all dependencies from the receiver" |
72d873c3eb05
must retract an interest - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4971
diff
changeset
|
6721 |
|
72d873c3eb05
must retract an interest - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4971
diff
changeset
|
6722 |
visibilityChannel notNil ifTrue:[ |
72d873c3eb05
must retract an interest - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4971
diff
changeset
|
6723 |
visibilityChannel retractInterestsFor:self. |
72d873c3eb05
must retract an interest - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4971
diff
changeset
|
6724 |
visibilityChannel removeDependent:self. visibilityChannel := nil |
72d873c3eb05
must retract an interest - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4971
diff
changeset
|
6725 |
]. |
72d873c3eb05
must retract an interest - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4971
diff
changeset
|
6726 |
|
72d873c3eb05
must retract an interest - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4971
diff
changeset
|
6727 |
dependents := nil. |
72d873c3eb05
must retract an interest - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4971
diff
changeset
|
6728 |
|
72d873c3eb05
must retract an interest - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4971
diff
changeset
|
6729 |
"Modified: 19.4.1996 / 10:31:35 / cg" |
72d873c3eb05
must retract an interest - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4971
diff
changeset
|
6730 |
"Created: 11.6.1997 / 13:11:53 / cg" |
72d873c3eb05
must retract an interest - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4971
diff
changeset
|
6731 |
! |
72d873c3eb05
must retract an interest - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4971
diff
changeset
|
6732 |
|
4372
30c22dddafcf
Moved up #restarted to SimpleView
Stefan Vogel <sv@exept.de>
parents:
4352
diff
changeset
|
6733 |
restarted |
30c22dddafcf
Moved up #restarted to SimpleView
Stefan Vogel <sv@exept.de>
parents:
4352
diff
changeset
|
6734 |
"sent by my windowGroup, when restarted from an image. |
30c22dddafcf
Moved up #restarted to SimpleView
Stefan Vogel <sv@exept.de>
parents:
4352
diff
changeset
|
6735 |
Nothing done here, but can be redefined to perform any actions |
30c22dddafcf
Moved up #restarted to SimpleView
Stefan Vogel <sv@exept.de>
parents:
4352
diff
changeset
|
6736 |
required to reset some state after an image-restart. |
30c22dddafcf
Moved up #restarted to SimpleView
Stefan Vogel <sv@exept.de>
parents:
4352
diff
changeset
|
6737 |
|
30c22dddafcf
Moved up #restarted to SimpleView
Stefan Vogel <sv@exept.de>
parents:
4352
diff
changeset
|
6738 |
Only top views (usually instances of TopView) get this message sent. |
30c22dddafcf
Moved up #restarted to SimpleView
Stefan Vogel <sv@exept.de>
parents:
4352
diff
changeset
|
6739 |
Since SimpleViews can act as a top view, too this message is implemented |
30c22dddafcf
Moved up #restarted to SimpleView
Stefan Vogel <sv@exept.de>
parents:
4352
diff
changeset
|
6740 |
in SimpleView" |
30c22dddafcf
Moved up #restarted to SimpleView
Stefan Vogel <sv@exept.de>
parents:
4352
diff
changeset
|
6741 |
|
30c22dddafcf
Moved up #restarted to SimpleView
Stefan Vogel <sv@exept.de>
parents:
4352
diff
changeset
|
6742 |
^ self |
135 | 6743 |
! ! |
6744 |
||
3371 | 6745 |
!SimpleView methodsFor:'keyboard control'! |
6746 |
||
6747 |
defineShortcutAndTranslateLabelStringFrom:aString |
|
6748 |
|i| |
|
6749 |
||
6750 |
aString isString ifFalse:[ ^ aString]. |
|
6751 |
||
6752 |
(aString includes:$&) ifFalse:[ ^ aString]. |
|
6753 |
i := self shortcutAndTranslatedStringFrom:aString. |
|
6754 |
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
|
6755 |
^ i at:2. |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6756 |
! |
3371 | 6757 |
|
6758 |
mnemonicKey |
|
4492 | 6759 |
"get the mnemonic key or nil if undefined" |
4834 | 6760 |
|
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6761 |
^ self objectAttributeAt:#mnemonicKey |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6762 |
! |
3371 | 6763 |
|
4834 | 6764 |
mnemonicKey:aSymbolOrNil |
4492 | 6765 |
"set or clear the mnemonic key" |
4834 | 6766 |
|
3371 | 6767 |
aSymbolOrNil isSymbol ifTrue:[ |
4834 | 6768 |
self objectAttributeAt:#mnemonicKey put:aSymbolOrNil |
3371 | 6769 |
] ifFalse:[ |
4834 | 6770 |
self removeObjectAttribute:#mnemonicKey |
6771 |
]. |
|
6772 |
! |
|
6773 |
||
6774 |
mnemonicViewNext:aKeyEvent |
|
3371 | 6775 |
"a mnemonicKey event as forwarded from the keyboardProcessor - if there |
4492 | 6776 |
is the mnemonic-key defined for a subView return the view otherwise nil." |
4834 | 6777 |
|
3371 | 6778 |
|key rawKey mnemonic view| |
6779 |
||
4492 | 6780 |
key := aKeyEvent key. |
3371 | 6781 |
rawKey := aKeyEvent rawKey. |
4492 | 6782 |
(shown and:[ subViews notNil ]) ifTrue:[ |
4834 | 6783 |
subViews do:[:aSubView | |
6784 |
aSubView shown ifTrue:[ |
|
6785 |
(aSubView enabled |
|
6786 |
and:[ |
|
6787 |
(mnemonic := aSubView mnemonicKey) notNil |
|
6788 |
and:[ (mnemonic == rawKey or:[ mnemonic == key ]) ] |
|
6789 |
]) |
|
6790 |
ifTrue:[ ^ aSubView ]. |
|
6791 |
(view := aSubView mnemonicViewNext:aKeyEvent) notNil ifTrue:[ |
|
6792 |
^ view |
|
6793 |
]. |
|
6794 |
] |
|
6795 |
] |
|
3371 | 6796 |
]. |
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6797 |
^ nil |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6798 |
! |
3371 | 6799 |
|
6800 |
performShortcutAction |
|
6801 |
"perform my shortcutKey action. |
|
6802 |
" |
|
3374 | 6803 |
"/ intentionally left blank here |
6804 |
! |
|
3371 | 6805 |
|
4834 | 6806 |
processShortcut:aKeyEvent |
3371 | 6807 |
"a shortcutKey event as forwarded from the keyboardProcessor - if there is the |
4492 | 6808 |
shortcut-key defined process the shortcut and return true otherwise false." |
4834 | 6809 |
|
3371 | 6810 |
|key| |
6811 |
||
6812 |
shown ifTrue:[ |
|
4834 | 6813 |
self enabled ifTrue:[ |
6814 |
(key := self shortcutKey) notNil ifTrue:[ |
|
6815 |
(key == aKeyEvent key or:[ key == aKeyEvent rawKey ]) ifTrue:[ |
|
6816 |
self requestFocus. |
|
6817 |
(controller ? self) performShortcutAction. |
|
6818 |
^ true |
|
6819 |
] |
|
6820 |
]. |
|
6821 |
]. |
|
6822 |
subViews notNil ifTrue:[ |
|
6823 |
subViews do:[:aSubView | |
|
6824 |
(aSubView processShortcut:aKeyEvent) ifTrue:[ |
|
6825 |
^ true |
|
6826 |
] |
|
6827 |
] |
|
6828 |
] |
|
3371 | 6829 |
]. |
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6830 |
^ false |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6831 |
! |
3371 | 6832 |
|
6833 |
shortcutAndTranslatedStringFrom:aString |
|
6834 |
"return an array filled with an extracted shortcut key and a translated string; |
|
6835 |
looks for and reemoves any ampercent character from aString, and adds underline emphasis to the |
|
6836 |
following character" |
|
6837 |
||
3642 | 6838 |
|xLatedString c n s pos shortcutCharacter shortcut| |
3371 | 6839 |
|
6840 |
xLatedString := '' writeStream. |
|
6841 |
s := aString readStream. |
|
6842 |
||
6843 |
[s atEnd] whileFalse:[ |
|
3762 | 6844 |
c := s next. |
6845 |
c == $& ifTrue:[ |
|
6846 |
n := s peek. |
|
6847 |
(n notNil and:[n isLetter]) ifTrue:[ |
|
6848 |
c := s next. |
|
6849 |
pos := xLatedString size + 1. |
|
6850 |
] ifFalse:[ |
|
6851 |
n == $& ifTrue:[ |
|
6852 |
s next. |
|
6853 |
] |
|
6854 |
] |
|
6855 |
]. |
|
6856 |
c notNil ifTrue:[ |
|
6857 |
xLatedString nextPut:c |
|
6858 |
] |
|
3371 | 6859 |
]. |
6860 |
||
6861 |
xLatedString := xLatedString contents. |
|
6862 |
pos notNil ifTrue:[ |
|
3762 | 6863 |
shortcutCharacter := xLatedString at:pos ifAbsent:nil. |
6864 |
||
6865 |
xLatedString isText ifFalse:[ |
|
6866 |
xLatedString := Text string:xLatedString |
|
6867 |
]. |
|
6868 |
xLatedString emphasisAt:pos add:#underline. |
|
6869 |
||
6870 |
shortcut := ('Cmd' , shortcutCharacter asLowercase) asSymbol. |
|
3371 | 6871 |
]. |
6872 |
^ Array with:shortcut with:xLatedString |
|
6873 |
||
6874 |
" |
|
6875 |
Transcript showCR:(self basicNew shortcutAndTranslatedStringFrom:'hello' ) last |
|
6876 |
Transcript showCR:(self basicNew shortcutAndTranslatedStringFrom:'he&llo' ) last |
|
6877 |
Transcript showCR:(self basicNew shortcutAndTranslatedStringFrom:'he&&llo' ) last |
|
6878 |
Transcript showCR:(self basicNew shortcutAndTranslatedStringFrom:'he& llo' ) last |
|
6879 |
Transcript showCR:(self basicNew shortcutAndTranslatedStringFrom:'he&123llo' ) last |
|
6880 |
Transcript showCR:(self basicNew shortcutAndTranslatedStringFrom:'hello &' ) last |
|
6881 |
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
|
6882 |
" |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6883 |
! |
3371 | 6884 |
|
6885 |
shortcutKey |
|
4492 | 6886 |
"get the shortcut key" |
4834 | 6887 |
|
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6888 |
^ self objectAttributeAt:#shortcutKey |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6889 |
! |
3371 | 6890 |
|
4834 | 6891 |
shortcutKey:aSymbolOrNil |
4492 | 6892 |
"set or clear the shortcut key" |
4834 | 6893 |
|
4492 | 6894 |
aSymbolOrNil notNil ifTrue:[ |
4834 | 6895 |
self objectAttributeAt:#shortcutKey put:aSymbolOrNil |
3371 | 6896 |
] ifFalse:[ |
4834 | 6897 |
self removeObjectAttribute:#shortcutKey |
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6898 |
]. |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
6899 |
! ! |
3371 | 6900 |
|
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6901 |
!SimpleView methodsFor:'menu handling'! |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6902 |
|
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6903 |
activateMenu |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6904 |
"activate my menu. |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6905 |
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
|
6906 |
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
|
6907 |
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
|
6908 |
Otherwise, the follwing steps are performed: |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6909 |
|
4834 | 6910 |
- ask the receiver for the menu (via #yellowButtonMenu) |
6911 |
- ask the receiver for the menuPerformer. |
|
6912 |
- startUp the menu - it is supposed to return an actionSelector |
|
6913 |
- if the menuPerformer responds to the selector, |
|
6914 |
send it to the performer; |
|
6915 |
otherwise send it to the view (the receiver) |
|
6916 |
This is funny, it allows additional menuItems to be added |
|
6917 |
AND still get the views copy/cut/paste functionality. |
|
6918 |
Without this, you had to redefine and forward all of those |
|
6919 |
messages in the performer." |
|
2489
f7ce16896fa1
process exposes when menu closes.
Claus Gittinger <cg@exept.de>
parents:
2465
diff
changeset
|
6920 |
|
f7ce16896fa1
process exposes when menu closes.
Claus Gittinger <cg@exept.de>
parents:
2465
diff
changeset
|
6921 |
|menu menuPerformer actionSelector prevReceiver wg| |
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6922 |
|
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6923 |
middleButtonMenu isNil ifTrue:[ |
4834 | 6924 |
" |
6925 |
try ST-80 style menus first: |
|
6926 |
if there is a model, and a menuMessage is defined, |
|
6927 |
ask model for the menu and launch that if non-nil. |
|
6928 |
" |
|
6929 |
menu := self yellowButtonMenu. |
|
6930 |
menu notNil ifTrue:[ |
|
6931 |
" |
|
6932 |
got one, launch the menu. It is supposed |
|
6933 |
to return an actionSelector. |
|
6934 |
" |
|
6935 |
menuPerformer := self menuPerformer value. |
|
6936 |
||
6937 |
"/ could be a spec ... |
|
6938 |
menu isArray ifTrue:[ |
|
6939 |
menu := menu decodeAsLiteralArray. |
|
6940 |
menu receiver:menuPerformer. |
|
6941 |
menu findGuiResourcesIn:(self menuHolder). |
|
6942 |
] ifFalse:[ |
|
6943 |
(menu respondsTo:#receiver) ifTrue:[ |
|
6944 |
menuPerformer := menu receiver ? menuPerformer. |
|
6945 |
]. |
|
6946 |
]. |
|
6947 |
||
6948 |
" |
|
6949 |
a temporary kludge: |
|
6950 |
pass myself as receiver, the menuPerformer as performer; |
|
6951 |
the menu will send its messages to either the |
|
6952 |
menuPerformer or me (its receiver). |
|
6953 |
This allows for the ST-80 behavior, where some messages |
|
6954 |
go to the model, others to the view |
|
6955 |
(copy/cut/paste). |
|
6956 |
" |
|
6957 |
(prevReceiver := menu receiver) isNil ifTrue:[ |
|
6958 |
"/ kludge for oldStyle menus (MenuView/PopUpMenu) |
|
6959 |
"/ not req'd for real Menus |
|
6960 |
"/ (menu isKindOf:Menu) ifFalse:[ |
|
6961 |
(menu respondsTo:#menuPerformer:) ifTrue:[ |
|
6962 |
menu receiver:self. "/ really ? |
|
6963 |
menu menuPerformer:menuPerformer. |
|
6964 |
] ifFalse:[ |
|
6965 |
"/ ] ifTrue:[ |
|
6966 |
"/ new style menu |
|
6967 |
menu receiver:menuPerformer. |
|
6968 |
] |
|
6969 |
]. |
|
6970 |
||
6971 |
"/ |
|
6972 |
"/ startup the menu - this returns a selector |
|
6973 |
"/ |
|
6974 |
actionSelector := self startUpMenu:menu. |
|
6975 |
||
6976 |
"/ before doing anything else, redraw expose area from |
|
6977 |
"/ the menu (in case the action changes my state) |
|
6978 |
(wg := self windowGroup) notNil ifTrue:[ |
|
6979 |
wg processExposeEvents. |
|
6980 |
]. |
|
6981 |
||
6982 |
(actionSelector notNil and:[actionSelector isSymbol]) ifTrue:[ |
|
6983 |
self dispatchMenuSelection:actionSelector to: menuPerformer. |
|
6984 |
]. |
|
6985 |
||
6986 |
menu receiver:prevReceiver. |
|
6987 |
||
6988 |
^ self |
|
6989 |
]. |
|
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6990 |
]. |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6991 |
|
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6992 |
"/ |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6993 |
"/ old style static menu |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6994 |
"/ |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6995 |
super activateMenu |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
6996 |
|
2127 | 6997 |
"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
|
6998 |
"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
|
6999 |
! |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
7000 |
|
3241 | 7001 |
dispatchMenuSelection:menuSelection to:aMenuPerformerOrNil |
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
7002 |
"dispatch a menu message. |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
7003 |
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
|
7004 |
|
1943 | 7005 |
|actionSelector actionArg1 actionArg2 app menuPerformer| |
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
7006 |
|
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
7007 |
actionSelector := menuSelection. |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
7008 |
|
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
7009 |
" |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
7010 |
mhmh - kludge for selectors with argument |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
7011 |
" |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
7012 |
(menuSelection isMemberOf:Array) ifTrue:[ |
3762 | 7013 |
actionArg1 := menuSelection at:2. |
7014 |
actionSelector := menuSelection at:1. |
|
3241 | 7015 |
]. |
7016 |
||
7017 |
menuPerformer := aMenuPerformerOrNil ? self menuPerformer. |
|
1839 | 7018 |
|
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
7019 |
" |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
7020 |
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
|
7021 |
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
|
7022 |
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
|
7023 |
" |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
7024 |
actionSelector isSymbol ifTrue:[ |
3762 | 7025 |
(menuPerformer respondsTo:actionSelector) ifFalse:[ |
7026 |
((app := self application) respondsTo:actionSelector) ifTrue:[ |
|
7027 |
menuPerformer := app. |
|
7028 |
actionArg1 := self model. |
|
7029 |
actionArg2 := self controller. |
|
7030 |
] ifFalse:[ |
|
7031 |
(self respondsTo:actionSelector) ifTrue:[ |
|
7032 |
menuPerformer := self |
|
7033 |
] |
|
7034 |
] |
|
7035 |
]. |
|
7036 |
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
|
7037 |
]. |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
7038 |
|
1943 | 7039 |
"Created: / 20.6.1997 / 11:47:42 / cg" |
7040 |
"Modified: / 1.11.1997 / 13:45:23 / cg" |
|
3533 | 7041 |
! |
7042 |
||
7043 |
menuFromSpec:aMenuOrMenuSpec |
|
7044 |
"create a menu for the receiver from a spec" |
|
7045 |
||
3559 | 7046 |
|spec| |
7047 |
||
7048 |
aMenuOrMenuSpec isNil ifTrue:[^ nil]. |
|
3533 | 7049 |
|
7050 |
aMenuOrMenuSpec isArray ifTrue:[ |
|
3762 | 7051 |
spec := aMenuOrMenuSpec decodeAsLiteralArray. |
3533 | 7052 |
] ifFalse:[ |
3762 | 7053 |
spec := aMenuOrMenuSpec. |
3533 | 7054 |
]. |
3556
eaea177415b0
findGuiResources... now sets the receiver, if not yet set
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
7055 |
"/ spec receiver:self. -- now done in findGuiResources ... |
3533 | 7056 |
spec findGuiResourcesIn:self. |
7057 |
^ spec. |
|
3752 | 7058 |
! |
7059 |
||
7060 |
startUpMenu:aMenu |
|
3753 | 7061 |
^ aMenu startUpFor:self |
1759
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
7062 |
! ! |
f4cd63a4d736
extracted menu dispatch code into sep. method.
Claus Gittinger <cg@exept.de>
parents:
1756
diff
changeset
|
7063 |
|
140 | 7064 |
!SimpleView methodsFor:'private'! |
7065 |
||
659 | 7066 |
componentsContainingX:x y:y do:aBlock |
4609 | 7067 |
(x isNil or:[y isNil]) ifTrue:[ |
4834 | 7068 |
"/ delegated |
7069 |
^ self |
|
4609 | 7070 |
]. |
7071 |
||
659 | 7072 |
components notNil ifTrue:[ |
4834 | 7073 |
components reverseDo:[:aComponent | |
7074 |
|thisFrame| |
|
7075 |
||
7076 |
thisFrame := aComponent bounds. |
|
7077 |
(thisFrame containsPointX:x y:y) ifTrue:[ |
|
7078 |
"/ prepare for masked/non-rectangular components ... |
|
7079 |
(aComponent perform:#containsPointX:y: with:x with:y ifNotUnderstood:true) |
|
7080 |
ifTrue:[ |
|
7081 |
aBlock value:aComponent |
|
7082 |
value:x - thisFrame left |
|
7083 |
value:y - thisFrame top. |
|
7084 |
] |
|
7085 |
] |
|
7086 |
] |
|
4609 | 7087 |
]. |
7088 |
||
7089 |
"Created: / 08-05-1996 / 23:40:59 / cg" |
|
7090 |
"Modified: / 13-09-2006 / 18:55:30 / User" |
|
659 | 7091 |
! |
7092 |
||
140 | 7093 |
computeInnerClip |
7094 |
"compute, but do not set the inside clip-area" |
|
7095 |
||
7096 |
|m2 nX nY nW nH| |
|
7097 |
||
4139 | 7098 |
margin isNil ifTrue:[margin := 0]. |
140 | 7099 |
(margin ~~ 0) ifTrue:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7100 |
m2 := margin + margin. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7101 |
nX := nY := margin. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7102 |
nW := width - m2. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7103 |
nH := height - m2. |
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
7104 |
"/ transformation notNil ifTrue:[ |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
7105 |
"/ nX := transformation applyInverseToX:nX. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
7106 |
"/ nY := transformation applyInverseToY:nY. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
7107 |
"/ nW := transformation applyInverseScaleX:nW. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
7108 |
"/ nH := transformation applyInverseScaleY:nH. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
7109 |
"/ ]. |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7110 |
innerClipRect := Rectangle |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7111 |
left:nX |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7112 |
top:nY |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7113 |
width:nW |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7114 |
height:nH |
140 | 7115 |
] ifFalse:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7116 |
"no clipping" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7117 |
innerClipRect := nil |
140 | 7118 |
] |
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
7119 |
|
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
7120 |
"Modified: / 22.5.1999 / 16:50:58 / cg" |
140 | 7121 |
! |
7122 |
||
269 | 7123 |
cornerFromRelativeCorner |
7124 |
"compute & return pixel corner from relativeCorner" |
|
7125 |
||
7126 |
^ self cornerFromRelativeCorner:relativeCorner |
|
7127 |
! |
|
7128 |
||
7129 |
cornerFromRelativeCorner:aPoint |
|
7130 |
"compute & return pixel corner from a relativeCorner, aPoint" |
|
7131 |
||
7132 |
|p r b bw| |
|
7133 |
||
7134 |
p := self pointFromRelative:aPoint. |
|
7135 |
||
2382 | 7136 |
bw := borderWidth ? 0. |
269 | 7137 |
insets isNil ifTrue:[ |
3152 | 7138 |
bw == 0 ifTrue:[ |
7139 |
^ p |
|
7140 |
]. |
|
7141 |
^ (p x - bw) @ (p y - bw) |
|
269 | 7142 |
]. |
7143 |
r := (insets at:3) + bw. |
|
7144 |
b := (insets at:4) + bw. |
|
7145 |
||
7146 |
"/ r := b := bw. |
|
7147 |
"/ rightInset notNil ifTrue:[ |
|
7148 |
"/ r := rightInset + bw |
|
7149 |
"/ ]. |
|
7150 |
"/ bottomInset notNil ifTrue:[ |
|
7151 |
"/ b := bottomInset + bw |
|
7152 |
"/ ]. |
|
7153 |
((r ~~ 0) or:[b ~~ 0]) ifTrue:[ |
|
3152 | 7154 |
^ (p x - r) @ (p y - b) |
269 | 7155 |
]. |
7156 |
^ p |
|
2382 | 7157 |
|
7158 |
"Modified: / 1.10.1998 / 13:21:33 / cg" |
|
269 | 7159 |
! |
7160 |
||
3518
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
7161 |
detectViewAt:aPoint |
3540 | 7162 |
"find the subView which contains aPoint - invisible components are ignored. |
7163 |
This is almost the same as #componentContainingX:y: (if that existed) " |
|
7164 |
||
7165 |
^ self detectViewAt:aPoint ignoreInvisible:false |
|
7166 |
! |
|
7167 |
||
7168 |
detectViewAt:aPoint ignoreInvisible:ignoreInvisible |
|
7169 |
"find the subView which contains aPoint - invisible components are ignored if |
|
7170 |
the ignoreInvisible argument is false. |
|
3518
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
7171 |
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
|
7172 |
|
3642 | 7173 |
|subViews| |
3518
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
7174 |
|
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
7175 |
(subViews := self subViews) notNil ifTrue:[ |
3762 | 7176 |
subViews do:[:v| |p| |
7177 |
(ignoreInvisible or:[v shown]) ifTrue:[ |
|
7178 |
( (aPoint x between:(v left) and:(v right)) |
|
7179 |
and:[aPoint y between:(v top) and:(v bottom)] |
|
7180 |
) ifTrue:[ |
|
7181 |
"/ found a subview - the point is there |
|
7182 |
p := device translatePoint:aPoint fromView:self toView:v. |
|
7183 |
^ v detectViewAt:p ignoreInvisible:ignoreInvisible. |
|
7184 |
] |
|
7185 |
] |
|
7186 |
] |
|
3518
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
7187 |
]. |
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
7188 |
"/ no subview - the point is here |
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
7189 |
^ self |
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
7190 |
|
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
7191 |
"Modified: / 10.10.2001 / 13:45:26 / cg" |
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
7192 |
! |
983e7730a905
use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents:
3516
diff
changeset
|
7193 |
|
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
7194 |
explicitExtent:aBoolean |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
7195 |
"/ explicitExtent := aBoolean |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
7196 |
aBoolean ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
7197 |
flagBits := flagBits bitOr:FlagHasExplicitExtent |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
7198 |
] ifFalse:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
7199 |
flagBits := flagBits bitClear:FlagHasExplicitExtent |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
7200 |
]. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
7201 |
! |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
7202 |
|
269 | 7203 |
extentFromRelativeExtent |
7204 |
"compute & return pixel extent from relativeExtent" |
|
7205 |
||
7206 |
^ self extentFromRelativeExtent:relativeExtent |
|
7207 |
! |
|
7208 |
||
7209 |
extentFromRelativeExtent:aPoint |
|
7210 |
"compute & return pixel extent from relativeExtent, aPoint" |
|
7211 |
||
7212 |
|rel newX newY inRect bw2 i| |
|
7213 |
||
7214 |
superView isNil ifTrue:[ |
|
3152 | 7215 |
inRect := 0@0 extent:device extent |
269 | 7216 |
] ifFalse:[ |
3152 | 7217 |
inRect := superView viewRectangle. |
269 | 7218 |
]. |
7219 |
||
7220 |
bw2 := borderWidth * 2. |
|
7221 |
||
7222 |
rel := aPoint x. |
|
7223 |
rel isInteger ifFalse:[ |
|
3152 | 7224 |
newX := (rel * (inRect width + bw2)) asInteger + inRect left. |
7225 |
(borderWidth ~~ 0) ifTrue:[ |
|
7226 |
newX := newX - borderWidth |
|
7227 |
]. |
|
269 | 7228 |
] ifTrue:[ |
3152 | 7229 |
newX := rel |
269 | 7230 |
]. |
7231 |
||
7232 |
rel := aPoint y. |
|
7233 |
rel isInteger ifFalse:[ |
|
3152 | 7234 |
newY := (rel * (inRect height + bw2)) asInteger + inRect top. |
7235 |
(borderWidth ~~ 0) ifTrue:[ |
|
7236 |
newY := newY - borderWidth |
|
7237 |
]. |
|
269 | 7238 |
] ifTrue:[ |
3152 | 7239 |
newY := rel |
269 | 7240 |
]. |
7241 |
||
7242 |
insets notNil ifTrue:[ |
|
3152 | 7243 |
i := insets at:1. "top" |
7244 |
(i ~~ 0) ifTrue:[ |
|
7245 |
newX := newX - i |
|
7246 |
]. |
|
7247 |
i := insets at:3. "left" |
|
7248 |
(i ~~ 0) ifTrue:[ |
|
7249 |
newX := newX - i |
|
7250 |
]. |
|
7251 |
i := insets at:2. "right" |
|
7252 |
(i ~~ 0) ifTrue:[ |
|
7253 |
newY := newY - i |
|
7254 |
]. |
|
7255 |
i := insets at:4. "bottom" |
|
7256 |
(i ~~ 0) ifTrue:[ |
|
7257 |
newY := newY - i |
|
7258 |
]. |
|
269 | 7259 |
]. |
7260 |
^ newX @ newY |
|
7261 |
! |
|
7262 |
||
7263 |
originFromRelativeOrigin |
|
7264 |
"compute & return pixel origin from relativeOrigin" |
|
7265 |
||
7266 |
^ self originFromRelativeOrigin:relativeOrigin |
|
7267 |
! |
|
7268 |
||
7269 |
originFromRelativeOrigin:aPoint |
|
7270 |
"compute & return pixel origin from relativeOrigin, aPoint" |
|
7271 |
||
7272 |
|p l t| |
|
7273 |
||
7274 |
p := self pointFromRelative:aPoint. |
|
7275 |
||
7276 |
insets isNil ifTrue:[ |
|
3152 | 7277 |
^ p |
269 | 7278 |
]. |
7279 |
l := insets at:1. |
|
7280 |
t := insets at:2. |
|
7281 |
||
7282 |
"/ l := t := 0. |
|
7283 |
"/ leftInset notNil ifTrue:[ |
|
7284 |
"/ l := leftInset |
|
7285 |
"/ ]. |
|
7286 |
"/ topInset notNil ifTrue:[ |
|
7287 |
"/ t := topInset |
|
7288 |
"/ ]. |
|
7289 |
((l ~~ 0) or:[t ~~ 0]) ifTrue:[ |
|
3152 | 7290 |
^ (p x + l) @ (p y + t) |
269 | 7291 |
]. |
7292 |
^ p |
|
7293 |
! |
|
7294 |
||
7295 |
pixelCorner:corner |
|
7296 |
"set the views corner in pixels" |
|
7297 |
||
7298 |
|w h| |
|
7299 |
||
7300 |
w := corner x - left + 1. |
|
7301 |
h := corner y - top + 1. |
|
7302 |
self pixelOrigin:(left @ top) extent:(w @ h) |
|
7303 |
||
7304 |
"Modified: 31.8.1995 / 18:20:22 / claus" |
|
7305 |
! |
|
7306 |
||
7307 |
pixelExtent:extent |
|
7308 |
"set the views extent in pixels" |
|
7309 |
||
7310 |
self pixelOrigin:(left @ top) extent:extent |
|
7311 |
! |
|
7312 |
||
1363 | 7313 |
pixelOrigin |
7314 |
"return the views origin in pixels. For subviews. the origin is relative |
|
7315 |
to the superviews top-left. For topViews, its the screen origin." |
|
7316 |
||
7317 |
^ self computeOrigin |
|
7318 |
! |
|
7319 |
||
269 | 7320 |
pixelOrigin:origin |
7321 |
"set the views origin in pixels. For subviews. the origin is relative |
|
7322 |
to the superviews top-left. For topViews, its the screen origin." |
|
7323 |
||
7324 |
|newLeft newTop| |
|
7325 |
||
7326 |
newLeft := origin x. |
|
7327 |
newTop := origin y. |
|
7328 |
((newTop ~~ top) or:[newLeft ~~ left]) ifTrue:[ |
|
3152 | 7329 |
top := newTop. |
7330 |
left := newLeft. |
|
7331 |
||
7332 |
" |
|
7333 |
if the receiver is visible, or is a topView, perform the |
|
7334 |
operation right away - otherwise, simply remember that the |
|
7335 |
origin has changed - will tell the display once we get realized |
|
7336 |
" |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7337 |
"/ (shown |
269 | 7338 |
"/ or:[superView isNil and:[drawableId notNil]]) ifTrue:[ |
7339 |
||
3152 | 7340 |
"/ no, have to do it if drawableId is there |
7341 |
"/ (otherwise, we could not move unmapped views around ... |
|
7342 |
"/ |
|
7343 |
drawableId notNil ifTrue:[ |
|
7344 |
device moveWindow:drawableId x:left y:top |
|
7345 |
] ifFalse:[ |
|
3375 | 7346 |
self originChangedFlag:true |
3152 | 7347 |
] |
269 | 7348 |
] |
7349 |
! |
|
7350 |
||
7351 |
pixelOrigin:origin corner:corner |
|
7352 |
"set the views origin and corner in pixels" |
|
7353 |
||
7354 |
|w h| |
|
7355 |
||
7356 |
w := corner x - origin x + 1. |
|
7357 |
h := corner y - origin y + 1. |
|
7358 |
self pixelOrigin:origin extent:(w @ h) |
|
7359 |
||
7360 |
"Modified: 31.8.1995 / 18:24:16 / claus" |
|
7361 |
! |
|
7362 |
||
140 | 7363 |
pixelOrigin:origin extent:extent |
7364 |
"set the views origin and extent in pixels" |
|
7365 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7366 |
|newLeft newTop newWidth newHeight how |
140 | 7367 |
mustRedrawBottomEdge mustRedrawRightEdge mustRepaintBottom |
3340 | 7368 |
mustRepaintRight sameOrigin oldWidth oldHeight oldPaint| |
140 | 7369 |
|
7370 |
newLeft := origin x. |
|
7371 |
newTop := origin y. |
|
7372 |
sameOrigin := ((newTop == top) and:[newLeft == left]). |
|
7373 |
||
7374 |
newWidth := extent x. |
|
7375 |
newHeight := extent y. |
|
7376 |
||
7377 |
" |
|
7378 |
X complains badly if you try to create/resize a view with |
|
7379 |
a dimension <= 0 ... (although I think that 0 maks sense ...) |
|
7380 |
" |
|
7381 |
newWidth < 1 ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7382 |
newWidth := 1. |
140 | 7383 |
]. |
7384 |
newHeight < 1 ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7385 |
newHeight := 1 |
140 | 7386 |
]. |
7387 |
||
7388 |
((newWidth == width) and:[newHeight == height]) ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7389 |
sameOrigin ifTrue:[^ self]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7390 |
self changed:#origin. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7391 |
^ self pixelOrigin:origin |
140 | 7392 |
]. |
7393 |
top := newTop. |
|
7394 |
left := newLeft. |
|
7395 |
||
7396 |
"/ shown ifTrue:[ "4-nov-94 actually correct," |
|
7397 |
drawableId notNil ifTrue:[ "but theres a bug in menus when resized while hidden" |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7398 |
mustRedrawBottomEdge := (level ~~ 0) and:[newHeight < height]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7399 |
mustRedrawRightEdge := (level ~~ 0) and:[newWidth < width]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7400 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7401 |
((newHeight <= height) and:[newWidth <= width]) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7402 |
how := #smaller |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7403 |
] ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7404 |
((newHeight >= height) and:[newWidth >= width]) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7405 |
how := #larger |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7406 |
] |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7407 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7408 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7409 |
mustRepaintRight := false. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7410 |
mustRepaintBottom := false. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7411 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7412 |
oldWidth := width. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7413 |
oldHeight := height. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7414 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7415 |
shown ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7416 |
(level ~~ 0) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7417 |
"clear the old edges" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7418 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7419 |
newWidth > width ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7420 |
self clippingRectangle:nil. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7421 |
oldPaint := paint. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7422 |
self paint:viewBackground. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7423 |
self fillDeviceRectangleX:(width - margin) |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7424 |
y:0 |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7425 |
width:margin |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7426 |
height:height. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7427 |
self paint:oldPaint. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7428 |
mustRepaintRight := true. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7429 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7430 |
newHeight > height ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7431 |
self clippingRectangle:nil. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7432 |
oldPaint := paint. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7433 |
self paint:viewBackground. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7434 |
self fillDeviceRectangleX:0 |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7435 |
y:(height - margin) |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7436 |
width:width |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7437 |
height:margin. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7438 |
self paint:oldPaint. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7439 |
mustRepaintBottom := true. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7440 |
] |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7441 |
] |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7442 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7443 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7444 |
width := newWidth. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7445 |
height := newHeight. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7446 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7447 |
self setInnerClip. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7448 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7449 |
"if view becomes smaller, send sizeChanged first" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7450 |
true "(how == #smaller)" ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7451 |
self sizeChanged:how |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7452 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7453 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7454 |
"have to tell X, when extent of view is changed" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7455 |
sameOrigin ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7456 |
device resizeWindow:drawableId width:width height:height. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7457 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7458 |
] ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7459 |
"claus: some xservers seem to do better when resizing |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7460 |
first ...." |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7461 |
" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7462 |
(how == #smaller) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7463 |
device resizeWindow:drawableId width:width height:height. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7464 |
device moveWindow:drawableId x:left y:top |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7465 |
] ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7466 |
device moveResizeWindow:drawableId x:left y:top width:width height:height |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7467 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7468 |
" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7469 |
device moveResizeWindow:drawableId x:left y:top |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7470 |
width:width height:height. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7471 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7472 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7473 |
"if view becomes bigger, send sizeChanged after" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7474 |
false "(how ~~ #smaller)" ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7475 |
self sizeChanged:how |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7476 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7477 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7478 |
shown ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7479 |
(mustRedrawBottomEdge or:[mustRedrawRightEdge]) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7480 |
self deviceClippingRectangle:nil. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7481 |
oldPaint := paint. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7482 |
mustRedrawBottomEdge ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7483 |
self drawBottomEdge |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7484 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7485 |
mustRedrawRightEdge ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7486 |
self drawRightEdge |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7487 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7488 |
self paint:oldPaint. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7489 |
self deviceClippingRectangle:innerClipRect |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7490 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7491 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7492 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7493 |
mustRepaintRight ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7494 |
self invalidateDeviceRectangle:(((oldWidth - margin) @ 0) |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7495 |
extent:margin@height) |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7496 |
repairNow:false. |
2400
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
7497 |
"/ self redrawDeviceX:(oldWidth - margin) |
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
7498 |
"/ y:0 |
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
7499 |
"/ width:margin |
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
7500 |
"/ height:height. |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7501 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7502 |
mustRepaintBottom ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7503 |
self invalidateDeviceRectangle:((0 @ (oldHeight - margin)) |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7504 |
extent:width@margin) |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7505 |
repairNow:false. |
2400
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
7506 |
"/ self redrawDeviceX:0 |
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
7507 |
"/ y:(oldHeight - margin) |
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
7508 |
"/ width:width |
13dc68f612fb
when resizing, invalidate instead of redrawing right away
Claus Gittinger <cg@exept.de>
parents:
2396
diff
changeset
|
7509 |
"/ height:margin. |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7510 |
]. |
140 | 7511 |
] ifFalse:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7512 |
"otherwise memorize the need for a sizeChanged message" |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7513 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7514 |
width := newWidth. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7515 |
height := newHeight. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7516 |
sameOrigin ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7517 |
self originChangedFlag:true. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7518 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7519 |
self extentChangedFlag:true. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7520 |
subViews size > 0 ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7521 |
self extentChangedBeforeCreatedFlag:true. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7522 |
]. |
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
7523 |
]. |
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
7524 |
sameOrigin ifFalse:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7525 |
self changed:#origin. |
3784
378456357157
added #frame for displayObject compatibility
Michael Beyl <mb@exept.de>
parents:
3781
diff
changeset
|
7526 |
]. |
739 | 7527 |
|
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
7528 |
"Modified: / 25.5.1999 / 14:49:56 / cg" |
140 | 7529 |
! |
7530 |
||
7531 |
pointFromRelative:p |
|
7532 |
"compute absolute coordinate from p" |
|
7533 |
||
7534 |
|newX newY rel inRect bw superWidth superHeight superLeft superTop | |
|
7535 |
||
2382 | 7536 |
bw := borderWidth ? 0. |
140 | 7537 |
|
7538 |
superView isNil ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7539 |
superWidth := device width + bw. |
3152 | 7540 |
superHeight := device height + bw. |
7541 |
superLeft := superTop := 0. |
|
140 | 7542 |
] ifFalse:[ |
3152 | 7543 |
inRect := superView viewRectangle. |
7544 |
superWidth := inRect width. |
|
7545 |
superHeight := inRect height. |
|
7546 |
superLeft := inRect left. |
|
7547 |
superTop := inRect top. |
|
140 | 7548 |
]. |
7549 |
||
7550 |
rel := p x. |
|
7551 |
rel isInteger ifTrue:[ |
|
3152 | 7552 |
newX := rel |
140 | 7553 |
] ifFalse:[ |
3152 | 7554 |
newX := (rel * superWidth) asInteger + superLeft. |
7555 |
(bw ~~ 0) ifTrue:[ |
|
7556 |
rel ~= 1.0 ifTrue:[ |
|
7557 |
newX := newX - bw |
|
7558 |
] |
|
7559 |
] |
|
140 | 7560 |
]. |
7561 |
||
7562 |
rel := p y. |
|
7563 |
rel isInteger ifTrue:[ |
|
3152 | 7564 |
newY := rel |
140 | 7565 |
] ifFalse:[ |
3152 | 7566 |
newY := (rel * superHeight) asInteger + superTop. |
7567 |
(bw ~~ 0) ifTrue:[ |
|
7568 |
rel ~= 1.0 ifTrue:[ |
|
7569 |
newY := newY - bw |
|
7570 |
] |
|
7571 |
] |
|
140 | 7572 |
]. |
7573 |
^ newX @ newY |
|
2382 | 7574 |
|
7575 |
"Modified: / 1.10.1998 / 13:21:14 / cg" |
|
140 | 7576 |
! |
7577 |
||
7578 |
setBorderColor |
|
7579 |
"set my borderColor" |
|
7580 |
||
7581 |
|id dither| |
|
7582 |
||
7583 |
drawableId notNil ifTrue:[ |
|
3152 | 7584 |
borderColor := borderColor onDevice:device. |
7585 |
id := borderColor colorId. |
|
7586 |
id notNil ifTrue:[ |
|
7587 |
device setWindowBorderColor:id in:drawableId |
|
7588 |
] ifFalse:[ |
|
7589 |
dither := borderColor ditherForm. |
|
7590 |
dither notNil ifTrue:[ |
|
7591 |
device setWindowBorderPixmap:(dither id) in:drawableId |
|
7592 |
] ifFalse:[ |
|
7593 |
'SimpleView [warning]: bad borderColor' errorPrintCR |
|
7594 |
] |
|
7595 |
] |
|
135 | 7596 |
] |
1172
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
7597 |
|
a69398754511
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
7598 |
"Modified: 10.1.1997 / 18:06:34 / cg" |
135 | 7599 |
! |
7600 |
||
269 | 7601 |
setInnerClip |
7602 |
"compute, and set the inside clip-area" |
|
7603 |
||
7604 |
self computeInnerClip. |
|
2726
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
7605 |
self deviceClippingRectangle:innerClipRect. |
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
7606 |
|
c0a05c874843
always use a deviceClipRect as innerClip;
Claus Gittinger <cg@exept.de>
parents:
2721
diff
changeset
|
7607 |
"Modified: / 25.5.1999 / 14:45:53 / cg" |
1903 | 7608 |
! |
7609 |
||
4139 | 7610 |
setShown:aState |
7611 |
shown := aState |
|
7612 |
||
7613 |
! |
|
7614 |
||
1903 | 7615 |
setViewShape |
7616 |
|form| |
|
7617 |
||
7618 |
(form := viewShape borderShapeForm) notNil ifTrue:[ |
|
3152 | 7619 |
device setWindowBorderShape:(form id) in:drawableId |
1903 | 7620 |
]. |
7621 |
(form := viewShape viewShapeForm) notNil ifTrue:[ |
|
3152 | 7622 |
device setWindowShape:(form id) in:drawableId |
1903 | 7623 |
]. |
7624 |
||
7625 |
"Created: 18.9.1997 / 11:09:00 / cg" |
|
4139 | 7626 |
! |
7627 |
||
7628 |
windowGroupClass |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7629 |
^ WindowGroup |
140 | 7630 |
! ! |
7631 |
||
269 | 7632 |
!SimpleView methodsFor:'queries'! |
7633 |
||
7634 |
canHandle:aKey |
|
7635 |
"return true, if I like to handle the key (from a keyPress event). |
|
7636 |
OBSOLETE: do not use & depend on this method, it is a historic |
|
7637 |
leftOver and will be removed. Use the delegation mechanism for this." |
|
7638 |
||
7639 |
^ false |
|
7640 |
! |
|
7641 |
||
7642 |
canHandle:aKey from:aView |
|
7643 |
"return true, if I like to handle the key (from a keyPress event) |
|
7644 |
in aView. |
|
7645 |
OBSOLETE: do not use & depend on this method, it is a historic |
|
7646 |
leftOver and will be removed. Use the delegation mechanism for this." |
|
7647 |
||
7648 |
^ self canHandle:aKey |
|
7649 |
! |
|
7650 |
||
4915
440fb8ebb234
changed #computePreferredExtent (from cg)
Stefan Vogel <sv@exept.de>
parents:
4907
diff
changeset
|
7651 |
computePreferredExtent |
440fb8ebb234
changed #computePreferredExtent (from cg)
Stefan Vogel <sv@exept.de>
parents:
4907
diff
changeset
|
7652 |
|savedPref computedPref| |
440fb8ebb234
changed #computePreferredExtent (from cg)
Stefan Vogel <sv@exept.de>
parents:
4907
diff
changeset
|
7653 |
|
440fb8ebb234
changed #computePreferredExtent (from cg)
Stefan Vogel <sv@exept.de>
parents:
4907
diff
changeset
|
7654 |
savedPref := preferredExtent. |
440fb8ebb234
changed #computePreferredExtent (from cg)
Stefan Vogel <sv@exept.de>
parents:
4907
diff
changeset
|
7655 |
[ |
440fb8ebb234
changed #computePreferredExtent (from cg)
Stefan Vogel <sv@exept.de>
parents:
4907
diff
changeset
|
7656 |
preferredExtent := nil. |
440fb8ebb234
changed #computePreferredExtent (from cg)
Stefan Vogel <sv@exept.de>
parents:
4907
diff
changeset
|
7657 |
computedPref := self preferredExtent. |
440fb8ebb234
changed #computePreferredExtent (from cg)
Stefan Vogel <sv@exept.de>
parents:
4907
diff
changeset
|
7658 |
] ensure:[ |
440fb8ebb234
changed #computePreferredExtent (from cg)
Stefan Vogel <sv@exept.de>
parents:
4907
diff
changeset
|
7659 |
preferredExtent := savedPref. |
440fb8ebb234
changed #computePreferredExtent (from cg)
Stefan Vogel <sv@exept.de>
parents:
4907
diff
changeset
|
7660 |
]. |
440fb8ebb234
changed #computePreferredExtent (from cg)
Stefan Vogel <sv@exept.de>
parents:
4907
diff
changeset
|
7661 |
^ computedPref |
440fb8ebb234
changed #computePreferredExtent (from cg)
Stefan Vogel <sv@exept.de>
parents:
4907
diff
changeset
|
7662 |
! |
440fb8ebb234
changed #computePreferredExtent (from cg)
Stefan Vogel <sv@exept.de>
parents:
4907
diff
changeset
|
7663 |
|
3368
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7664 |
cornerChangedFlag |
3375 | 7665 |
"/ ^ cornerChangedFlag == true |
7666 |
^ flagBits bitTest:FlagCornerChanged |
|
7667 |
! |
|
7668 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
7669 |
cornerChangedFlag:aBoolean |
3375 | 7670 |
"/ cornerChangedFlag := aBoolean |
7671 |
aBoolean ifTrue:[ |
|
7672 |
flagBits := flagBits bitOr:FlagCornerChanged |
|
7673 |
] ifFalse:[ |
|
7674 |
flagBits := flagBits bitClear:FlagCornerChanged |
|
7675 |
]. |
|
3368
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7676 |
! |
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7677 |
|
269 | 7678 |
delegatesTo:someone |
7679 |
"return true, if I delegate events to someone" |
|
7680 |
||
7681 |
delegate isNil ifTrue:[^ false]. |
|
7682 |
^ delegate delegatesTo:someone |
|
7683 |
! |
|
7684 |
||
3439 | 7685 |
escapeIsCancel |
7686 |
"return the escapeIsCancel setting - defaults to true for popupViews here." |
|
7687 |
||
7688 |
^ self isPopUpView |
|
7689 |
! |
|
7690 |
||
3394
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
7691 |
extentChangedBeforeCreatedFlag |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
7692 |
^ flagBits bitTest:FlagExtentChangedBeforeCreated |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
7693 |
! |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
7694 |
|
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
7695 |
extentChangedBeforeCreatedFlag:aBoolean |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
7696 |
aBoolean ifTrue:[ |
3762 | 7697 |
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
|
7698 |
] ifFalse:[ |
3762 | 7699 |
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
|
7700 |
]. |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
7701 |
! |
56080b4ebce1
remember the fact, that the extent changed before the view
Claus Gittinger <cg@exept.de>
parents:
3392
diff
changeset
|
7702 |
|
3368
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7703 |
extentChangedFlag |
3375 | 7704 |
"/ ^ extentChangedFlag == true |
7705 |
^ flagBits bitTest:FlagExtentChanged |
|
3368
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7706 |
! |
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7707 |
|
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7708 |
extentChangedFlag:aBoolean |
3375 | 7709 |
"/ extentChangedFlag := aBoolean |
7710 |
aBoolean ifTrue:[ |
|
7711 |
flagBits := flagBits bitOr:FlagExtentChanged |
|
7712 |
] ifFalse:[ |
|
7713 |
flagBits := flagBits bitClear:FlagExtentChanged |
|
7714 |
]. |
|
3368
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7715 |
! |
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7716 |
|
269 | 7717 |
hasFocus |
7718 |
"return true, if the receiver has the keyboard focus |
|
7719 |
(either via the focusView mechanism in the windowGroup, |
|
7720 |
or via delegation)" |
|
7721 |
||
4675 | 7722 |
|focusViewToCheck focusViewInWindowGroup focusViewOnDisplay delegate| |
269 | 7723 |
|
7724 |
windowGroup isNil ifTrue:[^ false]. |
|
7725 |
||
4675 | 7726 |
"/ this is wrong (the old code). |
7727 |
"/ focusViewInWindowGroup := windowGroup focusView. |
|
7728 |
"/ focusViewToCheck := focusViewInWindowGroup. |
|
7729 |
||
7730 |
focusViewOnDisplay := device focusView. |
|
7731 |
focusViewToCheck := focusViewOnDisplay. |
|
4834 | 7732 |
|
4675 | 7733 |
focusViewToCheck == self ifTrue:[ |
4834 | 7734 |
^ true |
4675 | 7735 |
]. |
7736 |
||
7737 |
focusViewToCheck notNil ifTrue:[ |
|
4834 | 7738 |
"mhmh - is there a delegation to me ?" |
7739 |
(delegate := focusViewToCheck delegate) notNil ifTrue:[ |
|
7740 |
delegate == self ifTrue:[^ true]. |
|
7741 |
^ delegate delegatesTo:self |
|
7742 |
] |
|
135 | 7743 |
]. |
269 | 7744 |
^ false |
4675 | 7745 |
|
7746 |
"Modified: / 08-11-2006 / 12:10:32 / cg" |
|
269 | 7747 |
! |
7748 |
||
370 | 7749 |
is3D |
7750 |
"return true, if my style is some kind of 3D style |
|
7751 |
This is OBSOLETE and will be removed." |
|
7752 |
||
7753 |
^ styleSheet is3D |
|
7754 |
! |
|
7755 |
||
794 | 7756 |
isBorderedWrapper |
7757 |
^ false |
|
7758 |
||
7759 |
"Created: 5.6.1996 / 14:11:15 / cg" |
|
7760 |
! |
|
7761 |
||
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
7762 |
isComponentOf:aViewOrComponent |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
7763 |
"return true, if I am a (direct or indirect) component of aViewOrComponent" |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
7764 |
|
3362 | 7765 |
|sview| |
7766 |
||
7767 |
sview := self. |
|
7768 |
||
3616 | 7769 |
[ (sview := sview container) notNil ] whileTrue:[ |
3762 | 7770 |
sview == aViewOrComponent ifTrue:[^ true]. |
3362 | 7771 |
]. |
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7772 |
^ false |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7773 |
! |
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
7774 |
|
3711
f74e461c8b31
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
3709
diff
changeset
|
7775 |
isCursorKeyConsumer |
f74e461c8b31
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
3709
diff
changeset
|
7776 |
"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
|
7777 |
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
|
7778 |
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
|
7779 |
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
|
7780 |
mode is off. |
f74e461c8b31
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
3709
diff
changeset
|
7781 |
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
|
7782 |
|
f74e461c8b31
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
3709
diff
changeset
|
7783 |
^ false |
f74e461c8b31
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
3709
diff
changeset
|
7784 |
! |
f74e461c8b31
added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents:
3709
diff
changeset
|
7785 |
|
2496 | 7786 |
isDefault |
7787 |
"return true, if I am a default widget; |
|
7788 |
Used with autoAccept. Currently only default buttons are supposed to return |
|
7789 |
true here" |
|
7790 |
||
7791 |
^ false |
|
7792 |
! |
|
7793 |
||
2430
fbce2378d686
added isExternalTopView query.
Claus Gittinger <cg@exept.de>
parents:
2425
diff
changeset
|
7794 |
isExternalTopView |
2454 | 7795 |
"return true, if this is an external topView - always false here" |
7796 |
||
2430
fbce2378d686
added isExternalTopView query.
Claus Gittinger <cg@exept.de>
parents:
2425
diff
changeset
|
7797 |
^ false |
fbce2378d686
added isExternalTopView query.
Claus Gittinger <cg@exept.de>
parents:
2425
diff
changeset
|
7798 |
|
fbce2378d686
added isExternalTopView query.
Claus Gittinger <cg@exept.de>
parents:
2425
diff
changeset
|
7799 |
|
fbce2378d686
added isExternalTopView query.
Claus Gittinger <cg@exept.de>
parents:
2425
diff
changeset
|
7800 |
! |
fbce2378d686
added isExternalTopView query.
Claus Gittinger <cg@exept.de>
parents:
2425
diff
changeset
|
7801 |
|
497 | 7802 |
isInputField |
7803 |
"return true, if the receiver is some kind of input view, |
|
7804 |
i.e. it should (can) be part of an enterGroup. |
|
7805 |
Return false here, this is redefined in EnterField." |
|
7806 |
||
7807 |
^ false |
|
7808 |
||
7809 |
"Created: 4.3.1996 / 11:34:07 / cg" |
|
7810 |
! |
|
7811 |
||
2410 | 7812 |
isJavaView |
7813 |
^ false |
|
7814 |
||
7815 |
"Created: / 4.12.1998 / 14:10:06 / cg" |
|
7816 |
! |
|
7817 |
||
2588 | 7818 |
isKeyboardConsumer |
2727 | 7819 |
"return true, if the receiver is a keyboard consumer; |
2588 | 7820 |
i.e. it can handle (non-shortkey) keyboard input, |
7821 |
keyboardConsumer are potential candidates for getting the keyboard |
|
7822 |
focus initially within dialogBoxes, or when the focus-follows-pointer |
|
7823 |
mode is off. |
|
7824 |
Return false here, this is redefined in EditTextView and EditField." |
|
7825 |
||
7826 |
^ false |
|
2727 | 7827 |
|
7828 |
"Modified: / 22.5.1999 / 16:19:27 / cg" |
|
2588 | 7829 |
! |
7830 |
||
964 | 7831 |
isLayoutWrapper |
7832 |
^ false |
|
7833 |
||
7834 |
"Created: 19.7.1996 / 17:51:04 / cg" |
|
7835 |
! |
|
7836 |
||
4497 | 7837 |
isMDIClientView |
7838 |
^false |
|
7839 |
! |
|
7840 |
||
4184 | 7841 |
isModal |
7842 |
"return true, if the receiver has been opened modal. |
|
7843 |
For compatibility with topView (if regular views are the window of an application), |
|
7844 |
return false here." |
|
7845 |
||
7846 |
^ false |
|
7847 |
! |
|
7848 |
||
3653 | 7849 |
isSameOrComponentOf:aView |
7850 |
"return true, if I am aView or a (direct or indirect) component of aView" |
|
7851 |
||
7852 |
^ self == aView or:[self isComponentOf:aView]. |
|
7853 |
! |
|
7854 |
||
2161
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
7855 |
isScrollWrapper |
4918
4c804945889f
Clean up documentation & variable names
Stefan Vogel <sv@exept.de>
parents:
4915
diff
changeset
|
7856 |
"answer true if this view wraps a possibly larger view and has scroll bars" |
4c804945889f
Clean up documentation & variable names
Stefan Vogel <sv@exept.de>
parents:
4915
diff
changeset
|
7857 |
|
2161
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
7858 |
^ false |
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
7859 |
|
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
7860 |
"Created: / 5.6.1996 / 14:11:15 / cg" |
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
7861 |
"Modified: / 20.6.1998 / 14:15:29 / cg" |
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
7862 |
! |
46940821c697
added #isScrollWrapper query.
Claus Gittinger <cg@exept.de>
parents:
2159
diff
changeset
|
7863 |
|
269 | 7864 |
isSubViewOf:aView |
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
7865 |
"return true, if I am a (direct or indirect) subview of aView" |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
7866 |
|
3434 | 7867 |
<resource:#obsolete> |
7868 |
||
791
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
7869 |
self obsoleteMethodWarning:'use #isComponentOf:'. |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
7870 |
^ self isComponentOf:aView. |
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
7871 |
|
e6adfb28e3bc
isSubViewOf: -> isComponentOf:
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
7872 |
"Modified: 5.6.1996 / 14:25:35 / cg" |
269 | 7873 |
! |
7874 |
||
3754 | 7875 |
isTextView |
7876 |
"I am not showing text (showing lines)" |
|
7877 |
||
7878 |
^ false |
|
7879 |
! |
|
7880 |
||
4151 | 7881 |
isTransparentBox |
7882 |
^ false |
|
7883 |
! |
|
7884 |
||
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
7885 |
isWrapper |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
7886 |
^ false |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
7887 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
7888 |
"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
|
7889 |
! |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
7890 |
|
3368
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7891 |
originChangedFlag |
3375 | 7892 |
"/ ^ originChangedFlag == true |
7893 |
^ flagBits bitTest:FlagOriginChanged |
|
3368
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7894 |
! |
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7895 |
|
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7896 |
originChangedFlag:aBoolean |
3375 | 7897 |
"/ originChangedFlag := aBoolean |
7898 |
aBoolean ifTrue:[ |
|
7899 |
flagBits := flagBits bitOr:FlagOriginChanged |
|
7900 |
] ifFalse:[ |
|
7901 |
flagBits := flagBits bitClear:FlagOriginChanged |
|
7902 |
]. |
|
3368
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7903 |
! |
57da0cceaf16
concentrated all accesses to originChanged, extentChanged and
Claus Gittinger <cg@exept.de>
parents:
3367
diff
changeset
|
7904 |
|
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7905 |
originOrExtentChanged |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7906 |
"/ ^ originChanged or:[extentChanged]. |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7907 |
^ flagBits bitTest:( FlagOriginChanged + FlagExtentChanged ) |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7908 |
! |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7909 |
|
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7910 |
originOrExtentOrCornerChanged |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7911 |
"/ ^ 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
|
7912 |
^ 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
|
7913 |
! |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
7914 |
|
269 | 7915 |
preferredBounds |
7916 |
"ST-80 compatibility." |
|
7917 |
||
971 | 7918 |
^ 0@0 extent:(self preferredExtent) |
7919 |
||
7920 |
"Modified: 19.7.1996 / 20:41:36 / cg" |
|
269 | 7921 |
! |
7922 |
||
7923 |
preferredExtent |
|
7924 |
"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
|
7925 |
If the preferredExtent has been set, that one is returned. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7926 |
Otherwise, if there are any components, a rectangle enclosing them |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7927 |
is returned. Otherwise, the actual extent is returned." |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7928 |
|
1063 | 7929 |
|maxX maxY| |
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7930 |
|
971 | 7931 |
"/ If I have an explicit preferredExtent .. |
7932 |
||
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7933 |
preferredExtent notNil ifTrue:[ |
3152 | 7934 |
^ preferredExtent |
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7935 |
]. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7936 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7937 |
"/ mhmh - if I have subViews, collect their |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7938 |
"/ preferred bounds ... |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7939 |
|
269 | 7940 |
subViews notNil ifTrue:[ |
3152 | 7941 |
maxX := maxY := 0. |
7942 |
subViews do:[:aSubView | |
|
7943 |
|org corn| |
|
7944 |
||
7945 |
org := aSubView computeOrigin. |
|
7946 |
corn := org + aSubView preferredExtent. |
|
7947 |
maxX := maxX max:corn x. |
|
7948 |
maxY := maxY max:corn y. |
|
7949 |
] |
|
140 | 7950 |
]. |
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7951 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7952 |
"/ mhmh - if I have components, collect their |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7953 |
"/ preferred bounds ... |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7954 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7955 |
components notNil ifTrue:[ |
3152 | 7956 |
maxX isNil ifTrue:[ |
7957 |
maxX := maxY := 0. |
|
7958 |
]. |
|
7959 |
components do:[:aComponent | |
|
7960 |
|bounds org corn| |
|
7961 |
||
7962 |
bounds := aComponent preferredBounds. |
|
7963 |
corn := bounds corner. |
|
7964 |
maxX := maxX max:corn x. |
|
7965 |
maxY := maxY max:corn y. |
|
7966 |
] |
|
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7967 |
]. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7968 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7969 |
"/ nothing found - return the actual size |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7970 |
|
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7971 |
maxX isNil ifTrue:[ |
3152 | 7972 |
^ self extent. |
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7973 |
]. |
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7974 |
|
269 | 7975 |
^ maxX @ maxY. |
761
34d17118452a
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
760
diff
changeset
|
7976 |
|
971 | 7977 |
"Modified: 19.7.1996 / 20:43:32 / cg" |
269 | 7978 |
! |
7979 |
||
4970
6a58581288cc
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
4968
diff
changeset
|
7980 |
preferredHeight |
6a58581288cc
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
4968
diff
changeset
|
7981 |
^ self preferredExtent y |
6a58581288cc
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
4968
diff
changeset
|
7982 |
! |
6a58581288cc
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
4968
diff
changeset
|
7983 |
|
6a58581288cc
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
4968
diff
changeset
|
7984 |
preferredWidth |
6a58581288cc
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
4968
diff
changeset
|
7985 |
^ self preferredExtent x |
6a58581288cc
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
4968
diff
changeset
|
7986 |
! |
6a58581288cc
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
4968
diff
changeset
|
7987 |
|
2956 | 7988 |
reallyRealized |
7989 |
"return true, if the receiver is realized and all containers |
|
7990 |
are realized." |
|
7991 |
||
7992 |
realized ifFalse:[^ false]. |
|
7993 |
superView isNil ifTrue:[^ true]. |
|
7994 |
^ superView reallyRealized |
|
7995 |
||
7996 |
||
7997 |
! |
|
7998 |
||
2130
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
7999 |
resources |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
8000 |
^ resources |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
8001 |
|
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
8002 |
"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
|
8003 |
! |
5dbffd126b4a
added #resources class method for all views.
Claus Gittinger <cg@exept.de>
parents:
2128
diff
changeset
|
8004 |
|
269 | 8005 |
sizeFixed |
8006 |
"return true, if this vew wants its size to remain unchanged. |
|
8007 |
Used by panels, to check if their components want to keep their size." |
|
8008 |
||
8009 |
^ false |
|
8010 |
||
8011 |
"Created: 17.9.1995 / 20:29:20 / claus" |
|
3901 | 8012 |
! |
8013 |
||
8014 |
tabRequiresControl |
|
8015 |
"returns true, if a focus tabbing requires a control-key to be pressed. |
|
8016 |
The default is true for editTextView, false for other widgets, |
|
8017 |
to allow for easier text entry" |
|
8018 |
||
8019 |
^ false |
|
4191 | 8020 |
! |
8021 |
||
8022 |
window |
|
8023 |
"for compatibility with applicationModels ... return the receiver" |
|
8024 |
||
8025 |
^ self |
|
1699
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
8026 |
! ! |
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
8027 |
|
3266 | 8028 |
!SimpleView methodsFor:'queries-events'! |
2802 | 8029 |
|
8030 |
buttonMotionEventPending |
|
8031 |
"return true, if a button motion event is pending. |
|
8032 |
Normally, you dont want to use this, since no polling is needed |
|
8033 |
(not even for mouse-tracking). |
|
8034 |
Actually, its a historical leftover" |
|
8035 |
||
8036 |
windowGroup notNil ifTrue:[ |
|
3152 | 8037 |
^ windowGroup sensor hasButtonMotionEventFor:self |
2802 | 8038 |
]. |
8039 |
^ super buttonMotionEventPending |
|
8040 |
||
8041 |
"Modified: 1.11.1996 / 17:04:38 / cg" |
|
8042 |
! ! |
|
8043 |
||
3266 | 8044 |
!SimpleView methodsFor:'queries-internal'! |
1699
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
8045 |
|
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
8046 |
nativeWindowType |
1702 | 8047 |
"return a symbol describing my native window type - here, nil is returned |
8048 |
(may be used internally by the device as a native window creation hint)" |
|
8049 |
||
1699
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
8050 |
^ nil |
1354 | 8051 |
! |
8052 |
||
8053 |
specClass |
|
1943 | 8054 |
"fallback - heuristics to get a specClass for some viewClass. |
8055 |
Based upon my className, look for a corresponding Spec-class. |
|
8056 |
If there is none, return ArbiraryComponentSpec as a fallBack" |
|
8057 |
||
8058 |
|myClass myName cls| |
|
8059 |
||
4157 | 8060 |
myClass := self class. |
8061 |
(myClass == View or:[myClass == SimpleView]) ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8062 |
^ ViewSpec "/ CompositeSpecCollection |
1943 | 8063 |
]. |
8064 |
||
8065 |
"/ try: appending 'Spec' to my classes name |
|
1409
3818a8a85c16
use CompositeSpecCollection as specClass for
Claus Gittinger <cg@exept.de>
parents:
1402
diff
changeset
|
8066 |
|
1354 | 8067 |
myName := self class name. |
8068 |
cls := Smalltalk classNamed:(myName , 'Spec'). |
|
1943 | 8069 |
cls notNil ifTrue:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8070 |
cls := cls autoload. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8071 |
(cls isSubclassOf:UISpecification) ifTrue:[^ cls]. |
1943 | 8072 |
]. |
1354 | 8073 |
|
8074 |
(myName endsWith:'View') ifTrue:[ |
|
1943 | 8075 |
"/ "/ try name without 'View' |
8076 |
"/ cls := Smalltalk classNamed:(myName copyWithoutLast:4). |
|
4157 | 8077 |
"/ cls notNil ifTrue:[ |
8078 |
"/ cls := cls autoload. |
|
8079 |
"/ (cls isSubclassOf:UISpecification) ifTrue:[^ cls]. |
|
1943 | 8080 |
"/ ]. |
4157 | 8081 |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8082 |
"/ try with 'View' replaced by 'Spec' |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8083 |
cls := Smalltalk classNamed:((myName copyWithoutLast:4) , 'View'). |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8084 |
cls notNil ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8085 |
cls := cls autoload. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8086 |
(cls isSubclassOf:UISpecification) ifTrue:[^ cls]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8087 |
] |
4157 | 8088 |
]. |
8089 |
||
8090 |
"/ fall back for all others |
|
1356 | 8091 |
^ ArbitraryComponentSpec |
8092 |
||
1354 | 8093 |
|
8094 |
" |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8095 |
FramedBox new specClass |
1354 | 8096 |
" |
1409
3818a8a85c16
use CompositeSpecCollection as specClass for
Claus Gittinger <cg@exept.de>
parents:
1402
diff
changeset
|
8097 |
|
1943 | 8098 |
"Modified: / 31.10.1997 / 19:44:55 / cg" |
1699
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
8099 |
! |
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
8100 |
|
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
8101 |
windowStyle |
3715 | 8102 |
"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
|
8103 |
|
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
8104 |
self isPopUpView ifTrue:[ |
4834 | 8105 |
^ #popUp |
4497 | 8106 |
]. |
4501 | 8107 |
self isMDIChildView ifTrue:[ |
4834 | 8108 |
^ #mdiChild |
4501 | 8109 |
]. |
1699
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
8110 |
^ #normal |
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
8111 |
|
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
8112 |
"Created: 2.5.1997 / 14:29:48 / cg" |
ae9986a1a97f
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
8113 |
"Modified: 2.5.1997 / 14:30:14 / cg" |
4494 | 8114 |
! |
8115 |
||
8116 |
windowType |
|
8117 |
"return a symbol describing my type (one of: #mdichild or nil)" |
|
8118 |
||
8119 |
^ nil |
|
140 | 8120 |
! ! |
8121 |
||
8122 |
!SimpleView methodsFor:'realization'! |
|
8123 |
||
3459
d50728855052
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
3439
diff
changeset
|
8124 |
closeCancel |
d50728855052
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
3439
diff
changeset
|
8125 |
"for protocol compatibility with modal dialogs" |
d50728855052
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
3439
diff
changeset
|
8126 |
|
d50728855052
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
3439
diff
changeset
|
8127 |
self hideRequest |
d50728855052
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
3439
diff
changeset
|
8128 |
! |
d50728855052
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
3439
diff
changeset
|
8129 |
|
269 | 8130 |
create |
8131 |
"create (i.e. tell my device about me) if not already created. |
|
8132 |
This does not make the view visible (needs a #map for that)" |
|
8133 |
||
8134 |
drawableId isNil ifTrue:[ |
|
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8135 |
" |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8136 |
make certain that superview is created also |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8137 |
" |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8138 |
superView notNil ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8139 |
superView view create. |
269 | 8140 |
|
8141 |
"/ "and put my controller into the superviews controller list" |
|
8142 |
"/ controller notNil ifTrue:[ |
|
8143 |
"/ superView controller notNil ifTrue:[ |
|
8144 |
"/ controller manager:(superView controller manager) |
|
8145 |
"/ ] |
|
8146 |
"/ ] |
|
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8147 |
] ifFalse:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8148 |
"/ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8149 |
"/ if the display is not already dispatching events, |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8150 |
"/ this starts the event process. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8151 |
"/ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8152 |
device startDispatch |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8153 |
]. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8154 |
|
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8155 |
cursor notNil ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8156 |
cursor := cursor onDevice:device. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8157 |
]. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8158 |
|
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8159 |
self extentChangedBeforeCreatedFlag ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8160 |
"/ this is true, if the extent was changed before |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8161 |
"/ this view was created (and therefore, no sizeChangeEvent |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8162 |
"/ was sent to me, which would notify children.) |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8163 |
"/ have to do this here. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8164 |
self sizeChanged:nil. "/ must tell children (if any) |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8165 |
]. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8166 |
self hasExplicitExtent ifFalse:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8167 |
self resize |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8168 |
]. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8169 |
|
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8170 |
self physicalCreate. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8171 |
|
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8172 |
viewBackground notNil ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8173 |
self setViewBackground |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8174 |
]. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8175 |
|
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8176 |
"/ self initializeMiddleButtonMenu. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8177 |
self initEvents. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8178 |
|
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8179 |
" |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8180 |
this is the first create, |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8181 |
force sizechange messages to be sent to the view |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8182 |
" |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8183 |
self extentChangedFlag:true. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8184 |
self originChangedFlag:true |
151 | 8185 |
] |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
8186 |
|
1494
4faf11deec70
cursor #on: is obsoleted by #onDevice:.
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
8187 |
"Modified: 28.3.1997 / 13:50:17 / cg" |
151 | 8188 |
! |
8189 |
||
269 | 8190 |
createWithAllSubViews |
8191 |
"create, then create all subviews" |
|
8192 |
||
8193 |
drawableId isNil ifTrue:[self create]. |
|
8194 |
subViews notNil ifTrue:[ |
|
3152 | 8195 |
subViews do:[:subView | subView createWithAllSubViews] |
269 | 8196 |
] |
8197 |
! |
|
8198 |
||
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8199 |
fetchDeviceResources |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8200 |
"fetch all device specific resources. This is invoked, |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8201 |
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
|
8202 |
time, to allocate device specific colors, fonts, bitmaps etc. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8203 |
The view may keep those in instance variables, to avoid reallocating |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8204 |
those with every redraw. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8205 |
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
|
8206 |
but possibly slower, since resources are reallocated over and over. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8207 |
If you redefine this method, make certain that 'super fetchDeviceResources' |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8208 |
is always sent." |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8209 |
|
2829 | 8210 |
shadowColor notNil ifTrue:[shadowColor := shadowColor onDevice:device]. |
8211 |
lightColor notNil ifTrue:[lightColor := lightColor onDevice:device]. |
|
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8212 |
|
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8213 |
"Created: 13.1.1997 / 21:51:59 / cg" |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8214 |
! |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8215 |
|
140 | 8216 |
fixSize |
8217 |
"This is called right before the view is made visible. |
|
8218 |
Adjust the size of the view according to either relative/abs or |
|
8219 |
block extent; also set origin. Also, subclasses may redefine this |
|
8220 |
method to adjust the size based on some extent (for example, PopUpMenus |
|
8221 |
do so to take care of changed number of menu entries)." |
|
8222 |
||
151 | 8223 |
|org ext r| |
8224 |
||
8225 |
" |
|
8226 |
slowly migrating to use layoutObjects ... |
|
8227 |
" |
|
8228 |
layout notNil ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8229 |
superView notNil ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8230 |
(self originOrExtentOrCornerChanged) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8231 |
r := (layout rectangleRelativeTo:(superView viewRectangle) |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8232 |
preferred:[self preferredBounds]). |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8233 |
org := r origin rounded. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8234 |
ext := r extent rounded. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8235 |
self pixelOrigin:org extent:ext. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8236 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8237 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8238 |
^ self. |
151 | 8239 |
]. |
8240 |
||
140 | 8241 |
"if the extent is not the one we created the window with ..." |
3375 | 8242 |
"/ self extentChangedFlag ifTrue:[ |
890
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
8243 |
"/ self sizeChanged:nil. |
3375 | 8244 |
"/ self extentChangedFlag:false |
890
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
8245 |
"/ ]. |
140 | 8246 |
|
3375 | 8247 |
self originChangedFlag ifTrue:[ |
140 | 8248 |
"/ org := self computeOrigin. |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8249 |
"/ self pixelOrigin:org. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8250 |
originRule notNil ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8251 |
self pixelOrigin:self computeOrigin |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8252 |
] ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8253 |
relativeOrigin notNil ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8254 |
self originFromRelativeOrigin:relativeOrigin |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8255 |
] ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8256 |
shown ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8257 |
device moveWindow:drawableId x:left y:top. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8258 |
] ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8259 |
self pixelOrigin:left@top |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8260 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8261 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8262 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8263 |
self originChangedFlag:false |
140 | 8264 |
] |
890
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
8265 |
|
f202a05da548
avoid sending sizeChanged: twice
Claus Gittinger <cg@exept.de>
parents:
867
diff
changeset
|
8266 |
"Modified: 18.6.1996 / 21:44:03 / cg" |
140 | 8267 |
! |
8268 |
||
4853 | 8269 |
forceResize |
8270 |
"force resizing - even if already done" |
|
8271 |
||
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8272 |
self explicitExtent:false. |
4853 | 8273 |
self resize |
8274 |
! |
|
8275 |
||
393
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
8276 |
hide |
1356 | 8277 |
"only useful with modal views: hide the view and return control |
8278 |
back to the suspended main view. Ignored for non-modal views." |
|
8279 |
||
2579 | 8280 |
|masterGroup| |
1356 | 8281 |
|
8282 |
realized ifFalse:[^ self]. |
|
8283 |
windowGroup isNil ifTrue:[^ self]. |
|
8284 |
windowGroup isModal ifFalse:[^ self]. |
|
2579 | 8285 |
masterGroup := windowGroup previousGroup. |
1356 | 8286 |
|
8287 |
windowGroup notNil ifTrue:[windowGroup focusView:nil]. |
|
8288 |
||
8289 |
self unmap. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8290 |
device flush. |
1356 | 8291 |
|
2579 | 8292 |
masterGroup notNil ifTrue:[ |
3152 | 8293 |
" |
8294 |
this is a kludge for IRIS and others which do not provide backingstore: |
|
8295 |
when we hide a modalbox (such as a searchbox) which covered |
|
8296 |
a scrollbar, the scrollbars bitblt-method will copy from the |
|
8297 |
not-yet redrawn area - effectively clearing the scroller. |
|
8298 |
We need a short delay here, since at this time, the expose event has |
|
8299 |
not yet arrived. |
|
8300 |
" |
|
8301 |
Delay waitForSeconds:0.05. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8302 |
masterGroup processExposeEvents |
2576 | 8303 |
]. |
8304 |
||
8305 |
"/ WindowGroup leaveSignal raise. |
|
8306 |
"/ "/ not reached |
|
8307 |
"/ ^ self |
|
393
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
8308 |
! |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
8309 |
|
3087 | 8310 |
hideForAction |
8311 |
"for popUpMenu compatibility; |
|
8312 |
this is invoked to hide a when it is going to perform its action |
|
8313 |
(in contrast to the generic hide)." |
|
8314 |
||
8315 |
^ self hide |
|
8316 |
! |
|
8317 |
||
393
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
8318 |
hideRequest |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
8319 |
"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
|
8320 |
ignored here." |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
8321 |
|
3439 | 8322 |
self isPopUpView ifTrue:[ |
3762 | 8323 |
self hide |
3439 | 8324 |
]. |
393
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
8325 |
^ self |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
8326 |
! |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
8327 |
|
269 | 8328 |
map |
1827 | 8329 |
"make the view visible on the screen. |
8330 |
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
|
8331 |
views position on the screen. |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
8332 |
Notice: |
3152 | 8333 |
Actually, this method is only valid for topViews; |
8334 |
however, it is defined here to allow things like 'Button new realize'" |
|
1827 | 8335 |
|
8336 |
self mapAt:nil iconified:false |
|
8337 |
||
8338 |
"Modified: 24.7.1997 / 13:44:25 / cg" |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8339 |
! |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8340 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8341 |
mapAt:aPoint |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8342 |
"make the view visible on the screen. |
1827 | 8343 |
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
|
8344 |
(unless you have a dictator as windowManager ;-) |
dbe7a348084f
do not forget minExtent/maxExtent in remap
Claus Gittinger <cg@exept.de>
parents:
2095
diff
changeset
|
8345 |
Notice: |
3152 | 8346 |
Actually, this method is only valid for topViews; |
8347 |
however, it is defined here to allow things like 'Button new realize'" |
|
1827 | 8348 |
|
8349 |
self mapAt:aPoint iconified:false |
|
8350 |
||
8351 |
"Modified: 24.7.1997 / 13:45:02 / cg" |
|
8352 |
! |
|
8353 |
||
8354 |
mapAt:aPoint iconified:iconified |
|
8355 |
"make the view visible on the screen. |
|
8356 |
For topViews, if aPoint is nonNil, the views origin is located there |
|
8357 |
(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
|
8358 |
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
|
8359 |
Notice: |
3152 | 8360 |
Actually, this method is only valid for topViews; |
8361 |
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
|
8362 |
|
1809
fec93025e9e7
mapping trouble fixed (see mswindows scrollBar remap)
Claus Gittinger <cg@exept.de>
parents:
1808
diff
changeset
|
8363 |
|subs| |
fec93025e9e7
mapping trouble fixed (see mswindows scrollBar remap)
Claus Gittinger <cg@exept.de>
parents:
1808
diff
changeset
|
8364 |
|
269 | 8365 |
realized ifFalse:[ |
3152 | 8366 |
drawableId isNil ifTrue:[ |
8367 |
" |
|
8368 |
first time ? |
|
8369 |
yes, realize (implies a map) |
|
8370 |
" |
|
8371 |
self realizeKeepingGroup:false at:aPoint iconified:iconified |
|
8372 |
] ifFalse:[ |
|
8373 |
" |
|
8374 |
no, map only |
|
8375 |
" |
|
8376 |
realized := true. |
|
8377 |
aPoint isNil ifTrue:[ |
|
8378 |
iconified ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8379 |
device |
3152 | 8380 |
mapView:self id:drawableId iconified:iconified |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8381 |
atX:0 y:0 |
3152 | 8382 |
width:width height:height |
8383 |
minExtent:(self minExtent) maxExtent:(self maxExtent). |
|
8384 |
] ifFalse:[ |
|
8385 |
device mapWindow:drawableId. |
|
8386 |
] |
|
8387 |
] ifFalse:[ |
|
8388 |
left := aPoint x. |
|
8389 |
top := aPoint y. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8390 |
device |
3152 | 8391 |
mapView:self id:drawableId iconified:iconified |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8392 |
atX:left y:top |
3152 | 8393 |
width:width height:height |
8394 |
minExtent:(self minExtent) maxExtent:(self maxExtent). |
|
8395 |
]. |
|
8396 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8397 |
"/ |
3152 | 8398 |
"/ implies that all realized subviews |
8399 |
"/ are now also mapped |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8400 |
"/ |
3152 | 8401 |
"/ not needed for topViews - the mapped event does exactly the same |
8402 |
"/ however, X does not generate mapped events for non-topViews |
|
8403 |
"/ when a view gets deiconified. |
|
8404 |
||
8405 |
superView notNil ifTrue:[ |
|
8406 |
(subs := self subViews) notNil ifTrue:[ |
|
8407 |
subs do:[:v | |
|
8408 |
v shown ifFalse:[ |
|
8409 |
v mapped |
|
8410 |
] |
|
8411 |
] |
|
8412 |
] |
|
8413 |
] |
|
8414 |
]. |
|
140 | 8415 |
] |
654 | 8416 |
|
1039
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
8417 |
"Modified: 23.8.1996 / 14:53:55 / stefan" |
1827 | 8418 |
"Created: 24.7.1997 / 13:43:23 / cg" |
8419 |
"Modified: 24.7.1997 / 13:46:21 / cg" |
|
8420 |
! |
|
8421 |
||
8422 |
mapIconified |
|
8423 |
"make the view visible on the screen. |
|
8424 |
For topViews, the view is created in iconified state" |
|
8425 |
||
8426 |
self mapAt:nil iconified:true |
|
8427 |
||
8428 |
"Modified: 24.7.1997 / 13:44:25 / cg" |
|
8429 |
"Created: 24.7.1997 / 13:47:03 / cg" |
|
140 | 8430 |
! |
8431 |
||
269 | 8432 |
physicalCreate |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8433 |
"common code for create & recreate: |
269 | 8434 |
physically create (but do not map) the view on the device." |
8435 |
||
3642 | 8436 |
|sv isInputOnly| |
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
8437 |
|
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
8438 |
sv := superView isNil ifTrue:[superView] ifFalse:[superView view]. |
269 | 8439 |
|
3008
81987f198808
let WindowSensor perform the preViewCreation/postViewCreation
Claus Gittinger <cg@exept.de>
parents:
3007
diff
changeset
|
8440 |
"/ give global eventListeners a chance to intercept windowCreation |
81987f198808
let WindowSensor perform the preViewCreation/postViewCreation
Claus Gittinger <cg@exept.de>
parents:
3007
diff
changeset
|
8441 |
"/ 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
|
8442 |
WindowSensor preViewCreateNotification:self. |
81987f198808
let WindowSensor perform the preViewCreation/postViewCreation
Claus Gittinger <cg@exept.de>
parents:
3007
diff
changeset
|
8443 |
|
2088 | 8444 |
isInputOnly := self isInputOnly. |
8445 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8446 |
drawableId := device |
4834 | 8447 |
createWindowFor:self |
8448 |
type:(self windowType) |
|
8449 |
origin:(left @ top) |
|
8450 |
extent:(width @ height) |
|
8451 |
minExtent:nil |
|
8452 |
maxExtent:nil |
|
8453 |
borderWidth:borderWidth |
|
8454 |
subViewOf:sv |
|
8455 |
style:(self windowStyle) |
|
8456 |
inputOnly:isInputOnly |
|
8457 |
label:nil |
|
8458 |
owner:nil |
|
8459 |
icon:nil iconMask:nil |
|
8460 |
iconView:nil. |
|
269 | 8461 |
|
8462 |
Lobby registerChange:self. |
|
1716
d6bf8f0deb18
added werners eventListener hook for view creation
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
8463 |
|
3010
ea1a075505b4
Let #waitUntilVisible processExposeEvents
Stefan Vogel <sv@exept.de>
parents:
3008
diff
changeset
|
8464 |
"/ if there is a global eventListener, |
ea1a075505b4
Let #waitUntilVisible processExposeEvents
Stefan Vogel <sv@exept.de>
parents:
3008
diff
changeset
|
8465 |
"/ give it a chance to track views |
ea1a075505b4
Let #waitUntilVisible processExposeEvents
Stefan Vogel <sv@exept.de>
parents:
3008
diff
changeset
|
8466 |
|
3008
81987f198808
let WindowSensor perform the preViewCreation/postViewCreation
Claus Gittinger <cg@exept.de>
parents:
3007
diff
changeset
|
8467 |
"/ give global listeners a chance to track views |
81987f198808
let WindowSensor perform the preViewCreation/postViewCreation
Claus Gittinger <cg@exept.de>
parents:
3007
diff
changeset
|
8468 |
WindowSensor postViewCreateNotification:self. |
1716
d6bf8f0deb18
added werners eventListener hook for view creation
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
8469 |
|
3375 | 8470 |
self extentChangedFlag:false. |
8471 |
self originChangedFlag:false. |
|
269 | 8472 |
|
1201
6e990cfdd66d
dont use Black/White when drawing;
Claus Gittinger <cg@exept.de>
parents:
1193
diff
changeset
|
8473 |
(borderColor notNil and:[borderColor ~= Black]) ifTrue:[ |
4834 | 8474 |
isInputOnly ifFalse:[ |
2088 | 8475 |
"/ borderColor := borderColor on:device. |
4834 | 8476 |
self setBorderColor |
8477 |
] |
|
269 | 8478 |
]. |
8479 |
(viewGravity notNil "and:[viewGravity ~~ #NorthWest]") ifTrue:[ |
|
4834 | 8480 |
device setWindowGravity:viewGravity in:drawableId |
269 | 8481 |
]. |
8482 |
(bitGravity notNil "and:[bitGravity ~~ #NorthWest]") ifTrue:[ |
|
4834 | 8483 |
isInputOnly ifFalse:[ |
8484 |
device setBitGravity:bitGravity in:drawableId |
|
8485 |
] |
|
269 | 8486 |
]. |
8487 |
viewShape notNil ifTrue:[ |
|
4834 | 8488 |
self setViewShape |
269 | 8489 |
]. |
8490 |
(backed notNil and:[backed ~~ false]) ifTrue:[ |
|
4834 | 8491 |
device setBackingStore:backed in:drawableId |
3152 | 8492 |
]. |
8493 |
self saveUnder ifTrue:[ |
|
4834 | 8494 |
device setSaveUnder:true in:drawableId |
1903 | 8495 |
]. |
1960 | 8496 |
cursor notNil ifTrue:[ |
4834 | 8497 |
self setCursor |
2088 | 8498 |
]. |
8499 |
||
8500 |
"Modified: / 9.4.1998 / 20:18:12 / cg" |
|
269 | 8501 |
! |
8502 |
||
1827 | 8503 |
postRealize |
8504 |
"invoked after a view was realized. |
|
8505 |
Can be redefined in subclasses to perform delayed actions." |
|
8506 |
||
8507 |
"/ nothing done here |
|
8508 |
||
8509 |
"Created: 24.7.1997 / 14:35:36 / cg" |
|
8510 |
! |
|
8511 |
||
4126 | 8512 |
preRealize |
8513 |
"invoked right before a view is realized. |
|
8514 |
Can be redefined in subclasses to perform delayed actions." |
|
8515 |
||
8516 |
"/ nothing done here |
|
8517 |
||
8518 |
"Created: 24.7.1997 / 14:35:36 / cg" |
|
8519 |
! |
|
8520 |
||
269 | 8521 |
realize |
8522 |
"realize - make visible; |
|
8523 |
realizing is done very late (after layout is fixed) to avoid |
|
8524 |
visible rearranging of windows on the screen" |
|
8525 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8526 |
self realizeKeepingGroup:false at:nil iconified:false |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8527 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8528 |
"Modified: 24.7.1997 / 13:14:28 / cg" |
269 | 8529 |
! |
8530 |
||
8531 |
realizeAllSubViews |
|
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8532 |
"realize all my subviews - but not myself." |
269 | 8533 |
|
8534 |
subViews notNil ifTrue:[ |
|
3762 | 8535 |
subViews do:[:subView | |
8536 |
subView realize |
|
8537 |
] |
|
792
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
8538 |
]. |
177cfa66f2b8
prepare for components & non-view as superView
Claus Gittinger <cg@exept.de>
parents:
791
diff
changeset
|
8539 |
components notNil ifTrue:[ |
3762 | 8540 |
components do:[:component | |
8541 |
component realize |
|
8542 |
] |
|
269 | 8543 |
]. |
8544 |
||
8545 |
"Modified: 5.9.1995 / 23:30:47 / claus" |
|
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8546 |
"Modified: 13.1.1997 / 21:25:49 / cg" |
269 | 8547 |
! |
8548 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8549 |
realizeAt:aPoint |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8550 |
"realize - make visible; |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8551 |
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
|
8552 |
visible rearranging of windows on the screen" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8553 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8554 |
self realizeKeepingGroup:false at:aPoint iconified:false |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8555 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8556 |
"Modified: 24.7.1997 / 13:14:28 / cg" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8557 |
"Created: 24.7.1997 / 13:21:04 / cg" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8558 |
! |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8559 |
|
269 | 8560 |
realizeInGroup |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8561 |
"special realize - leave windowgroup as is; |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8562 |
This allows a view to be realized in any windowgroup; |
269 | 8563 |
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
|
8564 |
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
|
8565 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
8566 |
windowGroup isForModalSubview:true. |
1877 | 8567 |
"/ self realize. |
8568 |
||
8569 |
self realizeKeepingGroup:true at:nil iconified:false |
|
8570 |
||
8571 |
"Modified: 20.8.1997 / 14:56:20 / cg" |
|
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
8572 |
! |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
8573 |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8574 |
realizeKeepingGroup:keepGroupAsIs at:position iconified:iconified |
151 | 8575 |
"common helper for realize and realizeInGroup. |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8576 |
Create the view; if the keepGroupAsIs argument is not true, |
1877 | 8577 |
assign my windowGroup." |
140 | 8578 |
|
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
8579 |
|superGroup groupChange keep| |
140 | 8580 |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8581 |
"/ fetch device colors, to avoid reallocation at redraw time |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8582 |
self fetchDeviceResources. |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8583 |
|
2189
86284985c4c0
care for non-creatable views.
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
8584 |
drawableId isNil ifTrue:[ |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8585 |
self create. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8586 |
drawableId isNil ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8587 |
('SimpleView [warning]: could not create view: ' , self class name) errorPrintCR. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8588 |
^ self |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8589 |
] |
2189
86284985c4c0
care for non-creatable views.
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
8590 |
]. |
140 | 8591 |
|
372 | 8592 |
groupChange := false. |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
8593 |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8594 |
(windowGroup notNil |
1877 | 8595 |
and:[superView isNil |
8596 |
and:[windowGroup isForModalSubview]]) ifTrue:[ |
|
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8597 |
keep := true. |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
8598 |
] ifFalse:[ |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8599 |
keep := keepGroupAsIs |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
8600 |
]. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
8601 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
8602 |
keep ifFalse:[ |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8603 |
" |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8604 |
put myself into superviews windowgroup if there is a superview |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8605 |
This is the default behavior, which may be suppressed by |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8606 |
passing true as keepGroupAsIs-argument. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8607 |
(it may be useful to assign a separate windowGroup to |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8608 |
a childView to have it execute independent of the parent |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8609 |
-> an example is found in the fileBrowsers kill-button) |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8610 |
" |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8611 |
superView notNil ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8612 |
superGroup := superView windowGroup. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8613 |
(windowGroup notNil and:[superGroup ~~ windowGroup]) ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8614 |
" |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8615 |
mhmh - seems that the windowgroup has changed .... |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8616 |
" |
145 | 8617 |
"/ 'oops - wgroup change on realize' printNL. |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8618 |
groupChange := true. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8619 |
|
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8620 |
"/ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8621 |
"/ recursively change the windowGroup of |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8622 |
"/ myself and all of my children |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8623 |
"/ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8624 |
self windowGroup:superGroup. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8625 |
] ifFalse:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8626 |
windowGroup isNil ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8627 |
"/ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8628 |
"/ only change the group of myself - |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8629 |
"/ subviews will fetch it when realized. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8630 |
"/ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8631 |
windowGroup := superGroup. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8632 |
superGroup notNil ifTrue:[superGroup addView:self]. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8633 |
] |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8634 |
]. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8635 |
]. |
140 | 8636 |
]. |
8637 |
||
3375 | 8638 |
(self originOrExtentChanged) ifTrue:[ |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8639 |
self fixSize. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8640 |
self sizeChanged:nil. |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8641 |
]. |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8642 |
position notNil ifTrue:[ |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8643 |
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
|
8644 |
]. |
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
8645 |
|
ef2ded1798df
Send #realize to subviews even if hiddenOnRealize is set for myself.
Stefan Vogel <sv@exept.de>
parents:
1038
diff
changeset
|
8646 |
(subViews notNil or:[components notNil]) ifTrue:[ |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8647 |
(realized not or:[groupChange]) ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8648 |
self isHiddenOnRealize ifFalse:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8649 |
self realizeAllSubViews. |
2558 | 8650 |
]. |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8651 |
]. |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8652 |
]. |
1874
a46a8c065050
recursively change the windowGroup of all children,
Claus Gittinger <cg@exept.de>
parents:
1860
diff
changeset
|
8653 |
|
4126 | 8654 |
self preRealize. |
8655 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8656 |
iconified ifTrue:[ |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8657 |
realized ifFalse:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8658 |
self mapIconified |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8659 |
] |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
8660 |
] ifFalse:[ |
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8661 |
self isHiddenOnRealize ifFalse:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8662 |
self setInnerClip. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8663 |
|
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8664 |
realized ifFalse:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8665 |
" |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8666 |
now, make the view visible |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8667 |
" |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8668 |
self mapAt:position |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8669 |
] |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8670 |
] |
140 | 8671 |
]. |
8672 |
||
8673 |
controller notNil ifTrue:[ |
|
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8674 |
controller startUp |
1827 | 8675 |
]. |
8676 |
||
8677 |
self postRealize |
|
654 | 8678 |
|
2189
86284985c4c0
care for non-creatable views.
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
8679 |
"Modified: / 23.8.1996 / 15:07:16 / stefan" |
86284985c4c0
care for non-creatable views.
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
8680 |
"Created: / 24.7.1997 / 13:10:17 / cg" |
86284985c4c0
care for non-creatable views.
Claus Gittinger <cg@exept.de>
parents:
2174
diff
changeset
|
8681 |
"Modified: / 27.7.1998 / 20:01:02 / cg" |
140 | 8682 |
! |
8683 |
||
8684 |
recreate |
|
3301 | 8685 |
"recreate (i.e. tell X about me) after a snapin or a migration" |
140 | 8686 |
|
8687 |
drawableId isNil ifTrue:[ |
|
3762 | 8688 |
super recreate. |
8689 |
self physicalCreate. |
|
8690 |
||
8691 |
viewBackground notNil ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8692 |
self setViewBackground |
3762 | 8693 |
]. |
8694 |
||
8695 |
" |
|
8696 |
XXX has to be changed: eventmasks are device specific - |
|
8697 |
XXX will not allow restart on another Workstation-type. |
|
8698 |
XXX event masks must become symbolic |
|
8699 |
" |
|
8700 |
eventMask isNil ifTrue:[ |
|
8701 |
eventMask := device defaultEventMask |
|
8702 |
]. |
|
8703 |
device setEventMask:eventMask in:drawableId |
|
140 | 8704 |
] |
8705 |
! |
|
8706 |
||
654 | 8707 |
remap |
8708 |
"make the view visible on the screen at its previous position. |
|
8709 |
In contrast to map, this asks the windowManager to show the view |
|
8710 |
immediately (instead of asking for a frame). However, some windowManagers |
|
8711 |
are known to ignore this ..." |
|
8712 |
||
8713 |
realized ifFalse:[ |
|
3152 | 8714 |
" |
8715 |
now, make the view visible |
|
8716 |
" |
|
8717 |
realized := true. |
|
8718 |
device |
|
8719 |
mapView:self id:drawableId iconified:false |
|
8720 |
atX:left y:top width:width height:height |
|
8721 |
minExtent:(self minExtent) maxExtent:(self maxExtent) |
|
654 | 8722 |
] |
8723 |
||
8724 |
"Created: 8.5.1996 / 09:33:06 / cg" |
|
1379 | 8725 |
"Modified: 25.2.1997 / 22:44:33 / cg" |
654 | 8726 |
! |
8727 |
||
1109 | 8728 |
rerealize |
8729 |
"rerealize at old position in (a possibly different) windowGroup." |
|
8730 |
||
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8731 |
self fetchDeviceResources. |
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8732 |
|
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8733 |
self rerealizeInGroup:windowGroup. |
1109 | 8734 |
|
8735 |
"Created: 7.11.1996 / 16:27:09 / cg" |
|
1193
341a4265f5d6
added #fetchDeviceResources,
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
8736 |
"Modified: 13.1.1997 / 21:53:18 / cg" |
1109 | 8737 |
! |
8738 |
||
269 | 8739 |
rerealizeInGroup:aWindowGroup |
8740 |
"rerealize at old position in (a possibly different) windowGroup." |
|
8741 |
||
1837 | 8742 |
drawableId isNil ifTrue:[self create]. |
269 | 8743 |
drawableId notNil ifTrue:[ |
3152 | 8744 |
aWindowGroup ~~ windowGroup ifTrue:[ |
8745 |
windowGroup notNil ifTrue:[ |
|
8746 |
windowGroup removeView:self |
|
8747 |
]. |
|
8748 |
windowGroup := aWindowGroup. |
|
8749 |
aWindowGroup addTopView:self. |
|
8750 |
]. |
|
8751 |
self remap. |
|
269 | 8752 |
] |
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
8753 |
|
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
8754 |
"Modified: 3.5.1996 / 23:59:30 / stefan" |
1837 | 8755 |
"Modified: 28.7.1997 / 18:53:01 / cg" |
140 | 8756 |
! |
8757 |
||
8758 |
rerealizeWithAllSubViews |
|
8759 |
"rerealize myself with all subviews" |
|
8760 |
||
8761 |
drawableId notNil ifTrue:[ |
|
4907 | 8762 |
realized := true. |
8763 |
self realizeAllSubViews. |
|
8764 |
superView isNil ifTrue:[ |
|
8765 |
device |
|
8766 |
mapView:self id:drawableId iconified:false |
|
8767 |
atX:left y:top width:width height:height |
|
8768 |
minExtent:(self minExtent) maxExtent:(self maxExtent) |
|
8769 |
] ifFalse:[ |
|
8770 |
device |
|
8771 |
mapWindow:drawableId |
|
8772 |
]. |
|
140 | 8773 |
] |
1290
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
8774 |
|
1cc24cff6fe9
eliminated some references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
1261
diff
changeset
|
8775 |
"Modified: 28.1.1997 / 17:59:28 / cg" |
180 | 8776 |
! |
8777 |
||
269 | 8778 |
resize |
8779 |
"resize myself to make everything fit into me. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8780 |
Here, nothing special is done (except for setting my extent to the |
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
8781 |
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
|
8782 |
|
4899
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8783 |
self hasExplicitExtent ifFalse:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8784 |
layout isNil ifTrue:[ |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8785 |
self extent:(self preferredExtent). |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8786 |
self explicitExtent:false. |
5d9393ff0aae
use accessors for hiddenOnRealize and explicitExtents;
Claus Gittinger <cg@exept.de>
parents:
4898
diff
changeset
|
8787 |
]. |
947
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
8788 |
] |
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
8789 |
|
e8ff54bc0309
remember an explicit change of the extent;
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
8790 |
"Modified: 15.7.1996 / 11:20:27 / cg" |
269 | 8791 |
! |
8792 |
||
8793 |
unmap |
|
2576 | 8794 |
"unmap the view - the view stays created (but invisible), and can be remapped again later." |
269 | 8795 |
|
8796 |
realized ifTrue:[ |
|
3762 | 8797 |
realized := false. |
8798 |
drawableId notNil ifTrue:[ |
|
8799 |
device unmapWindow:drawableId. |
|
8800 |
||
8801 |
"/ make it go away immediately |
|
8802 |
"/ (this hides the subview killing) |
|
8803 |
device flush. |
|
8804 |
]. |
|
8805 |
||
8806 |
"/ Normally, this is not correct with X, where the |
|
8807 |
"/ unmap is an asynchronous operation. |
|
8808 |
"/ (shown is cleared also in unmapped event) |
|
8809 |
"/ Do it anyway, to avoid synchronisation problems. |
|
8810 |
||
8811 |
shown := false. |
|
8812 |
self changed:#visibility. |
|
269 | 8813 |
]. |
190 | 8814 |
|
8815 |
" |
|
269 | 8816 |
|top sub| |
8817 |
||
8818 |
top := StandardSystemView new. |
|
8819 |
top extent:200@200. |
|
8820 |
||
8821 |
sub := View |
|
3762 | 8822 |
origin:0.2@0.2 |
8823 |
corner:0.8@0.8 |
|
8824 |
in:top. |
|
269 | 8825 |
|
8826 |
sub viewBackground:Color red. |
|
8827 |
sub hiddenOnRealize:true. |
|
8828 |
||
8829 |
top open. |
|
8830 |
(Delay forSeconds:5) wait. |
|
8831 |
sub map. |
|
8832 |
(Delay forSeconds:3) wait. |
|
8833 |
sub unmap. |
|
8834 |
sub viewBackground:(Color green). |
|
8835 |
(Delay forSeconds:3) wait. |
|
8836 |
sub map. |
|
151 | 8837 |
" |
1379 | 8838 |
|
2465
193a96bd94d7
clear shown when unmapped notification arrives
Claus Gittinger <cg@exept.de>
parents:
2454
diff
changeset
|
8839 |
"Modified: / 22.2.1999 / 20:10:58 / cg" |
269 | 8840 |
! |
8841 |
||
8842 |
unrealize |
|
8843 |
"alias for unmap, for historic reasons" |
|
8844 |
||
3434 | 8845 |
<resource:#obsolete> |
8846 |
||
4464 | 8847 |
self obsoleteMethodWarning:'use #unmap'. |
269 | 8848 |
self unmap. |
646
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
8849 |
|
0d2886a9ae38
Rename unrealize-->unmap, rerealize-->map.
Stefan Vogel <sv@exept.de>
parents:
640
diff
changeset
|
8850 |
"Modified: 4.5.1996 / 00:07:48 / stefan" |
151 | 8851 |
! ! |
8852 |
||
8853 |
!SimpleView methodsFor:'redrawing'! |
|
8854 |
||
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8855 |
flash |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8856 |
"flash the view - fill it black, then white, finally |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8857 |
redraw completely. |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8858 |
Can be used to wakeup the user :-) |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8859 |
when problem or warning conditions arise. |
2174 | 8860 |
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
|
8861 |
|
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8862 |
self fill:Black. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8863 |
Delay waitForSeconds:0.1. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8864 |
self fill:White. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8865 |
Delay waitForSeconds:0.1. |
2173 | 8866 |
self fill:viewBackground. |
8867 |
"/ self clear. |
|
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8868 |
self invalidate |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8869 |
|
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8870 |
" |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8871 |
|v| |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8872 |
|
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8873 |
v := View new openAndWait. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8874 |
Delay waitForSeconds:2. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8875 |
v flash. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8876 |
Delay waitForSeconds:2. |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8877 |
v destroy |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8878 |
" |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8879 |
|
2174 | 8880 |
"Modified: / 16.7.1998 / 18:46:48 / cg" |
765
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8881 |
! |
f6c9c653e03f
removed useless superViewMapped/superViewUnmapped messages
Claus Gittinger <cg@exept.de>
parents:
763
diff
changeset
|
8882 |
|
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8883 |
invalidate |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8884 |
"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
|
8885 |
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
|
8886 |
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
|
8887 |
multiple damage rectangles into single redraws. |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8888 |
However, be aware, that the redrawing may be delayed for some time, |
4057 | 8889 |
until the receivers windowGroupProcess gets rescheduled." |
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8890 |
|
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8891 |
shown ifFalse:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8892 |
"/ no need to add damage - will get a full-redraw anyway, |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8893 |
"/ when I will be shown again. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8894 |
^ self |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8895 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8896 |
self |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8897 |
invalidateDeviceRectangle:(Rectangle left:0 top:0 width:width height:height) |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8898 |
repairNow:false |
2394
cfb6434f1a9c
oops - invalidate must add deviceRectangles to the damage-list.
Claus Gittinger <cg@exept.de>
parents:
2382
diff
changeset
|
8899 |
|
cfb6434f1a9c
oops - invalidate must add deviceRectangles to the damage-list.
Claus Gittinger <cg@exept.de>
parents:
2382
diff
changeset
|
8900 |
"Modified: / 9.11.1998 / 21:04:16 / cg" |
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8901 |
! |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8902 |
|
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8903 |
invalidate:aRectangle |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8904 |
"add a damage to redraw part of the recevier, to its input event queue. |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8905 |
This is preferable to calling redraw directly, |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8906 |
in that the drawing is done by the views process itself, |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8907 |
and there is a possibilty to merge multiple damage rectangles into |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8908 |
single redraws. |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8909 |
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
|
8910 |
intil the receivers windowGroupProcess gets rescheduled." |
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8911 |
|
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8912 |
shown ifFalse:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8913 |
"/ no need to add damage - will get a full-redraw anyway, |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8914 |
"/ when I will be shown again. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8915 |
^ self |
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8916 |
]. |
2394
cfb6434f1a9c
oops - invalidate must add deviceRectangles to the damage-list.
Claus Gittinger <cg@exept.de>
parents:
2382
diff
changeset
|
8917 |
self invalidate:aRectangle repairNow:false |
cfb6434f1a9c
oops - invalidate must add deviceRectangles to the damage-list.
Claus Gittinger <cg@exept.de>
parents:
2382
diff
changeset
|
8918 |
|
cfb6434f1a9c
oops - invalidate must add deviceRectangles to the damage-list.
Claus Gittinger <cg@exept.de>
parents:
2382
diff
changeset
|
8919 |
"Modified: / 9.11.1998 / 21:03:14 / cg" |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8920 |
! |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8921 |
|
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8922 |
invalidate:aRectangle repairNow:doRepairNow |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8923 |
"add a damage to redraw part of the receiver, to its input event queue. |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8924 |
and (if repairNow is true), force the receiver to repair all of its |
2451 | 8925 |
damaged areas right now. |
8926 |
The given rectangle is in logical coordinate space." |
|
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8927 |
|
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
8928 |
|r| |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
8929 |
|
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8930 |
shown ifFalse:[ |
4971 | 8931 |
"/ no need to add damage - will get a full-redraw anyway, |
8932 |
"/ when I will be shown again. |
|
8933 |
^ self |
|
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8934 |
]. |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8935 |
|
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
8936 |
r := aRectangle. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3838
diff
changeset
|
8937 |
transformation notNil ifTrue:[ |
4971 | 8938 |
r := transformation applyTo:r. |
8939 |
]. |
|
8940 |
self invalidateDeviceRectangle:aRectangle repairNow:doRepairNow |
|
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8941 |
|
2395 | 8942 |
"Modified: / 10.11.1998 / 01:55:03 / cg" |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8943 |
! |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8944 |
|
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8945 |
invalidateDeviceRectangle:aRectangle repairNow:doRepairNow |
2396
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
8946 |
"add a damage to redraw part of the receiver, to its input event queue. |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8947 |
and (if repairNow is true), force the receiver to repair all of its |
2451 | 8948 |
damaged areas right now. |
8949 |
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
|
8950 |
|
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8951 |
shown ifFalse:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8952 |
"/ no need to add damage - will get a full-redraw anyway, |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8953 |
"/ when I will be shown again. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8954 |
^ self |
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8955 |
]. |
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8956 |
|
4049 | 8957 |
self sensor addDamage:aRectangle view:self. |
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8958 |
doRepairNow ifTrue:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8959 |
self repairDamage |
2396
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
8960 |
] |
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
8961 |
|
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
8962 |
"Modified: / 10.11.1998 / 01:55:03 / cg" |
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
8963 |
"Created: / 10.11.1998 / 19:02:01 / cg" |
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
8964 |
! |
da3125ce46f1
oops - must invalidate deviceRectangle in scroll.
Claus Gittinger <cg@exept.de>
parents:
2395
diff
changeset
|
8965 |
|
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8966 |
invalidateRepairNow:doRepair |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8967 |
"add a damage to redraw all of the receiver, to its input event queue. |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8968 |
and (if repairNow is true), force the receiver to repair all of its |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8969 |
damaged areas right now." |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8970 |
|
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8971 |
shown ifFalse:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8972 |
"/ no need to add damage - will get a full-redraw anyway, |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8973 |
"/ when I will be shown again. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8974 |
^ self |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8975 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8976 |
self |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8977 |
invalidateDeviceRectangle:(Rectangle left:0 top:0 width:width height:height) |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8978 |
repairNow:doRepair |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8979 |
|
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8980 |
"Created: 19.4.1997 / 11:58:04 / cg" |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
8981 |
"Modified: 19.4.1997 / 12:00:00 / cg" |
718
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8982 |
! |
4ff126c012b5
added #invalidate / #invalidate:
Claus Gittinger <cg@exept.de>
parents:
714
diff
changeset
|
8983 |
|
3704 | 8984 |
invalidateX:x y:y width:w height:h |
8985 |
"add a damage to redraw all of the receiver, to its input event queue." |
|
8986 |
||
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
8987 |
shown ifFalse:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8988 |
"/ no need to add damage - will get a full-redraw anyway, |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8989 |
"/ when I will be shown again. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8990 |
^ self |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8991 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8992 |
self invalidate:(Rectangle left:x top:y width:w height:h) |
3704 | 8993 |
! |
8994 |
||
8995 |
invalidateX:x y:y width:w height:h repairNow:doRepair |
|
8996 |
"add a damage to redraw all of the receiver, to its input event queue. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
8997 |
and (if repairNow is true), force the receiver to repair all of its |
3704 | 8998 |
damaged areas right now." |
8999 |
||
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
9000 |
shown ifFalse:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9001 |
"/ no need to add damage - will get a full-redraw anyway, |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9002 |
"/ when I will be shown again. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9003 |
^ self |
4047
622d06eca488
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
4038
diff
changeset
|
9004 |
]. |
3704 | 9005 |
self invalidate:(Rectangle left:x top:y width:w height:h) repairNow:doRepair |
9006 |
! |
|
9007 |
||
269 | 9008 |
redraw |
782 | 9009 |
"redraw myself completely - this is sent by redrawX:y:width:height: |
9010 |
as a fallback. |
|
9011 |
Cannot do much here - is redefined in subclasses which dont care for |
|
9012 |
updating regions but instead update everything." |
|
9013 |
||
9014 |
"Modified: 29.5.1996 / 18:02:52 / cg" |
|
269 | 9015 |
! |
9016 |
||
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
9017 |
redraw:aRectangle |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
9018 |
"redraw a part of the view immediately." |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
9019 |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9020 |
self |
3152 | 9021 |
redrawX:(aRectangle left) |
9022 |
y:(aRectangle top) |
|
9023 |
width:(aRectangle width) |
|
9024 |
height:(aRectangle height) |
|
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
9025 |
|
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
9026 |
"Modified: 19.4.1997 / 11:54:23 / cg" |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
9027 |
! |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
9028 |
|
269 | 9029 |
redrawDeviceX:x y:y width:w height:h |
9030 |
"have to redraw part of the view. |
|
9031 |
The coordinates are in device space - if there is a transformation, |
|
9032 |
must inverse-transform back to logical coordinates. (since the view thinks |
|
9033 |
in its coordinate space)" |
|
9034 |
||
9035 |
|lx ly lw lh| |
|
9036 |
||
2822 | 9037 |
transformation isNil ifTrue:[ |
3152 | 9038 |
lx := x. |
9039 |
ly := y. |
|
9040 |
lw := w. |
|
9041 |
lh := h. |
|
2822 | 9042 |
] ifFalse:[ |
3152 | 9043 |
lx := transformation applyInverseToX:x. |
9044 |
ly := transformation applyInverseToY:y. |
|
9045 |
lw := transformation applyInverseScaleX:w. |
|
9046 |
lh := transformation applyInverseScaleY:h. |
|
269 | 9047 |
]. |
9048 |
self redrawX:lx y:ly width:lw height:lh |
|
9049 |
! |
|
9050 |
||
151 | 9051 |
redrawX:x y:y width:w height:h |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9052 |
"redraw part of myself immediately, given logical coordinates |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
9053 |
(if transformation is nonNil) |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9054 |
The default here is to redraw everything |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
9055 |
- subclasses usually redefine this, adding more intelligence" |
151 | 9056 |
|
738 | 9057 |
|area oldClip| |
151 | 9058 |
|
9059 |
shown ifFalse:[^ self]. |
|
9060 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9061 |
area := Rectangle left:x top:y width:w height:h. |
738 | 9062 |
oldClip := clipRect. |
9063 |
self clippingRectangle:area. |
|
9064 |
||
9065 |
components notNil ifTrue:[ |
|
3152 | 9066 |
self clearRectangleX:x y:y width:w height:h. |
9067 |
components do:[:aComponent | |
|
9068 |
|thisFrame is| |
|
9069 |
||
9070 |
thisFrame := aComponent bounds. |
|
9071 |
(thisFrame intersects:area) ifTrue:[ |
|
9072 |
aComponent displayOn:self |
|
9073 |
] |
|
9074 |
] |
|
738 | 9075 |
] ifFalse:[ |
3152 | 9076 |
"/ redraw everything - a fallBack for lazy views. |
9077 |
self redraw |
|
738 | 9078 |
]. |
9079 |
||
9080 |
self clippingRectangle:oldClip. |
|
9081 |
||
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
9082 |
"Modified: 19.4.1997 / 11:55:08 / cg" |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
9083 |
! |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
9084 |
|
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
9085 |
repairDamage |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9086 |
"force the receiver to repair all of its |
2095 | 9087 |
damaged areas right now." |
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
9088 |
|
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
9089 |
|wg| |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
9090 |
|
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
9091 |
shown ifTrue:[ |
3152 | 9092 |
(wg := self windowGroup) notNil ifTrue:[ |
9093 |
"/ wg processRealExposeEventsFor:self. "/ this ignores map/unmap |
|
9094 |
wg processExposeEventsFor:self. "/ this handles map/unmap |
|
9095 |
] |
|
1615
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
9096 |
] |
24950d99a5c2
added #repairDamage & invalidate-with-repair
Claus Gittinger <cg@exept.de>
parents:
1614
diff
changeset
|
9097 |
|
2138
1800e9b5afe3
also handle map/unmap events in repairDamage.
Claus Gittinger <cg@exept.de>
parents:
2130
diff
changeset
|
9098 |
"Created: / 19.4.1997 / 12:01:13 / cg" |
2406 | 9099 |
"Modified: / 3.12.1998 / 14:02:06 / cg" |
151 | 9100 |
! |
9101 |
||
269 | 9102 |
showActive |
9103 |
"redraw myself as active (i.e. busy). |
|
9104 |
Nothing done here, but redefined in some classes." |
|
9105 |
||
9106 |
^ self |
|
135 | 9107 |
! |
9108 |
||
9109 |
showPassive |
|
9110 |
"redraw myself as inactive (i.e. nonbusy). |
|
151 | 9111 |
Nothing done here, but redefined in some classes." |
135 | 9112 |
|
9113 |
^ self |
|
9114 |
! ! |
|
9115 |
||
269 | 9116 |
!SimpleView methodsFor:'scrolling'! |
9117 |
||
2559
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
9118 |
halfPageDown |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
9119 |
"scroll down half a page |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
9120 |
" |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
9121 |
self scrollDown:(self innerHeight // 2) |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
9122 |
|
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
9123 |
|
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
9124 |
! |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
9125 |
|
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
9126 |
halfPageUp |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
9127 |
"scroll up half a page |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
9128 |
" |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
9129 |
self scrollUp:(self innerHeight // 2) |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
9130 |
|
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
9131 |
! |
6f5c5691475e
halfPage scroll methods moved to SimpleView
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
9132 |
|
269 | 9133 |
horizontalScrollStep |
9134 |
"return the amount to scroll when stepping left/right. |
|
9135 |
Subclasses may want to redefine this." |
|
9136 |
||
9137 |
^ (device horizontalPixelPerMillimeter * 20) asInteger |
|
9138 |
! |
|
9139 |
||
1052
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
9140 |
pageDown |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
9141 |
self scrollDown:(self innerHeight) |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
9142 |
|
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
9143 |
"Created: 13.9.1996 / 14:06:54 / cg" |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
9144 |
! |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
9145 |
|
4964
b059a14ce764
Define #pageLeft and #pageRight
Stefan Vogel <sv@exept.de>
parents:
4958
diff
changeset
|
9146 |
pageLeft |
b059a14ce764
Define #pageLeft and #pageRight
Stefan Vogel <sv@exept.de>
parents:
4958
diff
changeset
|
9147 |
self scrollLeft:(self innerWidth) |
b059a14ce764
Define #pageLeft and #pageRight
Stefan Vogel <sv@exept.de>
parents:
4958
diff
changeset
|
9148 |
|
b059a14ce764
Define #pageLeft and #pageRight
Stefan Vogel <sv@exept.de>
parents:
4958
diff
changeset
|
9149 |
"Created: 13.9.1996 / 14:06:54 / cg" |
b059a14ce764
Define #pageLeft and #pageRight
Stefan Vogel <sv@exept.de>
parents:
4958
diff
changeset
|
9150 |
! |
b059a14ce764
Define #pageLeft and #pageRight
Stefan Vogel <sv@exept.de>
parents:
4958
diff
changeset
|
9151 |
|
b059a14ce764
Define #pageLeft and #pageRight
Stefan Vogel <sv@exept.de>
parents:
4958
diff
changeset
|
9152 |
pageRight |
b059a14ce764
Define #pageLeft and #pageRight
Stefan Vogel <sv@exept.de>
parents:
4958
diff
changeset
|
9153 |
self scrollRight:(self innerWidth) |
b059a14ce764
Define #pageLeft and #pageRight
Stefan Vogel <sv@exept.de>
parents:
4958
diff
changeset
|
9154 |
! |
b059a14ce764
Define #pageLeft and #pageRight
Stefan Vogel <sv@exept.de>
parents:
4958
diff
changeset
|
9155 |
|
1052
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
9156 |
pageUp |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
9157 |
self scrollUp:(self innerHeight) |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
9158 |
|
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
9159 |
"Created: 13.9.1996 / 14:07:01 / cg" |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
9160 |
! |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
9161 |
|
269 | 9162 |
scrollDown |
9163 |
"scroll down by some amount; this is called when the scrollbars |
|
9164 |
scroll-step down button is pressed." |
|
9165 |
||
9166 |
self scrollDown:(self verticalScrollStep) |
|
9167 |
! |
|
9168 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9169 |
scrollDown:nPixels |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9170 |
"change origin to scroll down some pixels" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9171 |
|
1035
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
9172 |
|viewOrigin| |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
9173 |
|
2703 | 9174 |
nPixels ~~ 0 ifTrue:[ |
3152 | 9175 |
viewOrigin := self viewOrigin. |
9176 |
self scrollTo:(viewOrigin x @ (viewOrigin y + nPixels)) |
|
2703 | 9177 |
] |
9178 |
||
9179 |
"Modified: / 20.8.1996 / 17:34:36 / stefan" |
|
9180 |
"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
|
9181 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9182 |
|
269 | 9183 |
scrollHorizontalTo:aPixelOffset |
9184 |
"change origin to make aPixelOffset be the left col" |
|
9185 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9186 |
|orgY| |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9187 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9188 |
orgY := self viewOrigin y. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9189 |
^ self scrollTo:(aPixelOffset @ orgY). |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9190 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9191 |
"Modified: 8.7.1996 / 15:34:54 / stefan" |
140 | 9192 |
! |
9193 |
||
269 | 9194 |
scrollHorizontalToPercent:percent |
9195 |
"scroll to a position given in percent of total" |
|
9196 |
||
9197 |
|wCont| |
|
9198 |
||
9199 |
wCont := self widthOfContents. |
|
9200 |
transformation notNil ifTrue:[ |
|
3152 | 9201 |
wCont := transformation applyScaleX:wCont. |
269 | 9202 |
]. |
9203 |
self scrollHorizontalTo: |
|
3152 | 9204 |
((((wCont * percent) / 100.0) + 0.5) asInteger) |
269 | 9205 |
! |
9206 |
||
9207 |
scrollLeft |
|
9208 |
"scroll left by some amount; this is called when the scrollbars |
|
9209 |
scroll-step left button is pressed." |
|
9210 |
||
9211 |
self scrollLeft:(self horizontalScrollStep) |
|
9212 |
! |
|
9213 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9214 |
scrollLeft:nPixels |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9215 |
"change origin to scroll left some pixels" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9216 |
|
1035
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
9217 |
|viewOrigin| |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
9218 |
|
2703 | 9219 |
nPixels ~~ 0 ifTrue:[ |
3152 | 9220 |
viewOrigin := self viewOrigin. |
9221 |
self scrollTo:((viewOrigin x - nPixels) @ viewOrigin y). |
|
2703 | 9222 |
] |
9223 |
||
9224 |
"Modified: / 20.8.1996 / 17:35:09 / stefan" |
|
9225 |
"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
|
9226 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9227 |
|
269 | 9228 |
scrollRight |
9229 |
"scroll right by some amount; this is called when the scrollbars |
|
9230 |
scroll-step right button is pressed." |
|
9231 |
||
9232 |
self scrollRight:(self horizontalScrollStep) |
|
9233 |
! |
|
9234 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9235 |
scrollRight:nPixels |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9236 |
"change origin to scroll right some pixels" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9237 |
|
1035
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
9238 |
|viewOrigin| |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
9239 |
|
2703 | 9240 |
nPixels ~~ 0 ifTrue:[ |
3152 | 9241 |
viewOrigin := self viewOrigin. |
9242 |
self scrollTo:((viewOrigin x + nPixels) @ viewOrigin y) |
|
2703 | 9243 |
] |
9244 |
||
9245 |
"Modified: / 20.8.1996 / 17:35:37 / stefan" |
|
9246 |
"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
|
9247 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9248 |
|
1052
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
9249 |
scrollToBottom |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
9250 |
self scrollTo:0 @ (self heightOfContents - self innerHeight) |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
9251 |
|
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
9252 |
"Created: 13.9.1996 / 14:08:03 / cg" |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
9253 |
"Modified: 13.9.1996 / 14:09:32 / cg" |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
9254 |
! |
c7e31a453192
added default implementations for pageUp / pageDown
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
9255 |
|
2371
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
9256 |
scrollToLeft |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
9257 |
"move viewOrigin to the left" |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
9258 |
|
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
9259 |
self scrollHorizontalTo:0 |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
9260 |
! |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
9261 |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9262 |
scrollToPercent:originAsPercent |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9263 |
"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
|
9264 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9265 |
|wCont hCont percent| |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9266 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9267 |
percent := originAsPercent asPoint. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9268 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9269 |
wCont := self widthOfContents. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9270 |
hCont := self heightOfContents. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9271 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9272 |
transformation notNil ifTrue:[ |
3152 | 9273 |
wCont := transformation applyScaleX:wCont. |
9274 |
hCont := transformation applyScaleY:hCont. |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9275 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9276 |
self scrollTo: |
3152 | 9277 |
((((wCont * percent x) / 100.0) + 0.5) asInteger) @ |
9278 |
((((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
|
9279 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9280 |
"Created: 5.8.1996 / 12:15:53 / stefan" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9281 |
"Modified: 5.8.1996 / 12:42:57 / stefan" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9282 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9283 |
|
2371
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
9284 |
scrollToRight |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
9285 |
"move viewOrigin to the right" |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
9286 |
|
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
9287 |
|wCont| |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
9288 |
|
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
9289 |
wCont := self widthOfContents. |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
9290 |
transformation notNil ifTrue:[ |
3152 | 9291 |
wCont := transformation applyScaleX:wCont. |
2371
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
9292 |
]. |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
9293 |
self scrollHorizontalTo:((wCont - self innerWidth) max:0) |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
9294 |
|
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
9295 |
! |
fafba97d401c
added #scrollToLeft and #scrollToRight
Claus Gittinger <cg@exept.de>
parents:
2357
diff
changeset
|
9296 |
|
269 | 9297 |
scrollToTop |
9298 |
"move viewOrigin to top" |
|
9299 |
||
9300 |
self scrollVerticalTo:0 |
|
9301 |
! |
|
9302 |
||
9303 |
scrollToTopLeft |
|
9304 |
"move viewOrigin to top/left" |
|
9305 |
||
9306 |
self scrollTo:(0 @ 0). |
|
9307 |
! |
|
9308 |
||
9309 |
scrollUp |
|
9310 |
"scroll up by some amount; this is called when the scrollbars |
|
9311 |
scroll-step up button is pressed." |
|
9312 |
||
9313 |
self scrollUp:(self verticalScrollStep) |
|
9314 |
! |
|
9315 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9316 |
scrollUp:nPixels |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9317 |
"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
|
9318 |
|
1035
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
9319 |
|viewOrigin| |
261c3ab854f0
Use #viewOrigin instead of translation transformation to get
Stefan Vogel <sv@exept.de>
parents:
1028
diff
changeset
|
9320 |
|
2703 | 9321 |
nPixels ~~ 0 ifTrue:[ |
3152 | 9322 |
viewOrigin := self viewOrigin. |
9323 |
self scrollTo:(viewOrigin x @ (viewOrigin y - nPixels)). |
|
2703 | 9324 |
] |
9325 |
||
9326 |
"Modified: / 20.8.1996 / 17:36:16 / stefan" |
|
9327 |
"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
|
9328 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9329 |
|
269 | 9330 |
scrollVerticalTo:aPixelOffset |
9331 |
"change origin to make aPixelOffset be the top line" |
|
9332 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9333 |
|orgX| |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9334 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9335 |
orgX := self viewOrigin x. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9336 |
^ self scrollTo:(orgX @ aPixelOffset). |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9337 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9338 |
"Modified: 8.7.1996 / 15:35:40 / stefan" |
135 | 9339 |
! |
9340 |
||
269 | 9341 |
scrollVerticalToPercent:percent |
9342 |
"scroll to a position given in percent of total" |
|
9343 |
||
9344 |
|hCont| |
|
9345 |
||
9346 |
hCont := self heightOfContents. |
|
9347 |
transformation notNil ifTrue:[ |
|
3152 | 9348 |
hCont := transformation applyScaleY:hCont. |
140 | 9349 |
]. |
269 | 9350 |
self scrollVerticalTo: |
3152 | 9351 |
((((hCont * percent) / 100.0) + 0.5) asInteger) |
269 | 9352 |
! |
9353 |
||
9354 |
verticalScrollStep |
|
9355 |
"return the amount to scroll when stepping up/down. |
|
9356 |
Subclasses may want to redefine this." |
|
9357 |
||
9358 |
^ (device verticalPixelPerMillimeter * 20) asInteger |
|
9359 |
! |
|
9360 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9361 |
widthForScrollBetween:yStart and:yEnd |
269 | 9362 |
"return the width in pixels for a scroll between yStart and yEnd |
9363 |
- return full width here since we do not know how wide contents is. |
|
9364 |
Views which only use part of their space (short lists, text) may redefine |
|
9365 |
this method and return the number of pixels that have to be scrolled. |
|
9366 |
On slow displays, this may make a difference; on fast ones you will probably |
|
9367 |
not notice any difference." |
|
9368 |
||
9369 |
^ (width - margin - margin) |
|
135 | 9370 |
! ! |
9371 |
||
9372 |
!SimpleView methodsFor:'scrolling-basic'! |
|
9373 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9374 |
scrollTo:newOrigin |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9375 |
"change origin to have newOrigin be visible at the top-left. |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9376 |
The argument defines the integer device coordinates of the new top-left |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9377 |
point." |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9378 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9379 |
^ self scrollTo:newOrigin redraw:true |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9380 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9381 |
"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
|
9382 |
"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
|
9383 |
! |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9384 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9385 |
scrollTo:newOrigin redraw:doRedraw |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9386 |
"change origin to have newOrigin be visible at the top-left. |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9387 |
The argument defines the integer device coordinates of the new top-left |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9388 |
point." |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9389 |
|
3704 | 9390 |
^ self |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9391 |
scrollTo:newOrigin |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9392 |
redraw:doRedraw |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9393 |
allowScrollBeyondContents:false |
3704 | 9394 |
! |
9395 |
||
9396 |
scrollTo:newOrigin redraw:doRedraw allowScrollBehondContents:allowScrollBehondContents |
|
9397 |
"change origin to have newOrigin be visible at the top-left. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9398 |
The argument defines the integer device coordinates of the new top-left |
3704 | 9399 |
point." |
9400 |
||
4295 | 9401 |
self obsoleteMethodWarning:'use #scrollTo:redraw:allowScrollBehondContents:'. |
4294 | 9402 |
^ self |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9403 |
scrollTo:newOrigin redraw:doRedraw allowScrollBeyondContents:allowScrollBehondContents |
4294 | 9404 |
! |
9405 |
||
9406 |
scrollTo:newOrigin redraw:doRedraw allowScrollBeyondContents:allowScrollBehondContents |
|
9407 |
"change origin to have newOrigin be visible at the top-left. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9408 |
The argument defines the integer device coordinates of the new top-left |
4294 | 9409 |
point." |
9410 |
||
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9411 |
|dX "{ Class:SmallInteger }" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9412 |
dY "{ Class:SmallInteger }" |
4520 | 9413 |
orgX |
9414 |
orgY |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9415 |
x y iw ih |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9416 |
hCont wCont fromX toX fromY toY copyWidth copyHeight |
2649 | 9417 |
redrawX redrawY wg| |
135 | 9418 |
|
9419 |
hCont := self heightOfContents. |
|
9420 |
wCont := self widthOfContents. |
|
9421 |
transformation isNil ifTrue:[ |
|
4834 | 9422 |
orgY := orgX := 0 |
135 | 9423 |
] ifFalse:[ |
4834 | 9424 |
wCont := (transformation applyScaleX:wCont) rounded. |
9425 |
hCont := (transformation applyScaleY:hCont) rounded. |
|
9426 |
orgY := transformation translation y negated. |
|
9427 |
orgX := transformation translation x negated |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9428 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9429 |
|
135 | 9430 |
iw := self innerWidth. |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9431 |
ih := self innerHeight. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9432 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9433 |
"don't scroll outside of displayed area" |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9434 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9435 |
x := newOrigin x. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9436 |
y := newOrigin y. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9437 |
|
3704 | 9438 |
allowScrollBehondContents ifFalse:[ |
4834 | 9439 |
x + iw > wCont ifTrue:[ |
9440 |
x := (wCont - iw) asInteger. |
|
9441 |
]. |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9442 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9443 |
x < 0 ifTrue:[ |
4834 | 9444 |
x := 0 |
3704 | 9445 |
]. |
9446 |
allowScrollBehondContents ifFalse:[ |
|
4834 | 9447 |
y + ih > hCont ifTrue:[ |
9448 |
y := (hCont - ih) asInteger. |
|
9449 |
]. |
|
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9450 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9451 |
y < 0 ifTrue:[ |
4834 | 9452 |
y := 0. |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9453 |
]. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9454 |
|
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9455 |
dX := x - orgX. |
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9456 |
dY := y - orgY. |
135 | 9457 |
|
1066 | 9458 |
(dX == 0 and:[dY == 0]) ifTrue:[ |
9459 |
^ self |
|
9460 |
]. |
|
9461 |
||
2649 | 9462 |
(wg := self windowGroup) notNil ifTrue:[ |
4834 | 9463 |
wg processRealExposeEventsFor:self. |
2649 | 9464 |
]. |
2405
95e4a8e563d8
precess expose events before scroll
Claus Gittinger <cg@exept.de>
parents:
2400
diff
changeset
|
9465 |
|
135 | 9466 |
self originWillChange. |
1017
43bc3829dcc5
Make #scrollTo: the basic scroll action.
Stefan Vogel <sv@exept.de>
parents:
1005
diff
changeset
|
9467 |
(shown and:[doRedraw]) ifTrue:[ |
4834 | 9468 |
copyWidth := iw - dX abs. |
9469 |
copyHeight := ih - dY abs. |
|
9470 |
((copyWidth > 0) and:[copyHeight > 0]) ifTrue:[ |
|
9471 |
"/ some of the currently displayed pixels |
|
9472 |
"/ remain visible. Copy them |
|
9473 |
||
9474 |
dX < 0 ifTrue:[ |
|
9475 |
fromX := margin. |
|
9476 |
toX := margin - dX. |
|
9477 |
redrawX := margin |
|
9478 |
] ifFalse:[ |
|
9479 |
fromX := margin + dX. |
|
9480 |
toX := margin. |
|
9481 |
redrawX := margin + copyWidth. |
|
9482 |
]. |
|
9483 |
dY < 0 ifTrue:[ |
|
9484 |
fromY := margin. |
|
9485 |
toY := margin - dY. |
|
9486 |
redrawY := margin. |
|
9487 |
] ifFalse:[ |
|
9488 |
fromY := margin + dY. |
|
9489 |
toY := margin. |
|
9490 |
redrawY := margin + copyHeight. |
|
9491 |
]. |
|
9492 |
self catchExpose. |
|
9493 |
self setViewOrigin:(x @ y). |
|
9494 |
self |
|
9495 |
copyFrom:self |
|
9496 |
x:fromX y:fromY |
|
9497 |
toX:toX y:toY |
|
9498 |
width:copyWidth |
|
9499 |
height:copyHeight |
|
9500 |
async:true. |
|
9501 |
||
9502 |
self setInnerClip. |
|
9503 |
||
9504 |
"first redraw the rectangle above/below the |
|
9505 |
copied area (with full width)." |
|
9506 |
||
9507 |
copyHeight < ih ifTrue:[ |
|
9508 |
self invalidateDeviceRectangle:((margin@redrawY) extent:(iw@(ih - copyHeight))) repairNow:false. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9509 |
"/ self |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9510 |
"/ redrawDeviceX:margin y:redrawY |
2381
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
9511 |
"/ width:iw height:(ih - copyHeight). |
4834 | 9512 |
]. |
9513 |
||
9514 |
"second redraw the rectangle left/right of the |
|
9515 |
copied area" |
|
9516 |
||
9517 |
copyWidth < iw ifTrue:[ |
|
9518 |
self invalidateDeviceRectangle:((redrawX@toY) extent:((iw-copyWidth)@copyHeight)) repairNow:false. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9519 |
"/ self redrawDeviceX:redrawX y:toY |
2381
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
9520 |
"/ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9521 |
"/ width:iw - copyWidth |
2381
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
9522 |
"/ height:copyHeight. |
4834 | 9523 |
]. |
9524 |
self waitForExpose. |
|
9525 |
] ifFalse:[ |
|
9526 |
"redraw everything" |
|
9527 |
||
9528 |
self setViewOrigin:(x @ y). |
|
9529 |
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
|
9530 |
"/ 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
|
9531 |
"/ width:iw |
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
9532 |
"/ height:ih. |
4834 | 9533 |
]. |
269 | 9534 |
] ifFalse:[ |
4834 | 9535 |
self setViewOrigin:(x @ y). |
2802 | 9536 |
]. |
9537 |
||
709 | 9538 |
self originChanged:(dX negated @ dY negated). |
9539 |
||
2381
9a365ce57a19
async redraw when scrolling (i.e. invalidate instead of redraw)
Claus Gittinger <cg@exept.de>
parents:
2376
diff
changeset
|
9540 |
"Modified: / 5.8.1996 / 11:57:09 / stefan" |
2405
95e4a8e563d8
precess expose events before scroll
Claus Gittinger <cg@exept.de>
parents:
2400
diff
changeset
|
9541 |
"Modified: / 1.12.1998 / 22:35:18 / cg" |
135 | 9542 |
! ! |
9543 |
||
269 | 9544 |
!SimpleView methodsFor:'startup'! |
9545 |
||
9546 |
open |
|
9547 |
"open up the view - for normal views, this is a modeless open |
|
9548 |
(i.e. the new view comes up as independent process). |
|
9549 |
Although #open is only to be sent to topviews (i.e. it could have been |
|
9550 |
implemented in TopView), it is implemented here - therefore, every view |
|
9551 |
can be opened as a topView. |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9552 |
This is redefined in ModalBox, which comes up modal (i.e. |
269 | 9553 |
control is under the current process, so that interaction with the |
4131 | 9554 |
current group is blocked while the modalBox is active). |
9555 |
||
9556 |
Notice: after the open, you cannot be sure that the view is really open and |
|
9557 |
visible, since #open forks a new process, which does the actual window opening. |
|
9558 |
To ensure visibility, use #openAndWait or waitUntilVisible after the open." |
|
269 | 9559 |
|
9560 |
^ self openModeless |
|
9561 |
||
9562 |
" |
|
9563 |
View new open |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9564 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9565 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9566 |
" |
269 | 9567 |
(Button label:'hello') open |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9568 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9569 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9570 |
" |
269 | 9571 |
|top| |
9572 |
top := StandardSystemView new. |
|
9573 |
top extent:200@200. |
|
9574 |
Button label:'hello' in:top. |
|
9575 |
top open |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9576 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9577 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9578 |
" |
269 | 9579 |
YesNoBox new open |
9580 |
" |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9581 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9582 |
"Modified: 24.7.1997 / 13:26:42 / cg" |
269 | 9583 |
! |
9584 |
||
9585 |
openAndWait |
|
9586 |
"open up the view - wait until it is visible. |
|
9587 |
In normal applications, you do not need to wait till the view is |
|
9588 |
open - it should do all of its drawing itself when it gets the |
|
9589 |
first expose event. |
|
9590 |
However, if you want to 'manually' draw into the view (for example, |
|
9591 |
in doIt expressions) the view must be visible (realized) before doing so. |
|
9592 |
Use this open in those situations." |
|
9593 |
||
9594 |
self open. |
|
9595 |
self waitUntilVisible. |
|
9596 |
||
9597 |
"does not work: |
|
9598 |
||
3152 | 9599 |
|v| |
9600 |
||
9601 |
v := View new open. |
|
9602 |
v displayLineFrom:0@0 to:50@50 |
|
269 | 9603 |
|
9604 |
does work: |
|
9605 |
||
3152 | 9606 |
|v| |
9607 |
||
9608 |
v := View new openAndWait. |
|
9609 |
v displayLineFrom:0@0 to:50@50 |
|
269 | 9610 |
" |
9611 |
! |
|
9612 |
||
9613 |
openAt:aPoint |
|
9614 |
"open up the view modeless - positions the view" |
|
9615 |
||
9616 |
^self openModelessAt:aPoint |
|
9617 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9618 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9619 |
(Button label:'hello') open |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9620 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9621 |
(Button label:'hello') openAt:(100@100) |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9622 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9623 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9624 |
"Modified: 24.7.1997 / 13:26:23 / cg" |
269 | 9625 |
! |
9626 |
||
9627 |
openAtCenter |
|
9628 |
"open up the view modeless - positions the view" |
|
9629 |
||
9630 |
^self openModelessAtCenter |
|
9631 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9632 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9633 |
(Button label:'hello') open |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9634 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9635 |
(Button label:'hello') openAtCenter |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9636 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9637 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9638 |
"Modified: 24.7.1997 / 13:01:12 / cg" |
269 | 9639 |
! |
9640 |
||
9641 |
openAutonomous |
|
9642 |
"create and schedule a new windowgroup for me and open the view. |
|
9643 |
The view will be handled by its own process, effectively running in |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9644 |
parallel. |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9645 |
Notice: |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9646 |
This entry is for NON-topviews, which want to be served |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9647 |
autonomous from their real topview. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9648 |
(see the fileBrowsers kill-button |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9649 |
when executing unix commands as an example)" |
269 | 9650 |
|
1877 | 9651 |
|wg mainGroup| |
269 | 9652 |
|
4139 | 9653 |
wg := self windowGroupClass new. |
763 | 9654 |
self windowGroup:wg. |
1877 | 9655 |
|
9656 |
mainGroup := WindowGroup activeGroup. |
|
9657 |
mainGroup notNil ifTrue:[ |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9658 |
mainGroup := mainGroup mainGroup. |
1877 | 9659 |
]. |
9660 |
||
9661 |
wg isForModalSubview:true. "/ make it handle update events for the main group |
|
9662 |
wg startupWith:[wg mainGroup:mainGroup. self realizeInGroup]. |
|
9663 |
||
9664 |
"/ wg startupModal:[true] forGroup:mainGroup |
|
9665 |
"/ self realizeInGroup. |
|
9666 |
||
9667 |
"Modified: 20.8.1997 / 17:57:38 / cg" |
|
269 | 9668 |
! |
9669 |
||
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9670 |
openInGroup:aGroup |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9671 |
"special open within another windowGroup. |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9672 |
This allows a view to be realized in any windowgroup; |
420
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9673 |
for applications where multiple views act as a group |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9674 |
(i.e. close and iconify together)." |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9675 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9676 |
self windowGroup:aGroup. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9677 |
aGroup addTopView:self. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9678 |
|
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9679 |
"/ self realizeKeepingGroup:true |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9680 |
aGroup isForModalSubview:true. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9681 |
self realize. |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9682 |
! |
9ad55eba79ac
allow opening subViews as modal;
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
9683 |
|
269 | 9684 |
openModal |
9685 |
"create a new windowgroup, but start processing in the current process |
|
9686 |
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
|
9687 |
Stay in the modalLoop while the view is visible. |
269 | 9688 |
(i.e. control is returned to the sender when the receiver is closed)" |
9689 |
||
9690 |
self openModal:[true] |
|
9691 |
||
9692 |
" |
|
9693 |
the same: |
|
3152 | 9694 |
YesNoBox new open |
9695 |
||
9696 |
YesNoBox new openModal |
|
269 | 9697 |
|
9698 |
different: |
|
3152 | 9699 |
(Button label:'hello') open |
9700 |
||
9701 |
(Button label:'hello') openModal |
|
269 | 9702 |
" |
9703 |
! |
|
9704 |
||
9705 |
openModal:aBlock |
|
9706 |
"create a new windowgroup, but start processing in the current process - |
|
9707 |
actually suspending event processing for the currently active group. |
|
9708 |
Stay in this modal loop while aBlock evaluates to true AND the receiver is |
|
9709 |
visible. |
|
9710 |
(i.e. control is returned to the sender when the receiver is closed) |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9711 |
This makes any interaction with the current window impossible - |
269 | 9712 |
however, other views (in other windowgroups) still work." |
9713 |
||
3642 | 9714 |
|masterGroup| |
2167
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
9715 |
|
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
9716 |
"/ mainGroup := WindowGroup activeGroup. |
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
9717 |
"/ mainGroup notNil ifTrue:[mainGroup := mainGroup mainGroup]. |
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
9718 |
|
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
9719 |
masterGroup := WindowGroup activeGroup. |
3345 | 9720 |
[masterGroup notNil and:[masterGroup isPopUp or:[masterGroup isModal]]] whileTrue:[ |
3762 | 9721 |
masterGroup := masterGroup previousGroup. |
2167
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
9722 |
]. |
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
9723 |
^ self openModal:aBlock inGroup:masterGroup "/ mainGroup. |
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
9724 |
|
41e74cf73d7a
fixed modal popup from a modal view
Claus Gittinger <cg@exept.de>
parents:
2161
diff
changeset
|
9725 |
"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
|
9726 |
"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
|
9727 |
! |
299
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
9728 |
|
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
9729 |
openModal:aBlock inGroup:mainGroup |
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
9730 |
"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
|
9731 |
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
|
9732 |
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
|
9733 |
visible. |
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
9734 |
(i.e. control is returned to the sender when the receiver is closed) |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9735 |
This makes any interaction with the current window impossible - |
299
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
9736 |
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
|
9737 |
|
3345 | 9738 |
|tops mainView mainViewID previousGroup | |
1397
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
9739 |
|
1736 | 9740 |
self isPopUpView ifFalse:[ |
4834 | 9741 |
mainGroup notNil ifTrue:[ |
9742 |
(tops := mainGroup topViews) notNil ifTrue:[ |
|
9743 |
tops notEmpty ifTrue:[ |
|
9744 |
mainView := tops detect:[:v| v shown] ifNone:nil. |
|
9745 |
mainView notNil ifTrue:[ |
|
9746 |
mainViewID := mainView id. |
|
9747 |
] |
|
9748 |
] |
|
9749 |
]. |
|
9750 |
]. |
|
9751 |
mainView notNil ifTrue:[ |
|
9752 |
mainView activate; setForegroundWindow. |
|
9753 |
]. |
|
9754 |
||
9755 |
ModalBox usingTransientViews ifTrue:[ |
|
9756 |
"make view only transient, if there is a visible topView. |
|
9757 |
If none of them is visible, we do want an icon for ourself" |
|
9758 |
||
9759 |
mainViewID isNil ifTrue:[ |
|
9760 |
self origin:(device center - (self extent//2)) |
|
9761 |
]. |
|
9762 |
||
9763 |
drawableId isNil ifTrue:[self create]. |
|
9764 |
mainView notNil ifTrue:[ |
|
9765 |
device setTransient:drawableId for:mainViewID. |
|
9766 |
]. |
|
9767 |
]. |
|
1397
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
9768 |
]. |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
9769 |
|
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1393
diff
changeset
|
9770 |
self raise. |
299
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
9771 |
|
269 | 9772 |
Processor activeProcessIsSystemProcess ifTrue:[ |
4834 | 9773 |
" |
9774 |
put myself into the modal group, let it handle events for |
|
9775 |
me as well. This is only a half way solution, since the view |
|
9776 |
is not modal at all ... however, the only situation |
|
9777 |
where this happens is with modal boxes popped while in a |
|
9778 |
modal browser. You will forgive me for that inconvenience. |
|
9779 |
" |
|
9780 |
windowGroup := mainGroup. |
|
9781 |
mainGroup notNil ifTrue:[mainGroup addTopView:self]. |
|
9782 |
self realize |
|
135 | 9783 |
] ifFalse:[ |
4834 | 9784 |
previousGroup := WindowGroup activeGroup. |
9785 |
||
9786 |
" |
|
9787 |
show a stop-cursor in the main group |
|
9788 |
" |
|
9789 |
mainGroup notNil ifTrue:[ |
|
9790 |
self isPopUpView ifFalse:[ |
|
9791 |
mainGroup showCursor:(Cursor stop). |
|
9792 |
(previousGroup notNil and:[previousGroup ~~ mainGroup]) ifTrue:[ |
|
9793 |
previousGroup showCursor:(Cursor stop). |
|
9794 |
]. |
|
9795 |
] |
|
9796 |
]. |
|
9797 |
||
9798 |
" |
|
9799 |
create a new window group and put myself into it |
|
9800 |
" |
|
9801 |
windowGroup := self windowGroupClass new. |
|
9802 |
windowGroup addTopView:self. |
|
9803 |
windowGroup setPreviousGroup:previousGroup. |
|
9804 |
||
9805 |
superView notNil ifTrue:[ |
|
9806 |
"/ |
|
9807 |
"/ special: this is a modal subview, |
|
9808 |
"/ prevent the view from reassigning its windowGroup when realized |
|
9809 |
"/ (subviews normally place themself into the superviews group) |
|
9810 |
"/ |
|
9811 |
windowGroup isForModalSubview:true. |
|
9812 |
]. |
|
9813 |
||
9814 |
" |
|
9815 |
go dispatch events in this new group |
|
9816 |
(thus current windowgroup is blocked from interaction) |
|
9817 |
" |
|
9818 |
AbortSignal handle:[:ex | |
|
9819 |
self hide. |
|
9820 |
ex return. |
|
9821 |
] do:[ |
|
9822 |
[ |
|
9823 |
[ |
|
9824 |
windowGroup startupModal:[realized and:aBlock] forGroup:mainGroup |
|
9825 |
] ifCurtailed:[ |
|
9826 |
self hide. |
|
9827 |
] |
|
9828 |
] ensure:[ |
|
9829 |
mainGroup notNil ifTrue:[ |
|
9830 |
mainGroup graphicsDevice sync. "thats a round trip - make sure that all drawing has been processed" |
|
9831 |
"/ ensure that eventListener runs here ... |
|
9832 |
Delay waitForSeconds:0.05. |
|
9833 |
mainGroup processExposeEvents. |
|
9834 |
||
9835 |
ReturnFocusWhenClosingModalBoxes ifTrue:[ |
|
9836 |
" |
|
9837 |
return input focus to previously active groups top. |
|
9838 |
This helps with windowmanagers which need an explicit click |
|
9839 |
on the view for the focus. |
|
9840 |
" |
|
9841 |
tops := mainGroup topViews. |
|
9842 |
(tops notEmptyOrNil) ifTrue:[ |
|
9843 |
tops first getKeyboardFocus |
|
9844 |
]. |
|
9845 |
]. |
|
9846 |
||
9847 |
" |
|
9848 |
restore cursors in the main group & flush its buffered key & mouse events |
|
9849 |
" |
|
9850 |
mainGroup restoreCursors. |
|
9851 |
(previousGroup notNil and:[previousGroup ~~ mainGroup]) ifTrue:[ |
|
9852 |
previousGroup restoreCursors. |
|
9853 |
]. |
|
1329 | 9854 |
"/ mainGroup sensor flushUserEvents. |
4834 | 9855 |
] |
9856 |
] |
|
9857 |
]. |
|
135 | 9858 |
] |
299
e2c8fd828a64
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
271
diff
changeset
|
9859 |
|
4654 | 9860 |
"Created: / 10-12-1995 / 14:06:14 / cg" |
9861 |
"Modified: / 17-10-2006 / 18:21:07 / cg" |
|
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
9862 |
! |
135 | 9863 |
|
269 | 9864 |
openModalAt:aPoint |
9865 |
"open up the view modeless - positions the view |
|
9866 |
(i.e. circumvents window managers positioning)" |
|
9867 |
||
9868 |
self origin:aPoint. |
|
1837 | 9869 |
drawableId isNil ifTrue:[self create]. |
560
968d062c79cb
oops - openAt did set transient; definitely wrong ...
Claus Gittinger <cg@exept.de>
parents:
527
diff
changeset
|
9870 |
"/ device setTransient:drawableId for:0. |
269 | 9871 |
^ self openModal |
9872 |
||
9873 |
" |
|
9874 |
View new openModal |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9875 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9876 |
" |
269 | 9877 |
View new openModalAt:100@100 |
9878 |
" |
|
9879 |
||
9880 |
"Created: 18.9.1995 / 23:21:42 / claus" |
|
9881 |
"Modified: 18.9.1995 / 23:32:26 / claus" |
|
1837 | 9882 |
"Modified: 28.7.1997 / 18:52:29 / cg" |
269 | 9883 |
! |
9884 |
||
9885 |
openModalAtCenter |
|
9886 |
"open up the view modeless - positions the view |
|
9887 |
(i.e. circumvents window managers positioning)" |
|
9888 |
||
9889 |
^ self openModalAt:(device center - (self extent//2)). |
|
9890 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9891 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9892 |
View new openModal |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9893 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9894 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9895 |
View new openModalAtCenter |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9896 |
" |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9897 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9898 |
"Modified: 24.7.1997 / 13:27:37 / cg" |
269 | 9899 |
! |
9900 |
||
9901 |
openModeless |
|
9902 |
"create and schedule a new windowgroup for me and open the view. |
|
9903 |
The view will be handled by its own process, effectively running in |
|
9904 |
parallel (i.e. control is returned to the sender immediately)." |
|
9905 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9906 |
self openModelessAt:nil |
269 | 9907 |
|
9908 |
" |
|
9909 |
the same: |
|
3152 | 9910 |
(Button label:'hello') open |
9911 |
||
9912 |
(Button label:'hello') openModeless |
|
269 | 9913 |
|
9914 |
different: |
|
3152 | 9915 |
YesNoBox new open |
9916 |
||
9917 |
YesNoBox new openModeless |
|
269 | 9918 |
" |
9919 |
" |
|
9920 |
(almost) the same: |
|
3152 | 9921 |
YesNoBox new open |
9922 |
||
9923 |
YesNoBox new openModal |
|
269 | 9924 |
|
9925 |
different: |
|
3152 | 9926 |
(Button label:'hello') open |
9927 |
||
9928 |
(Button label:'hello') openModal |
|
269 | 9929 |
" |
503
c2b27766bb0a
dont create a new windowGroup if there is one (in #openModeless)
Claus Gittinger <cg@exept.de>
parents:
497
diff
changeset
|
9930 |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9931 |
"Modified: 24.7.1997 / 13:17:49 / cg" |
269 | 9932 |
! |
9933 |
||
9934 |
openModelessAt:aPoint |
|
9935 |
"open up the view modeless - positions the view |
|
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9936 |
(i.e. tries to circumvent the window managers positioning) |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9937 |
Notice: some windowManagers seem to ignore this and always |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9938 |
ask the user to position the view." |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9939 |
|
1827 | 9940 |
self openModelessAt:aPoint iconified:false |
9941 |
||
9942 |
" |
|
9943 |
View new openModeless |
|
9944 |
||
9945 |
View new openModelessAt:100@100 |
|
9946 |
" |
|
9947 |
||
9948 |
"Created: 18.9.1995 / 23:21:42 / claus" |
|
9949 |
"Modified: 24.7.1997 / 13:48:52 / cg" |
|
9950 |
! |
|
9951 |
||
9952 |
openModelessAt:aPoint iconified:iconified |
|
9953 |
"open up the view modeless - positions the view |
|
9954 |
(i.e. tries to circumvent the window managers positioning) |
|
9955 |
Notice: some windowManagers seem to ignore this and always |
|
9956 |
ask the user to position the view." |
|
9957 |
||
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9958 |
|newGroup| |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9959 |
|
1837 | 9960 |
drawableId isNil ifTrue:[self create]. |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9961 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9962 |
windowGroup isNil ifTrue:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9963 |
newGroup := true. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9964 |
windowGroup := self windowGroupClass new. |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9965 |
] ifFalse:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9966 |
newGroup := false. |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9967 |
]. |
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9968 |
|
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9969 |
windowGroup addTopView:self. |
3745 | 9970 |
newGroup ifTrue:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9971 |
(aPoint isNil and:[iconified not]) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9972 |
windowGroup startupWith:[self realize]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9973 |
] ifFalse:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9974 |
windowGroup startupWith:[self realizeKeepingGroup:false at:aPoint iconified:iconified]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9975 |
]. |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9976 |
] ifFalse:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
9977 |
self realizeInGroup. |
1823
56c9a8366a31
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1809
diff
changeset
|
9978 |
]. |
269 | 9979 |
|
9980 |
" |
|
1827 | 9981 |
StandardSystemView new openModeless |
9982 |
||
9983 |
StandardSystemView new openModelessAt:100@100 |
|
9984 |
||
9985 |
StandardSystemView new openModelessAt:100@100 iconified:true |
|
269 | 9986 |
" |
9987 |
||
9988 |
"Created: 18.9.1995 / 23:21:42 / claus" |
|
1837 | 9989 |
"Modified: 28.7.1997 / 18:52:26 / cg" |
269 | 9990 |
! |
9991 |
||
9992 |
openModelessAtCenter |
|
9993 |
"open up the view modeless - positions the view |
|
9994 |
(i.e. circumvents window managers positioning)" |
|
9995 |
||
9996 |
^ self openModelessAt:(device center - (self extent//2)). |
|
9997 |
||
9998 |
" |
|
9999 |
View new openModeless |
|
10000 |
||
10001 |
View new openModelessAtCenter |
|
10002 |
" |
|
10003 |
||
10004 |
"Created: 18.9.1995 / 23:21:42 / claus" |
|
10005 |
! |
|
10006 |
||
10007 |
waitUntilVisible |
|
10008 |
"wait until the receiver visible. |
|
10009 |
In normal applications, you do not need to wait till a view is |
|
10010 |
open - it should do all of its drawing itself when it gets the |
|
10011 |
first expose event. |
|
10012 |
However, if you want to 'manually' draw into the view (for example, |
|
10013 |
in doIt expressions), or subsequent views depend on some state of |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10014 |
another view (which is only available once visible), |
269 | 10015 |
use this to suspend the current process until the receiver is shown. |
10016 |
Caveat: |
|
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10017 |
we poll here for the view to be shown - we need a semaphore |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10018 |
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
|
10019 |
|
a98163edc25b
care for #waitUntilVisible to be called from within the event dispatcher
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
10020 |
|wg n| |
a98163edc25b
care for #waitUntilVisible to be called from within the event dispatcher
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
10021 |
|
a98163edc25b
care for #waitUntilVisible to be called from within the event dispatcher
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
10022 |
n := 0. |
269 | 10023 |
[self shown] whileFalse:[ |
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10024 |
(device notNil and:[device isOpen not]) ifTrue:[^ self]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10025 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10026 |
"/ this was added to avoid a deadlock, when called from within |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10027 |
"/ the event dispatch process (as when doing foo inspect there). |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10028 |
n > (10 / 0.05) ifTrue:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10029 |
'SimpleView [info]: View not visible after 10 seconds - will not wait any longer in waitUntilVisible' infoPrintCR. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10030 |
^ self |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10031 |
]. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10032 |
n := n + 1. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10033 |
Delay waitForSeconds:0.05. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10034 |
(wg := self windowGroup) ifNotNil:[ |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10035 |
wg processExposeEvents. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10036 |
]. |
269 | 10037 |
]. |
10038 |
||
10039 |
"does not work (the view is in its opening phase, |
|
10040 |
when we attempt to draw a line - this gives an error, since |
|
10041 |
its internals are not yet correctly setup): |
|
10042 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10043 |
|v| |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10044 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10045 |
v := View new open. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10046 |
v displayLineFrom:0@0 to:50@50 |
269 | 10047 |
|
10048 |
does work (since we wait until the view has completely finished |
|
10049 |
its startup phase): |
|
10050 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10051 |
|v| |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10052 |
|
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10053 |
v := View new open. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10054 |
v waitUntilVisible. |
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10055 |
v displayLineFrom:0@0 to:50@50 |
269 | 10056 |
" |
135 | 10057 |
! ! |
10058 |
||
3276 | 10059 |
!SimpleView methodsFor:'user interaction & notifications'! |
135 | 10060 |
|
10061 |
warn:aString |
|
10062 |
"like Objects warn, but translates the string via the |
|
10063 |
resourcePack, thus giving a translated string automatically" |
|
10064 |
||
4452
0076d4427e51
remember the helpKey in the view - not in the builder
Claus Gittinger <cg@exept.de>
parents:
4447
diff
changeset
|
10065 |
super warn:(resources stringWithCRs:aString) |
135 | 10066 |
! |
10067 |
||
10068 |
warn:aString with:argument |
|
10069 |
"like Objects warn, but translates the string via the |
|
10070 |
resourcePack, thus giving a translated string automatically" |
|
10071 |
||
4406 | 10072 |
super warn:(resources stringWithCRs:aString with:argument) |
151 | 10073 |
! |
10074 |
||
10075 |
warn:aString with:arg1 with:arg2 |
|
10076 |
"like Objects warn, but translates the string via the |
|
10077 |
resourcePack, thus giving a translated string automatically" |
|
10078 |
||
4406 | 10079 |
super warn:(resources stringWithCRs:aString with:arg1 with:arg2) |
3182 | 10080 |
! |
10081 |
||
10082 |
warn:aString with:arg1 with:arg2 with:arg3 |
|
10083 |
"like Objects warn, but translates the string via the |
|
10084 |
resourcePack, thus giving a translated string automatically" |
|
10085 |
||
4406 | 10086 |
super warn:(resources stringWithCRs:aString with:arg1 with:arg2 with:arg3) |
135 | 10087 |
! ! |
10088 |
||
2750
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
10089 |
!SimpleView::ViewShape methodsFor:'queries'! |
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
10090 |
|
3366 | 10091 |
isRoundShape |
10092 |
^ false |
|
10093 |
! ! |
|
2750
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
10094 |
|
3377
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
10095 |
!SimpleView::RoundViewShape methodsFor:'queries'! |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
10096 |
|
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
10097 |
isRoundShape |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
10098 |
^ true |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
10099 |
|
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
10100 |
|
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
10101 |
! ! |
9a9199a8bc3f
must invoke findGUIResources, when an spec array is converted to
Claus Gittinger <cg@exept.de>
parents:
3375
diff
changeset
|
10102 |
|
2750
36b1a4d30882
moved round-view shape computation code to simpleView
Claus Gittinger <cg@exept.de>
parents:
2741
diff
changeset
|
10103 |
!SimpleView::ArbitraryViewShape methodsFor:'accessing'! |
1903 | 10104 |
|
3366 | 10105 |
borderShapeForm |
10106 |
"return the value of the instance variable 'borderShapeForm' (automatically generated)" |
|
10107 |
||
10108 |
^ borderShapeForm |
|
10109 |
||
10110 |
"Created: 18.9.1997 / 11:04:29 / cg" |
|
10111 |
! |
|
10112 |
||
10113 |
borderShapeForm:something |
|
10114 |
"set the value of the instance variable 'borderShapeForm' (automatically generated)" |
|
10115 |
||
10116 |
borderShapeForm := something. |
|
10117 |
||
10118 |
"Created: 18.9.1997 / 11:04:29 / cg" |
|
10119 |
! |
|
10120 |
||
10121 |
viewShapeForm |
|
10122 |
"return the value of the instance variable 'viewShapeForm' (automatically generated)" |
|
10123 |
||
10124 |
^ viewShapeForm |
|
10125 |
||
10126 |
"Created: 18.9.1997 / 11:04:29 / cg" |
|
10127 |
! |
|
10128 |
||
10129 |
viewShapeForm:something |
|
10130 |
"set the value of the instance variable 'viewShapeForm' (automatically generated)" |
|
10131 |
||
10132 |
viewShapeForm := something. |
|
10133 |
||
10134 |
"Created: 18.9.1997 / 11:04:29 / cg" |
|
10135 |
! ! |
|
1903 | 10136 |
|
1101
ffeb697dd9e0
hasButtonMotionEventsFor -> hasButtonMotionEventFor
Claus Gittinger <cg@exept.de>
parents:
1066
diff
changeset
|
10137 |
!SimpleView class methodsFor:'documentation'! |
269 | 10138 |
|
10139 |
version |
|
4978
72d873c3eb05
must retract an interest - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4971
diff
changeset
|
10140 |
^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.587 2008-06-23 15:29:03 cg Exp $' |
135 | 10141 |
! ! |
3745 | 10142 |
|
135 | 10143 |
SimpleView initialize! |