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