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