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