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