author | Stefan Vogel <sv@exept.de> |
Fri, 15 Jul 2016 13:57:43 +0200 | |
branch | delegated_gc |
changeset 7412 | d4b5f3114373 |
parent 6794 | d23983b0f222 |
child 6819 | f91377f97414 |
child 6870 | 9809bd505ea7 |
permissions | -rw-r--r-- |
6794 | 1 |
"{ Encoding: utf8 }" |
2 |
||
0 | 3 |
" |
6 | 4 |
COPYRIGHT (c) 1989 by Claus Gittinger |
72 | 5 |
All Rights Reserved |
0 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
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 |
||
771 |
maxExtent ~= max ifTrue:[ |
|
6278 | 772 |
maxExtent := max. |
773 |
maxExtent x isNil ifTrue:[ |
|
774 |
maxExtent := 99999 @ maxExtent y. |
|
775 |
]. |
|
776 |
maxExtent y isNil ifTrue:[ |
|
777 |
maxExtent := maxExtent x @ 99999. |
|
778 |
]. |
|
4566 | 779 |
|
6278 | 780 |
self drawableId notNil ifTrue:[ |
781 |
self graphicsDevice setWindowMinExtent:nil maxExtent:max in:self drawableId |
|
782 |
]. |
|
4566 | 783 |
|
6278 | 784 |
"/ if my current extent is larger than the new |
785 |
"/ maxExtent, adjust. |
|
4566 | 786 |
|
6278 | 787 |
(width notNil and:[height notNil]) ifTrue:[ |
788 |
((width > (max x)) or: |
|
789 |
[height > (max y)]) ifTrue: [ |
|
790 |
self extent:(max min:self extent) |
|
791 |
] |
|
792 |
] |
|
4566 | 793 |
]. |
794 |
! |
|
795 |
||
796 |
minExtent |
|
797 |
"return the views minimum allowed extent" |
|
798 |
||
799 |
^ minExtent |
|
800 |
! |
|
801 |
||
802 |
minExtent:min |
|
803 |
"define the minimum extent the view may have - |
|
804 |
depends on good-will of window manager" |
|
805 |
||
806 |
minExtent ~= min ifTrue:[ |
|
6278 | 807 |
minExtent := min. |
808 |
self drawableId notNil ifTrue:[ |
|
809 |
self graphicsDevice setWindowMinExtent:min maxExtent:nil in:self drawableId |
|
810 |
]. |
|
4566 | 811 |
|
6278 | 812 |
"/ if my current extent is smaller than the new |
813 |
"/ minExtent, adjust. |
|
4566 | 814 |
|
6278 | 815 |
(width notNil and:[height notNil]) ifTrue:[ |
816 |
((width < (min x)) or: |
|
817 |
[height < (min y)]) ifTrue: [ |
|
818 |
self extent:(min max:self extent) |
|
819 |
] |
|
820 |
] |
|
4566 | 821 |
] |
822 |
! ! |
|
823 |
||
824 |
!StandardSystemView methodsFor:'accessing-look'! |
|
825 |
||
826 |
icon |
|
827 |
"return the form defined as icon" |
|
828 |
||
829 |
^ icon value |
|
830 |
! |
|
831 |
||
832 |
icon:aFormOrImage |
|
833 |
"define the form or image (bitmap) used as icon" |
|
834 |
||
835 |
|i m iconValue| |
|
836 |
||
837 |
icon := aFormOrImage. |
|
838 |
iconValue := icon value. |
|
839 |
iconValue notNil ifTrue:[ |
|
6278 | 840 |
self drawableId notNil ifTrue:[ |
841 |
i := self graphicsDevice convertedIcon:iconValue. |
|
842 |
(i notNil and:[i id notNil]) ifTrue:[ |
|
843 |
(m := iconValue mask) notNil ifTrue:[ |
|
844 |
m := self graphicsDevice convertedIconMask:m. |
|
845 |
]. |
|
846 |
self graphicsDevice setWindowIcon:i mask:m in:self drawableId |
|
847 |
] |
|
848 |
] |
|
4566 | 849 |
] |
850 |
||
4814 | 851 |
"Modified: / 30-10-2007 / 16:39:15 / cg" |
4566 | 852 |
! |
853 |
||
854 |
iconLabel |
|
855 |
"return the name displayed in the icon" |
|
856 |
||
857 |
^ iconLabel |
|
858 |
! |
|
859 |
||
860 |
iconLabel:aString |
|
861 |
"define the name to be displayed in the icon" |
|
862 |
||
863 |
|newLabel| |
|
864 |
||
865 |
(newLabel := aString string) ~= iconLabel ifTrue:[ |
|
6278 | 866 |
iconLabel := newLabel. |
867 |
self drawableId notNil ifTrue:[ |
|
868 |
self graphicsDevice setIconName:newLabel in:self drawableId. |
|
869 |
" |
|
870 |
unbuffered - to make it visible right NOW |
|
871 |
" |
|
872 |
self flush. |
|
873 |
] |
|
4566 | 874 |
] |
875 |
! |
|
876 |
||
877 |
iconMask |
|
878 |
"return the form defined as iconMask. |
|
879 |
Notice, that many windowManagers ignore this mask |
|
880 |
(usually, only managers which place icons on the background desktop |
|
881 |
care for an icon - if at all ...)" |
|
882 |
||
883 |
|mask| |
|
884 |
||
885 |
"/ only images possibly have iconMasks |
|
886 |
icon notNil ifTrue:[ |
|
6278 | 887 |
(mask := icon value mask) notNil ifTrue:[ |
888 |
^ self graphicsDevice convertedIconMask:mask |
|
889 |
] |
|
4566 | 890 |
]. |
891 |
||
892 |
^ nil |
|
893 |
||
4815 | 894 |
"Modified: / 30-10-2007 / 20:59:40 / cg" |
4566 | 895 |
! |
896 |
||
897 |
iconName:aString |
|
898 |
"this method will vanish soon ... - for backward compatibility" |
|
899 |
||
900 |
<resource:#obsolete> |
|
901 |
||
902 |
self obsoleteMethodWarning:'use #iconLabel:'. |
|
903 |
self iconLabel:aString |
|
904 |
! |
|
905 |
||
906 |
iconView |
|
907 |
"return the view used as icon-view" |
|
908 |
||
909 |
^ iconView |
|
910 |
! |
|
911 |
||
912 |
iconView:aView |
|
913 |
"specify the view to be used as icon. |
|
914 |
This may not be supported on all display types" |
|
915 |
||
916 |
iconView := aView. |
|
6278 | 917 |
self drawableId notNil ifTrue:[ |
918 |
aView create. |
|
919 |
self graphicsDevice setWindowIconWindow:aView in:self drawableId. |
|
920 |
aView setRealized:true. |
|
4566 | 921 |
] |
922 |
||
923 |
"Modified: 4.4.1997 / 16:21:37 / cg" |
|
924 |
! |
|
925 |
||
926 |
label |
|
927 |
"return the views name in the title area" |
|
928 |
||
929 |
^ label |
|
930 |
! |
|
931 |
||
932 |
label:aString |
|
6245 | 933 |
"define the view's name in the window's title area. |
934 |
If IncludeHostNameInLabel is true, prepend the hostname - now done in windowLabelFor: |
|
4566 | 935 |
(you will appreciate this, if you are working on multiple |
936 |
machines simultaneously - as I do ...)" |
|
937 |
||
5066 | 938 |
|newLabel expandedLabel| |
4566 | 939 |
|
4633 | 940 |
newLabel := aString. |
941 |
newLabel notNil ifTrue:[newLabel := newLabel string]. |
|
942 |
newLabel ~= label ifTrue:[ |
|
6079 | 943 |
label := newLabel. |
6248 | 944 |
"/ fix: cg: realized is a bad test here - could still be unmapped... |
6278 | 945 |
self drawableId notNil "realized" ifTrue: [ |
6079 | 946 |
expandedLabel := self windowLabelFor:label. |
6228 | 947 |
self windowName:(expandedLabel ? ''). |
6079 | 948 |
shown ifTrue:[ |
949 |
" |
|
950 |
unbuffered - to make it visible right NOW |
|
951 |
" |
|
6228 | 952 |
self flush. |
6079 | 953 |
] |
954 |
] |
|
4566 | 955 |
] |
956 |
||
4633 | 957 |
"Created: / 08-09-1995 / 19:37:06 / claus" |
958 |
"Modified: / 06-10-2006 / 11:55:06 / cg" |
|
4566 | 959 |
! |
960 |
||
961 |
label:labelString iconLabel:iconLabelString |
|
962 |
"set both the label and the iconLabel" |
|
963 |
||
964 |
self label:labelString. |
|
965 |
self iconLabel:iconLabelString |
|
966 |
! ! |
|
967 |
||
968 |
!StandardSystemView methodsFor:'change & update'! |
|
969 |
||
970 |
update:something with:aParameter from:changedObject |
|
971 |
"the MVC way of changing the label ..." |
|
972 |
||
973 |
changedObject notNil ifTrue:[ |
|
5613 | 974 |
changedObject == labelChannel ifTrue:[ |
975 |
self label:labelChannel value. |
|
976 |
^ self |
|
977 |
]. |
|
4566 | 978 |
]. |
979 |
^ super update:something with:aParameter from:changedObject |
|
980 |
! ! |
|
981 |
||
982 |
!StandardSystemView methodsFor:'destroying'! |
|
983 |
||
984 |
release |
|
985 |
self removeFromCurrentProject. |
|
986 |
labelChannel notNil ifTrue:[ |
|
5613 | 987 |
labelChannel removeDependent:self. |
988 |
labelChannel := nil. |
|
4566 | 989 |
]. |
990 |
windowGroup notNil ifTrue:[ |
|
5613 | 991 |
windowGroup focusSequence:nil. |
4566 | 992 |
]. |
993 |
super release. |
|
994 |
! |
|
995 |
||
996 |
saveAndTerminate |
|
5613 | 997 |
"save & terminate request from the windowManager. The application should |
4566 | 998 |
save its data/files/text etc. somehow and close. |
999 |
If there is an application, let it decide how do do that. |
|
1000 |
Otherwise, forward it to superclasses which knows how to do this. |
|
1001 |
(it defaults to a terminate there). |
|
1002 |
Notice, that not all windowmanagers are nice enough |
|
1003 |
to send this request; some simply distroy the view." |
|
1004 |
||
1005 |
application notNil ifTrue:[ |
|
1006 |
application saveAndTerminateRequestFor:self |
|
1007 |
] ifFalse:[ |
|
1008 |
super saveAndTerminate |
|
1009 |
] |
|
1010 |
! |
|
1011 |
||
1012 |
terminate |
|
1013 |
"terminate request from the windowManager. If there is an application, |
|
1014 |
let it decide if it really wants to be close. Otherwise, forward it to |
|
1015 |
superclasses terminate which knows how to do this. |
|
1016 |
Notice, that not all windowmanagers are nice enough |
|
1017 |
to send this request; some simply distroy the view." |
|
1018 |
||
1019 |
application notNil ifTrue:[ |
|
1020 |
application closeRequestFor:self |
|
1021 |
] ifFalse:[ |
|
1022 |
self closeRequest. |
|
1023 |
] |
|
1024 |
||
1025 |
"Modified: / 3.8.1998 / 19:49:45 / cg" |
|
1026 |
! ! |
|
1027 |
||
1028 |
!StandardSystemView methodsFor:'event handling'! |
|
1029 |
||
6646 | 1030 |
delayedAutoRaiseEvent |
6048 | 1031 |
"called with a delay by the focusIn code, iff the userPref setting is active. |
1032 |
Some (a small number only) may want to prevent autoraise in certain situations |
|
1033 |
- for example, if one view is controlling another. These get a chance to redefine this |
|
1034 |
method" |
|
1035 |
||
6073 | 1036 |
|wg app| |
6049 | 1037 |
|
6071 | 1038 |
"/ not, if my windowGroup is in a modal or popup action |
6073 | 1039 |
((wg := self windowGroup) notNil |
1040 |
and:[ wg isInModalLoop not |
|
1041 |
and:[ wg mainGroup isInModalLoop not |
|
1042 |
and:[ self isModal not ]]]) ifTrue:[ |
|
1043 |
self sensor anyButtonPressed ifFalse:[ |
|
1044 |
"/ if I have an application, let it decide |
|
1045 |
(app := self application) notNil ifTrue:[ |
|
6646 | 1046 |
app delayedAutoRaiseEventFor:self |
6073 | 1047 |
] ifFalse:[ |
1048 |
self raise. |
|
1049 |
]. |
|
1050 |
] |
|
6071 | 1051 |
] |
6048 | 1052 |
! |
1053 |
||
4566 | 1054 |
focusIn |
1055 |
"the view got the keyboard focus (via the window manager). |
|
1056 |
I.e. the mouse was moved out into the topView area - restore the |
|
1057 |
focus to the previous focusView.." |
|
1058 |
||
6721 | 1059 |
|viewToGetFocus viewUnderMousePointer ms| |
4566 | 1060 |
|
1061 |
windowGroup notNil ifTrue:[ |
|
6772 | 1062 |
"/ a hack for window managers, which do not honor the |
1063 |
"/ WMTransientFor attribute (i.e. XQuartz). |
|
6794 | 1064 |
"/ This flag would prevent a popup (dialog or notification) from being |
6772 | 1065 |
"/ covered by its underlying regular view. But on MAC, it does not. |
1066 |
"/ However, focus is coming in, when doing this, so we manually fix this |
|
1067 |
"/ here. Should not hurt on other systems, where the view is already on top. |
|
1068 |
"/ if it does, add some conditional check here (device WMTransientForBroken or similar) |
|
1069 |
"/ You can check for you WM to be correct, by disabling the line below, |
|
1070 |
"/ then click on a smallLint-note icon, to see the smallLint info, |
|
1071 |
"/ then click on the underlying codeView, to raise it. |
|
1072 |
"/ if the smallLint view can be covered, your WM is broken. |
|
6794 | 1073 |
"/ cg: turns out to be a bad idea - it does help solve the above problem (on mac), |
1074 |
"/ but raises unwanted topViews (for example, if a modal dialog's popup menu closes) |
|
1075 |
"/ windowGroup topViews first raise. |
|
6772 | 1076 |
|
5675 | 1077 |
"/ I got the focus - tell the current focus-windowgroup |
1078 |
"/ that its focus is gone elsewhere ... |
|
6646 | 1079 |
"/ 'focusIn ' print. windowGroup process name printCR. |
1080 |
"/ 'focusView is ' print. windowGroup focusView printCR. |
|
4566 | 1081 |
|
6646 | 1082 |
"/ although the foucs has usually already been taken (see focusOut), |
1083 |
"/ there are situations where this does not happen; |
|
1084 |
"/ I am not sure if that is a WM bug or an ST/X bug, but sometimes (with popups), |
|
1085 |
"/ I only get a focus in. Could be a race, when the loosing view is already destroyed, |
|
6772 | 1086 |
"/ at the time the focus event arrives. |
1087 |
"/ Anyway: it should not matter to take it again... |
|
6278 | 1088 |
WindowGroup takeFocusFromDevice:self graphicsDevice. |
4566 | 1089 |
|
6772 | 1090 |
windowGroup isInModalLoop ifTrue:[ |
1091 |
windowGroup allTopViewsDo:[:t | |
|
1092 |
t ~~ self ifTrue:[ |
|
1093 |
t focusIn. |
|
6774 | 1094 |
t raise. |
6772 | 1095 |
^ self. |
1096 |
]. |
|
1097 |
] |
|
1098 |
]. |
|
1099 |
||
6646 | 1100 |
"/ Transcript show:self; show:' focus in '; showCR:windowGroup isInModalLoop. |
1101 |
||
6721 | 1102 |
viewToGetFocus := windowGroup focusView. |
1103 |
viewToGetFocus isNil ifTrue:[ |
|
5675 | 1104 |
UserPreferences current focusFollowsMouse ~~ false ifTrue:[ |
6721 | 1105 |
viewUnderMousePointer := windowGroup pointerView. |
1106 |
"/ 'viewUnderMousePointer is ' print. viewUnderMousePointer printCR. |
|
1107 |
(viewUnderMousePointer notNil |
|
1108 |
and:[viewUnderMousePointer isKeyboardConsumer |
|
1109 |
and:[viewUnderMousePointer wantsFocusWithPointerEnter]]) ifTrue:[ |
|
1110 |
viewToGetFocus := viewUnderMousePointer. |
|
5675 | 1111 |
] |
6721 | 1112 |
]. |
5675 | 1113 |
]. |
6721 | 1114 |
viewToGetFocus isNil ifTrue:[ |
6741 | 1115 |
windowGroup focusBackToPreviousFocusView. |
1116 |
windowGroup focusView isNil ifTrue:[ |
|
1117 |
self assignInitialKeyboardFocus. |
|
1118 |
]. |
|
5675 | 1119 |
] ifFalse:[ |
1120 |
"/ v requestFocus. - will be denied; but we must force it here |
|
1121 |
"/ to force a change... |
|
1122 |
windowGroup setFocusView:nil. |
|
6721 | 1123 |
windowGroup focusView:viewToGetFocus byTab:nil. |
6047 | 1124 |
]. |
1125 |
||
1126 |
"/ optionally bring the window to the front after some delay. |
|
6071 | 1127 |
"/ but not, if my windowGroup is in a modal or popup action |
6047 | 1128 |
(ms := UserPreferences current autoRaiseOnFocusInDelay) notNil ifTrue:[ |
6073 | 1129 |
self scheduleAutoRaiseAfter:ms |
6047 | 1130 |
]. |
4566 | 1131 |
]. |
1132 |
super focusIn |
|
1133 |
||
5675 | 1134 |
"Modified: / 20-01-2011 / 20:51:20 / cg" |
4566 | 1135 |
! |
1136 |
||
1137 |
focusOut |
|
1138 |
"the top-view lost the keyboard focus (via the window manager). |
|
1139 |
I.e. the mouse was moved out of the topView area." |
|
1140 |
||
6787 | 1141 |
|v wg| |
4566 | 1142 |
|
6148 | 1143 |
"/ 'fout ' print. self printCR. |
1144 |
||
6787 | 1145 |
(wg := windowGroup) notNil ifTrue:[ |
6148 | 1146 |
"/ ' fout-focusView: ' print. windowGroup focusView printCR. |
6787 | 1147 |
(v := wg focusView) notNil ifTrue:[ |
6788 | 1148 |
"/ wg focusView:nil. "/ -- let windowGroup do it. |
6148 | 1149 |
v showNoFocus:(windowGroup explicitFocusView == v). |
1150 |
"/ ' send-has-nofocus to: ' print. v printCR. |
|
1151 |
v hasKeyboardFocus:false. |
|
1152 |
] |
|
4566 | 1153 |
]. |
1154 |
super focusOut |
|
1155 |
||
1156 |
"Modified: 25.2.1997 / 23:19:46 / cg" |
|
1157 |
! |
|
1158 |
||
6100
409e2909e130
Added StandardSystemView>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6079
diff
changeset
|
1159 |
processShortcut:aKeyEvent |
409e2909e130
Added StandardSystemView>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6079
diff
changeset
|
1160 |
"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
|
1161 |
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
|
1162 |
|
409e2909e130
Added StandardSystemView>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6079
diff
changeset
|
1163 |
application notNil ifTrue:[ |
6101
ea437d17677d
Fix in StandardSystemView>>#processShortcut:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6100
diff
changeset
|
1164 |
(application processShortcut:aKeyEvent) ifTrue:[ ^ true ] |
ea437d17677d
Fix in StandardSystemView>>#processShortcut:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6100
diff
changeset
|
1165 |
]. |
ea437d17677d
Fix in StandardSystemView>>#processShortcut:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6100
diff
changeset
|
1166 |
^super processShortcut:aKeyEvent |
6100
409e2909e130
Added StandardSystemView>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6079
diff
changeset
|
1167 |
|
409e2909e130
Added StandardSystemView>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6079
diff
changeset
|
1168 |
"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
|
1169 |
"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
|
1170 |
! |
409e2909e130
Added StandardSystemView>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6079
diff
changeset
|
1171 |
|
6073 | 1172 |
scheduleAutoRaiseAfter:ms |
1173 |
"bring the window to the front after some delay. |
|
1174 |
but not, if my windowGroup is in a modal or popup action" |
|
1175 |
||
1176 |
|wg actionID| |
|
1177 |
||
6646 | 1178 |
(wg := self windowGroup) isNil ifTrue:[^ self]. |
1179 |
wg isInModalLoop ifTrue:[^ self]. |
|
1180 |
wg mainGroup isInModalLoop ifTrue:[^ self]. |
|
1181 |
"/ self isModal ifTrue:[^ self]. |
|
1182 |
||
1183 |
TimedRaiseAction notNil ifTrue:[ |
|
1184 |
Processor removeTimeoutWithID:TimedRaiseAction. |
|
1185 |
]. |
|
1186 |
TimedRaiseAction := actionID := Processor |
|
1187 |
addTimedBlock: |
|
1188 |
[ |
|
1189 |
TimedRaiseAction == actionID ifTrue:[ |
|
1190 |
TimedRaiseAction := nil. |
|
1191 |
self sensor pushUserEvent: #delayedAutoRaiseEvent for: self |
|
1192 |
]. |
|
1193 |
] |
|
1194 |
afterMilliseconds:ms. |
|
6073 | 1195 |
! |
1196 |
||
4566 | 1197 |
showActivity:someMessage |
1198 |
"some activityNotification shalt be communicated to |
|
1199 |
the user. Forward it to my application (if any). |
|
1200 |
(that one should know how to deal with it). |
|
1201 |
Otherwise, simply ignore it." |
|
1202 |
||
1203 |
application notNil ifTrue:[ |
|
1204 |
application showActivity:someMessage |
|
1205 |
] |
|
1206 |
||
1207 |
"Created: 16.12.1995 / 18:40:44 / cg" |
|
1208 |
"Modified: 23.4.1996 / 21:38:11 / cg" |
|
1209 |
! ! |
|
1210 |
||
1211 |
!StandardSystemView methodsFor:'initialization & release'! |
|
1212 |
||
1213 |
addToCurrentProject |
|
1214 |
"add the receiver (a topview) to the current projects set-of-views. |
|
1215 |
(If there is a current project)" |
|
1216 |
||
1217 |
|p| |
|
1218 |
||
1219 |
" |
|
1220 |
the following check allows systems |
|
1221 |
without projects and changeSets |
|
1222 |
" |
|
1223 |
(Project notNil and:[(p := Project current) notNil]) ifTrue:[ |
|
1224 |
p addView: self |
|
1225 |
] |
|
1226 |
! |
|
1227 |
||
1228 |
defaultControllerClass |
|
1229 |
"for ST-80 compatibility only - not used in ST/X" |
|
1230 |
||
1231 |
^ nil "/ StandardSystemController |
|
1232 |
! |
|
1233 |
||
1234 |
initEvents |
|
1235 |
super initEvents. |
|
1236 |
self enableFocusEvents. |
|
1237 |
! |
|
1238 |
||
1239 |
initialize |
|
1240 |
super initialize. |
|
1241 |
||
5388 | 1242 |
"/ self setBorderWidth:2. "- notice: many window managers ignore this" |
6369 | 1243 |
self graphicsDevice isWindowsPlatform ifTrue:[ |
5942 | 1244 |
minExtent := 0 @ 0. |
4566 | 1245 |
] ifFalse:[ |
5942 | 1246 |
minExtent := 10 @ 10. |
4566 | 1247 |
]. |
1248 |
||
1249 |
label isNil ifTrue:[label := self class defaultLabel]. |
|
1250 |
icon isNil ifTrue:[icon := self class defaultIcon]. |
|
5942 | 1251 |
sizeFixed := false. |
1252 |
||
1253 |
"Modified: / 27-10-2012 / 12:16:39 / cg" |
|
4566 | 1254 |
! |
1255 |
||
5659 | 1256 |
mapped |
1257 |
super mapped. |
|
6369 | 1258 |
self graphicsDevice isWindowsPlatform ifTrue:[ |
5743 | 1259 |
"don't do this in X11 - switching between |
1260 |
virtual desktops would change the window stacking all the time" |
|
1261 |
self setForegroundWindow. |
|
1262 |
self activate. |
|
1263 |
]. |
|
5659 | 1264 |
|
1265 |
"Created: / 01-12-2010 / 15:57:22 / cg" |
|
1266 |
! |
|
1267 |
||
4566 | 1268 |
reAdjustGeometry |
1269 |
"sent as a final step when an image is restarted. |
|
5613 | 1270 |
when we come up on a smaller display, |
4566 | 1271 |
make certain, that the receiver is visible" |
1272 |
||
6278 | 1273 |
|dX dY limitRight limitBottom graphicsDevice| |
4566 | 1274 |
|
6278 | 1275 |
graphicsDevice := self graphicsDevice. |
1276 |
dX := (graphicsDevice horizontalPixelPerMillimeter * 20) rounded. |
|
1277 |
dY := (graphicsDevice verticalPixelPerMillimeter * 20) rounded. |
|
4566 | 1278 |
|
6278 | 1279 |
limitRight := graphicsDevice usableWidth - dX. |
1280 |
limitBottom := graphicsDevice usableHeight - dY. |
|
4566 | 1281 |
((self left > limitRight) or:[ |
1282 |
self top > limitBottom]) ifTrue:[ |
|
6278 | 1283 |
'StandardSystemView [info]: moving view into visible area' infoPrintCR. |
1284 |
self origin:limitRight @ limitBottom |
|
4566 | 1285 |
] |
1286 |
||
1287 |
"Modified: 10.1.1997 / 15:12:19 / cg" |
|
1288 |
! |
|
1289 |
||
1290 |
reinitialize |
|
1291 |
"reopen the receiver if if was visible before. |
|
1292 |
This is called right after snapIn; Notice, that all instance variables |
|
1293 |
(such as shown, realized etc.) are left-overs from the time the snapout |
|
1294 |
was done. Remap the receiver, if it was mapped at snapout time" |
|
1295 |
||
1296 |
|myController| |
|
1297 |
||
1298 |
"if I have already been reinited - return" |
|
6278 | 1299 |
self drawableId notNil ifTrue:[ |
1300 |
^ self |
|
4566 | 1301 |
]. |
1302 |
||
5613 | 1303 |
"have to kludge with the controller |
4566 | 1304 |
- otherwise its startup performs unwanted actions ..." |
1305 |
||
1306 |
myController := controller. |
|
1307 |
controller := nil. |
|
1308 |
||
1309 |
"physically create the view & subviews" |
|
1310 |
self recreate. |
|
1311 |
||
1312 |
"if I was iconified (not realized), remap iconified" |
|
6278 | 1313 |
self graphicsDevice |
1314 |
mapView:self id:self drawableId iconified:(realized "shown" not) |
|
1315 |
atX:left y:top width:width height:height |
|
1316 |
minExtent:minExtent maxExtent:maxExtent. |
|
24 | 1317 |
|
4566 | 1318 |
"and restart the window-group process" |
1319 |
windowGroup notNil ifTrue:[ |
|
6278 | 1320 |
windowGroup restart |
4566 | 1321 |
]. |
24 | 1322 |
|
4566 | 1323 |
"restore controller" |
1324 |
controller := myController |
|
1325 |
||
1326 |
"Modified: / 6.5.1999 / 09:50:13 / cg" |
|
1327 |
! |
|
1328 |
||
1329 |
removeFromCurrentProject |
|
1330 |
"remove the receiver (a topview) from the current projects set-of-views. |
|
1331 |
(If there is a current project)" |
|
1332 |
||
1333 |
|p| |
|
1334 |
||
1335 |
" |
|
1336 |
the following check allows systems |
|
1337 |
without projects and changeSets |
|
1338 |
" |
|
1339 |
(Project notNil and:[(p := Project current) notNil]) ifTrue:[ |
|
1340 |
p removeView:self |
|
1341 |
] |
|
1342 |
! |
|
1343 |
||
1344 |
restarted |
|
1345 |
"sent by my windowGroup, when restarted from an image. |
|
1346 |
Nothing done here, but can be redefined to perform any actions |
|
1347 |
required to reset the application after an image-restart. |
|
1348 |
(for example: check if application files are still around, restart |
|
1349 |
subprocesses etc.)." |
|
1350 |
||
1351 |
application notNil ifTrue:[ |
|
1352 |
application restarted |
|
1353 |
]. |
|
1354 |
! ! |
|
1355 |
||
1356 |
!StandardSystemView methodsFor:'printing & storing'! |
|
1357 |
||
5233
fb88be5a3dea
define #printOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
5086
diff
changeset
|
1358 |
printOn:aStream |
4566 | 1359 |
"just for your convenience in inspectors ... |
1360 |
... add the views label to the displayString." |
|
1361 |
||
5233
fb88be5a3dea
define #printOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
5086
diff
changeset
|
1362 |
super printOn:aStream. |
4566 | 1363 |
label notNil ifTrue:[ |
5613 | 1364 |
aStream nextPut:$(. label printOn:aStream. aStream nextPut:$). |
4566 | 1365 |
]. |
1366 |
! ! |
|
1367 |
||
1368 |
!StandardSystemView methodsFor:'private'! |
|
1369 |
||
1370 |
convertedIcon |
|
1371 |
"make certain, that the icon is compatible with my device; |
|
1372 |
this means converting it to a format (typically: monochrome) which |
|
1373 |
the device supports. Return a compatible version of the icon." |
|
1374 |
||
6278 | 1375 |
^ self graphicsDevice convertedIcon:icon |
4566 | 1376 |
|
4814 | 1377 |
"Modified: / 30-10-2007 / 16:39:55 / cg" |
4566 | 1378 |
! |
1379 |
||
1380 |
convertedIcon:iconArg |
|
1381 |
"make certain, that the image argument is compatible with my device; |
|
1382 |
this means converting it to a format (typically: monochrome) which |
|
1383 |
the device supports. Return a compatible version of the icon." |
|
1384 |
||
6278 | 1385 |
^ self graphicsDevice convertedIcon:iconArg |
4566 | 1386 |
|
4814 | 1387 |
"Modified: / 30-10-2007 / 16:37:31 / cg" |
4566 | 1388 |
! |
1389 |
||
1390 |
convertedIconMask:aMask |
|
1391 |
"return a version of the argument which can be used as an iconMask |
|
1392 |
on my device. Typically, this means conversion to a monochrome |
|
1393 |
mask - future versions may add alpha channel masks, if the device supports |
|
1394 |
them ..." |
|
1395 |
||
6278 | 1396 |
^ self graphicsDevice convertedIconMask:aMask |
4566 | 1397 |
|
4814 | 1398 |
"Modified: / 30-10-2007 / 16:38:58 / cg" |
4566 | 1399 |
! |
1400 |
||
1401 |
setWindowGroupFromApplication |
|
1402 |
"get the applications topView and set my windowGroup to its wg." |
|
1403 |
||
1404 |
|win master| |
|
1405 |
||
1406 |
windowGroup isNil ifTrue:[ |
|
5613 | 1407 |
application notNil ifTrue:[ |
1408 |
(win := application window) notNil ifTrue:[ |
|
1409 |
win ~~ self ifTrue:[ |
|
1410 |
windowGroup := win windowGroup. |
|
1411 |
^ self |
|
1412 |
]. |
|
1413 |
(master := application masterApplication) notNil ifTrue:[ |
|
1414 |
(win := master window) notNil ifTrue:[ |
|
1415 |
windowGroup := win windowGroup. |
|
1416 |
^ self |
|
1417 |
]. |
|
1418 |
]. |
|
1419 |
] |
|
1420 |
] |
|
4566 | 1421 |
]. |
1422 |
||
1423 |
"Created: 22.9.1995 / 17:40:36 / claus" |
|
1424 |
"Modified: 6.3.1996 / 16:17:32 / cg" |
|
1425 |
! |
|
1426 |
||
1427 |
windowLabelFor:labelString |
|
1428 |
"return an expanded labelString, according to the hostName-in-window setting. |
|
1429 |
The labelString may include positional parameters: |
|
6504 | 1430 |
%1 - the actual label |
1431 |
%2 - the hostname |
|
1432 |
%3 - the userName |
|
1433 |
%4 - the processId |
|
1434 |
%5 - the TOP-directories name |
|
1435 |
%6 - the TOP-directories path |
|
4566 | 1436 |
" |
1437 |
||
6504 | 1438 |
|wg proc id pidString lbl windowLabelFormat stxPackageDirectory topDirectory| |
4566 | 1439 |
|
1440 |
(IncludeHostNameInLabel == true |
|
1441 |
and:[(windowLabelFormat := self class windowLabelFormat) notNil]) ifTrue:[ |
|
6504 | 1442 |
(wg := self windowGroup) notNil ifTrue:[ |
1443 |
(proc := wg process) notNil ifTrue:[ |
|
1444 |
(id := proc id) notNil ifTrue:[ |
|
1445 |
pidString := id printString |
|
1446 |
] |
|
1447 |
] |
|
1448 |
]. |
|
1449 |
stxPackageDirectory := Smalltalk getPackageDirectoryForPackage:'stx'. |
|
1450 |
stxPackageDirectory isNil ifTrue:[ |
|
1451 |
'StdSysView [info]: cannot figure out stx package directory.' infoPrintCR. |
|
1452 |
stxPackageDirectory := OperatingSystem pathOfSTXExecutable asFilename. |
|
1453 |
]. |
|
1454 |
stxPackageDirectory isNil ifTrue:[ |
|
1455 |
topDirectory := OperatingSystem getHomeDirectory asFilename. |
|
1456 |
] ifFalse:[ |
|
1457 |
topDirectory := stxPackageDirectory directory. |
|
6519 | 1458 |
"/ a hack to make it look nicer on mac... (shows Packages otherwise) |
1459 |
topDirectory baseName = 'Packages' ifTrue:[ |
|
1460 |
topDirectory := topDirectory directory |
|
1461 |
]. |
|
6504 | 1462 |
]. |
1463 |
lbl := windowLabelFormat |
|
1464 |
bindWith:labelString |
|
1465 |
with:[OperatingSystem getHostName] |
|
1466 |
with:[OperatingSystem getLoginName] |
|
1467 |
with:pidString |
|
1468 |
with:[topDirectory baseName] |
|
1469 |
with:[topDirectory pathName]. |
|
1470 |
^ lbl |
|
4566 | 1471 |
]. |
1472 |
^ labelString |
|
1473 |
||
1474 |
"Created: / 22-09-1997 / 10:10:32 / cg" |
|
1475 |
"Modified: / 22-08-2006 / 11:42:53 / cg" |
|
1476 |
! ! |
|
1477 |
||
1478 |
!StandardSystemView methodsFor:'queries'! |
|
1479 |
||
1480 |
processName |
|
1481 |
"return a string to be shown for my process in the |
|
1482 |
process monitor. This has no semantic meaning, but exists |
|
1483 |
for your convenience only." |
|
1484 |
||
1485 |
application notNil ifTrue:[ |
|
1486 |
^ application processName |
|
1487 |
]. |
|
1488 |
label notNil ifTrue:[^ label]. |
|
1489 |
^ super processName |
|
1490 |
||
1491 |
"Modified: 24.4.1996 / 09:47:01 / cg" |
|
1492 |
! ! |
|
1493 |
||
1494 |
!StandardSystemView methodsFor:'realization'! |
|
1495 |
||
1496 |
collapse |
|
1497 |
"iconify the receiver" |
|
1498 |
||
1499 |
shown ifTrue:[ |
|
6278 | 1500 |
self unmap. |
4566 | 1501 |
|
6278 | 1502 |
"if it was iconified, try to remap iconified" |
1503 |
self graphicsDevice |
|
1504 |
mapView:self id:self drawableId iconified:true |
|
1505 |
atX:left y:top width:width height:height |
|
1506 |
minExtent:minExtent maxExtent:maxExtent. |
|
5086
0a18f82d02ec
sending of visibility-change fixed
Claus Gittinger <cg@exept.de>
parents:
5066
diff
changeset
|
1507 |
|
6278 | 1508 |
shown ifTrue:[ |
1509 |
shown := false. |
|
1510 |
self changed:#visibility. |
|
1511 |
]. |
|
4566 | 1512 |
]. |
1513 |
||
1514 |
" |
|
1515 |
|top| |
|
1516 |
||
1517 |
top := StandardSystemView new. |
|
1518 |
top label:'hello'. |
|
1519 |
top openAndWait. |
|
1520 |
Delay waitForSeconds:2. |
|
1521 |
top collapse. |
|
1522 |
Delay waitForSeconds:2. |
|
1523 |
top expand. |
|
1524 |
" |
|
1525 |
||
1526 |
"Modified: 24.7.1997 / 12:32:17 / cg" |
|
1527 |
! |
|
1528 |
||
1529 |
create |
|
1530 |
"create - make certain that icon is available" |
|
1531 |
||
1532 |
super create. |
|
1533 |
||
1534 |
iconView notNil ifTrue:[ |
|
6278 | 1535 |
iconView create. |
1536 |
self graphicsDevice setWindowIconWindow:iconView in:self drawableId. |
|
1537 |
iconView setRealized:true. |
|
4566 | 1538 |
]. |
1539 |
iconLabel notNil ifTrue:[ |
|
6278 | 1540 |
self graphicsDevice setIconName:iconLabel string in:self drawableId |
4566 | 1541 |
] |
1542 |
||
1543 |
"Modified: 10.6.1996 / 20:14:50 / cg" |
|
1544 |
! |
|
1545 |
||
1546 |
expand |
|
1547 |
"de-iconify the receiver at its old position" |
|
1548 |
||
1549 |
shown ifFalse:[ |
|
6278 | 1550 |
self unmap. |
4566 | 1551 |
|
6278 | 1552 |
"if it was iconified, try to remap iconified" |
1553 |
self graphicsDevice |
|
1554 |
mapView:self id:self drawableId iconified:false |
|
1555 |
atX:left y:top width:width height:height |
|
1556 |
minExtent:minExtent maxExtent:maxExtent. |
|
4566 | 1557 |
]. |
1558 |
||
1559 |
" |
|
1560 |
|top| |
|
1561 |
||
1562 |
top := StandardSystemView new. |
|
1563 |
top label:'hello'. |
|
1564 |
top openAndWait. |
|
1565 |
top collapse. |
|
1566 |
Delay waitForSeconds:5. |
|
1567 |
top expand. |
|
1568 |
" |
|
1569 |
||
1570 |
"Modified: / 3.2.1998 / 16:02:56 / cg" |
|
1571 |
! |
|
1572 |
||
1573 |
physicalCreate |
|
1574 |
"common code for create & recreate" |
|
1575 |
||
6228 | 1576 |
|dev lbl iconValue icn icnMask windowClassNameString org devBounds windowNameString| |
1577 |
||
1578 |
dev := self device. |
|
5613 | 1579 |
|
5624 | 1580 |
UserPreferences current forceWindowsIntoMonitorBounds ifTrue:[ |
1581 |
"/ MULTI SCREEN support |
|
6228 | 1582 |
devBounds := dev monitorBoundsAt:( left @ top ). |
5624 | 1583 |
"/ adjust origin, if too large |
1584 |
left + width > devBounds right ifTrue:[ |
|
1585 |
left := devBounds right - width. |
|
1586 |
]. |
|
1587 |
top + height > devBounds bottom ifTrue:[ |
|
1588 |
top := devBounds bottom - height. |
|
1589 |
]. |
|
1590 |
top := top max:(devBounds top). |
|
1591 |
left := left max:(devBounds left). |
|
5532 | 1592 |
]. |
1593 |
||
5613 | 1594 |
org := (left @ top) rounded. |
4566 | 1595 |
lbl := self windowLabelFor:label. |
1596 |
||
1597 |
icon notNil ifTrue:[ |
|
5624 | 1598 |
iconValue := icon value. |
6228 | 1599 |
icn := dev convertedIcon:iconValue. |
5624 | 1600 |
(icnMask := iconValue mask) notNil ifTrue:[ |
6228 | 1601 |
icnMask := dev convertedIconMask:icnMask |
5624 | 1602 |
]. |
1603 |
deviceIcon := icn. |
|
4566 | 1604 |
]. |
1605 |
||
1606 |
"/ give global eventListeners a chance to intercept windowCreation |
|
1607 |
"/ and provide another origin (by payching my origin via setOrigin:). |
|
1608 |
WindowSensor preViewCreateNotification:self. |
|
1609 |
||
6283 | 1610 |
gc |
6228 | 1611 |
createWindowFor:self |
1612 |
type:(self windowType) |
|
1613 |
origin:org |
|
1614 |
extent:(width @ height) |
|
1615 |
minExtent:minExtent |
|
1616 |
maxExtent:maxExtent |
|
1617 |
borderWidth:0 "self borderWidth" |
|
1618 |
subViewOf:nil |
|
1619 |
style:(self windowStyle) |
|
1620 |
inputOnly:(self isInputOnly) |
|
1621 |
label:lbl |
|
1622 |
owner:nil |
|
1623 |
icon:icn iconMask:icnMask |
|
1624 |
iconView:iconView. |
|
4566 | 1625 |
|
1626 |
Lobby registerChange:self. |
|
1627 |
||
1628 |
"/ give global listeners a chance to track views |
|
1629 |
WindowSensor postViewCreateNotification:self. |
|
1630 |
||
5556 | 1631 |
self originChangedFlag:false extentChangedFlag:false. |
4566 | 1632 |
|
5388 | 1633 |
"/ (borderColor notNil and:[borderColor ~= Black]) ifTrue:[ |
1634 |
"/ self setBorderColor |
|
1635 |
"/ ]. |
|
4566 | 1636 |
|
1637 |
"/ (viewGravity notNil "and:[viewGravity ~~ #NorthWest]") ifTrue:[ |
|
6228 | 1638 |
"/ super viewGravity:viewGravity |
4566 | 1639 |
"/ ]. |
1640 |
||
1641 |
"/ (bitGravity notNil "and:[bitGravity ~~ #NorthWest]") ifTrue:[ |
|
6228 | 1642 |
"/ super bitGravity:bitGravity |
4566 | 1643 |
"/ ]. |
1644 |
||
1645 |
viewShape notNil ifTrue:[ |
|
5624 | 1646 |
self setViewShape |
4566 | 1647 |
]. |
1648 |
||
1649 |
(backed notNil and:[backed ~~ false]) ifTrue:[ |
|
6228 | 1650 |
self backingStore:backed. |
4566 | 1651 |
]. |
1652 |
self saveUnder ifTrue:[ |
|
6228 | 1653 |
self saveUnder:true. |
4566 | 1654 |
]. |
1655 |
cursor notNil ifTrue:[ |
|
5624 | 1656 |
self setCursor |
4566 | 1657 |
]. |
1658 |
||
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
|
1659 |
"/JV@2012-11-11: Updated to be ICCCM 2.0 Compliant - some modern Window managers |
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
|
1660 |
"/ provide better UX when application behave nicely. Being |
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
|
1661 |
"/ conformant should not hurt as St/X don't depend on X resources anyway :-) |
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
|
1662 |
"/ See: |
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
|
1663 |
"/ |
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
|
1664 |
"/ http://tronche.com/gui/x/icccm/sec-4.html |
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 |
|
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
|
1666 |
(UserPreferences current icccm20Compliant) ifTrue:[ |
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
|
1667 |
"/ICCCM 2.0 compliant name & class. See ICCCM 2.0 section 4.1.2.5. |
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
|
1668 |
|
6788 | 1669 |
| commandName lastSepIndex | |
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
|
1670 |
|
6788 | 1671 |
commandName := Smalltalk commandName. |
1672 |
lastSepIndex := commandName lastIndexOf: Filename separator. |
|
1673 |
windowNameString := commandName copyFrom: lastSepIndex + 1. |
|
6775 | 1674 |
windowClassNameString := windowNameString asUppercaseFirst. |
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
|
1675 |
|
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
|
1676 |
"/ Also, set _NET_WM_PID |
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
|
1677 |
self setWindowPid: nil. |
5039 | 1678 |
] ifFalse:[ |
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
|
1679 |
"/ Old code..." |
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
|
1680 |
application notNil ifTrue:[ |
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
|
1681 |
windowClassNameString := application class name. |
5624 | 1682 |
] ifFalse:[ |
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
|
1683 |
(self class == StandardSystemView and:[subViews size == 1]) ifTrue:[ |
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
|
1684 |
"This is a subclass of SimpleView wrapped into a StandardSystemView" |
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
|
1685 |
windowClassNameString := subViews first class name. |
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
|
1686 |
] ifFalse:[ |
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
|
1687 |
windowClassNameString := self class name. |
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
|
1688 |
] |
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
|
1689 |
]. |
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
|
1690 |
windowClassNameString := 'Stx.', windowClassNameString. |
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
|
1691 |
windowNameString := 'main'. |
4566 | 1692 |
]. |
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
|
1693 |
|
6228 | 1694 |
self windowClass:windowClassNameString name:windowNameString. |
4566 | 1695 |
|
4807
62e7832829b7
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4800
diff
changeset
|
1696 |
"Modified: / 14-06-1996 / 17:14:25 / stefan" |
5624 | 1697 |
"Modified: / 22-10-2010 / 11:01:35 / cg" |
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
|
1698 |
"Modified: / 04-01-2013 / 16:13:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4566 | 1699 |
! |
1700 |
||
1701 |
postRealize |
|
1702 |
"postRealize actions - tell the application (if any)." |
|
1703 |
||
1704 |
super postRealize. |
|
6245 | 1705 |
|
4566 | 1706 |
"/ |
1707 |
"/ let the application add its views to the current project |
|
1708 |
"/ |
|
1709 |
application notNil ifTrue:[ |
|
6245 | 1710 |
application opened:self. |
4566 | 1711 |
] ifFalse:[ |
6245 | 1712 |
self addToCurrentProject. |
4566 | 1713 |
]. |
1714 |
||
1715 |
"Created: 24.7.1997 / 18:11:26 / cg" |
|
1716 |
! |
|
1717 |
||
1718 |
preRealize |
|
1719 |
"invoked right before the view is realized. |
|
1720 |
preRealize actions - tell the application (if any)." |
|
1721 |
||
1722 |
super preRealize. |
|
1723 |
||
1724 |
application notNil ifTrue:[ |
|
5613 | 1725 |
application aboutToOpen:self. |
4566 | 1726 |
]. |
1727 |
! |
|
1728 |
||
1729 |
recreate |
|
1730 |
"recreate the view after a snap-in or a migration" |
|
1731 |
||
1732 |
super recreate. |
|
1733 |
||
1734 |
iconView notNil ifTrue:[ |
|
6278 | 1735 |
iconView recreate. |
1736 |
self graphicsDevice setWindowIconWindow:iconView in:self drawableId. |
|
1737 |
iconView setRealized:true. |
|
4566 | 1738 |
] ifFalse:[ |
6278 | 1739 |
icon notNil ifTrue:[ |
1740 |
self icon:(self graphicsDevice convertedIcon:icon). |
|
1741 |
]. |
|
4566 | 1742 |
]. |
1743 |
||
1744 |
iconLabel notNil ifTrue:[ |
|
6278 | 1745 |
self graphicsDevice setIconName:iconLabel in:self drawableId |
4566 | 1746 |
] |
1747 |
||
4814 | 1748 |
"Modified: / 30-10-2007 / 16:39:42 / cg" |
4566 | 1749 |
! ! |
1750 |
||
1751 |
!StandardSystemView class methodsFor:'documentation'! |
|
1752 |
||
6048 | 1753 |
version |
6794 | 1754 |
^ '$Header: /cvs/stx/stx/libview/StandardSystemView.st,v 1.231 2015-02-27 13:33:16 cg Exp $' |
6048 | 1755 |
! |
1756 |
||
5388 | 1757 |
version_CVS |
6794 | 1758 |
^ '$Header: /cvs/stx/stx/libview/StandardSystemView.st,v 1.231 2015-02-27 13:33:16 cg Exp $' |
4566 | 1759 |
! ! |
3746
d9dccd3a4a41
beSlave: also try masterApp in setWGFromApplication
Claus Gittinger <cg@exept.de>
parents:
3706
diff
changeset
|
1760 |
|
6047 | 1761 |
|
1878
76e9bc8e1b9c
new hostName in label format
Claus Gittinger <cg@exept.de>
parents:
1865
diff
changeset
|
1762 |
StandardSystemView initialize! |