author | Claus Gittinger <cg@exept.de> |
Thu, 06 Jul 2000 09:52:44 +0200 | |
changeset 3219 | 9197f5be48d1 |
parent 3179 | 7bc06fd99d81 |
child 3307 | bc96492a48de |
permissions | -rw-r--r-- |
0 | 1 |
" |
6 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
72 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
3219 | 13 |
"{ Package: 'stx:libview' }" |
14 |
||
135 | 15 |
TopView subclass:#PopUpView |
3088 | 16 |
instanceVariableNames:'shadowView haveControl exclusivePointer mapTime |
17 |
previousPointerGrab previousKeyboardGrab' |
|
485 | 18 |
classVariableNames:'DefaultShadow DefaultLevel DefaultBorderWidth DefaultBorderColor' |
19 |
poolDictionaries:'' |
|
20 |
category:'Views-Basic' |
|
0 | 21 |
! |
22 |
||
1174
6889dc61d701
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
23 |
!PopUpView class methodsFor:'documentation'! |
2 | 24 |
|
46 | 25 |
copyright |
26 |
" |
|
27 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
72 | 28 |
All Rights Reserved |
46 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
2 | 39 |
documentation |
40 |
" |
|
46 | 41 |
this class implements an abstract superclass for all views which bypass the |
89 | 42 |
window manager and pop up on top of the screen. A typical example is |
43 |
a PopUpMenu. PopUpView itself is abstract, providing basic mechanisms. |
|
44 |
They are not decorated by window managers. |
|
2 | 45 |
|
616 | 46 |
[styleSheet parameters:] |
2 | 47 |
|
616 | 48 |
popupShadow <Boolean> if true, popupViews show a shadow below |
49 |
popupLevel <nil | Integer> 3D level |
|
50 |
popupBorderWidth <nil | Integer> borderWidth |
|
51 |
||
52 |
[author:] |
|
53 |
Claus Gittinger |
|
2 | 54 |
" |
55 |
! ! |
|
56 |
||
1174
6889dc61d701
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
57 |
!PopUpView class methodsFor:'defaults'! |
0 | 58 |
|
59 |
defaultExtent |
|
587 | 60 |
"return the default extent of my instances. |
61 |
The value returned here is usually ignored, and |
|
62 |
the value from preferredExtent taken instead." |
|
63 |
||
922
52c1d0d22c0e
dont ask Display for defaultExtent - ask current screen
Claus Gittinger <cg@exept.de>
parents:
677
diff
changeset
|
64 |
|screen| |
587 | 65 |
|
922
52c1d0d22c0e
dont ask Display for defaultExtent - ask current screen
Claus Gittinger <cg@exept.de>
parents:
677
diff
changeset
|
66 |
screen := Screen current. |
52c1d0d22c0e
dont ask Display for defaultExtent - ask current screen
Claus Gittinger <cg@exept.de>
parents:
677
diff
changeset
|
67 |
^ (screen width // 3) @ (screen height // 3) |
52c1d0d22c0e
dont ask Display for defaultExtent - ask current screen
Claus Gittinger <cg@exept.de>
parents:
677
diff
changeset
|
68 |
|
52c1d0d22c0e
dont ask Display for defaultExtent - ask current screen
Claus Gittinger <cg@exept.de>
parents:
677
diff
changeset
|
69 |
"Modified: 5.7.1996 / 13:55:08 / cg" |
81 | 70 |
! |
0 | 71 |
|
269 | 72 |
shadows |
2876
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
73 |
"return the shadows-flag. False means: turned off. |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
74 |
Notice, that even when set to true, a particular device might |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
75 |
want to suppress this feature." |
269 | 76 |
|
77 |
^ DefaultShadow |
|
144 | 78 |
! |
79 |
||
80 |
shadows:aBoolean |
|
81 |
"turn on/off shadows under popUpViews. |
|
2876
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
82 |
Notice, that even when set to true, a particular device might |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
83 |
want to suppress this feature. |
144 | 84 |
On slow displays, turning them off makes menus appear a bit snappier. |
85 |
The default is set via the styleSheet and changes when the viewStyle |
|
86 |
is changed." |
|
87 |
||
88 |
DefaultShadow := aBoolean |
|
89 |
! |
|
90 |
||
2876
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
91 |
shadowsOnDevice:aDevice |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
92 |
"return true, if shadows should be shown on aDevice" |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
93 |
|
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
94 |
^ DefaultShadow and:[aDevice suppressShadowViews not] |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
95 |
! |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
96 |
|
269 | 97 |
updateStyleCache |
485 | 98 |
"extract values from the styleSheet and cache them in class variables" |
99 |
||
1930 | 100 |
<resource: #style (#'popup.shadow' #'popup.level' |
101 |
#'popup.borderWidth' |
|
102 |
#'popup.borderColor')> |
|
485 | 103 |
|
269 | 104 |
ShadowView isNil ifTrue:[ |
485 | 105 |
DefaultShadow := false |
269 | 106 |
] ifFalse:[ |
2876
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
107 |
"/ notice, that even when true, a particular device might |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
108 |
"/ want to suppress this feature. |
1930 | 109 |
DefaultShadow := StyleSheet at:'popup.shadow' default:false. |
269 | 110 |
]. |
1930 | 111 |
DefaultLevel := StyleSheet at:'popup.level'. |
112 |
DefaultBorderWidth := StyleSheet at:'popup.borderWidth'. |
|
113 |
DefaultBorderColor := StyleSheet colorAt:'popup.borderColor'. |
|
485 | 114 |
|
1930 | 115 |
"Modified: 20.10.1997 / 15:10:07 / cg" |
269 | 116 |
! ! |
117 |
||
118 |
!PopUpView methodsFor:'accessing'! |
|
119 |
||
120 |
exclusivePointer:aBoolean |
|
677
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
121 |
"set/clear the exclusive pointer flag; |
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
122 |
DANGER: if set, no interaction with other views is possible, |
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
123 |
while the popUp is active" |
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
124 |
|
269 | 125 |
exclusivePointer := aBoolean |
677
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
126 |
|
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
127 |
"Modified: 12.5.1996 / 22:02:52 / cg" |
269 | 128 |
! |
129 |
||
130 |
noShadow |
|
131 |
"turn off the shadow" |
|
132 |
||
133 |
shadowView := nil |
|
134 |
! ! |
|
135 |
||
3179 | 136 |
!PopUpView methodsFor:'activation / deactivation'! |
269 | 137 |
|
3154
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
138 |
open |
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
139 |
"default for popUpViews is to come up modal" |
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
140 |
|
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
141 |
self openModal |
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
142 |
! |
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
143 |
|
269 | 144 |
show |
145 |
"realize the view at its last position" |
|
146 |
||
147 |
self fixSize. |
|
3154
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
148 |
self open |
269 | 149 |
! |
144 | 150 |
|
269 | 151 |
showAt:aPoint |
152 |
"realize the view at aPoint" |
|
153 |
||
154 |
self showAt:aPoint resizing:true |
|
155 |
! |
|
156 |
||
157 |
showAt:aPoint resizing:aBoolean |
|
158 |
"realize the view at aPoint" |
|
159 |
||
160 |
aBoolean ifTrue:[ |
|
1732 | 161 |
self fixSize. |
269 | 162 |
]. |
163 |
self origin:aPoint. |
|
164 |
self makeFullyVisible. |
|
3154
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
165 |
self open |
269 | 166 |
! |
167 |
||
168 |
showAtPointer |
|
169 |
"realize the view at the current pointer position" |
|
170 |
||
171 |
self showAt:(device pointerPosition) resizing:true |
|
172 |
! |
|
173 |
||
174 |
showCenteredIn:aView |
|
175 |
"make myself visible at the screen center." |
|
176 |
||
177 |
|top| |
|
178 |
||
179 |
top := aView topView. |
|
180 |
top raise. |
|
181 |
self showAt:(top origin |
|
182 |
+ (aView originRelativeTo:top) |
|
183 |
+ (aView extent // 2) |
|
184 |
- (self extent // 2)) |
|
185 |
! ! |
|
186 |
||
2412 | 187 |
!PopUpView methodsFor:'defaults'! |
188 |
||
189 |
defaultShadow |
|
2876
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
190 |
"obsoleted by PopUpView defaultShadowOn:aDevice" |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
191 |
|
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
192 |
self obsoleteMethodWarning. |
2412 | 193 |
^ DefaultShadow |
194 |
||
195 |
"Created: / 4.12.1998 / 15:11:20 / cg" |
|
196 |
! ! |
|
197 |
||
3088 | 198 |
!PopUpView methodsFor:'grabbing'! |
199 |
||
200 |
forceUngrabKeyboard |
|
201 |
'PopUpView [warning]: forceUngrabKeyboard should no longer be invoked' errorPrint. |
|
202 |
"/ Transcript show:'k-uuu forced by '; show:self; show:'[',self identityHash printString,']'; showCR:' - previous is ' , previousKeyboardGrab printString. |
|
203 |
"/ self halt. |
|
204 |
super forceUngrabKeyboard. |
|
205 |
||
206 |
||
207 |
! |
|
208 |
||
209 |
forceUngrabPointer |
|
210 |
'PopUpView [warning]: forceUngrabPointer should no longer be invoked' errorPrint. |
|
211 |
"/ Transcript show:'uuu forced by '; show:self; show:'[',self identityHash printString,']'; showCR:' - previous is ' , previousPointerGrab printString. |
|
212 |
"/ self halt. |
|
213 |
super forceUngrabPointer. |
|
214 |
||
215 |
||
216 |
! |
|
217 |
||
218 |
grabKeyboard |
|
219 |
previousKeyboardGrab := device activeKeyboardGrab. |
|
220 |
"/ Transcript show:'k-ggg by '; show:self; show:'[',self identityHash printString,']'; showCR:' - previous is ' , previousKeyboardGrab printString. |
|
221 |
^ super grabKeyboard |
|
222 |
||
223 |
||
224 |
! |
|
225 |
||
226 |
grabPointerWithCursor:aCursorOrNil |
|
227 |
previousPointerGrab := device activePointerGrab. |
|
228 |
"/ Transcript show:'ggg by '; show:self; show:'[',self identityHash printString,']'; showCR:' - previous is ' , previousPointerGrab printString. |
|
229 |
^ super grabPointerWithCursor:aCursorOrNil |
|
230 |
||
231 |
||
232 |
! |
|
233 |
||
234 |
ungrabKeyboard |
|
235 |
"/ Transcript show:'k-uuu by '; show:self; show:'[',self identityHash printString,']'; showCR:' - previous is ' , previousKeyboardGrab printString. |
|
236 |
super ungrabKeyboard. |
|
237 |
previousKeyboardGrab notNil ifTrue:[ |
|
238 |
device grabKeyboardInView:previousKeyboardGrab |
|
239 |
]. |
|
240 |
||
241 |
||
242 |
! |
|
243 |
||
244 |
ungrabPointer |
|
245 |
"/ Transcript show:'uuu by '; show:self; show:'[',self identityHash printString,']'; showCR:' - previous is ' , previousPointerGrab printString. |
|
246 |
super ungrabPointer. |
|
247 |
previousPointerGrab notNil ifTrue:[ |
|
248 |
device grabPointerInView:previousPointerGrab |
|
249 |
]. |
|
250 |
||
251 |
||
252 |
! ! |
|
253 |
||
89 | 254 |
!PopUpView methodsFor:'initialize / release'! |
0 | 255 |
|
269 | 256 |
create |
257 |
super create. |
|
1732 | 258 |
|
269 | 259 |
shadowView isNil ifTrue:[ |
1732 | 260 |
self saveUnder:true |
269 | 261 |
] |
262 |
! |
|
263 |
||
264 |
destroy |
|
141 | 265 |
haveControl := false. |
269 | 266 |
super destroy. |
267 |
shadowView notNil ifTrue:[shadowView destroy. shadowView := nil] |
|
81 | 268 |
! |
269 |
||
270 |
initStyle |
|
1263 | 271 |
"setup viewStyle specifics" |
272 |
||
2574 | 273 |
|l| |
81 | 274 |
|
2574 | 275 |
super initStyle. |
0 | 276 |
|
81 | 277 |
DefaultBorderColor notNil ifTrue:[ |
2831 | 278 |
self borderColor:(DefaultBorderColor onDevice:device). |
81 | 279 |
]. |
2574 | 280 |
DefaultBorderWidth isNil ifTrue:[ |
281 |
borderWidth := styleSheet is3D ifTrue:[0] ifFalse:[1]. |
|
282 |
] ifFalse:[ |
|
1263 | 283 |
borderWidth := DefaultBorderWidth. |
81 | 284 |
]. |
2574 | 285 |
DefaultLevel isNil ifTrue:[ |
286 |
l := styleSheet is3D ifTrue:[1] ifFalse:[0]. |
|
287 |
] ifFalse:[ |
|
288 |
l := DefaultLevel. |
|
81 | 289 |
]. |
2574 | 290 |
self level:l. |
81 | 291 |
|
2876
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
292 |
(self class shadowsOnDevice:device) ifTrue:[ |
1263 | 293 |
shadowView := (ShadowView onDevice:device) for:self. |
0 | 294 |
]. |
1263 | 295 |
|
2412 | 296 |
"Modified: / 4.12.1998 / 15:11:28 / cg" |
0 | 297 |
! |
298 |
||
269 | 299 |
initialize |
300 |
super initialize. |
|
301 |
exclusivePointer := true. |
|
0 | 302 |
haveControl := false. |
269 | 303 |
type := #popup |
162 | 304 |
! |
305 |
||
306 |
releasePointer |
|
677
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
307 |
"release the mouse pointer" |
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
308 |
|
162 | 309 |
device activePointerGrab == self ifTrue:[ |
677
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
310 |
device ungrabPointer. |
162 | 311 |
]. |
677
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
312 |
|
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
313 |
"Modified: 12.5.1996 / 22:04:09 / cg" |
2387
cfd8fa32799b
also release keyboard when unmapped
Claus Gittinger <cg@exept.de>
parents:
2335
diff
changeset
|
314 |
! |
cfd8fa32799b
also release keyboard when unmapped
Claus Gittinger <cg@exept.de>
parents:
2335
diff
changeset
|
315 |
|
cfd8fa32799b
also release keyboard when unmapped
Claus Gittinger <cg@exept.de>
parents:
2335
diff
changeset
|
316 |
releasePointerAndKeyboard |
cfd8fa32799b
also release keyboard when unmapped
Claus Gittinger <cg@exept.de>
parents:
2335
diff
changeset
|
317 |
"release the pointer and keyboard" |
cfd8fa32799b
also release keyboard when unmapped
Claus Gittinger <cg@exept.de>
parents:
2335
diff
changeset
|
318 |
|
3088 | 319 |
self ungrabPointer. |
320 |
self ungrabKeyboard. |
|
0 | 321 |
! ! |
322 |
||
269 | 323 |
!PopUpView methodsFor:'private'! |
0 | 324 |
|
677
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
325 |
regainControl |
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
326 |
"get exclusive access to pointer and keyboard" |
0 | 327 |
|
648 | 328 |
shown ifTrue:[ |
3088 | 329 |
self grabPointer. |
330 |
self grabKeyboard. |
|
331 |
self sensor flushMotionEventsFor:nil; flushKeyboardFor:nil. |
|
648 | 332 |
]. |
493 | 333 |
|
648 | 334 |
"Modified: 6.5.1996 / 22:33:39 / stefan" |
677
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
335 |
"Modified: 12.5.1996 / 22:04:42 / cg" |
89 | 336 |
! ! |
337 |
||
269 | 338 |
!PopUpView methodsFor:'queries'! |
89 | 339 |
|
3154
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
340 |
grabWhenMapped |
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
341 |
"return true, if I should perform a grab when mapped. |
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
342 |
Redefinable for subclasses." |
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
343 |
|
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
344 |
^ true |
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
345 |
|
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
346 |
"Modified: 12.5.1996 / 21:57:51 / cg" |
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
347 |
! |
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
348 |
|
269 | 349 |
isPopUpView |
677
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
350 |
"return true, since I want to come up without decoration |
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
351 |
and popUp to top immediately." |
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
352 |
|
269 | 353 |
^ true |
677
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
354 |
|
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
355 |
"Modified: 12.5.1996 / 21:57:51 / cg" |
0 | 356 |
! ! |
357 |
||
358 |
!PopUpView methodsFor:'realize / unrealize'! |
|
359 |
||
2574 | 360 |
hide |
361 |
"hide the view, leave its modal event loop" |
|
362 |
||
2579 | 363 |
|masterGroup| |
364 |
||
2574 | 365 |
windowGroup notNil ifTrue:[ |
2579 | 366 |
masterGroup := windowGroup previousGroup. |
2574 | 367 |
windowGroup removeView:self. |
368 |
windowGroup := nil. |
|
369 |
]. |
|
370 |
self unmap. |
|
371 |
||
372 |
"/ allow for redraw events to arrive |
|
373 |
"/ (actually, only req'd for win32 systems, |
|
374 |
"/ but that short delay does not hurt on others) |
|
375 |
||
2579 | 376 |
"/ Delay waitForSeconds:0.05. |
377 |
masterGroup notNil ifTrue:[ |
|
378 |
" |
|
379 |
this is a kludge for IRIS and others which do not provide backingstore: |
|
380 |
when we hide a modalbox (such as a searchbox) which covered |
|
381 |
a scrollbar, the scrollbars bitblt-method will copy from the |
|
382 |
not-yet redrawn area - effectively clearing the scroller. |
|
383 |
We need a short delay here, since at this time, the expose event has |
|
384 |
not yet arrived. |
|
385 |
" |
|
386 |
Delay waitForSeconds:0.05. |
|
387 |
masterGroup processExposeEvents |
|
388 |
]. |
|
2574 | 389 |
|
390 |
"Modified: / 3.5.1996 / 23:48:22 / stefan" |
|
391 |
"Modified: / 12.9.1998 / 14:58:33 / cg" |
|
392 |
! |
|
393 |
||
0 | 394 |
mapped |
162 | 395 |
"grab the pointer here, when visible (but not control is already lost). |
643 | 396 |
If the grab fails, try again and unmap myself if that fails too." |
0 | 397 |
|
523 | 398 |
mapTime := Time millisecondClockValue. |
399 |
||
0 | 400 |
super mapped. |
162 | 401 |
|
157 | 402 |
(haveControl |
162 | 403 |
and:[true "/ exclusivePointer |
3154
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
404 |
and:[realized |
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
405 |
and:[self grabWhenMapped]]]) ifTrue:[ |
3088 | 406 |
(self grabPointer) ifFalse:[ |
493 | 407 |
"wait a little bit and try again" |
157 | 408 |
"/ 'grab pointer failed' errorPrintNL. |
493 | 409 |
Delay waitForSeconds:0.1. |
3088 | 410 |
(self grabPointer) ifFalse:[ |
493 | 411 |
"give up" |
1174
6889dc61d701
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
412 |
'PopUpView [warning]: could not grab pointer' errorPrintCR. |
643 | 413 |
self unmap |
493 | 414 |
] |
415 |
]. |
|
416 |
exclusivePointer ifFalse:[ |
|
417 |
self releasePointer |
|
418 |
]. |
|
3088 | 419 |
self grabKeyboard. |
493 | 420 |
self getKeyboardFocus |
81 | 421 |
] |
493 | 422 |
|
643 | 423 |
"Modified: 3.5.1996 / 23:48:37 / stefan" |
1174
6889dc61d701
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
424 |
"Modified: 10.1.1997 / 18:00:31 / cg" |
0 | 425 |
! |
426 |
||
427 |
realize |
|
428 |
shadowView notNil ifTrue:[shadowView realize]. |
|
429 |
self raise. |
|
81 | 430 |
haveControl := true. |
3219 | 431 |
|
432 |
"/ device zoom:(device pointerPosition extent:1@1)to:(self bounds) duration:10. |
|
0 | 433 |
super realize. |
434 |
! |
|
435 |
||
269 | 436 |
restarted |
437 |
^ self |
|
438 |
! |
|
439 |
||
643 | 440 |
unmap |
0 | 441 |
haveControl := false. |
1732 | 442 |
|
2387
cfd8fa32799b
also release keyboard when unmapped
Claus Gittinger <cg@exept.de>
parents:
2335
diff
changeset
|
443 |
self releasePointerAndKeyboard. |
643 | 444 |
super unmap. |
445 |
shadowView notNil ifTrue:[shadowView unmap]. |
|
446 |
||
447 |
"Modified: 3.5.1996 / 23:46:06 / stefan" |
|
0 | 448 |
! ! |
449 |
||
1174
6889dc61d701
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
450 |
!PopUpView class methodsFor:'documentation'! |
0 | 451 |
|
269 | 452 |
version |
3219 | 453 |
^ '$Header: /cvs/stx/stx/libview/PopUpView.st,v 1.46 2000-07-06 07:52:44 cg Exp $' |
157 | 454 |
! ! |