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