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