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