0
|
1 |
"
|
6
|
2 |
COPYRIGHT (c) 1990 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 |
"
|
|
12 |
|
|
13 |
StandardSystemView subclass:#ModalBox
|
89
|
14 |
instanceVariableNames:'shadowView exclusiveKeyboard '
|
72
|
15 |
classVariableNames:'UseTransientViews'
|
0
|
16 |
poolDictionaries:''
|
|
17 |
category:'Views-Basic'
|
|
18 |
!
|
|
19 |
|
|
20 |
ModalBox comment:'
|
6
|
21 |
COPYRIGHT (c) 1990 by Claus Gittinger
|
72
|
22 |
All Rights Reserved
|
54
|
23 |
|
134
|
24 |
$Header: /cvs/stx/stx/libview/ModalBox.st,v 1.21 1995-05-03 00:04:18 claus Exp $
|
2
|
25 |
'!
|
|
26 |
|
|
27 |
!ModalBox class methodsFor:'documentation'!
|
|
28 |
|
46
|
29 |
copyright
|
|
30 |
"
|
|
31 |
COPYRIGHT (c) 1990 by Claus Gittinger
|
72
|
32 |
All Rights Reserved
|
46
|
33 |
|
|
34 |
This software is furnished under a license and may be used
|
|
35 |
only in accordance with the terms of that license and with the
|
|
36 |
inclusion of the above copyright notice. This software may not
|
|
37 |
be provided or otherwise made available to, or used by, any
|
|
38 |
other person. No title to or ownership of the software is
|
|
39 |
hereby transferred.
|
|
40 |
"
|
|
41 |
!
|
|
42 |
|
|
43 |
version
|
|
44 |
"
|
134
|
45 |
$Header: /cvs/stx/stx/libview/ModalBox.st,v 1.21 1995-05-03 00:04:18 claus Exp $
|
46
|
46 |
"
|
|
47 |
!
|
|
48 |
|
2
|
49 |
documentation
|
|
50 |
"
|
46
|
51 |
this class implements modal boxes; ModalBoxes are different from
|
81
|
52 |
others, in that they take control over the current topview, until
|
|
53 |
all processing is done (i.e. the currently active topview and all of
|
|
54 |
its subviews will not handle user events while the box is active).
|
89
|
55 |
|
|
56 |
ModalBoxes are either implemented as transient windows
|
|
57 |
(if UseTransientViews := true) or as override redirect views.
|
|
58 |
Some window managers have problems with either; so you may want to
|
|
59 |
change the default setting from your display.rc file.
|
2
|
60 |
"
|
|
61 |
! !
|
|
62 |
|
|
63 |
!ModalBox class methodsFor:'initialization'!
|
0
|
64 |
|
2
|
65 |
initialize
|
89
|
66 |
UseTransientViews := true.
|
|
67 |
! !
|
|
68 |
|
|
69 |
!ModalBox class methodsFor:'defaults'!
|
|
70 |
|
|
71 |
defaultExtent
|
|
72 |
"this defines the defaultExtent for instances of me;
|
|
73 |
the value returned here is usually not correct for concrete subclasses,
|
|
74 |
so you better redefine this method"
|
|
75 |
|
|
76 |
^ (Display pixelPerMillimeter * (60 @ 30)) rounded
|
|
77 |
!
|
|
78 |
|
|
79 |
useTransientViews:aBoolean
|
|
80 |
"change the way modalBoxes are created on the Display.
|
|
81 |
If the argument is true, transient views are used; otherwise
|
|
82 |
override redirect views are used. Depending on your windowmanager,
|
|
83 |
either one may have problems. You may want to change the setting
|
|
84 |
from your display.rc or d_xxx.rc file."
|
|
85 |
|
|
86 |
UseTransientViews := aBoolean.
|
|
87 |
|
|
88 |
"
|
|
89 |
ModalBox useTransient:false
|
|
90 |
ModalBox useTransient:true
|
|
91 |
"
|
2
|
92 |
! !
|
0
|
93 |
|
|
94 |
!ModalBox methodsFor:'initialize / release'!
|
|
95 |
|
|
96 |
initialize
|
89
|
97 |
|form resizeButton moveButton|
|
81
|
98 |
|
0
|
99 |
super initialize.
|
|
100 |
|
12
|
101 |
exclusiveKeyboard := false.
|
72
|
102 |
label := ' '.
|
12
|
103 |
|
89
|
104 |
label := 'Popup'.
|
|
105 |
|
81
|
106 |
UseTransientViews ifFalse:[
|
72
|
107 |
(StyleSheet at:#popupShadow default:false) ifTrue:[
|
|
108 |
shadowView := (ShadowView on:device) for:self
|
89
|
109 |
].
|
|
110 |
|
|
111 |
form := Form width:8 height:8
|
|
112 |
fromArray:#[2r00000000
|
|
113 |
2r00000000
|
|
114 |
2r00000000
|
|
115 |
2r00000001
|
|
116 |
2r00000011
|
|
117 |
2r00000111
|
|
118 |
2r00001111
|
|
119 |
2r00011111
|
|
120 |
]
|
|
121 |
on:device.
|
|
122 |
resizeButton := Button form:form in:self.
|
|
123 |
resizeButton origin:1.0 @ 1.0 corner:1.0@1.0.
|
|
124 |
resizeButton activeForegroundColor:(resizeButton foregroundColor).
|
|
125 |
resizeButton activeBackgroundColor:(resizeButton backgroundColor).
|
|
126 |
resizeButton enteredBackgroundColor:(resizeButton backgroundColor).
|
|
127 |
resizeButton leftInset:-8; topInset:-8.
|
|
128 |
resizeButton releaseAction:[].
|
|
129 |
resizeButton pressAction:[resizeButton turnOff; redraw. self doResize].
|
|
130 |
resizeButton borderWidth:0.
|
|
131 |
resizeButton onLevel:0; offLevel:0.
|
|
132 |
resizeButton cursor:(Cursor corner).
|
|
133 |
|
|
134 |
form := Form width:8 height:8
|
|
135 |
fromArray:#[2r11111000
|
|
136 |
2r11110000
|
|
137 |
2r11100000
|
|
138 |
2r11000000
|
|
139 |
2r10000000
|
|
140 |
2r00000000
|
|
141 |
2r00000000
|
|
142 |
2r00000000
|
|
143 |
]
|
|
144 |
on:device.
|
|
145 |
moveButton := Button form:form in:self.
|
|
146 |
moveButton origin:0.0 @ 0.0 corner:0.0@0.0.
|
|
147 |
moveButton activeForegroundColor:(moveButton foregroundColor).
|
|
148 |
moveButton activeBackgroundColor:(moveButton backgroundColor).
|
|
149 |
moveButton enteredBackgroundColor:(moveButton backgroundColor).
|
|
150 |
moveButton rightInset:-8; bottomInset:-8.
|
|
151 |
moveButton releaseAction:[].
|
|
152 |
moveButton pressAction:[moveButton turnOff; redraw. self doMove].
|
|
153 |
moveButton borderWidth:0.
|
|
154 |
moveButton onLevel:0; offLevel:0.
|
|
155 |
moveButton cursor:(Cursor origin)
|
81
|
156 |
].
|
|
157 |
|
12
|
158 |
!
|
|
159 |
|
72
|
160 |
initEvents
|
89
|
161 |
super initEvents.
|
72
|
162 |
self enableEvent:#visibilityChange
|
|
163 |
!
|
|
164 |
|
12
|
165 |
initStyle
|
|
166 |
super initStyle.
|
46
|
167 |
((style ~~ #normal) and:[style ~~ #mswindows]) ifTrue:[
|
72
|
168 |
borderWidth := 0.
|
89
|
169 |
UseTransientViews ifFalse:[
|
|
170 |
self level:2
|
|
171 |
]
|
0
|
172 |
]
|
|
173 |
!
|
|
174 |
|
72
|
175 |
reinitialize
|
|
176 |
super reinitialize.
|
|
177 |
self unrealize.
|
|
178 |
!
|
|
179 |
|
0
|
180 |
addToCurrentProject
|
|
181 |
"ignored here"
|
|
182 |
|
|
183 |
^ self
|
|
184 |
!
|
|
185 |
|
|
186 |
destroy
|
12
|
187 |
shadowView notNil ifTrue:[
|
72
|
188 |
shadowView destroy.
|
|
189 |
shadowView := nil
|
12
|
190 |
].
|
|
191 |
self leaveControl. "just to make sure"
|
0
|
192 |
super destroy.
|
|
193 |
!
|
|
194 |
|
|
195 |
create
|
|
196 |
super create.
|
72
|
197 |
shadowView notNil ifTrue:[
|
|
198 |
self saveUnder:true
|
2
|
199 |
]
|
0
|
200 |
!
|
|
201 |
|
|
202 |
createOnTop
|
81
|
203 |
^ UseTransientViews not
|
|
204 |
!
|
|
205 |
|
|
206 |
resize
|
|
207 |
"resize myself to make everything visible"
|
|
208 |
|
|
209 |
|newExtent|
|
|
210 |
|
|
211 |
newExtent := self preferedExtent.
|
|
212 |
newExtent = self extent ifTrue:[^ self].
|
|
213 |
|
|
214 |
(shown and:[shadowView notNil]) ifTrue:[
|
|
215 |
shadowView unrealize.
|
|
216 |
self extent:newExtent.
|
|
217 |
shadowView realize.
|
|
218 |
self raise
|
|
219 |
] ifFalse:[
|
|
220 |
self extent:newExtent.
|
|
221 |
].
|
|
222 |
! !
|
|
223 |
|
|
224 |
!ModalBox methodsFor:'queries'!
|
|
225 |
|
|
226 |
preferedExtent
|
|
227 |
"return the extent required to make all components
|
|
228 |
visible in myself. This should be redefined in
|
|
229 |
subclasses."
|
|
230 |
|
|
231 |
^ self class defaultExtent
|
0
|
232 |
! !
|
|
233 |
|
54
|
234 |
!ModalBox methodsFor:'accessing'!
|
|
235 |
|
|
236 |
exclusiveKeyboard:aBoolean
|
|
237 |
"set/clear exclusive locking of the keyboard;
|
|
238 |
If set, the box will take total control over the
|
|
239 |
keyboard, not allowing input to other views/boxes
|
|
240 |
while active.
|
|
241 |
Danger: only use this for very very urgent boxes, since
|
|
242 |
no interaction with any view on the screen is possible then."
|
|
243 |
|
|
244 |
exclusiveKeyboard := aBoolean
|
|
245 |
! !
|
|
246 |
|
0
|
247 |
!ModalBox methodsFor:'show / hide'!
|
|
248 |
|
|
249 |
mapped
|
|
250 |
"wait till visible for grabbing"
|
|
251 |
|
|
252 |
super mapped.
|
12
|
253 |
|
|
254 |
"take it away from any popup menu possibly still active"
|
|
255 |
|
81
|
256 |
device ungrabKeyboard.
|
|
257 |
device ungrabPointer.
|
12
|
258 |
|
54
|
259 |
"
|
|
260 |
if I am a super-modal box, take the keyboard
|
|
261 |
"
|
12
|
262 |
exclusiveKeyboard ifTrue:[
|
81
|
263 |
device grabKeyboardInView:self.
|
12
|
264 |
].
|
|
265 |
|
89
|
266 |
"/ UseTransientViews ifFalse:[
|
|
267 |
"
|
|
268 |
get the focus
|
|
269 |
"
|
|
270 |
self getKeyboardFocus.
|
|
271 |
self enableEnterLeaveEvents
|
|
272 |
"/ ]
|
0
|
273 |
!
|
|
274 |
|
12
|
275 |
fixPosition:aPoint
|
72
|
276 |
"set origin to aPoint, but make sure, that the box is fully visible
|
|
277 |
by shifting it into the visible screen area if nescessary.
|
|
278 |
This prevents invisible modalBoxes (which you could never close)."
|
0
|
279 |
|
|
280 |
self origin:aPoint.
|
54
|
281 |
self makeFullyVisible
|
12
|
282 |
!
|
|
283 |
|
113
|
284 |
fixSize
|
134
|
285 |
"this is sent right before the modalBox is made visible;
|
|
286 |
If the size is not fixed, adjust my size."
|
113
|
287 |
|
134
|
288 |
sizeFixed == true ifFalse:[
|
|
289 |
self resize.
|
|
290 |
].
|
113
|
291 |
super fixSize.
|
|
292 |
!
|
|
293 |
|
12
|
294 |
positionOffset
|
|
295 |
"return the delta, by which the box should be
|
72
|
296 |
displaced from the mouse pointer.
|
|
297 |
Usually redefined in subclasses to have the most convenient
|
|
298 |
ok-button appear under the pointer."
|
12
|
299 |
|
|
300 |
^ (width // 2) @ (height // 2)
|
|
301 |
!
|
|
302 |
|
46
|
303 |
open
|
72
|
304 |
"default for modalboxes is to come up modal at the pointer position"
|
46
|
305 |
|
72
|
306 |
^ self showAtPointer
|
46
|
307 |
!
|
|
308 |
|
72
|
309 |
openModal:aBlock
|
54
|
310 |
"open the box modal;
|
|
311 |
In addition to the basic (inherited) modalloop, change
|
72
|
312 |
the current active windowgroups cursors to the busy-stop cursor, show
|
54
|
313 |
a shadow, and raise the box."
|
|
314 |
|
72
|
315 |
|mainGroup mainView useTransient|
|
|
316 |
|
81
|
317 |
useTransient := UseTransientViews.
|
72
|
318 |
|
|
319 |
"
|
|
320 |
show a stop-cursor in the current group
|
|
321 |
"
|
|
322 |
mainGroup := WindowGroup activeGroup.
|
|
323 |
mainGroup notNil ifTrue:[
|
|
324 |
mainGroup := mainGroup mainGroup.
|
|
325 |
mainGroup notNil ifTrue:[
|
|
326 |
mainGroup showCursor:(Cursor stop).
|
|
327 |
]
|
|
328 |
].
|
|
329 |
|
|
330 |
mainGroup isNil ifTrue:[
|
|
331 |
useTransient := false
|
|
332 |
].
|
|
333 |
|
|
334 |
useTransient ifTrue:[
|
|
335 |
mainGroup topViews notNil ifTrue:[
|
|
336 |
mainView := mainGroup topViews first.
|
|
337 |
].
|
|
338 |
mainView isNil ifTrue:[
|
|
339 |
useTransient := false.
|
|
340 |
]
|
|
341 |
].
|
54
|
342 |
|
72
|
343 |
useTransient ifTrue:[
|
|
344 |
shadowView := nil.
|
|
345 |
] ifFalse:[
|
|
346 |
shadowView notNil ifTrue:[shadowView realize].
|
54
|
347 |
].
|
|
348 |
self raise.
|
72
|
349 |
|
|
350 |
mainGroup notNil ifTrue:[
|
|
351 |
"
|
|
352 |
flush pending key & mouse events.
|
|
353 |
this avoids pre-characters
|
|
354 |
to be put into the view ...
|
|
355 |
"
|
|
356 |
"/ mainGroup sensor flushUserEvents.
|
|
357 |
].
|
|
358 |
|
|
359 |
useTransient ifTrue:[
|
|
360 |
device setTransient:drawableId for:(mainView id).
|
|
361 |
].
|
129
|
362 |
|
|
363 |
[
|
|
364 |
super openModal:aBlock.
|
|
365 |
] valueNowOrOnUnwindDo:[
|
|
366 |
"
|
|
367 |
restore cursors in the main group
|
|
368 |
"
|
|
369 |
mainGroup notNil ifTrue:[
|
|
370 |
mainGroup restoreCursors
|
|
371 |
]
|
|
372 |
].
|
|
373 |
|
72
|
374 |
mainGroup notNil ifTrue:[
|
|
375 |
"
|
|
376 |
flush any key & mouse events which arrived
|
|
377 |
while the box was open (avoids stray input).
|
|
378 |
"
|
|
379 |
mainGroup sensor flushUserEvents.
|
|
380 |
].
|
54
|
381 |
!
|
|
382 |
|
12
|
383 |
show
|
72
|
384 |
"make myself visible (at the last or default position) and take control"
|
12
|
385 |
|
|
386 |
self fixSize.
|
72
|
387 |
self makeFullyVisible.
|
54
|
388 |
self openModal
|
72
|
389 |
|
|
390 |
"
|
|
391 |
|b|
|
|
392 |
|
|
393 |
b := InfoBox title:'hello'.
|
|
394 |
b show.
|
|
395 |
"
|
12
|
396 |
!
|
|
397 |
|
|
398 |
showAt:aPoint
|
|
399 |
"make myself visible at aPoint.
|
|
400 |
Fix position to make box fully visible"
|
|
401 |
|
|
402 |
self fixSize.
|
|
403 |
self fixPosition:aPoint.
|
54
|
404 |
self openModal
|
72
|
405 |
|
|
406 |
"
|
|
407 |
|b|
|
|
408 |
|
|
409 |
b := InfoBox title:'hello'.
|
|
410 |
b showAt:(0 @ 0).
|
|
411 |
b showAt:(400 @ 400).
|
|
412 |
"
|
|
413 |
!
|
|
414 |
|
|
415 |
showAt:aPoint center:center
|
|
416 |
"make myself visible at aPoint. center specifies
|
|
417 |
if the view should show up centered around aPoint."
|
|
418 |
|
|
419 |
self showAt:aPoint centerX:center centerY:center
|
|
420 |
|
|
421 |
"
|
|
422 |
|b|
|
|
423 |
|
|
424 |
b := InfoBox title:'hello'.
|
|
425 |
b showAt:(100 @ 100) center:true.
|
|
426 |
b showAt:(100 @ 100) center:false.
|
|
427 |
"
|
|
428 |
!
|
|
429 |
|
|
430 |
showAt:aPoint centerX:centerX centerY:centerY
|
|
431 |
"make myself visible at aPoint. centerX/centerY specify
|
|
432 |
if the view should show up centered around aPoint.
|
|
433 |
Fix position to make box fully visible"
|
|
434 |
|
|
435 |
|dx dy|
|
|
436 |
|
|
437 |
self fixSize.
|
|
438 |
centerX ifTrue:[
|
|
439 |
dx := self width // 2.
|
|
440 |
] ifFalse:[
|
|
441 |
dx := 0
|
|
442 |
].
|
|
443 |
centerY ifTrue:[
|
|
444 |
dy := self height // 2.
|
|
445 |
] ifFalse:[
|
|
446 |
dy := 0
|
|
447 |
].
|
|
448 |
self origin:(aPoint - (dx @ dy)).
|
|
449 |
self makeFullyVisible.
|
|
450 |
self openModal
|
|
451 |
|
|
452 |
"
|
|
453 |
|b|
|
|
454 |
|
|
455 |
b := InfoBox title:'hello'.
|
|
456 |
b showAt:(100 @ 100).
|
|
457 |
b showAt:(100 @ 100) centerX:true centerY:false.
|
|
458 |
"
|
54
|
459 |
!
|
|
460 |
|
|
461 |
showAtCenter
|
|
462 |
"make myself visible at the screen center."
|
|
463 |
|
72
|
464 |
self showAt:(device center) center:true
|
|
465 |
|
|
466 |
"
|
|
467 |
|b|
|
|
468 |
|
|
469 |
b := InfoBox title:'hello'.
|
|
470 |
b showAtCenter.
|
|
471 |
"
|
|
472 |
!
|
|
473 |
|
|
474 |
showCenteredIn:aView
|
|
475 |
"make myself visible at the screen center."
|
|
476 |
|
|
477 |
|top|
|
|
478 |
|
|
479 |
top := aView topView.
|
|
480 |
top raise.
|
|
481 |
self showAt:(top center + (aView originRelativeTo:top)) center:true
|
|
482 |
|
|
483 |
"
|
|
484 |
|b|
|
|
485 |
|
|
486 |
b := InfoBox title:'hello'.
|
|
487 |
b showCenteredIn:Transcript.
|
|
488 |
"
|
0
|
489 |
!
|
|
490 |
|
|
491 |
showAtPointer
|
12
|
492 |
"make myself visible at mouse pointer shifted to have
|
66
|
493 |
convenient button under cursor. self positionOffset should
|
|
494 |
return that offset (usually redefined, since we dont know here,
|
|
495 |
which button should be under cursor)."
|
12
|
496 |
|
|
497 |
self fixSize.
|
66
|
498 |
self fixPosition:(device pointerPosition - self positionOffset).
|
|
499 |
self openModal
|
72
|
500 |
|
|
501 |
"
|
|
502 |
|b|
|
|
503 |
|
|
504 |
b := InfoBox title:'hello'.
|
|
505 |
b showAtPointer.
|
|
506 |
"
|
0
|
507 |
!
|
|
508 |
|
|
509 |
showAtPointerNotCovering:aView
|
12
|
510 |
"make myself visible at mouse pointer shifted to have
|
|
511 |
convenient button under cursor.
|
54
|
512 |
Fix position to make box fully visible and to make sure that
|
12
|
513 |
aView is not covered."
|
|
514 |
|
54
|
515 |
|pos newX|
|
0
|
516 |
|
12
|
517 |
pos := device pointerPosition - self positionOffset.
|
54
|
518 |
|
|
519 |
((Rectangle origin:pos extent:self extent)
|
72
|
520 |
intersects: (aView origin corner: aView corner))
|
54
|
521 |
ifTrue:[
|
72
|
522 |
"
|
|
523 |
try to the right of the untouchable view
|
|
524 |
"
|
|
525 |
newX := (aView origin x + aView width).
|
|
526 |
newX + width > device width ifTrue:[
|
|
527 |
newX := device width - width
|
|
528 |
].
|
|
529 |
pos x:newX.
|
54
|
530 |
|
|
531 |
|
72
|
532 |
((Rectangle origin:pos extent:self extent)
|
|
533 |
intersects: (aView origin corner: aView corner))
|
|
534 |
ifTrue:[
|
|
535 |
"
|
|
536 |
try to the left of the untouchable view
|
|
537 |
"
|
|
538 |
newX := aView origin x - width.
|
|
539 |
"
|
|
540 |
should look for vertical possibilities too ...
|
|
541 |
"
|
|
542 |
pos x:newX.
|
|
543 |
]
|
54
|
544 |
|
0
|
545 |
].
|
12
|
546 |
self showAt:pos
|
0
|
547 |
!
|
|
548 |
|
|
549 |
hide
|
54
|
550 |
"make the receiver invisible and leave control"
|
0
|
551 |
|
59
|
552 |
|p|
|
|
553 |
|
12
|
554 |
shadowView notNil ifTrue:[shadowView unrealize].
|
89
|
555 |
windowGroup notNil ifTrue:[windowGroup focusView:nil].
|
121
|
556 |
self leaveControl.
|
0
|
557 |
self unrealize.
|
12
|
558 |
device synchronizeOutput.
|
59
|
559 |
|
|
560 |
(windowGroup notNil and:[(p := windowGroup previousGroup) notNil]) ifTrue:[
|
72
|
561 |
"
|
|
562 |
this is a kludge for IRIS which does not provide backingstore:
|
|
563 |
when we hide a modalbox (such as a searchbox) which covered
|
|
564 |
a scrollbar, the scrollbars bitblt-method will copy from the
|
|
565 |
not-yet redrawn area - effectively clearing the scroller.
|
82
|
566 |
We need a short delay here, since at this time, the expose event has
|
72
|
567 |
not yet arrived.
|
|
568 |
"
|
|
569 |
(Delay forSeconds:0.1) wait.
|
|
570 |
p processExposeEvents
|
59
|
571 |
].
|
54
|
572 |
!
|
|
573 |
|
|
574 |
autoHideAfter:seconds with:anAction
|
|
575 |
"install a background process, which hides the box
|
|
576 |
after some time. Also, if non-nil, anAction will be
|
72
|
577 |
evaluated then. The action will not be evaluated if
|
|
578 |
the box is closed by the user pressing a button."
|
54
|
579 |
|
72
|
580 |
"the implementation is simple: just fork of a process
|
|
581 |
to hide me."
|
54
|
582 |
[
|
72
|
583 |
(Delay forSeconds:seconds) wait.
|
|
584 |
self shown ifTrue:[
|
|
585 |
self hide.
|
|
586 |
anAction notNil ifTrue:[anAction value]
|
|
587 |
]
|
54
|
588 |
] forkAt:4.
|
|
589 |
|
|
590 |
"
|
|
591 |
|b|
|
|
592 |
|
|
593 |
b := InfoBox title:'hello there'.
|
|
594 |
b autoHideAfter:5 with:[].
|
|
595 |
b showAtCenter.
|
|
596 |
"
|
|
597 |
! !
|
|
598 |
|
89
|
599 |
!ModalBox methodsFor:'move & resize'!
|
|
600 |
|
|
601 |
doMove
|
|
602 |
"the move button was pressed"
|
|
603 |
|
|
604 |
|r|
|
|
605 |
|
|
606 |
r := device rectangleFromUser:(self origin corner:self corner).
|
|
607 |
shadowView notNil ifTrue:[
|
|
608 |
shadowView unrealize
|
|
609 |
].
|
|
610 |
self origin:r origin extent:(r extent max:(100@100)).
|
|
611 |
shadowView notNil ifTrue:[
|
|
612 |
shadowView realize.
|
|
613 |
self raise
|
|
614 |
].
|
|
615 |
!
|
54
|
616 |
|
81
|
617 |
doResize
|
|
618 |
"the resize button was pressed"
|
|
619 |
|
|
620 |
|r|
|
|
621 |
|
|
622 |
r := device rectangleFromUser:(self origin corner:self corner).
|
|
623 |
shadowView notNil ifTrue:[
|
|
624 |
shadowView unrealize
|
|
625 |
].
|
|
626 |
self origin:r origin extent:(r extent max:(100@100)).
|
|
627 |
shadowView notNil ifTrue:[
|
|
628 |
shadowView realize.
|
|
629 |
self raise
|
|
630 |
].
|
89
|
631 |
! !
|
|
632 |
|
|
633 |
!ModalBox methodsFor:'event handling'!
|
|
634 |
|
|
635 |
terminate
|
|
636 |
"this is the close from a windowmanager
|
|
637 |
(only if UseTransientViews == true)"
|
|
638 |
|
|
639 |
self hide
|
81
|
640 |
!
|
|
641 |
|
72
|
642 |
visibilityChange:how
|
|
643 |
"raise when covered - this should not be needed, since we
|
|
644 |
have been created as override-redirect window (which should
|
|
645 |
stay on top - but some window managers (fvwm) seem to ignore
|
|
646 |
this ..."
|
|
647 |
|
89
|
648 |
"the code below is not good, since it will lead to
|
72
|
649 |
oscillating raises when two modalBoxes are going to cover
|
|
650 |
each other - see coveredBy:-handling ..."
|
|
651 |
|
|
652 |
"/ how ~~ #fullyVisible ifTrue:[
|
|
653 |
"/ self raise
|
|
654 |
"/ ]
|
|
655 |
!
|
|
656 |
|
|
657 |
coveredBy:aView
|
|
658 |
"the receiver has been covered by another view.
|
|
659 |
If the other view is a non-modal one, raise"
|
|
660 |
|
|
661 |
|mainGroup topViews|
|
|
662 |
|
|
663 |
"
|
|
664 |
if the other view is not a modal- (or shadow-, or popup-) -view,
|
|
665 |
bring myself to the front again.
|
|
666 |
"
|
|
667 |
aView createOnTop ifFalse:[
|
|
668 |
"
|
|
669 |
if I have a mainGroup,
|
|
670 |
only raise if its one of my maingroup-views
|
|
671 |
"
|
|
672 |
windowGroup notNil ifTrue:[
|
|
673 |
mainGroup := windowGroup mainGroup.
|
|
674 |
mainGroup notNil ifTrue:[
|
|
675 |
topViews := mainGroup topViews.
|
|
676 |
topViews notNil ifTrue:[
|
|
677 |
topViews do:[:aTopView |
|
|
678 |
aView == aTopView ifTrue:[
|
|
679 |
self raise.
|
|
680 |
^ self
|
|
681 |
]
|
|
682 |
]
|
|
683 |
].
|
|
684 |
^ self
|
|
685 |
]
|
|
686 |
].
|
|
687 |
self raise
|
|
688 |
]
|
|
689 |
!
|
|
690 |
|
54
|
691 |
pointerEnter:state x:x y:y
|
89
|
692 |
"mhmh: this seems to be a special X kludge;
|
54
|
693 |
without the following, we will not regain input focus after
|
89
|
694 |
pointer is reentered."
|
54
|
695 |
|
89
|
696 |
self getKeyboardFocus.
|
54
|
697 |
super pointerEnter:state x:x y:y
|
0
|
698 |
! !
|
|
699 |
|
|
700 |
!ModalBox methodsFor:'private'!
|
|
701 |
|
54
|
702 |
leaveControl
|
12
|
703 |
exclusiveKeyboard ifTrue:[
|
72
|
704 |
device ungrabKeyboard
|
12
|
705 |
]
|
0
|
706 |
! !
|