author | Claus Gittinger <cg@exept.de> |
Tue, 30 Oct 2007 21:00:28 +0100 | |
changeset 4815 | 77b9f37c9e10 |
parent 4814 | 4204263d3ab3 |
child 4824 | 8c1e4838ac4a |
permissions | -rw-r--r-- |
0 | 1 |
" |
6 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
72 | 3 |
All Rights Reserved |
0 | 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 |
" |
|
3210 | 12 |
"{ Package: 'stx:libview' }" |
13 |
||
135 | 14 |
TopView subclass:#StandardSystemView |
1539 | 15 |
instanceVariableNames:'label icon iconView iconLabel minExtent maxExtent sizeFixed |
3408
42384f123133
Add labelChannel and visibilityChannel to WindowSpec/StandardSystemView
Stefan Vogel <sv@exept.de>
parents:
3393
diff
changeset
|
16 |
application windowEventsForApplication deviceIcon labelChannel' |
2326 | 17 |
classVariableNames:'DefaultIcon IncludeHostNameInLabel DefaultExtent |
2651
8f800d7bcee3
send minExtend/maxExtend changes down to the device.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
18 |
WindowLabelFormat DefaultMinExtent' |
328 | 19 |
poolDictionaries:'' |
20 |
category:'Views-Basic' |
|
0 | 21 |
! |
22 |
||
4566 | 23 |
!StandardSystemView class methodsFor:'documentation'! |
46 | 24 |
|
4566 | 25 |
copyright |
26 |
" |
|
27 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
28 |
All Rights Reserved |
|
0 | 29 |
|
4566 | 30 |
This software is furnished under a license and may be used |
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
0 | 38 |
|
4566 | 39 |
documentation |
40 |
" |
|
41 |
I represent standard application topViews |
|
42 |
i.e. those views which have a title-label, an icon etc. |
|
43 |
||
44 |
The name `StandardSystemView' is probably misleading and |
|
45 |
results from ST-80 (rel2.x) compatibility reasons. |
|
46 |
Think of it as an ApplicationWindow. |
|
625
4d8f6dc3af75
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
621
diff
changeset
|
47 |
|
4d8f6dc3af75
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
621
diff
changeset
|
48 |
|
4566 | 49 |
In ST/X, StandardSystemViews were subclassed for special views |
50 |
in the past (for example: FileBrowser, ChangesBrowser etc.). |
|
51 |
Although this worked, it may lead to the following |
|
52 |
problems and inconveniences: |
|
53 |
- applications inherit a big number of methods through the |
|
54 |
SimpleView->View->TopView->StandardSystemView hierarchy. |
|
55 |
There is quite a danger that by accident, some method gets |
|
56 |
redefined which is required by one of those classes. |
|
57 |
(typical candidates are: terminate, destroy, open ...) |
|
58 |
This may lead to strange effects, which may not be obvious to |
|
59 |
non experts ... |
|
604
672ecb7ec347
fixed iconView handling (thought it was not realized); comments & docu
Claus Gittinger <cg@exept.de>
parents:
597
diff
changeset
|
60 |
|
4566 | 61 |
- applications with multiple topViews are difficult to implement |
62 |
and manage. |
|
63 |
||
64 |
- use of a windowBuilder is difficult. |
|
65 |
||
66 |
For all those reasons, we HIGHLY recommend to NOT define applications |
|
67 |
as subclasses of StandardSystemView, but instead base them on |
|
68 |
ApplicationModel, and reference the topView(s) as instance variables of |
|
69 |
if (if at all). |
|
70 |
||
71 |
[instance variables:] |
|
72 |
label <String> the label in the windows title |
|
604
672ecb7ec347
fixed iconView handling (thought it was not realized); comments & docu
Claus Gittinger <cg@exept.de>
parents:
597
diff
changeset
|
73 |
|
4566 | 74 |
icon <Form> the icon |
75 |
[ignored if the display does not |
|
76 |
support icons] |
|
604
672ecb7ec347
fixed iconView handling (thought it was not realized); comments & docu
Claus Gittinger <cg@exept.de>
parents:
597
diff
changeset
|
77 |
|
4566 | 78 |
iconView <View> an optional icon-view (for animated icons) |
79 |
[ignored if the display does not |
|
80 |
supports this] |
|
604
672ecb7ec347
fixed iconView handling (thought it was not realized); comments & docu
Claus Gittinger <cg@exept.de>
parents:
597
diff
changeset
|
81 |
|
4566 | 82 |
iconLabel <String> the label in the icon |
83 |
[ignored if the display does not |
|
84 |
support label-tabs with icons] |
|
85 |
||
86 |
minExtent <Point> the minimum size |
|
87 |
No limit, if nil |
|
88 |
[the window manager may have its own |
|
89 |
limit; typically some small area] |
|
90 |
||
91 |
maxExtent <Point> the maximum size |
|
92 |
No limit, if nil. |
|
93 |
[the window manager may have its own |
|
94 |
limit; typically the screen size] |
|
95 |
||
96 |
sizeFixed <Boolean> prevents the view from resizing itself |
|
97 |
(especially to freeze a dialogs size) |
|
98 |
||
99 |
application <AppModel> if nonNil, thats the application |
|
100 |
Many requests (such as open/close etc. |
|
101 |
are forwarded to it, if present. |
|
604
672ecb7ec347
fixed iconView handling (thought it was not realized); comments & docu
Claus Gittinger <cg@exept.de>
parents:
597
diff
changeset
|
102 |
|
672ecb7ec347
fixed iconView handling (thought it was not realized); comments & docu
Claus Gittinger <cg@exept.de>
parents:
597
diff
changeset
|
103 |
|
672ecb7ec347
fixed iconView handling (thought it was not realized); comments & docu
Claus Gittinger <cg@exept.de>
parents:
597
diff
changeset
|
104 |
|
4566 | 105 |
[class variables:] |
106 |
||
107 |
DefaultIcon <Form> cached default icon |
|
108 |
||
109 |
TakeFocusWhenMapped <Boolean> if true, views grab the keyboard |
|
110 |
focus (convenient with some stupid |
|
111 |
windowManagers) |
|
112 |
||
113 |
IncludeHostNameInLabel <Boolean> if true, the windows title shall |
|
114 |
include the hostname. |
|
115 |
(convenient if you have many remote |
|
116 |
views open simultaneously) |
|
117 |
||
118 |
WindowLabelFormat <Boolean> specifies the format for windowLabels |
|
119 |
||
120 |
||
121 |
[author:] |
|
122 |
Claus Gittinger |
|
123 |
||
124 |
[see also:] |
|
125 |
WindowGroup |
|
126 |
ApplicationModel |
|
127 |
" |
|
128 |
||
129 |
! |
|
130 |
||
131 |
examples |
|
132 |
" |
|
133 |
simple, empty topView: |
|
134 |
[exBegin] |
|
135 |
|topView| |
|
136 |
||
137 |
topView := StandardSystemView new. |
|
138 |
topView label:'my first view'. |
|
139 |
topView extent:200 @ 200. |
|
140 |
topView open. |
|
141 |
[exEnd] |
|
142 |
||
143 |
with an icon & iconLabel: |
|
144 |
[exBegin] |
|
145 |
|topView| |
|
146 |
||
147 |
topView := StandardSystemView extent:200 @ 200. |
|
148 |
topView label:'Hello world'. |
|
149 |
||
150 |
topView icon:(Image fromFile:'hello_world.icon'). |
|
151 |
topView open. |
|
152 |
[exEnd] |
|
153 |
||
154 |
||
155 |
with an animated iconView [not supported on all display devices]: |
|
156 |
[exBegin] |
|
157 |
|iconView topView| |
|
158 |
||
159 |
iconView := ClockView new. |
|
160 |
||
161 |
topView := StandardSystemView extent:200 @ 200. |
|
162 |
topView label:'Hello world'. |
|
163 |
||
164 |
topView iconView:iconView. |
|
165 |
topView open. |
|
166 |
[exEnd] |
|
604
672ecb7ec347
fixed iconView handling (thought it was not realized); comments & docu
Claus Gittinger <cg@exept.de>
parents:
597
diff
changeset
|
167 |
|
672ecb7ec347
fixed iconView handling (thought it was not realized); comments & docu
Claus Gittinger <cg@exept.de>
parents:
597
diff
changeset
|
168 |
|
4566 | 169 |
placing a subView into it: |
170 |
[exBegin] |
|
171 |
|topView button| |
|
172 |
||
173 |
topView := StandardSystemView new. |
|
174 |
topView label:'my second view'. |
|
175 |
topView extent:200 @ 200. |
|
176 |
||
177 |
button := Button label:'close' in:topView. |
|
178 |
button action:[topView destroy]. |
|
179 |
||
180 |
topView open. |
|
181 |
[exEnd] |
|
182 |
||
183 |
same, relative sized subview: |
|
184 |
[exBegin] |
|
185 |
|topView button| |
|
186 |
||
187 |
topView := StandardSystemView new. |
|
188 |
topView label:'my second view'. |
|
189 |
topView extent:200 @ 200. |
|
190 |
||
191 |
button := Button label:'close' in:topView. |
|
192 |
button action:[topView destroy]. |
|
193 |
button origin:0.25 @ 0.25 corner:0.75 @ 0.75. |
|
194 |
||
195 |
topView open. |
|
196 |
[exEnd] |
|
197 |
||
198 |
multiple buttons in a panel in a topView: |
|
199 |
[exBegin] |
|
200 |
|topView panel button1 button2 button3| |
|
201 |
||
202 |
topView := StandardSystemView new. |
|
203 |
topView label:'my second view'. |
|
204 |
topView extent:200 @ 200. |
|
205 |
||
206 |
panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:topView. |
|
207 |
panel inset:10. |
|
208 |
panel level:-1. |
|
209 |
||
210 |
button1 := Button label:'one' in:panel. |
|
211 |
button1 action:[Transcript showCR:'one pressed']. |
|
212 |
||
213 |
button2 := Button label:'two' in:panel. |
|
214 |
button2 action:[Transcript showCR:'two pressed']. |
|
215 |
||
216 |
button3 := Button label:'three' in:panel. |
|
217 |
button3 action:[Transcript showCR:'three pressed']. |
|
218 |
||
219 |
topView open. |
|
220 |
[exEnd] |
|
221 |
" |
|
222 |
! ! |
|
223 |
||
224 |
!StandardSystemView class methodsFor:'instance creation'! |
|
225 |
||
226 |
extent:anExtent label:aLabel icon:aForm |
|
227 |
"create a new topView and define its extent, label and icon" |
|
228 |
||
229 |
^ self origin:nil extent:anExtent |
|
230 |
label:aLabel icon:aForm |
|
231 |
minExtent:nil maxExtent:nil |
|
232 |
! |
|
233 |
||
234 |
extent:anExtent label:aLabel icon:aForm minExtent:minExtent |
|
235 |
^ self origin:nil extent:anExtent |
|
236 |
label:aLabel icon:aForm |
|
237 |
minExtent:minExtent maxExtent:nil |
|
238 |
! |
|
239 |
||
240 |
extent:anExtent label:aLabel icon:aForm minExtent:minExtent maxExtent:maxExtent |
|
241 |
^ self origin:nil extent:anExtent |
|
242 |
label:aLabel icon:aForm |
|
243 |
minExtent:minExtent maxExtent:maxExtent |
|
244 |
! |
|
245 |
||
246 |
extent:anExtent label:aLabel minExtent:minExtent |
|
247 |
"create a new topView and define its extent, label and minumum extent" |
|
248 |
||
249 |
^ self origin:nil extent:anExtent |
|
250 |
label:aLabel icon:nil |
|
251 |
minExtent:minExtent maxExtent:nil |
|
252 |
! |
|
253 |
||
254 |
label:aLabel |
|
255 |
"create a new topView and define its label" |
|
256 |
||
257 |
^ self origin:nil extent:nil |
|
258 |
label:aLabel icon:nil |
|
259 |
minExtent:nil maxExtent:nil |
|
260 |
! |
|
261 |
||
262 |
label:aLabel icon:aForm |
|
263 |
"create a new topView and define its label and icon" |
|
264 |
||
265 |
^ self origin:nil extent:nil |
|
266 |
label:aLabel icon:aForm |
|
267 |
minExtent:nil maxExtent:nil |
|
268 |
! |
|
269 |
||
270 |
label:aLabel icon:aForm minExtent:anExtent |
|
271 |
"create a new topView and define its label, icon and minumum extent" |
|
272 |
||
273 |
^ self origin:nil extent:nil |
|
274 |
label:aLabel icon:aForm |
|
275 |
minExtent:anExtent maxExtent:nil |
|
276 |
! |
|
277 |
||
278 |
label:aLabel icon:aForm minExtent:minExtent maxExtent:maxExtent |
|
279 |
"create a new topView and define its label, icon, min and max extents" |
|
280 |
||
281 |
^ self origin:nil extent:nil |
|
282 |
label:aLabel icon:aForm |
|
283 |
minExtent:minExtent maxExtent:maxExtent |
|
284 |
! |
|
285 |
||
286 |
label:aLabel minExtent:anExtent |
|
287 |
"create a new topView and define its label and minimum extent" |
|
288 |
||
289 |
^ self origin:nil extent:nil |
|
290 |
label:aLabel icon:nil |
|
291 |
minExtent:anExtent maxExtent:nil |
|
292 |
! |
|
293 |
||
294 |
model:aModel label:aLabel minimumSize:minExtent |
|
295 |
"ST80-style instance creation" |
|
296 |
||
297 |
|newView| |
|
298 |
||
299 |
newView := self origin:nil |
|
300 |
extent:minExtent |
|
301 |
label:aLabel |
|
302 |
icon:nil |
|
303 |
minExtent:minExtent |
|
304 |
maxExtent:nil. |
|
305 |
newView model:aModel. |
|
306 |
"/ newView controller:(self defaultControllerClass new view:newView). |
|
307 |
^ newView |
|
308 |
! |
|
309 |
||
310 |
origin:anOrigin extent:anExtent label:aLabel |
|
311 |
"create a new topView and define its origin, extent and label" |
|
312 |
||
313 |
^ self origin:anOrigin extent:anExtent |
|
314 |
label:aLabel icon:nil |
|
315 |
minExtent:nil maxExtent:nil |
|
316 |
! |
|
317 |
||
318 |
origin:anOrigin label:aLabel icon:aForm |
|
319 |
minExtent:minExtent maxExtent:maxExtent |
|
320 |
"create a new topView and define its origin, extent, label, icon |
|
321 |
and extent-boundaries." |
|
322 |
||
323 |
^ self origin:anOrigin extent:nil |
|
324 |
label:aLabel icon:aForm |
|
325 |
minExtent:minExtent maxExtent:maxExtent |
|
326 |
! ! |
|
327 |
||
328 |
!StandardSystemView class methodsFor:'Compatibility-VW'! |
|
329 |
||
330 |
promptForOpen:aBoolean |
|
331 |
"not implemented here" |
|
332 |
! ! |
|
333 |
||
334 |
!StandardSystemView class methodsFor:'class initialization'! |
|
335 |
||
336 |
initialize |
|
337 |
IncludeHostNameInLabel := false. |
|
338 |
WindowLabelFormat := self defaultWindowLabelFormat. |
|
339 |
||
340 |
TakeFocusWhenMapped := (Display notNil and:[Display platformName = 'WIN32']). |
|
341 |
||
342 |
"Created: / 20.8.1997 / 14:16:32 / cg" |
|
343 |
"Modified: / 24.8.1998 / 17:16:33 / cg" |
|
344 |
! ! |
|
345 |
||
346 |
!StandardSystemView class methodsFor:'defaults'! |
|
347 |
||
348 |
defaultExtent |
|
349 |
"return a standardSystemViews default window extent" |
|
350 |
||
351 |
DefaultExtent notNil ifTrue:[ |
|
352 |
^ DefaultExtent |
|
353 |
]. |
|
354 |
^ super defaultExtent |
|
355 |
||
356 |
"Created: 15.8.1997 / 01:36:21 / cg" |
|
357 |
! |
|
358 |
||
359 |
defaultIcon |
|
360 |
"return a topViews default window icon" |
|
361 |
||
4800 | 362 |
<resource: #programImage> |
4566 | 363 |
<resource: #style (#ICON #ICON_FILE)> |
364 |
||
365 |
|n nm i| |
|
366 |
||
367 |
(i := DefaultIcon) isNil ifTrue:[ |
|
368 |
i := self classResources at:'ICON' default:nil. |
|
369 |
i isNil ifTrue:[ |
|
370 |
"/ OperatingSystem platformName == #win32 ifTrue:[ |
|
371 |
"/ n := 'stx_16x16.xpm'. |
|
372 |
"/ ] ifFalse:[ |
|
373 |
"/ n := 'SmalltalkX.xbm'. |
|
374 |
"/ ]. |
|
375 |
nm := ClassResources at:'ICON_FILE' default:n. |
|
376 |
nm notNil ifTrue:[ |
|
377 |
i := Smalltalk imageFromFileNamed:nm inPackage:'stx:libtool'. |
|
378 |
]. |
|
379 |
i isNil ifTrue:[ |
|
380 |
i := self defaultSTXIcon |
|
381 |
]. |
|
382 |
]. |
|
383 |
i notNil ifTrue:[ |
|
384 |
DefaultIcon := i := i onDevice:Display |
|
385 |
] |
|
386 |
]. |
|
387 |
^ i |
|
388 |
||
389 |
" |
|
390 |
DefaultIcon := nil. |
|
391 |
self defaultIcon inspect |
|
392 |
" |
|
393 |
||
4800 | 394 |
"Modified: / 17-09-2007 / 11:36:25 / cg" |
4566 | 395 |
! |
396 |
||
397 |
defaultLabel |
|
398 |
"return the default label for views of my kind. |
|
399 |
This can be redefined in subclasses or overwritten in |
|
400 |
initialize methods." |
|
401 |
||
402 |
^ self nameWithoutPrefix. "/ 'aView' |
|
403 |
||
404 |
"Modified: / 27.9.1999 / 11:38:57 / cg" |
|
405 |
! |
|
406 |
||
407 |
defaultWindowLabelFormat |
|
408 |
"%2 is the hostName; |
|
409 |
%1 is the actual window label." |
|
410 |
||
411 |
"/ ^ '%2:%1'. "/ the old format |
|
412 |
"/ ^ '%1 @ %2'. |
|
413 |
^ '%1 [%2]'. |
|
414 |
! |
|
415 |
||
416 |
includeHostNameInLabel |
|
417 |
"return the flag which controls if a views label should |
|
418 |
include the hostname. |
|
419 |
This flag is usually set/cleared in your private.rc file; |
|
420 |
the default is false." |
|
421 |
||
422 |
^ IncludeHostNameInLabel |
|
423 |
||
424 |
"Created: 10.9.1995 / 19:21:16 / claus" |
|
425 |
! |
|
426 |
||
427 |
includeHostNameInLabel:aBoolean |
|
428 |
"set/clear the flag which controls if a views label should |
|
429 |
include the hostname - this is highly useful if you have |
|
430 |
multiple smalltalks open simultaneously ... |
|
431 |
This flag is usually set/cleared in your private.rc file; |
|
432 |
the default is false." |
|
433 |
||
434 |
IncludeHostNameInLabel := aBoolean |
|
435 |
||
436 |
"Modified: 24.4.1996 / 09:09:21 / cg" |
|
437 |
! |
|
438 |
||
439 |
takeFocusWhenMapped |
|
440 |
^ TakeFocusWhenMapped |
|
441 |
||
442 |
" |
|
443 |
StandardSystemView takeFocusWhenMapped |
|
444 |
" |
|
445 |
! |
|
446 |
||
447 |
updateStyleCache |
|
448 |
"extract values from the styleSheet and cache them in class variables" |
|
449 |
||
450 |
<resource: #style (#'standardSystemView.defaultExtent')> |
|
451 |
||
452 |
DefaultExtent := StyleSheet at:'standardSystemView.defaultExtent' default:nil. |
|
453 |
||
454 |
" |
|
455 |
self updateStyleCache |
|
456 |
" |
|
457 |
||
458 |
"Modified: 31.8.1995 / 03:01:14 / claus" |
|
459 |
"Created: 15.8.1997 / 01:34:37 / cg" |
|
460 |
"Modified: 20.10.1997 / 15:13:50 / cg" |
|
461 |
! |
|
462 |
||
463 |
windowLabelFormat |
|
464 |
^ WindowLabelFormat |
|
465 |
! |
|
466 |
||
467 |
windowLabelFormat:aFormatString |
|
468 |
WindowLabelFormat := aFormatString |
|
469 |
! ! |
|
470 |
||
471 |
!StandardSystemView class methodsFor:'image specs'! |
|
472 |
||
473 |
defaultSTXIcon |
|
474 |
<resource: #programImage> |
|
475 |
||
476 |
^ self defaultSTXIcon3. |
|
477 |
! |
|
478 |
||
479 |
defaultSTXIcon1 |
|
480 |
"This resource specification was automatically generated |
|
481 |
by the ImageEditor of ST/X." |
|
482 |
||
483 |
"Do not manually edit this!! If it is corrupted, |
|
484 |
the ImageEditor may not be able to read the specification." |
|
485 |
||
486 |
" |
|
487 |
self defaultSTXIcon1 inspect |
|
488 |
ImageEditor openOnClass:self andSelector:#defaultSTXIcon1 |
|
489 |
Icon flushCachedIcons |
|
490 |
" |
|
491 |
||
492 |
<resource: #image> |
|
493 |
||
494 |
^Icon |
|
495 |
constantNamed:#'StandardSystemView class defaultSTXIcon1' |
|
496 |
ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#[2]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@E@@@@AP@D@@V@D@@APF@@@F&@@@AV@@@@&@@@@%P@@@&F@@@VBP@@V@I@@V@@P@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 0 127 127 184 231 231]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@X@A PGB@LX@_@A8@G@@<@GX@9 GC@8D@@@@@@b') ; yourself); yourself] |
|
497 |
! |
|
498 |
||
499 |
defaultSTXIcon2 |
|
500 |
"This resource specification was automatically generated |
|
501 |
by the ImageEditor of ST/X." |
|
502 |
||
503 |
"Do not manually edit this!! If it is corrupted, |
|
504 |
the ImageEditor may not be able to read the specification." |
|
505 |
||
506 |
" |
|
507 |
self defaultSTXIcon2 inspect |
|
508 |
ImageEditor openOnClass:self andSelector:#defaultSTXIcon2 |
|
509 |
Icon flushCachedIcons |
|
510 |
" |
|
511 |
||
512 |
<resource: #image> |
|
513 |
||
514 |
^Icon |
|
515 |
constantNamed:#'StandardSystemView class defaultSTXIcon2' |
|
516 |
ifAbsentPut:[(Depth8Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
517 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@HB@@@@@@@@@@@@@@@@@@@B@ @@@@@@@@H@@@@@@@@@@ H@@@@@@@H@@@@@@@@@@@@B@ @@ |
|
518 |
@@H@@@@@@@@@@@@@@@H@@@H@@@@@@@@@@@@@@@@B@ H@@@@@@@@@@@@@@@@@@@H@@@@@@@@@@@@@@@@@@@HB@ @@@@@@@@@@@@@@@@H@@@H@@@@@@@@@@@@@ |
|
519 |
@ H@@@@@@ @@@@@@@@@@@ H@@@@@@@@B@@@@@@@@@ H@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[184 231 231 63 63 63 0 127 127]; yourself] |
|
520 |
! |
|
521 |
||
522 |
defaultSTXIcon3 |
|
523 |
"This resource specification was automatically generated |
|
524 |
by the ImageEditor of ST/X." |
|
525 |
||
526 |
"Do not manually edit this!! If it is corrupted, |
|
527 |
the ImageEditor may not be able to read the specification." |
|
528 |
||
529 |
" |
|
530 |
self defaultSTXIcon3 inspect |
|
531 |
ImageEditor openOnClass:self andSelector:#defaultSTXIcon3 |
|
532 |
Icon flushCachedIcons |
|
533 |
" |
|
534 |
||
535 |
<resource: #image> |
|
536 |
||
537 |
^Icon |
|
538 |
constantNamed:#'StandardSystemView class defaultSTXIcon3' |
|
539 |
ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#[2]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@E@@@@AP@D@@V@D@@APF@@@FF@@@AV@@@@&@@@@%P@@@$F@@@T@X@@T@I@@T@@P@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 0 204 51 0 112 0]; yourself] |
|
540 |
! ! |
|
541 |
||
542 |
!StandardSystemView class methodsFor:'startup'! |
|
543 |
||
544 |
start |
|
545 |
"create, realize the view - this topview and all its subviews will |
|
546 |
run as a separate process with its own windowGroup. |
|
547 |
This method exists for backward compatibility - use open." |
|
548 |
||
549 |
^ self open |
|
550 |
! ! |
|
551 |
||
552 |
!StandardSystemView methodsFor:'Compatibility-ST80'! |
|
553 |
||
554 |
maximumSize |
|
555 |
"same as maxExtent; for ST-80 compatibility" |
|
556 |
||
557 |
^ self maxExtent |
|
558 |
! |
|
559 |
||
560 |
maximumSize:anExtent |
|
561 |
"same as maxExtent; for ST-80 compatibility" |
|
562 |
||
563 |
^ self maxExtent:anExtent |
|
564 |
! |
|
565 |
||
566 |
menuBar |
|
567 |
"return my menuBar or nil if I have none. |
|
568 |
This is only valid for topViews which were built with the UIBuilder." |
|
569 |
||
570 |
^ application builder menuBar |
|
571 |
||
572 |
"Created: / 27.10.1997 / 16:23:13 / cg" |
|
573 |
! |
|
574 |
||
575 |
minimumSize |
|
576 |
"same as minExtent; for ST-80 compatibility" |
|
577 |
||
578 |
^ self minExtent |
|
579 |
! |
|
580 |
||
581 |
minimumSize:anExtent |
|
582 |
"same as minExtent; for ST-80 compatibility" |
|
583 |
||
584 |
^ self minExtent:anExtent |
|
585 |
! |
|
586 |
||
587 |
quit |
|
588 |
"same as closeRequest |
|
589 |
(but sometimes sent via the sensors event queue from VW programs)" |
|
590 |
||
591 |
self closeRequest |
|
592 |
||
593 |
"Created: / 30.10.1997 / 19:23:01 / cg" |
|
594 |
"Modified: / 3.8.1998 / 20:04:22 / cg" |
|
595 |
! ! |
|
596 |
||
597 |
!StandardSystemView methodsFor:'accessing'! |
|
598 |
||
599 |
application |
|
600 |
"return the topViews application. |
|
601 |
This is new protocol for ST-80 compatibility and not yet fully supported" |
|
602 |
||
603 |
^ application |
|
604 |
! |
|
605 |
||
606 |
application:anApplicationModel |
|
607 |
"set the topViews application. |
|
608 |
This is new protocol for ST-80 compatibility and not yet fully supported" |
|
609 |
||
610 |
application := anApplicationModel. |
|
611 |
anApplicationModel notNil ifTrue:[ |
|
612 |
anApplicationModel window isNil ifTrue:[ |
|
613 |
anApplicationModel window:self |
|
614 |
] |
|
615 |
] |
|
616 |
||
617 |
"Modified: 18.4.1996 / 14:55:44 / cg" |
|
618 |
! ! |
|
619 |
||
620 |
!StandardSystemView methodsFor:'accessing-behavior'! |
|
621 |
||
622 |
bePartner |
|
623 |
"define me as a partner-View. |
|
624 |
All partners within the applications windowGroup iconify/deiconify together." |
|
625 |
||
626 |
self setWindowGroupFromApplication. |
|
627 |
super bePartner. |
|
628 |
||
629 |
" |
|
630 |
see example in TopView>>bePartner |
|
631 |
" |
|
632 |
||
633 |
"Created: 22.9.1995 / 17:40:15 / claus" |
|
634 |
"Modified: 6.3.1996 / 16:16:42 / cg" |
|
635 |
! |
|
636 |
||
637 |
beSlave |
|
638 |
"define me as a slave-View. |
|
639 |
All slaves within the applications windowGroup iconify/deiconify with the masterView(s) |
|
640 |
(i.e. they follow their master(s))" |
|
641 |
||
642 |
self setWindowGroupFromApplication. |
|
643 |
super beSlave. |
|
644 |
||
645 |
" |
|
646 |
see example in TopView>>beSlave |
|
647 |
" |
|
648 |
||
649 |
"Created: 22.9.1995 / 17:40:15 / claus" |
|
650 |
"Modified: 6.3.1996 / 16:16:50 / cg" |
|
651 |
! |
|
652 |
||
653 |
sendWindowEvents:collectionOfEventSymbols |
|
654 |
"define the events that are to be forwarded to the application. |
|
655 |
This is being implemented ..." |
|
656 |
||
657 |
windowEventsForApplication := collectionOfEventSymbols |
|
658 |
! |
|
659 |
||
660 |
sizeFixed:aBoolean |
|
661 |
"this prevents the view from resizing itself when realized. |
|
662 |
For normal topViews, this is void, since they dont do this anyway. |
|
663 |
||
664 |
However, modalBoxes (especially: DialogBoxes) typically resize themselfes |
|
665 |
to the preferredExtent of their components. In some cases, this behavior is |
|
666 |
not desired and it should be turned off by setting sizeFixed to true. |
|
667 |
||
668 |
To avoid confusion: |
|
669 |
This does NOT prevent the window manager from resizing the view, |
|
670 |
instead it tells the view to NOT resize ITSELF." |
|
671 |
||
672 |
sizeFixed := aBoolean. |
|
673 |
||
674 |
"example: dialog which resizes itself on #open: |
|
675 |
(thereby ignoring the 200@200 extent) |
|
676 |
||
677 |
|dialog| |
|
678 |
||
679 |
dialog := Dialog new. |
|
680 |
dialog addInputFieldOn:'' asValue. |
|
681 |
dialog addOkButton. |
|
682 |
dialog extent:200@200. |
|
683 |
dialog open. |
|
625
4d8f6dc3af75
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
621
diff
changeset
|
684 |
|
4d8f6dc3af75
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
621
diff
changeset
|
685 |
|
4566 | 686 |
using sizeFixed: |
687 |
||
688 |
|dialog| |
|
689 |
||
690 |
dialog := Dialog new. |
|
691 |
dialog addInputFieldOn:'' asValue. |
|
692 |
dialog addOkButton. |
|
693 |
dialog extent:200@200; sizeFixed:true. |
|
694 |
dialog open. |
|
625
4d8f6dc3af75
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
621
diff
changeset
|
695 |
|
4d8f6dc3af75
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
621
diff
changeset
|
696 |
|
4566 | 697 |
using openWithExtent (also sets sizeFixed): |
625
4d8f6dc3af75
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
621
diff
changeset
|
698 |
|
4566 | 699 |
|dialog| |
700 |
||
701 |
dialog := Dialog new. |
|
702 |
dialog addInputFieldOn:'' asValue. |
|
703 |
dialog addOkButton. |
|
704 |
dialog openWithExtent:200@200. |
|
705 |
" |
|
706 |
! ! |
|
707 |
||
708 |
!StandardSystemView methodsFor:'accessing-channels'! |
|
709 |
||
710 |
labelChannel |
|
711 |
"return the labelChannel - or nil" |
|
712 |
||
713 |
^ labelChannel. |
|
714 |
! |
|
715 |
||
716 |
labelChannel:aValueHolder |
|
717 |
"set the labelChannel - a valueHolder holding a string |
|
718 |
which is shown as title bar" |
|
719 |
||
720 |
|prev| |
|
721 |
||
722 |
prev := labelChannel. |
|
723 |
labelChannel := aValueHolder. |
|
724 |
self setupChannel:aValueHolder for:nil withOld:prev. |
|
725 |
! ! |
|
726 |
||
727 |
!StandardSystemView methodsFor:'accessing-dimensions'! |
|
728 |
||
729 |
maxExtent |
|
730 |
"return the views maximum allowed extent" |
|
731 |
||
732 |
^ maxExtent |
|
733 |
! |
|
734 |
||
735 |
maxExtent:max |
|
736 |
"define the maximum extent the view may have - |
|
737 |
depends on good-will of window manager" |
|
738 |
||
739 |
maxExtent ~= max ifTrue:[ |
|
740 |
maxExtent := max. |
|
741 |
maxExtent x isNil ifTrue:[ |
|
742 |
maxExtent := 99999 @ maxExtent y. |
|
743 |
]. |
|
744 |
maxExtent y isNil ifTrue:[ |
|
745 |
maxExtent := maxExtent x @ 99999. |
|
746 |
]. |
|
747 |
||
748 |
drawableId notNil ifTrue:[ |
|
749 |
device setWindowMinExtent:nil maxExtent:max in:drawableId |
|
750 |
]. |
|
751 |
||
752 |
"/ if my current extent is larger than the new |
|
753 |
"/ maxExtent, adjust. |
|
754 |
||
755 |
(width notNil and:[height notNil]) ifTrue:[ |
|
756 |
((width > (max x)) or: |
|
757 |
[height > (max y)]) ifTrue: [ |
|
758 |
self extent:(max min:self extent) |
|
759 |
] |
|
760 |
] |
|
761 |
]. |
|
762 |
! |
|
763 |
||
764 |
minExtent |
|
765 |
"return the views minimum allowed extent" |
|
766 |
||
767 |
^ minExtent |
|
768 |
! |
|
769 |
||
770 |
minExtent:min |
|
771 |
"define the minimum extent the view may have - |
|
772 |
depends on good-will of window manager" |
|
773 |
||
774 |
minExtent ~= min ifTrue:[ |
|
775 |
minExtent := min. |
|
776 |
drawableId notNil ifTrue:[ |
|
777 |
device setWindowMinExtent:min maxExtent:nil in:drawableId |
|
778 |
]. |
|
779 |
||
780 |
"/ if my current extent is smaller than the new |
|
781 |
"/ minExtent, adjust. |
|
782 |
||
783 |
(width notNil and:[height notNil]) ifTrue:[ |
|
784 |
((width < (min x)) or: |
|
785 |
[height < (min y)]) ifTrue: [ |
|
786 |
self extent:(min max:self extent) |
|
787 |
] |
|
788 |
] |
|
789 |
] |
|
790 |
||
791 |
! ! |
|
792 |
||
793 |
!StandardSystemView methodsFor:'accessing-look'! |
|
794 |
||
795 |
icon |
|
796 |
"return the form defined as icon" |
|
797 |
||
798 |
^ icon value |
|
799 |
! |
|
800 |
||
801 |
icon:aFormOrImage |
|
802 |
"define the form or image (bitmap) used as icon" |
|
803 |
||
804 |
|i m iconValue| |
|
805 |
||
806 |
icon := aFormOrImage. |
|
807 |
iconValue := icon value. |
|
808 |
iconValue notNil ifTrue:[ |
|
809 |
drawableId notNil ifTrue:[ |
|
4814 | 810 |
i := device convertedIcon:iconValue. |
4566 | 811 |
(i notNil and:[i id notNil]) ifTrue:[ |
812 |
(m := iconValue mask) notNil ifTrue:[ |
|
4814 | 813 |
m := device convertedIconMask:m. |
4566 | 814 |
]. |
815 |
device setWindowIcon:i mask:m in:drawableId |
|
816 |
] |
|
817 |
] |
|
818 |
] |
|
819 |
||
4814 | 820 |
"Modified: / 30-10-2007 / 16:39:15 / cg" |
4566 | 821 |
! |
822 |
||
823 |
iconLabel |
|
824 |
"return the name displayed in the icon" |
|
825 |
||
826 |
^ iconLabel |
|
827 |
! |
|
828 |
||
829 |
iconLabel:aString |
|
830 |
"define the name to be displayed in the icon" |
|
831 |
||
832 |
|newLabel| |
|
833 |
||
834 |
(newLabel := aString string) ~= iconLabel ifTrue:[ |
|
835 |
iconLabel := newLabel. |
|
836 |
drawableId notNil ifTrue:[ |
|
837 |
device setIconName:newLabel in:drawableId. |
|
838 |
" |
|
839 |
unbuffered - to make it visible right NOW |
|
840 |
" |
|
841 |
device flush. |
|
842 |
] |
|
843 |
] |
|
844 |
! |
|
845 |
||
846 |
iconMask |
|
847 |
"return the form defined as iconMask. |
|
848 |
Notice, that many windowManagers ignore this mask |
|
849 |
(usually, only managers which place icons on the background desktop |
|
850 |
care for an icon - if at all ...)" |
|
851 |
||
852 |
|mask| |
|
853 |
||
854 |
"/ only images possibly have iconMasks |
|
855 |
icon notNil ifTrue:[ |
|
856 |
(mask := icon value mask) notNil ifTrue:[ |
|
4815 | 857 |
^ device convertedIconMask:mask |
4566 | 858 |
] |
859 |
]. |
|
860 |
||
861 |
^ nil |
|
862 |
||
4815 | 863 |
"Modified: / 30-10-2007 / 20:59:40 / cg" |
4566 | 864 |
! |
865 |
||
866 |
iconName:aString |
|
867 |
"this method will vanish soon ... - for backward compatibility" |
|
868 |
||
869 |
<resource:#obsolete> |
|
870 |
||
871 |
self obsoleteMethodWarning:'use #iconLabel:'. |
|
872 |
self iconLabel:aString |
|
873 |
! |
|
874 |
||
875 |
iconView |
|
876 |
"return the view used as icon-view" |
|
877 |
||
878 |
^ iconView |
|
879 |
! |
|
880 |
||
881 |
iconView:aView |
|
882 |
"specify the view to be used as icon. |
|
883 |
This may not be supported on all display types" |
|
884 |
||
885 |
iconView := aView. |
|
886 |
drawableId notNil ifTrue:[ |
|
887 |
aView create. |
|
888 |
device setWindowIconWindow:aView in:drawableId. |
|
889 |
aView setRealized:true. |
|
890 |
] |
|
891 |
||
892 |
"Modified: 4.4.1997 / 16:21:37 / cg" |
|
893 |
! |
|
894 |
||
895 |
label |
|
896 |
"return the views name in the title area" |
|
897 |
||
898 |
^ label |
|
899 |
! |
|
900 |
||
901 |
label:aString |
|
902 |
"define the views name in the windows title area. |
|
903 |
If IncludeHostNameInLabel is true, prepend the hostname |
|
904 |
(you will appreciate this, if you are working on multiple |
|
905 |
machines simultaneously - as I do ...)" |
|
906 |
||
907 |
|newLabel| |
|
908 |
||
4633 | 909 |
newLabel := aString. |
910 |
newLabel notNil ifTrue:[newLabel := newLabel string]. |
|
911 |
newLabel ~= label ifTrue:[ |
|
4566 | 912 |
label := newLabel. |
913 |
drawableId notNil ifTrue: [ |
|
914 |
device setWindowName:(self windowLabelFor:label) in:drawableId. |
|
915 |
shown ifTrue:[ |
|
916 |
" |
|
917 |
unbuffered - to make it visible right NOW |
|
918 |
" |
|
919 |
device flush. |
|
920 |
] |
|
921 |
] |
|
922 |
] |
|
923 |
||
4633 | 924 |
"Created: / 08-09-1995 / 19:37:06 / claus" |
925 |
"Modified: / 06-10-2006 / 11:55:06 / cg" |
|
4566 | 926 |
! |
927 |
||
928 |
label:labelString iconLabel:iconLabelString |
|
929 |
"set both the label and the iconLabel" |
|
930 |
||
931 |
self label:labelString. |
|
932 |
self iconLabel:iconLabelString |
|
933 |
! ! |
|
934 |
||
935 |
!StandardSystemView methodsFor:'change & update'! |
|
936 |
||
937 |
update:something with:aParameter from:changedObject |
|
938 |
"the MVC way of changing the label ..." |
|
939 |
||
940 |
changedObject notNil ifTrue:[ |
|
941 |
changedObject == labelChannel ifTrue:[ |
|
942 |
self label:labelChannel value. |
|
943 |
^ self |
|
944 |
]. |
|
945 |
]. |
|
946 |
^ super update:something with:aParameter from:changedObject |
|
947 |
! ! |
|
948 |
||
949 |
!StandardSystemView methodsFor:'destroying'! |
|
950 |
||
951 |
release |
|
952 |
self removeFromCurrentProject. |
|
953 |
labelChannel notNil ifTrue:[ |
|
954 |
labelChannel removeDependent:self. |
|
955 |
labelChannel := nil. |
|
956 |
]. |
|
957 |
windowGroup notNil ifTrue:[ |
|
958 |
windowGroup focusSequence:nil. |
|
959 |
]. |
|
960 |
super release. |
|
961 |
! |
|
962 |
||
963 |
saveAndTerminate |
|
964 |
"save & terminate request from the windowManager. The application should |
|
965 |
save its data/files/text etc. somehow and close. |
|
966 |
If there is an application, let it decide how do do that. |
|
967 |
Otherwise, forward it to superclasses which knows how to do this. |
|
968 |
(it defaults to a terminate there). |
|
969 |
Notice, that not all windowmanagers are nice enough |
|
970 |
to send this request; some simply distroy the view." |
|
971 |
||
972 |
application notNil ifTrue:[ |
|
973 |
application saveAndTerminateRequestFor:self |
|
974 |
] ifFalse:[ |
|
975 |
super saveAndTerminate |
|
976 |
] |
|
977 |
! |
|
978 |
||
979 |
terminate |
|
980 |
"terminate request from the windowManager. If there is an application, |
|
981 |
let it decide if it really wants to be close. Otherwise, forward it to |
|
982 |
superclasses terminate which knows how to do this. |
|
983 |
Notice, that not all windowmanagers are nice enough |
|
984 |
to send this request; some simply distroy the view." |
|
985 |
||
986 |
application notNil ifTrue:[ |
|
987 |
application closeRequestFor:self |
|
988 |
] ifFalse:[ |
|
989 |
self closeRequest. |
|
990 |
] |
|
991 |
||
992 |
"Modified: / 3.8.1998 / 19:49:45 / cg" |
|
993 |
! ! |
|
994 |
||
995 |
!StandardSystemView methodsFor:'event handling'! |
|
996 |
||
997 |
focusIn |
|
998 |
"the view got the keyboard focus (via the window manager). |
|
999 |
I.e. the mouse was moved out into the topView area - restore the |
|
1000 |
focus to the previous focusView.." |
|
1001 |
||
1002 |
|v| |
|
1003 |
||
1004 |
windowGroup notNil ifTrue:[ |
|
1005 |
"/ I got the focus - tell the current focus-windowgroup |
|
1006 |
"/ that its focus is gone elsewhere ... |
|
1007 |
"/ 'focusIn ' print. windowGroup process name printCR. |
|
1008 |
"/ 'focusView is ' print. windowGroup focusView printCR. |
|
1009 |
||
1010 |
WindowGroup takeFocusFromDevice:device. |
|
1011 |
||
1012 |
v := windowGroup focusView. |
|
1013 |
v isNil ifTrue:[ |
|
1014 |
UserPreferences current focusFollowsMouse ~~ false ifTrue:[ |
|
1015 |
v := windowGroup pointerView. |
|
1016 |
"/ 'pointerView is ' print. v printCR. |
|
1017 |
(v notNil |
|
1018 |
and:[v isKeyboardConsumer not |
|
1019 |
and:[v wantsFocusWithPointerEnter not]]) ifTrue:[ |
|
1020 |
"/ no - not this one |
|
1021 |
"/ 'not a kbdConsumer' printCR. |
|
1022 |
v := nil. |
|
1023 |
] |
|
1024 |
] |
|
1025 |
]. |
|
1026 |
v isNil ifTrue:[ |
|
1027 |
self assignInitialKeyboardFocus. |
|
1028 |
] ifFalse:[ |
|
1029 |
"/ v requestFocus. - will be denied; but we must force it here |
|
1030 |
windowGroup focusView:v byTab:false. |
|
1031 |
] |
|
1032 |
]. |
|
1033 |
super focusIn |
|
1034 |
||
1035 |
"Modified: / 23.5.1999 / 14:00:20 / cg" |
|
1036 |
! |
|
1037 |
||
1038 |
focusOut |
|
1039 |
"the top-view lost the keyboard focus (via the window manager). |
|
1040 |
I.e. the mouse was moved out of the topView area." |
|
1041 |
||
1042 |
|v| |
|
1043 |
||
1044 |
windowGroup notNil ifTrue:[ |
|
1045 |
(v := windowGroup focusView) notNil ifTrue:[ |
|
1046 |
v showNoFocus:(windowGroup explicitFocusView == v). |
|
1047 |
v hasKeyboardFocus:false. |
|
1048 |
] |
|
1049 |
]. |
|
1050 |
super focusOut |
|
1051 |
||
1052 |
"Modified: 25.2.1997 / 23:19:46 / cg" |
|
1053 |
! |
|
1054 |
||
1055 |
showActivity:someMessage |
|
1056 |
"some activityNotification shalt be communicated to |
|
1057 |
the user. Forward it to my application (if any). |
|
1058 |
(that one should know how to deal with it). |
|
1059 |
Otherwise, simply ignore it." |
|
1060 |
||
1061 |
application notNil ifTrue:[ |
|
1062 |
application showActivity:someMessage |
|
1063 |
] |
|
1064 |
||
1065 |
"Created: 16.12.1995 / 18:40:44 / cg" |
|
1066 |
"Modified: 23.4.1996 / 21:38:11 / cg" |
|
1067 |
! ! |
|
1068 |
||
1069 |
!StandardSystemView methodsFor:'initialization & release'! |
|
1070 |
||
1071 |
addToCurrentProject |
|
1072 |
"add the receiver (a topview) to the current projects set-of-views. |
|
1073 |
(If there is a current project)" |
|
1074 |
||
1075 |
|p| |
|
1076 |
||
1077 |
" |
|
1078 |
the following check allows systems |
|
1079 |
without projects and changeSets |
|
1080 |
" |
|
1081 |
(Project notNil and:[(p := Project current) notNil]) ifTrue:[ |
|
1082 |
p addView: self |
|
1083 |
] |
|
1084 |
! |
|
1085 |
||
1086 |
defaultControllerClass |
|
1087 |
"for ST-80 compatibility only - not used in ST/X" |
|
1088 |
||
1089 |
^ nil "/ StandardSystemController |
|
1090 |
! |
|
1091 |
||
1092 |
initEvents |
|
1093 |
super initEvents. |
|
1094 |
self enableFocusEvents. |
|
1095 |
! |
|
1096 |
||
1097 |
initialize |
|
1098 |
super initialize. |
|
1099 |
||
1100 |
borderWidth := 2. "- notice: many window managers ignore this" |
|
1101 |
device platformName = 'WIN32' ifTrue:[ |
|
1102 |
minExtent := 0 @ 0. |
|
1103 |
] ifFalse:[ |
|
1104 |
minExtent := 10 @ 10. |
|
1105 |
]. |
|
1106 |
||
1107 |
"/ This code is bad for 2 reasons: |
|
1108 |
"/ - KDE (3.2) WM does not show the maximize button if the maxExtent is restricted. |
|
1109 |
"/ - why restrict the size of a window? |
|
1110 |
"/ maxExtent := device usableExtent "- (0 @ device captionHeight)". |
|
1111 |
||
1112 |
label isNil ifTrue:[label := self class defaultLabel]. |
|
1113 |
icon isNil ifTrue:[icon := self class defaultIcon]. |
|
1114 |
||
1115 |
"Modified: 14.6.1996 / 17:18:28 / stefan" |
|
1116 |
! |
|
1117 |
||
1118 |
reAdjustGeometry |
|
1119 |
"sent as a final step when an image is restarted. |
|
1120 |
when we come up on a smaller display, |
|
1121 |
make certain, that the receiver is visible" |
|
1122 |
||
1123 |
|dX dY limitRight limitBottom| |
|
1124 |
||
1125 |
dX := (device horizontalPixelPerMillimeter * 20) rounded. |
|
1126 |
dY := (device verticalPixelPerMillimeter * 20) rounded. |
|
1127 |
||
1128 |
limitRight := device usableWidth - dX. |
|
1129 |
limitBottom := device usableHeight - dY. |
|
1130 |
((self left > limitRight) or:[ |
|
1131 |
self top > limitBottom]) ifTrue:[ |
|
1132 |
'StandardSystemView [info]: moving view into visible area' infoPrintCR. |
|
1133 |
self origin:limitRight @ limitBottom |
|
1134 |
] |
|
1135 |
||
1136 |
"Modified: 10.1.1997 / 15:12:19 / cg" |
|
1137 |
! |
|
1138 |
||
1139 |
reinitialize |
|
1140 |
"reopen the receiver if if was visible before. |
|
1141 |
This is called right after snapIn; Notice, that all instance variables |
|
1142 |
(such as shown, realized etc.) are left-overs from the time the snapout |
|
1143 |
was done. Remap the receiver, if it was mapped at snapout time" |
|
1144 |
||
1145 |
|myController| |
|
1146 |
||
1147 |
"if I have already been reinited - return" |
|
1148 |
drawableId notNil ifTrue:[ |
|
1149 |
^ self |
|
1150 |
]. |
|
1151 |
||
1152 |
"have to kludge with the controller |
|
1153 |
- otherwise its startup performs unwanted actions ..." |
|
1154 |
||
1155 |
myController := controller. |
|
1156 |
controller := nil. |
|
1157 |
||
1158 |
"physically create the view & subviews" |
|
1159 |
self recreate. |
|
1160 |
||
1161 |
"if I was iconified (not realized), remap iconified" |
|
1162 |
device |
|
1163 |
mapView:self id:drawableId iconified:(realized "shown" not) |
|
1164 |
atX:left y:top width:width height:height |
|
1165 |
minExtent:minExtent maxExtent:maxExtent. |
|
24 | 1166 |
|
4566 | 1167 |
"and restart the window-group process" |
1168 |
windowGroup notNil ifTrue:[ |
|
1169 |
windowGroup restart |
|
1170 |
]. |
|
24 | 1171 |
|
4566 | 1172 |
"restore controller" |
1173 |
controller := myController |
|
1174 |
||
1175 |
"Modified: / 6.5.1999 / 09:50:13 / cg" |
|
1176 |
! |
|
1177 |
||
1178 |
removeFromCurrentProject |
|
1179 |
"remove the receiver (a topview) from the current projects set-of-views. |
|
1180 |
(If there is a current project)" |
|
1181 |
||
1182 |
|p| |
|
1183 |
||
1184 |
" |
|
1185 |
the following check allows systems |
|
1186 |
without projects and changeSets |
|
1187 |
" |
|
1188 |
(Project notNil and:[(p := Project current) notNil]) ifTrue:[ |
|
1189 |
p removeView:self |
|
1190 |
] |
|
1191 |
! |
|
1192 |
||
1193 |
restarted |
|
1194 |
"sent by my windowGroup, when restarted from an image. |
|
1195 |
Nothing done here, but can be redefined to perform any actions |
|
1196 |
required to reset the application after an image-restart. |
|
1197 |
(for example: check if application files are still around, restart |
|
1198 |
subprocesses etc.)." |
|
1199 |
||
1200 |
application notNil ifTrue:[ |
|
1201 |
application restarted |
|
1202 |
]. |
|
1203 |
! ! |
|
1204 |
||
1205 |
!StandardSystemView methodsFor:'printing & storing'! |
|
1206 |
||
1207 |
displayString |
|
1208 |
"just for your convenience in inspectors ... |
|
1209 |
... add the views label to the displayString." |
|
1210 |
||
1211 |
|s| |
|
1212 |
||
1213 |
s := super displayString. |
|
1214 |
label notNil ifTrue:[ |
|
1215 |
s := s , '(' , label , ')' |
|
1216 |
]. |
|
1217 |
^ s |
|
1218 |
! ! |
|
1219 |
||
1220 |
!StandardSystemView methodsFor:'private'! |
|
1221 |
||
1222 |
convertedIcon |
|
1223 |
"make certain, that the icon is compatible with my device; |
|
1224 |
this means converting it to a format (typically: monochrome) which |
|
1225 |
the device supports. Return a compatible version of the icon." |
|
1226 |
||
4814 | 1227 |
^ device convertedIcon:icon |
4566 | 1228 |
|
4814 | 1229 |
"Modified: / 30-10-2007 / 16:39:55 / cg" |
4566 | 1230 |
! |
1231 |
||
1232 |
convertedIcon:iconArg |
|
1233 |
"make certain, that the image argument is compatible with my device; |
|
1234 |
this means converting it to a format (typically: monochrome) which |
|
1235 |
the device supports. Return a compatible version of the icon." |
|
1236 |
||
4814 | 1237 |
^ device convertedIcon:iconArg |
4566 | 1238 |
|
4814 | 1239 |
"Modified: / 30-10-2007 / 16:37:31 / cg" |
4566 | 1240 |
! |
1241 |
||
1242 |
convertedIconMask:aMask |
|
1243 |
"return a version of the argument which can be used as an iconMask |
|
1244 |
on my device. Typically, this means conversion to a monochrome |
|
1245 |
mask - future versions may add alpha channel masks, if the device supports |
|
1246 |
them ..." |
|
1247 |
||
4814 | 1248 |
^ device convertedIconMask:aMask |
4566 | 1249 |
|
4814 | 1250 |
"Modified: / 30-10-2007 / 16:38:58 / cg" |
4566 | 1251 |
! |
1252 |
||
1253 |
setWindowGroupFromApplication |
|
1254 |
"get the applications topView and set my windowGroup to its wg." |
|
1255 |
||
1256 |
|win master| |
|
1257 |
||
1258 |
windowGroup isNil ifTrue:[ |
|
1259 |
application notNil ifTrue:[ |
|
1260 |
(win := application window) notNil ifTrue:[ |
|
1261 |
win ~~ self ifTrue:[ |
|
1262 |
windowGroup := win windowGroup. |
|
1263 |
^ self |
|
1264 |
]. |
|
1265 |
(master := application masterApplication) notNil ifTrue:[ |
|
1266 |
(win := master window) notNil ifTrue:[ |
|
1267 |
windowGroup := win windowGroup. |
|
1268 |
^ self |
|
1269 |
]. |
|
1270 |
]. |
|
1271 |
] |
|
1272 |
] |
|
1273 |
]. |
|
1274 |
||
1275 |
"Created: 22.9.1995 / 17:40:36 / claus" |
|
1276 |
"Modified: 6.3.1996 / 16:17:32 / cg" |
|
1277 |
! |
|
1278 |
||
1279 |
windowLabelFor:labelString |
|
1280 |
"return an expanded labelString, according to the hostName-in-window setting. |
|
1281 |
The labelString may include positional parameters: |
|
1282 |
%1 - the actual label |
|
1283 |
%2 - the hostname |
|
1284 |
%3 - the userName |
|
1285 |
%4 - the processId |
|
1286 |
%5 - the TOP-directories name |
|
1287 |
%6 - the TOP-directories path |
|
1288 |
" |
|
1289 |
||
1290 |
|wg proc id pidString lbl windowLabelFormat| |
|
1291 |
||
1292 |
(IncludeHostNameInLabel == true |
|
1293 |
and:[(windowLabelFormat := self class windowLabelFormat) notNil]) ifTrue:[ |
|
1294 |
(wg := self windowGroup) notNil ifTrue:[ |
|
1295 |
(proc := wg process) notNil ifTrue:[ |
|
1296 |
(id := proc id) notNil ifTrue:[ |
|
1297 |
pidString := id printString |
|
1298 |
] |
|
1299 |
] |
|
1300 |
]. |
|
1301 |
lbl := windowLabelFormat |
|
1302 |
bindWith:labelString |
|
1303 |
with:[OperatingSystem getHostName] |
|
1304 |
with:[OperatingSystem getLoginName] |
|
1305 |
with:pidString |
|
1306 |
with:[(Smalltalk getPackageDirectoryForPackage:'stx') directory baseName] |
|
1307 |
with:[(Smalltalk getPackageDirectoryForPackage:'stx') directory pathName]. |
|
1308 |
^ lbl |
|
1309 |
]. |
|
1310 |
^ labelString |
|
1311 |
||
1312 |
"Created: / 22-09-1997 / 10:10:32 / cg" |
|
1313 |
"Modified: / 22-08-2006 / 11:42:53 / cg" |
|
1314 |
! ! |
|
1315 |
||
1316 |
!StandardSystemView methodsFor:'queries'! |
|
1317 |
||
1318 |
processName |
|
1319 |
"return a string to be shown for my process in the |
|
1320 |
process monitor. This has no semantic meaning, but exists |
|
1321 |
for your convenience only." |
|
1322 |
||
1323 |
application notNil ifTrue:[ |
|
1324 |
^ application processName |
|
1325 |
]. |
|
1326 |
label notNil ifTrue:[^ label]. |
|
1327 |
^ super processName |
|
1328 |
||
1329 |
"Modified: 24.4.1996 / 09:47:01 / cg" |
|
1330 |
! ! |
|
1331 |
||
1332 |
!StandardSystemView methodsFor:'realization'! |
|
1333 |
||
1334 |
collapse |
|
1335 |
"iconify the receiver" |
|
1336 |
||
1337 |
shown ifTrue:[ |
|
1338 |
self unmap. |
|
1339 |
||
1340 |
"if it was iconified, try to remap iconified" |
|
1341 |
device |
|
1342 |
mapView:self id:drawableId iconified:true |
|
1343 |
atX:left y:top width:width height:height |
|
1344 |
minExtent:minExtent maxExtent:maxExtent. |
|
1345 |
shown := false. |
|
1346 |
]. |
|
1347 |
||
1348 |
" |
|
1349 |
|top| |
|
1350 |
||
1351 |
top := StandardSystemView new. |
|
1352 |
top label:'hello'. |
|
1353 |
top openAndWait. |
|
1354 |
Delay waitForSeconds:2. |
|
1355 |
top collapse. |
|
1356 |
Delay waitForSeconds:2. |
|
1357 |
top expand. |
|
1358 |
" |
|
1359 |
||
1360 |
"Modified: 24.7.1997 / 12:32:17 / cg" |
|
1361 |
! |
|
1362 |
||
1363 |
create |
|
1364 |
"create - make certain that icon is available" |
|
1365 |
||
1366 |
super create. |
|
1367 |
||
1368 |
iconView notNil ifTrue:[ |
|
1369 |
iconView create. |
|
1370 |
device setWindowIconWindow:iconView in:drawableId. |
|
1371 |
iconView setRealized:true. |
|
1372 |
]. |
|
1373 |
iconLabel notNil ifTrue:[ |
|
1374 |
device setIconName:iconLabel string in:drawableId |
|
1375 |
] |
|
1376 |
||
1377 |
"Modified: 10.6.1996 / 20:14:50 / cg" |
|
1378 |
! |
|
1379 |
||
1380 |
expand |
|
1381 |
"de-iconify the receiver at its old position" |
|
1382 |
||
1383 |
shown ifFalse:[ |
|
1384 |
self unmap. |
|
1385 |
||
1386 |
"if it was iconified, try to remap iconified" |
|
1387 |
device |
|
1388 |
mapView:self id:drawableId iconified:false |
|
1389 |
atX:left y:top width:width height:height |
|
1390 |
minExtent:minExtent maxExtent:maxExtent. |
|
1391 |
]. |
|
1392 |
||
1393 |
" |
|
1394 |
|top| |
|
1395 |
||
1396 |
top := StandardSystemView new. |
|
1397 |
top label:'hello'. |
|
1398 |
top openAndWait. |
|
1399 |
top collapse. |
|
1400 |
Delay waitForSeconds:5. |
|
1401 |
top expand. |
|
1402 |
" |
|
1403 |
||
1404 |
"Modified: / 3.2.1998 / 16:02:56 / cg" |
|
1405 |
! |
|
1406 |
||
1407 |
physicalCreate |
|
1408 |
"common code for create & recreate" |
|
1409 |
||
1410 |
|lbl iconValue icn icnMask windowClassNameString| |
|
1411 |
||
1412 |
lbl := self windowLabelFor:label. |
|
1413 |
||
1414 |
icon notNil ifTrue:[ |
|
1415 |
iconValue := icon value. |
|
4814 | 1416 |
icn := device convertedIcon:iconValue. |
4566 | 1417 |
(icnMask := iconValue mask) notNil ifTrue:[ |
4814 | 1418 |
icnMask := device convertedIconMask:icnMask |
4566 | 1419 |
]. |
1420 |
deviceIcon := icn. |
|
1421 |
]. |
|
1422 |
||
1423 |
"/ give global eventListeners a chance to intercept windowCreation |
|
1424 |
"/ and provide another origin (by payching my origin via setOrigin:). |
|
1425 |
WindowSensor preViewCreateNotification:self. |
|
1426 |
||
1427 |
drawableId := device |
|
1428 |
createWindowFor:self |
|
1429 |
type:(self windowType) |
|
1430 |
origin:(left @ top) |
|
1431 |
extent:(width @ height) |
|
1432 |
minExtent:minExtent |
|
1433 |
maxExtent:maxExtent |
|
1434 |
borderWidth:borderWidth |
|
1435 |
subViewOf:nil |
|
1436 |
style:(self windowStyle) |
|
1437 |
inputOnly:(self isInputOnly) |
|
1438 |
label:lbl |
|
1439 |
owner:nil |
|
1440 |
icon:icn iconMask:icnMask |
|
1441 |
iconView:iconView. |
|
1442 |
||
1443 |
Lobby registerChange:self. |
|
1444 |
||
1445 |
"/ give global listeners a chance to track views |
|
1446 |
WindowSensor postViewCreateNotification:self. |
|
1447 |
||
1448 |
self extentChangedFlag:false. |
|
1449 |
self originChangedFlag:false. |
|
1450 |
||
1451 |
(borderColor notNil and:[borderColor ~= Black]) ifTrue:[ |
|
1452 |
self setBorderColor |
|
1453 |
]. |
|
1454 |
||
1455 |
"/ (viewGravity notNil "and:[viewGravity ~~ #NorthWest]") ifTrue:[ |
|
1456 |
"/ device setWindowGravity:viewGravity in:drawableId |
|
1457 |
"/ ]. |
|
1458 |
||
1459 |
"/ (bitGravity notNil "and:[bitGravity ~~ #NorthWest]") ifTrue:[ |
|
1460 |
"/ device setBitGravity:bitGravity in:drawableId |
|
1461 |
"/ ]. |
|
1462 |
||
1463 |
viewShape notNil ifTrue:[ |
|
1464 |
self setViewShape |
|
1465 |
]. |
|
1466 |
||
1467 |
(backed notNil and:[backed ~~ false]) ifTrue:[ |
|
1468 |
device setBackingStore:backed in:drawableId |
|
1469 |
]. |
|
1470 |
self saveUnder ifTrue:[ |
|
1471 |
device setSaveUnder:true in:drawableId |
|
1472 |
]. |
|
1473 |
cursor notNil ifTrue:[ |
|
1474 |
self setCursor |
|
1475 |
]. |
|
1476 |
||
1477 |
application isNil ifTrue:[ |
|
1478 |
(self class == StandardSystemView and:[subViews size == 1]) ifTrue:[ |
|
1479 |
"This is a subclass of SimpleView wrapped into a StandardSystemView" |
|
1480 |
windowClassNameString := subViews first className. |
|
1481 |
] ifFalse:[ |
|
1482 |
windowClassNameString := self className. |
|
1483 |
] |
|
1484 |
] ifFalse:[ |
|
1485 |
windowClassNameString := application className. |
|
1486 |
]. |
|
1487 |
self setWindowClass:('Stx.', windowClassNameString) name:"name"'bla'. |
|
1488 |
||
4807
62e7832829b7
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4800
diff
changeset
|
1489 |
"Modified: / 14-06-1996 / 17:14:25 / stefan" |
4814 | 1490 |
"Modified: / 30-10-2007 / 16:39:30 / cg" |
4566 | 1491 |
! |
1492 |
||
1493 |
postRealize |
|
1494 |
"postRealize actions - tell the application (if any)." |
|
1495 |
||
1496 |
super postRealize. |
|
1497 |
"/ |
|
1498 |
"/ let the application add its views to the current project |
|
1499 |
"/ |
|
1500 |
application notNil ifTrue:[ |
|
1501 |
application opened:self. |
|
1502 |
] ifFalse:[ |
|
1503 |
self addToCurrentProject. |
|
1504 |
]. |
|
1505 |
||
1506 |
"Created: 24.7.1997 / 18:11:26 / cg" |
|
1507 |
! |
|
1508 |
||
1509 |
preRealize |
|
1510 |
"invoked right before the view is realized. |
|
1511 |
preRealize actions - tell the application (if any)." |
|
1512 |
||
1513 |
super preRealize. |
|
1514 |
||
1515 |
application notNil ifTrue:[ |
|
1516 |
application aboutToOpen:self. |
|
1517 |
]. |
|
1518 |
! |
|
1519 |
||
1520 |
recreate |
|
1521 |
"recreate the view after a snap-in or a migration" |
|
1522 |
||
1523 |
super recreate. |
|
1524 |
||
1525 |
iconView notNil ifTrue:[ |
|
1526 |
iconView recreate. |
|
1527 |
device setWindowIconWindow:iconView in:drawableId. |
|
1528 |
iconView setRealized:true. |
|
1529 |
] ifFalse:[ |
|
1530 |
icon notNil ifTrue:[ |
|
4814 | 1531 |
self icon:(device convertedIcon:icon). |
4566 | 1532 |
]. |
1533 |
]. |
|
1534 |
||
1535 |
iconLabel notNil ifTrue:[ |
|
1536 |
device setIconName:iconLabel in:drawableId |
|
1537 |
] |
|
1538 |
||
4814 | 1539 |
"Modified: / 30-10-2007 / 16:39:42 / cg" |
4566 | 1540 |
! ! |
1541 |
||
1542 |
!StandardSystemView class methodsFor:'documentation'! |
|
1543 |
||
1544 |
version |
|
4815 | 1545 |
^ '$Header: /cvs/stx/stx/libview/StandardSystemView.st,v 1.177 2007-10-30 20:00:28 cg Exp $' |
4566 | 1546 |
! ! |
3746
d9dccd3a4a41
beSlave: also try masterApp in setWGFromApplication
Claus Gittinger <cg@exept.de>
parents:
3706
diff
changeset
|
1547 |
|
1878
76e9bc8e1b9c
new hostName in label format
Claus Gittinger <cg@exept.de>
parents:
1865
diff
changeset
|
1548 |
StandardSystemView initialize! |