author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 06 Sep 2017 09:47:50 +0200 | |
branch | jv |
changeset 8179 | ced410b68993 |
parent 7856 | 7c52e7a9a087 |
child 8420 | 76e39223f5ab |
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 |
99 |
(especially to freeze a dialogs 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 |
|
422 |
"return the flag which controls if a views label should |
|
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 |
||
429 |
"Created: 10.9.1995 / 19:21:16 / claus" |
|
430 |
! |
|
431 |
||
432 |
includeHostNameInLabel:aBoolean |
|
433 |
"set/clear the flag which controls if a views label should |
|
5613 | 434 |
include the hostname - this is highly useful if you have |
4566 | 435 |
multiple smalltalks open simultaneously ... |
436 |
This flag is usually set/cleared in your private.rc file; |
|
437 |
the default is false." |
|
438 |
||
439 |
IncludeHostNameInLabel := aBoolean |
|
440 |
||
441 |
"Modified: 24.4.1996 / 09:09:21 / cg" |
|
442 |
! |
|
443 |
||
444 |
takeFocusWhenMapped |
|
5613 | 445 |
^ TakeFocusWhenMapped |
4566 | 446 |
|
447 |
" |
|
448 |
StandardSystemView takeFocusWhenMapped |
|
449 |
" |
|
450 |
! |
|
451 |
||
452 |
updateStyleCache |
|
453 |
"extract values from the styleSheet and cache them in class variables" |
|
454 |
||
455 |
<resource: #style (#'standardSystemView.defaultExtent')> |
|
456 |
||
457 |
DefaultExtent := StyleSheet at:'standardSystemView.defaultExtent' default:nil. |
|
458 |
||
459 |
" |
|
460 |
self updateStyleCache |
|
461 |
" |
|
462 |
||
463 |
"Modified: 31.8.1995 / 03:01:14 / claus" |
|
464 |
"Created: 15.8.1997 / 01:34:37 / cg" |
|
465 |
"Modified: 20.10.1997 / 15:13:50 / cg" |
|
466 |
! |
|
467 |
||
468 |
windowLabelFormat |
|
469 |
^ WindowLabelFormat |
|
470 |
! |
|
471 |
||
472 |
windowLabelFormat:aFormatString |
|
473 |
WindowLabelFormat := aFormatString |
|
474 |
! ! |
|
475 |
||
476 |
!StandardSystemView class methodsFor:'image specs'! |
|
477 |
||
478 |
defaultSTXIcon |
|
479 |
<resource: #programImage> |
|
480 |
||
7140 | 481 |
^ Icon stxIcon. |
4566 | 482 |
! ! |
483 |
||
484 |
!StandardSystemView class methodsFor:'startup'! |
|
485 |
||
6073 | 486 |
cancelAutoRaise |
487 |
"cancel any schedule autoraise action" |
|
488 |
||
489 |
|b| |
|
490 |
||
491 |
(b := TimedRaiseAction) notNil ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
492 |
TimedRaiseAction := nil. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
493 |
Processor removeTimeoutWithID:b. |
6073 | 494 |
]. |
495 |
! |
|
496 |
||
4566 | 497 |
start |
498 |
"create, realize the view - this topview and all its subviews will |
|
499 |
run as a separate process with its own windowGroup. |
|
500 |
This method exists for backward compatibility - use open." |
|
501 |
||
502 |
^ self open |
|
503 |
! ! |
|
504 |
||
505 |
!StandardSystemView methodsFor:'Compatibility-ST80'! |
|
506 |
||
507 |
maximumSize |
|
508 |
"same as maxExtent; for ST-80 compatibility" |
|
509 |
||
510 |
^ self maxExtent |
|
511 |
! |
|
512 |
||
513 |
maximumSize:anExtent |
|
514 |
"same as maxExtent; for ST-80 compatibility" |
|
515 |
||
516 |
^ self maxExtent:anExtent |
|
517 |
! |
|
518 |
||
519 |
menuBar |
|
520 |
"return my menuBar or nil if I have none. |
|
521 |
This is only valid for topViews which were built with the UIBuilder." |
|
522 |
||
523 |
^ application builder menuBar |
|
524 |
||
525 |
"Created: / 27.10.1997 / 16:23:13 / cg" |
|
526 |
! |
|
527 |
||
528 |
minimumSize |
|
529 |
"same as minExtent; for ST-80 compatibility" |
|
530 |
||
531 |
^ self minExtent |
|
532 |
! |
|
533 |
||
534 |
minimumSize:anExtent |
|
535 |
"same as minExtent; for ST-80 compatibility" |
|
536 |
||
537 |
^ self minExtent:anExtent |
|
538 |
! |
|
539 |
||
540 |
quit |
|
5613 | 541 |
"same as closeRequest |
4566 | 542 |
(but sometimes sent via the sensors event queue from VW programs)" |
543 |
||
544 |
self closeRequest |
|
545 |
||
546 |
"Created: / 30.10.1997 / 19:23:01 / cg" |
|
547 |
"Modified: / 3.8.1998 / 20:04:22 / cg" |
|
548 |
! ! |
|
549 |
||
550 |
!StandardSystemView methodsFor:'accessing'! |
|
551 |
||
552 |
application |
|
553 |
"return the topViews application. |
|
554 |
This is new protocol for ST-80 compatibility and not yet fully supported" |
|
555 |
||
556 |
^ application |
|
557 |
! |
|
558 |
||
559 |
application:anApplicationModel |
|
560 |
"set the topViews application. |
|
561 |
This is new protocol for ST-80 compatibility and not yet fully supported" |
|
562 |
||
563 |
application := anApplicationModel. |
|
564 |
anApplicationModel notNil ifTrue:[ |
|
565 |
anApplicationModel window isNil ifTrue:[ |
|
566 |
anApplicationModel window:self |
|
567 |
] |
|
568 |
] |
|
569 |
||
570 |
"Modified: 18.4.1996 / 14:55:44 / cg" |
|
7856
7c52e7a9a087
Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7716
diff
changeset
|
571 |
! |
7c52e7a9a087
Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7716
diff
changeset
|
572 |
|
7c52e7a9a087
Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7716
diff
changeset
|
573 |
keyboardMap |
7c52e7a9a087
Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7716
diff
changeset
|
574 |
"Return a KeyboardMap used to translate symbolic shortcuts to real key combinations." |
7c52e7a9a087
Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7716
diff
changeset
|
575 |
|
7c52e7a9a087
Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7716
diff
changeset
|
576 |
| map | |
7c52e7a9a087
Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7716
diff
changeset
|
577 |
|
7c52e7a9a087
Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7716
diff
changeset
|
578 |
application notNil ifTrue:[ |
7c52e7a9a087
Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7716
diff
changeset
|
579 |
[ |
7c52e7a9a087
Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7716
diff
changeset
|
580 |
map := application keyboardMap. |
7c52e7a9a087
Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7716
diff
changeset
|
581 |
] on: MessageNotUnderstood do:[ |
7c52e7a9a087
Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7716
diff
changeset
|
582 |
map := super keyboardMap |
7c52e7a9a087
Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7716
diff
changeset
|
583 |
]. |
7c52e7a9a087
Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7716
diff
changeset
|
584 |
] ifFalse:[ |
7c52e7a9a087
Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7716
diff
changeset
|
585 |
map := super keyboardMap |
7c52e7a9a087
Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7716
diff
changeset
|
586 |
]. |
7c52e7a9a087
Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7716
diff
changeset
|
587 |
^ map |
7c52e7a9a087
Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7716
diff
changeset
|
588 |
|
7c52e7a9a087
Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
7716
diff
changeset
|
589 |
"Created: / 02-02-2017 / 00:18:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4566 | 590 |
! ! |
591 |
||
592 |
!StandardSystemView methodsFor:'accessing-behavior'! |
|
593 |
||
594 |
bePartner |
|
595 |
"define me as a partner-View. |
|
596 |
All partners within the applications windowGroup iconify/deiconify together." |
|
597 |
||
598 |
self setWindowGroupFromApplication. |
|
599 |
super bePartner. |
|
600 |
||
601 |
" |
|
602 |
see example in TopView>>bePartner |
|
603 |
" |
|
604 |
||
605 |
"Created: 22.9.1995 / 17:40:15 / claus" |
|
606 |
"Modified: 6.3.1996 / 16:16:42 / cg" |
|
607 |
! |
|
608 |
||
609 |
beSlave |
|
610 |
"define me as a slave-View. |
|
6122 | 611 |
All slaves within the application's windowGroup iconify/deiconify with the masterView(s) |
4566 | 612 |
(i.e. they follow their master(s))" |
613 |
||
614 |
self setWindowGroupFromApplication. |
|
615 |
super beSlave. |
|
616 |
||
617 |
" |
|
618 |
see example in TopView>>beSlave |
|
619 |
" |
|
620 |
||
6122 | 621 |
"Created: / 22-09-1995 / 17:40:15 / claus" |
622 |
"Modified: / 06-03-1996 / 16:16:50 / cg" |
|
623 |
"Modified (comment): / 28-08-2013 / 21:27:46 / cg" |
|
4566 | 624 |
! |
625 |
||
626 |
sendWindowEvents:collectionOfEventSymbols |
|
627 |
"define the events that are to be forwarded to the application. |
|
628 |
This is being implemented ..." |
|
629 |
||
630 |
windowEventsForApplication := collectionOfEventSymbols |
|
631 |
! |
|
632 |
||
633 |
sizeFixed:aBoolean |
|
634 |
"this prevents the view from resizing itself when realized. |
|
7668 | 635 |
For normal topViews, this is void, since they don't do this anyway. |
4566 | 636 |
|
5613 | 637 |
However, modalBoxes (especially: DialogBoxes) typically resize themselfes |
638 |
to the preferredExtent of their components. In some cases, this behavior is |
|
4566 | 639 |
not desired and it should be turned off by setting sizeFixed to true. |
640 |
||
641 |
To avoid confusion: |
|
7668 | 642 |
This does NOT prevent the window manager from resizing the view, |
643 |
instead it tells the view to NOT resize ITSELF." |
|
4566 | 644 |
|
645 |
sizeFixed := aBoolean. |
|
646 |
||
5613 | 647 |
"example: dialog which resizes itself on #open: |
7668 | 648 |
(thereby ignoring the 200@200 extent) |
4566 | 649 |
|
7668 | 650 |
|dialog| |
4566 | 651 |
|
7668 | 652 |
dialog := Dialog new. |
653 |
dialog addInputFieldOn:'' asValue. |
|
654 |
dialog addOkButton. |
|
655 |
dialog extent:200@200. |
|
656 |
dialog open. |
|
625
4d8f6dc3af75
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
621
diff
changeset
|
657 |
|
4d8f6dc3af75
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
621
diff
changeset
|
658 |
|
4566 | 659 |
using sizeFixed: |
660 |
||
7668 | 661 |
|dialog| |
4566 | 662 |
|
7668 | 663 |
dialog := Dialog new. |
664 |
dialog addInputFieldOn:'' asValue. |
|
665 |
dialog addOkButton. |
|
666 |
dialog extent:200@200; sizeFixed:true. |
|
667 |
dialog open. |
|
625
4d8f6dc3af75
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
621
diff
changeset
|
668 |
|
4d8f6dc3af75
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
621
diff
changeset
|
669 |
|
4566 | 670 |
using openWithExtent (also sets sizeFixed): |
625
4d8f6dc3af75
commentary & category changes
Claus Gittinger <cg@exept.de>
parents:
621
diff
changeset
|
671 |
|
7668 | 672 |
|dialog| |
4566 | 673 |
|
7668 | 674 |
dialog := Dialog new. |
675 |
dialog addInputFieldOn:'' asValue. |
|
676 |
dialog addOkButton. |
|
677 |
dialog openWithExtent:200@200. |
|
4566 | 678 |
" |
679 |
! ! |
|
680 |
||
681 |
!StandardSystemView methodsFor:'accessing-channels'! |
|
682 |
||
683 |
labelChannel |
|
684 |
"return the labelChannel - or nil" |
|
685 |
||
686 |
^ labelChannel. |
|
687 |
! |
|
688 |
||
689 |
labelChannel:aValueHolder |
|
690 |
"set the labelChannel - a valueHolder holding a string |
|
691 |
which is shown as title bar" |
|
692 |
||
693 |
|prev| |
|
694 |
||
695 |
prev := labelChannel. |
|
696 |
labelChannel := aValueHolder. |
|
697 |
self setupChannel:aValueHolder for:nil withOld:prev. |
|
698 |
! ! |
|
699 |
||
700 |
!StandardSystemView methodsFor:'accessing-dimensions'! |
|
701 |
||
702 |
maxExtent |
|
7693 | 703 |
"return the view's maximum allowed extent" |
4566 | 704 |
|
705 |
^ maxExtent |
|
706 |
! |
|
707 |
||
708 |
maxExtent:max |
|
709 |
"define the maximum extent the view may have - |
|
710 |
depends on good-will of window manager" |
|
711 |
||
7080 | 712 |
|id| |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
713 |
|
4566 | 714 |
maxExtent ~= max ifTrue:[ |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
715 |
maxExtent := max. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
716 |
maxExtent x isNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
717 |
maxExtent := 99999 @ maxExtent y. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
718 |
]. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
719 |
maxExtent y isNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
720 |
maxExtent := maxExtent x @ 99999. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
721 |
]. |
4566 | 722 |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
723 |
(id := self drawableId) notNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
724 |
device setWindowMinExtent:nil maxExtent:max in:id |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
725 |
]. |
4566 | 726 |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
727 |
"/ if my current extent is larger than the new |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
728 |
"/ maxExtent, adjust. |
4566 | 729 |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
730 |
(width notNil and:[height notNil]) ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
731 |
((width > (max x)) or: |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
732 |
[height > (max y)]) ifTrue: [ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
733 |
self extent:(max min:self extent) |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
734 |
] |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
735 |
] |
4566 | 736 |
]. |
737 |
! |
|
738 |
||
739 |
minExtent |
|
7693 | 740 |
"return the view's minimum allowed extent" |
4566 | 741 |
|
742 |
^ minExtent |
|
743 |
! |
|
744 |
||
745 |
minExtent:min |
|
746 |
"define the minimum extent the view may have - |
|
747 |
depends on good-will of window manager" |
|
748 |
||
7080 | 749 |
|id| |
750 |
||
4566 | 751 |
minExtent ~= min ifTrue:[ |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
752 |
minExtent := min. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
753 |
(id := self drawableId) notNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
754 |
device setWindowMinExtent:min maxExtent:nil in:id |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
755 |
]. |
4566 | 756 |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
757 |
"/ if my current extent is smaller than the new |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
758 |
"/ minExtent, adjust. |
4566 | 759 |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
760 |
(width notNil and:[height notNil]) ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
761 |
((width < (min x)) or: |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
762 |
[height < (min y)]) ifTrue: [ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
763 |
self extent:(min max:self extent) |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
764 |
] |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
765 |
] |
4566 | 766 |
] |
767 |
! ! |
|
768 |
||
769 |
!StandardSystemView methodsFor:'accessing-look'! |
|
770 |
||
771 |
icon |
|
772 |
"return the form defined as icon" |
|
773 |
||
774 |
^ icon value |
|
775 |
! |
|
776 |
||
777 |
icon:aFormOrImage |
|
778 |
"define the form or image (bitmap) used as icon" |
|
779 |
||
780 |
|i m iconValue| |
|
781 |
||
782 |
icon := aFormOrImage. |
|
783 |
iconValue := icon value. |
|
784 |
iconValue notNil ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
785 |
self drawableId notNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
786 |
i := device convertedIcon:iconValue. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
787 |
(i notNil and:[i id notNil]) ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
788 |
(m := iconValue mask) notNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
789 |
m := device convertedIconMask:m. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
790 |
]. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
791 |
device setWindowIcon:i mask:m in:self drawableId |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
792 |
] |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
793 |
] |
4566 | 794 |
] |
795 |
||
4814 | 796 |
"Modified: / 30-10-2007 / 16:39:15 / cg" |
4566 | 797 |
! |
798 |
||
799 |
iconLabel |
|
800 |
"return the name displayed in the icon" |
|
801 |
||
802 |
^ iconLabel |
|
803 |
! |
|
804 |
||
805 |
iconLabel:aString |
|
806 |
"define the name to be displayed in the icon" |
|
807 |
||
808 |
|newLabel| |
|
809 |
||
810 |
(newLabel := aString string) ~= iconLabel ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
811 |
iconLabel := newLabel. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
812 |
self drawableId notNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
813 |
device setIconName:newLabel in:self drawableId. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
814 |
" |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
815 |
unbuffered - to make it visible right NOW |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
816 |
" |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
817 |
self flush. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
818 |
] |
4566 | 819 |
] |
820 |
! |
|
821 |
||
822 |
iconMask |
|
823 |
"return the form defined as iconMask. |
|
824 |
Notice, that many windowManagers ignore this mask |
|
825 |
(usually, only managers which place icons on the background desktop |
|
826 |
care for an icon - if at all ...)" |
|
827 |
||
828 |
|mask| |
|
829 |
||
830 |
"/ only images possibly have iconMasks |
|
831 |
icon notNil ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
832 |
(mask := icon value mask) notNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
833 |
^ device convertedIconMask:mask |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
834 |
] |
4566 | 835 |
]. |
836 |
||
837 |
^ nil |
|
838 |
||
4815 | 839 |
"Modified: / 30-10-2007 / 20:59:40 / cg" |
4566 | 840 |
! |
841 |
||
842 |
iconName:aString |
|
843 |
"this method will vanish soon ... - for backward compatibility" |
|
844 |
||
845 |
<resource:#obsolete> |
|
846 |
||
847 |
self obsoleteMethodWarning:'use #iconLabel:'. |
|
848 |
self iconLabel:aString |
|
849 |
! |
|
850 |
||
851 |
iconView |
|
852 |
"return the view used as icon-view" |
|
853 |
||
854 |
^ iconView |
|
855 |
! |
|
856 |
||
857 |
iconView:aView |
|
858 |
"specify the view to be used as icon. |
|
859 |
This may not be supported on all display types" |
|
860 |
||
861 |
iconView := aView. |
|
6278 | 862 |
self drawableId notNil ifTrue:[ |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
863 |
aView create. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
864 |
device setWindowIconWindow:aView in:self drawableId. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
865 |
aView setRealized:true. |
4566 | 866 |
] |
867 |
||
868 |
"Modified: 4.4.1997 / 16:21:37 / cg" |
|
869 |
! |
|
870 |
||
871 |
label |
|
7693 | 872 |
"return the view's name in the title area" |
4566 | 873 |
|
874 |
^ label |
|
875 |
! |
|
876 |
||
877 |
label:aString |
|
6245 | 878 |
"define the view's name in the window's title area. |
879 |
If IncludeHostNameInLabel is true, prepend the hostname - now done in windowLabelFor: |
|
4566 | 880 |
(you will appreciate this, if you are working on multiple |
881 |
machines simultaneously - as I do ...)" |
|
882 |
||
5066 | 883 |
|newLabel expandedLabel| |
4566 | 884 |
|
4633 | 885 |
newLabel := aString. |
886 |
newLabel notNil ifTrue:[newLabel := newLabel string]. |
|
887 |
newLabel ~= label ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
888 |
label := newLabel. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
889 |
"/ 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
|
890 |
self drawableId notNil "realized" ifTrue: [ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
891 |
expandedLabel := self windowLabelFor:label. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
892 |
self windowName:(expandedLabel ? ''). |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
893 |
shown ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
894 |
" |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
895 |
unbuffered - to make it visible right NOW |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
896 |
" |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
897 |
self flush. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
898 |
] |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
899 |
] |
4566 | 900 |
] |
901 |
||
4633 | 902 |
"Created: / 08-09-1995 / 19:37:06 / claus" |
903 |
"Modified: / 06-10-2006 / 11:55:06 / cg" |
|
4566 | 904 |
! |
905 |
||
906 |
label:labelString iconLabel:iconLabelString |
|
907 |
"set both the label and the iconLabel" |
|
908 |
||
909 |
self label:labelString. |
|
910 |
self iconLabel:iconLabelString |
|
911 |
! ! |
|
912 |
||
913 |
!StandardSystemView methodsFor:'change & update'! |
|
914 |
||
915 |
update:something with:aParameter from:changedObject |
|
916 |
"the MVC way of changing the label ..." |
|
917 |
||
918 |
changedObject notNil ifTrue:[ |
|
5613 | 919 |
changedObject == labelChannel ifTrue:[ |
920 |
self label:labelChannel value. |
|
921 |
^ self |
|
922 |
]. |
|
4566 | 923 |
]. |
924 |
^ super update:something with:aParameter from:changedObject |
|
925 |
! ! |
|
926 |
||
927 |
!StandardSystemView methodsFor:'destroying'! |
|
928 |
||
929 |
release |
|
930 |
self removeFromCurrentProject. |
|
931 |
labelChannel notNil ifTrue:[ |
|
5613 | 932 |
labelChannel removeDependent:self. |
933 |
labelChannel := nil. |
|
4566 | 934 |
]. |
935 |
windowGroup notNil ifTrue:[ |
|
5613 | 936 |
windowGroup focusSequence:nil. |
4566 | 937 |
]. |
938 |
super release. |
|
939 |
! |
|
940 |
||
941 |
saveAndTerminate |
|
5613 | 942 |
"save & terminate request from the windowManager. The application should |
4566 | 943 |
save its data/files/text etc. somehow and close. |
944 |
If there is an application, let it decide how do do that. |
|
945 |
Otherwise, forward it to superclasses which knows how to do this. |
|
946 |
(it defaults to a terminate there). |
|
947 |
Notice, that not all windowmanagers are nice enough |
|
948 |
to send this request; some simply distroy the view." |
|
949 |
||
950 |
application notNil ifTrue:[ |
|
951 |
application saveAndTerminateRequestFor:self |
|
952 |
] ifFalse:[ |
|
953 |
super saveAndTerminate |
|
954 |
] |
|
955 |
! |
|
956 |
||
957 |
terminate |
|
958 |
"terminate request from the windowManager. If there is an application, |
|
959 |
let it decide if it really wants to be close. Otherwise, forward it to |
|
960 |
superclasses terminate which knows how to do this. |
|
961 |
Notice, that not all windowmanagers are nice enough |
|
962 |
to send this request; some simply distroy the view." |
|
963 |
||
964 |
application notNil ifTrue:[ |
|
965 |
application closeRequestFor:self |
|
966 |
] ifFalse:[ |
|
967 |
self closeRequest. |
|
968 |
] |
|
969 |
||
970 |
"Modified: / 3.8.1998 / 19:49:45 / cg" |
|
971 |
! ! |
|
972 |
||
973 |
!StandardSystemView methodsFor:'event handling'! |
|
974 |
||
6646 | 975 |
delayedAutoRaiseEvent |
6048 | 976 |
"called with a delay by the focusIn code, iff the userPref setting is active. |
977 |
Some (a small number only) may want to prevent autoraise in certain situations |
|
978 |
- for example, if one view is controlling another. These get a chance to redefine this |
|
979 |
method" |
|
980 |
||
6073 | 981 |
|wg app| |
6049 | 982 |
|
6071 | 983 |
"/ not, if my windowGroup is in a modal or popup action |
6073 | 984 |
((wg := self windowGroup) notNil |
985 |
and:[ wg isInModalLoop not |
|
986 |
and:[ wg mainGroup isInModalLoop not |
|
987 |
and:[ self isModal not ]]]) ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
988 |
self sensor anyButtonPressed ifFalse:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
989 |
"/ if I have an application, let it decide |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
990 |
(app := self application) notNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
991 |
app delayedAutoRaiseEventFor:self |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
992 |
] ifFalse:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
993 |
self raise. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
994 |
]. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
995 |
] |
6071 | 996 |
] |
6048 | 997 |
! |
998 |
||
4566 | 999 |
focusIn |
1000 |
"the view got the keyboard focus (via the window manager). |
|
1001 |
I.e. the mouse was moved out into the topView area - restore the |
|
1002 |
focus to the previous focusView.." |
|
1003 |
||
6721 | 1004 |
|viewToGetFocus viewUnderMousePointer ms| |
4566 | 1005 |
|
1006 |
windowGroup notNil ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1007 |
"/ a hack for window managers, which do not honor the |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1008 |
"/ WMTransientFor attribute (i.e. XQuartz). |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1009 |
"/ This flag would prevent a popup (dialog or notification) from being |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1010 |
"/ 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
|
1011 |
"/ 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
|
1012 |
"/ 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
|
1013 |
"/ 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
|
1014 |
"/ 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
|
1015 |
"/ 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
|
1016 |
"/ then click on the underlying codeView, to raise it. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1017 |
"/ if the smallLint view can be covered, your WM is broken. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1018 |
"/ 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
|
1019 |
"/ 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
|
1020 |
"/ windowGroup topViews first raise. |
6772 | 1021 |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1022 |
"/ I got the focus - tell the current focus-windowgroup |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1023 |
"/ that its focus is gone elsewhere ... |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1024 |
"/ 'focusIn ' print. windowGroup process name printCR. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1025 |
"/ 'focusView is ' print. windowGroup focusView printCR. |
4566 | 1026 |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1027 |
"/ although the foucs has usually already been taken (see focusOut), |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1028 |
"/ there are situations where this does not happen; |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1029 |
"/ 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
|
1030 |
"/ 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
|
1031 |
"/ at the time the focus event arrives. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1032 |
"/ Anyway: it should not matter to take it again... |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1033 |
WindowGroup takeFocusFromDevice:device. |
4566 | 1034 |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1035 |
windowGroup isInModalLoop ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1036 |
windowGroup allTopViewsDo:[:t | |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1037 |
t ~~ self ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1038 |
t focusIn. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1039 |
t raise. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1040 |
^ self. |
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 |
] |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1043 |
]. |
6772 | 1044 |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1045 |
"/ Transcript show:self; show:' focus in '; showCR:windowGroup isInModalLoop. |
6646 | 1046 |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1047 |
viewToGetFocus := windowGroup focusView. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1048 |
viewToGetFocus isNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1049 |
UserPreferences current focusFollowsMouse ~~ false ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1050 |
viewUnderMousePointer := windowGroup pointerView. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1051 |
"/ 'viewUnderMousePointer is ' print. viewUnderMousePointer printCR. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1052 |
(viewUnderMousePointer notNil |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1053 |
and:[viewUnderMousePointer isKeyboardConsumer |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1054 |
and:[viewUnderMousePointer wantsFocusWithPointerEnter]]) ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1055 |
viewToGetFocus := viewUnderMousePointer. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1056 |
] |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1057 |
]. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1058 |
]. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1059 |
viewToGetFocus isNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1060 |
windowGroup focusBackToPreviousFocusView. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1061 |
windowGroup focusView isNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1062 |
self assignInitialKeyboardFocus. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1063 |
]. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1064 |
] ifFalse:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1065 |
"/ v requestFocus. - will be denied; but we must force it here |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1066 |
"/ to force a change... |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1067 |
windowGroup setFocusView:nil. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1068 |
windowGroup focusView:viewToGetFocus byTab:nil. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1069 |
]. |
6047 | 1070 |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1071 |
"/ optionally bring the window to the front after some delay. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1072 |
"/ 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
|
1073 |
(ms := UserPreferences current autoRaiseOnFocusInDelay) notNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1074 |
self scheduleAutoRaiseAfter:ms |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1075 |
]. |
4566 | 1076 |
]. |
1077 |
super focusIn |
|
1078 |
||
5675 | 1079 |
"Modified: / 20-01-2011 / 20:51:20 / cg" |
4566 | 1080 |
! |
1081 |
||
1082 |
focusOut |
|
1083 |
"the top-view lost the keyboard focus (via the window manager). |
|
1084 |
I.e. the mouse was moved out of the topView area." |
|
1085 |
||
6787 | 1086 |
|v wg| |
4566 | 1087 |
|
6148 | 1088 |
"/ 'fout ' print. self printCR. |
1089 |
||
6787 | 1090 |
(wg := windowGroup) notNil ifTrue:[ |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1091 |
"/ ' fout-focusView: ' print. windowGroup focusView printCR. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1092 |
(v := wg focusView) notNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1093 |
"/ wg focusView:nil. "/ -- let windowGroup do it. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1094 |
v showNoFocus:(windowGroup explicitFocusView == v). |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1095 |
"/ ' send-has-nofocus to: ' print. v printCR. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1096 |
v hasKeyboardFocus:false. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1097 |
] |
4566 | 1098 |
]. |
1099 |
super focusOut |
|
1100 |
||
1101 |
"Modified: 25.2.1997 / 23:19:46 / cg" |
|
1102 |
! |
|
1103 |
||
6100
409e2909e130
Added StandardSystemView>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6079
diff
changeset
|
1104 |
processShortcut:aKeyEvent |
409e2909e130
Added StandardSystemView>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6079
diff
changeset
|
1105 |
"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
|
1106 |
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
|
1107 |
|
409e2909e130
Added StandardSystemView>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6079
diff
changeset
|
1108 |
application notNil ifTrue:[ |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1109 |
(application processShortcut:aKeyEvent) ifTrue:[ ^ true ] |
6101
ea437d17677d
Fix in StandardSystemView>>#processShortcut:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6100
diff
changeset
|
1110 |
]. |
ea437d17677d
Fix in StandardSystemView>>#processShortcut:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6100
diff
changeset
|
1111 |
^super processShortcut:aKeyEvent |
6100
409e2909e130
Added StandardSystemView>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6079
diff
changeset
|
1112 |
|
409e2909e130
Added StandardSystemView>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6079
diff
changeset
|
1113 |
"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
|
1114 |
"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
|
1115 |
! |
409e2909e130
Added StandardSystemView>>#processShortcut: to allow per-application
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6079
diff
changeset
|
1116 |
|
6073 | 1117 |
scheduleAutoRaiseAfter:ms |
1118 |
"bring the window to the front after some delay. |
|
1119 |
but not, if my windowGroup is in a modal or popup action" |
|
1120 |
||
1121 |
|wg actionID| |
|
1122 |
||
6646 | 1123 |
(wg := self windowGroup) isNil ifTrue:[^ self]. |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1124 |
wg isInModalLoop ifTrue:[^ self]. |
6646 | 1125 |
wg mainGroup isInModalLoop ifTrue:[^ self]. |
1126 |
"/ self isModal ifTrue:[^ self]. |
|
1127 |
||
1128 |
TimedRaiseAction notNil ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1129 |
Processor removeTimeoutWithID:TimedRaiseAction. |
6646 | 1130 |
]. |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1131 |
TimedRaiseAction := actionID := Processor |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1132 |
addTimedBlock: |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1133 |
[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1134 |
TimedRaiseAction == actionID ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1135 |
TimedRaiseAction := nil. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1136 |
self sensor pushUserEvent: #delayedAutoRaiseEvent for: self |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1137 |
]. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1138 |
] |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1139 |
afterMilliseconds:ms. |
6073 | 1140 |
! |
1141 |
||
4566 | 1142 |
showActivity:someMessage |
1143 |
"some activityNotification shalt be communicated to |
|
1144 |
the user. Forward it to my application (if any). |
|
1145 |
(that one should know how to deal with it). |
|
1146 |
Otherwise, simply ignore it." |
|
1147 |
||
1148 |
application notNil ifTrue:[ |
|
1149 |
application showActivity:someMessage |
|
1150 |
] |
|
1151 |
||
1152 |
"Created: 16.12.1995 / 18:40:44 / cg" |
|
1153 |
"Modified: 23.4.1996 / 21:38:11 / cg" |
|
1154 |
! ! |
|
1155 |
||
1156 |
!StandardSystemView methodsFor:'initialization & release'! |
|
1157 |
||
1158 |
addToCurrentProject |
|
1159 |
"add the receiver (a topview) to the current projects set-of-views. |
|
1160 |
(If there is a current project)" |
|
1161 |
||
1162 |
|p| |
|
1163 |
||
1164 |
" |
|
1165 |
the following check allows systems |
|
1166 |
without projects and changeSets |
|
1167 |
" |
|
1168 |
(Project notNil and:[(p := Project current) notNil]) ifTrue:[ |
|
1169 |
p addView: self |
|
1170 |
] |
|
1171 |
! |
|
1172 |
||
1173 |
defaultControllerClass |
|
1174 |
"for ST-80 compatibility only - not used in ST/X" |
|
1175 |
||
1176 |
^ nil "/ StandardSystemController |
|
1177 |
! |
|
1178 |
||
1179 |
initEvents |
|
1180 |
super initEvents. |
|
1181 |
self enableFocusEvents. |
|
1182 |
! |
|
1183 |
||
1184 |
initialize |
|
1185 |
super initialize. |
|
1186 |
||
5388 | 1187 |
"/ self setBorderWidth:2. "- notice: many window managers ignore this" |
7263 | 1188 |
device isWindowsPlatform ifTrue:[ |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1189 |
minExtent := 0 @ 0. |
4566 | 1190 |
] ifFalse:[ |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1191 |
minExtent := 10 @ 10. |
4566 | 1192 |
]. |
1193 |
||
1194 |
label isNil ifTrue:[label := self class defaultLabel]. |
|
1195 |
icon isNil ifTrue:[icon := self class defaultIcon]. |
|
5942 | 1196 |
sizeFixed := false. |
1197 |
||
1198 |
"Modified: / 27-10-2012 / 12:16:39 / cg" |
|
4566 | 1199 |
! |
1200 |
||
5659 | 1201 |
mapped |
1202 |
super mapped. |
|
7263 | 1203 |
device isWindowsPlatform ifTrue:[ |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1204 |
"don't do this in X11 - switching between |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1205 |
virtual desktops would change the window stacking all the time" |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1206 |
self setForegroundWindow. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1207 |
self activate. |
5743 | 1208 |
]. |
5659 | 1209 |
|
1210 |
"Created: / 01-12-2010 / 15:57:22 / cg" |
|
1211 |
! |
|
1212 |
||
4566 | 1213 |
reAdjustGeometry |
1214 |
"sent as a final step when an image is restarted. |
|
5613 | 1215 |
when we come up on a smaller display, |
4566 | 1216 |
make certain, that the receiver is visible" |
1217 |
||
6278 | 1218 |
|dX dY limitRight limitBottom graphicsDevice| |
4566 | 1219 |
|
7263 | 1220 |
graphicsDevice := device. |
6278 | 1221 |
dX := (graphicsDevice horizontalPixelPerMillimeter * 20) rounded. |
1222 |
dY := (graphicsDevice verticalPixelPerMillimeter * 20) rounded. |
|
4566 | 1223 |
|
6278 | 1224 |
limitRight := graphicsDevice usableWidth - dX. |
1225 |
limitBottom := graphicsDevice usableHeight - dY. |
|
4566 | 1226 |
((self left > limitRight) or:[ |
1227 |
self top > limitBottom]) ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1228 |
'StandardSystemView [info]: moving view into visible area' infoPrintCR. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1229 |
self origin:limitRight @ limitBottom |
4566 | 1230 |
] |
1231 |
||
1232 |
"Modified: 10.1.1997 / 15:12:19 / cg" |
|
1233 |
! |
|
1234 |
||
1235 |
reinitialize |
|
7562 | 1236 |
"reopen the receiver if it was visible before. |
4566 | 1237 |
This is called right after snapIn; Notice, that all instance variables |
1238 |
(such as shown, realized etc.) are left-overs from the time the snapout |
|
1239 |
was done. Remap the receiver, if it was mapped at snapout time" |
|
1240 |
||
1241 |
|myController| |
|
1242 |
||
1243 |
"if I have already been reinited - return" |
|
6278 | 1244 |
self drawableId notNil ifTrue:[ |
7562 | 1245 |
^ self |
4566 | 1246 |
]. |
1247 |
||
5613 | 1248 |
"have to kludge with the controller |
4566 | 1249 |
- otherwise its startup performs unwanted actions ..." |
1250 |
||
1251 |
myController := controller. |
|
1252 |
controller := nil. |
|
1253 |
||
1254 |
"physically create the view & subviews" |
|
1255 |
self recreate. |
|
1256 |
||
1257 |
"if I was iconified (not realized), remap iconified" |
|
7263 | 1258 |
device |
7562 | 1259 |
mapView:self id:self drawableId iconified:(realized "shown" not) |
1260 |
atX:left y:top width:width height:height |
|
1261 |
minExtent:minExtent maxExtent:maxExtent. |
|
24 | 1262 |
|
4566 | 1263 |
"and restart the window-group process" |
1264 |
windowGroup notNil ifTrue:[ |
|
7562 | 1265 |
windowGroup restart |
4566 | 1266 |
]. |
24 | 1267 |
|
4566 | 1268 |
"restore controller" |
1269 |
controller := myController |
|
1270 |
||
1271 |
"Modified: / 6.5.1999 / 09:50:13 / cg" |
|
1272 |
! |
|
1273 |
||
1274 |
removeFromCurrentProject |
|
1275 |
"remove the receiver (a topview) from the current projects set-of-views. |
|
1276 |
(If there is a current project)" |
|
1277 |
||
1278 |
|p| |
|
1279 |
||
1280 |
" |
|
1281 |
the following check allows systems |
|
1282 |
without projects and changeSets |
|
1283 |
" |
|
1284 |
(Project notNil and:[(p := Project current) notNil]) ifTrue:[ |
|
1285 |
p removeView:self |
|
1286 |
] |
|
1287 |
! |
|
1288 |
||
1289 |
restarted |
|
1290 |
"sent by my windowGroup, when restarted from an image. |
|
1291 |
Nothing done here, but can be redefined to perform any actions |
|
1292 |
required to reset the application after an image-restart. |
|
1293 |
(for example: check if application files are still around, restart |
|
1294 |
subprocesses etc.)." |
|
1295 |
||
1296 |
application notNil ifTrue:[ |
|
1297 |
application restarted |
|
1298 |
]. |
|
1299 |
! ! |
|
1300 |
||
1301 |
!StandardSystemView methodsFor:'printing & storing'! |
|
1302 |
||
5233
fb88be5a3dea
define #printOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
5086
diff
changeset
|
1303 |
printOn:aStream |
4566 | 1304 |
"just for your convenience in inspectors ... |
7693 | 1305 |
... add the view's label to the displayString." |
4566 | 1306 |
|
5233
fb88be5a3dea
define #printOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
5086
diff
changeset
|
1307 |
super printOn:aStream. |
4566 | 1308 |
label notNil ifTrue:[ |
7693 | 1309 |
aStream nextPut:$(. label printOn:aStream. aStream nextPut:$). |
4566 | 1310 |
]. |
1311 |
! ! |
|
1312 |
||
1313 |
!StandardSystemView methodsFor:'private'! |
|
1314 |
||
1315 |
convertedIcon |
|
1316 |
"make certain, that the icon is compatible with my device; |
|
1317 |
this means converting it to a format (typically: monochrome) which |
|
1318 |
the device supports. Return a compatible version of the icon." |
|
1319 |
||
7263 | 1320 |
^ device convertedIcon:icon |
4566 | 1321 |
|
4814 | 1322 |
"Modified: / 30-10-2007 / 16:39:55 / cg" |
4566 | 1323 |
! |
1324 |
||
1325 |
convertedIcon:iconArg |
|
1326 |
"make certain, that the image argument is compatible with my device; |
|
1327 |
this means converting it to a format (typically: monochrome) which |
|
1328 |
the device supports. Return a compatible version of the icon." |
|
1329 |
||
7263 | 1330 |
^ device convertedIcon:iconArg |
4566 | 1331 |
|
4814 | 1332 |
"Modified: / 30-10-2007 / 16:37:31 / cg" |
4566 | 1333 |
! |
1334 |
||
1335 |
convertedIconMask:aMask |
|
1336 |
"return a version of the argument which can be used as an iconMask |
|
1337 |
on my device. Typically, this means conversion to a monochrome |
|
1338 |
mask - future versions may add alpha channel masks, if the device supports |
|
1339 |
them ..." |
|
1340 |
||
7263 | 1341 |
^ device convertedIconMask:aMask |
4566 | 1342 |
|
4814 | 1343 |
"Modified: / 30-10-2007 / 16:38:58 / cg" |
4566 | 1344 |
! |
1345 |
||
1346 |
setWindowGroupFromApplication |
|
1347 |
"get the applications topView and set my windowGroup to its wg." |
|
1348 |
||
1349 |
|win master| |
|
1350 |
||
1351 |
windowGroup isNil ifTrue:[ |
|
5613 | 1352 |
application notNil ifTrue:[ |
1353 |
(win := application window) notNil ifTrue:[ |
|
1354 |
win ~~ self ifTrue:[ |
|
1355 |
windowGroup := win windowGroup. |
|
1356 |
^ self |
|
1357 |
]. |
|
1358 |
(master := application masterApplication) notNil ifTrue:[ |
|
1359 |
(win := master window) notNil ifTrue:[ |
|
1360 |
windowGroup := win windowGroup. |
|
1361 |
^ self |
|
1362 |
]. |
|
1363 |
]. |
|
1364 |
] |
|
1365 |
] |
|
4566 | 1366 |
]. |
1367 |
||
1368 |
"Created: 22.9.1995 / 17:40:36 / claus" |
|
1369 |
"Modified: 6.3.1996 / 16:17:32 / cg" |
|
1370 |
! |
|
1371 |
||
1372 |
windowLabelFor:labelString |
|
1373 |
"return an expanded labelString, according to the hostName-in-window setting. |
|
1374 |
The labelString may include positional parameters: |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1375 |
%1 - the actual label |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1376 |
%2 - the hostname |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1377 |
%3 - the userName |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1378 |
%4 - the processId |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1379 |
%5 - the TOP-directories name |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1380 |
%6 - the TOP-directories path |
4566 | 1381 |
" |
1382 |
||
6504 | 1383 |
|wg proc id pidString lbl windowLabelFormat stxPackageDirectory topDirectory| |
4566 | 1384 |
|
1385 |
(IncludeHostNameInLabel == true |
|
1386 |
and:[(windowLabelFormat := self class windowLabelFormat) notNil]) ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1387 |
(wg := self windowGroup) notNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1388 |
(proc := wg process) notNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1389 |
(id := proc id) notNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1390 |
pidString := id printString |
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 |
]. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1394 |
stxPackageDirectory := Smalltalk getPackageDirectoryForPackage:'stx'. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1395 |
stxPackageDirectory isNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1396 |
'StdSysView [info]: cannot figure out stx package directory.' infoPrintCR. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1397 |
stxPackageDirectory := OperatingSystem pathOfSTXExecutable asFilename. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1398 |
]. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1399 |
stxPackageDirectory isNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1400 |
topDirectory := OperatingSystem getHomeDirectory asFilename. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1401 |
] ifFalse:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1402 |
topDirectory := stxPackageDirectory directory. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1403 |
"/ 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
|
1404 |
topDirectory baseName = 'Packages' ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1405 |
topDirectory := topDirectory directory |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1406 |
]. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1407 |
]. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1408 |
lbl := windowLabelFormat |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1409 |
bindWith:labelString |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1410 |
with:[OperatingSystem getHostName] |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1411 |
with:[OperatingSystem getLoginName] |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1412 |
with:pidString |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1413 |
with:[topDirectory baseName] |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1414 |
with:[topDirectory pathName]. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1415 |
^ lbl |
4566 | 1416 |
]. |
1417 |
^ labelString |
|
1418 |
||
1419 |
"Created: / 22-09-1997 / 10:10:32 / cg" |
|
1420 |
"Modified: / 22-08-2006 / 11:42:53 / cg" |
|
1421 |
! ! |
|
1422 |
||
1423 |
!StandardSystemView methodsFor:'queries'! |
|
1424 |
||
1425 |
processName |
|
1426 |
"return a string to be shown for my process in the |
|
1427 |
process monitor. This has no semantic meaning, but exists |
|
1428 |
for your convenience only." |
|
1429 |
||
1430 |
application notNil ifTrue:[ |
|
1431 |
^ application processName |
|
1432 |
]. |
|
1433 |
label notNil ifTrue:[^ label]. |
|
1434 |
^ super processName |
|
1435 |
||
1436 |
"Modified: 24.4.1996 / 09:47:01 / cg" |
|
1437 |
! ! |
|
1438 |
||
1439 |
!StandardSystemView methodsFor:'realization'! |
|
1440 |
||
1441 |
collapse |
|
1442 |
"iconify the receiver" |
|
1443 |
||
1444 |
shown ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1445 |
self unmap. |
4566 | 1446 |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1447 |
"if it was iconified, try to remap iconified" |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1448 |
device |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1449 |
mapView:self id:self drawableId iconified:true |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1450 |
atX:left y:top width:width height:height |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1451 |
minExtent:minExtent maxExtent:maxExtent. |
5086
0a18f82d02ec
sending of visibility-change fixed
Claus Gittinger <cg@exept.de>
parents:
5066
diff
changeset
|
1452 |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1453 |
shown ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1454 |
shown := false. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1455 |
dependents notNil ifTrue:[ self changed:#visibility ]. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1456 |
]. |
4566 | 1457 |
]. |
1458 |
||
1459 |
" |
|
1460 |
|top| |
|
1461 |
||
1462 |
top := StandardSystemView new. |
|
1463 |
top label:'hello'. |
|
1464 |
top openAndWait. |
|
1465 |
Delay waitForSeconds:2. |
|
1466 |
top collapse. |
|
1467 |
Delay waitForSeconds:2. |
|
1468 |
top expand. |
|
1469 |
" |
|
1470 |
||
1471 |
"Modified: 24.7.1997 / 12:32:17 / cg" |
|
1472 |
! |
|
1473 |
||
1474 |
create |
|
1475 |
"create - make certain that icon is available" |
|
1476 |
||
1477 |
super create. |
|
1478 |
||
1479 |
iconView notNil ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1480 |
iconView create. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1481 |
device setWindowIconWindow:iconView in:self drawableId. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1482 |
iconView setRealized:true. |
4566 | 1483 |
]. |
1484 |
iconLabel notNil ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1485 |
device setIconName:iconLabel string in:self drawableId |
4566 | 1486 |
] |
1487 |
||
1488 |
"Modified: 10.6.1996 / 20:14:50 / cg" |
|
1489 |
! |
|
1490 |
||
1491 |
expand |
|
1492 |
"de-iconify the receiver at its old position" |
|
1493 |
||
1494 |
shown ifFalse:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1495 |
self unmap. |
4566 | 1496 |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1497 |
"if it was iconified, try to remap non-iconified" |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1498 |
device |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1499 |
mapView:self id:self drawableId iconified:false |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1500 |
atX:left y:top width:width height:height |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1501 |
minExtent:minExtent maxExtent:maxExtent. |
4566 | 1502 |
]. |
1503 |
||
1504 |
" |
|
1505 |
|top| |
|
1506 |
||
1507 |
top := StandardSystemView new. |
|
1508 |
top label:'hello'. |
|
1509 |
top openAndWait. |
|
1510 |
top collapse. |
|
1511 |
Delay waitForSeconds:5. |
|
1512 |
top expand. |
|
1513 |
" |
|
1514 |
||
1515 |
"Modified: / 3.2.1998 / 16:02:56 / cg" |
|
1516 |
! |
|
1517 |
||
1518 |
physicalCreate |
|
1519 |
"common code for create & recreate" |
|
1520 |
||
7263 | 1521 |
|dev currentUserPrefs lbl iconValue icn icnMask windowClassNameString org devBounds windowNameString| |
6228 | 1522 |
|
7263 | 1523 |
dev := device. |
1524 |
currentUserPrefs := UserPreferences current. |
|
1525 |
currentUserPrefs forceWindowsIntoMonitorBounds ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1526 |
"/ MULTI SCREEN support |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1527 |
devBounds := dev monitorBoundsAt:( left @ top ). |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1528 |
"/ adjust origin, if too large |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1529 |
left + width > devBounds right ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1530 |
left := devBounds right - width. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1531 |
]. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1532 |
top + height > devBounds bottom ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1533 |
top := devBounds bottom - height. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1534 |
]. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1535 |
top := top max:(devBounds top). |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1536 |
left := left max:(devBounds left). |
5532 | 1537 |
]. |
1538 |
||
6871 | 1539 |
dev isWindowsPlatform ifTrue:[ |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1540 |
top := top + dev captionHeight. |
6871 | 1541 |
]. |
5613 | 1542 |
org := (left @ top) rounded. |
4566 | 1543 |
lbl := self windowLabelFor:label. |
1544 |
||
1545 |
icon notNil ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1546 |
iconValue := icon value. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1547 |
icn := dev convertedIcon:iconValue. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1548 |
(icnMask := iconValue mask) notNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1549 |
icnMask := dev convertedIconMask:icnMask. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1550 |
]. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1551 |
"this is to keep the references" |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1552 |
deviceIcon := Array with:icn with:icnMask. |
4566 | 1553 |
]. |
1554 |
||
1555 |
"/ give global eventListeners a chance to intercept windowCreation |
|
1556 |
"/ and provide another origin (by payching my origin via setOrigin:). |
|
1557 |
WindowSensor preViewCreateNotification:self. |
|
1558 |
||
6283 | 1559 |
gc |
6228 | 1560 |
createWindowFor:self |
1561 |
type:(self windowType) |
|
1562 |
origin:org |
|
1563 |
extent:(width @ height) |
|
1564 |
minExtent:minExtent |
|
1565 |
maxExtent:maxExtent |
|
1566 |
borderWidth:0 "self borderWidth" |
|
1567 |
subViewOf:nil |
|
1568 |
style:(self windowStyle) |
|
1569 |
inputOnly:(self isInputOnly) |
|
1570 |
label:lbl |
|
1571 |
owner:nil |
|
1572 |
icon:icn iconMask:icnMask |
|
1573 |
iconView:iconView. |
|
4566 | 1574 |
|
1575 |
"/ give global listeners a chance to track views |
|
1576 |
WindowSensor postViewCreateNotification:self. |
|
1577 |
||
5556 | 1578 |
self originChangedFlag:false extentChangedFlag:false. |
4566 | 1579 |
|
5388 | 1580 |
"/ (borderColor notNil and:[borderColor ~= Black]) ifTrue:[ |
1581 |
"/ self setBorderColor |
|
1582 |
"/ ]. |
|
4566 | 1583 |
|
1584 |
"/ (viewGravity notNil "and:[viewGravity ~~ #NorthWest]") ifTrue:[ |
|
6228 | 1585 |
"/ super viewGravity:viewGravity |
4566 | 1586 |
"/ ]. |
1587 |
||
1588 |
"/ (bitGravity notNil "and:[bitGravity ~~ #NorthWest]") ifTrue:[ |
|
6228 | 1589 |
"/ super bitGravity:bitGravity |
4566 | 1590 |
"/ ]. |
1591 |
||
1592 |
viewShape notNil ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1593 |
self setViewShape |
4566 | 1594 |
]. |
1595 |
||
1596 |
(backed notNil and:[backed ~~ false]) ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1597 |
self backingStore:backed. |
4566 | 1598 |
]. |
1599 |
self saveUnder ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1600 |
self saveUnder:true. |
4566 | 1601 |
]. |
1602 |
cursor notNil ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1603 |
self setCursor |
4566 | 1604 |
]. |
1605 |
||
4807
62e7832829b7
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4800
diff
changeset
|
1606 |
"Modified: / 14-06-1996 / 17:14:25 / stefan" |
5975
3d74c7895143
ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5942
diff
changeset
|
1607 |
"Modified: / 04-01-2013 / 16:13:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6871 | 1608 |
"Modified: / 22-05-2015 / 21:09:35 / cg" |
4566 | 1609 |
! |
1610 |
||
1611 |
postRealize |
|
1612 |
"postRealize actions - tell the application (if any)." |
|
1613 |
||
1614 |
super postRealize. |
|
6245 | 1615 |
|
4566 | 1616 |
"/ |
1617 |
"/ let the application add its views to the current project |
|
1618 |
"/ |
|
1619 |
application notNil ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1620 |
application opened:self. |
4566 | 1621 |
] ifFalse:[ |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1622 |
self addToCurrentProject. |
4566 | 1623 |
]. |
1624 |
||
1625 |
"Created: 24.7.1997 / 18:11:26 / cg" |
|
1626 |
! |
|
1627 |
||
1628 |
preRealize |
|
1629 |
"invoked right before the view is realized. |
|
1630 |
preRealize actions - tell the application (if any)." |
|
1631 |
||
1632 |
super preRealize. |
|
1633 |
||
1634 |
application notNil ifTrue:[ |
|
5613 | 1635 |
application aboutToOpen:self. |
4566 | 1636 |
]. |
1637 |
! |
|
1638 |
||
1639 |
recreate |
|
1640 |
"recreate the view after a snap-in or a migration" |
|
1641 |
||
1642 |
super recreate. |
|
1643 |
||
1644 |
iconView notNil ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1645 |
iconView recreate. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1646 |
device setWindowIconWindow:iconView in:self drawableId. |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1647 |
iconView setRealized:true. |
4566 | 1648 |
] ifFalse:[ |
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1649 |
icon notNil ifTrue:[ |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1650 |
self icon:(device convertedIcon:icon). |
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1651 |
]. |
4566 | 1652 |
]. |
1653 |
||
1654 |
iconLabel notNil ifTrue:[ |
|
7416
bd3b9e9edd9e
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
7398
diff
changeset
|
1655 |
device setIconName:iconLabel in:self drawableId |
4566 | 1656 |
] |
1657 |
||
4814 | 1658 |
"Modified: / 30-10-2007 / 16:39:42 / cg" |
4566 | 1659 |
! ! |
1660 |
||
1661 |
!StandardSystemView class methodsFor:'documentation'! |
|
1662 |
||
6048 | 1663 |
version |
7080 | 1664 |
^ '$Header$' |
6048 | 1665 |
! |
1666 |
||
5388 | 1667 |
version_CVS |
7080 | 1668 |
^ '$Header$' |
4566 | 1669 |
! ! |
3746
d9dccd3a4a41
beSlave: also try masterApp in setWGFromApplication
Claus Gittinger <cg@exept.de>
parents:
3706
diff
changeset
|
1670 |
|
6047 | 1671 |
|
1878
76e9bc8e1b9c
new hostName in label format
Claus Gittinger <cg@exept.de>
parents:
1865
diff
changeset
|
1672 |
StandardSystemView initialize! |