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