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