author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 14 Sep 2017 09:28:09 +0100 | |
branch | jv |
changeset 8182 | c730140a0156 |
parent 7261 | 9a2ab9752a55 |
child 8229 | c097b46a0b6b |
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 |
132 |
"set the flag which decides whether the pointers canbe grab |
|
133 |
during mapped. |
|
134 |
" |
|
135 |
haveControl := aBoolean. |
|
136 |
! |
|
137 |
||
269 | 138 |
noShadow |
139 |
"turn off the shadow" |
|
140 |
||
141 |
shadowView := nil |
|
142 |
! ! |
|
143 |
||
3887 | 144 |
!PopUpView methodsFor:'activation & deactivation'! |
269 | 145 |
|
3154
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
146 |
open |
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
147 |
"default for popUpViews is to come up modal" |
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 |
self openModal |
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 |
|
269 | 152 |
show |
153 |
"realize the view at its last position" |
|
154 |
||
155 |
self fixSize. |
|
3154
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
156 |
self open |
269 | 157 |
! |
144 | 158 |
|
269 | 159 |
showAt:aPoint |
160 |
"realize the view at aPoint" |
|
161 |
||
162 |
self showAt:aPoint resizing:true |
|
163 |
! |
|
164 |
||
165 |
showAt:aPoint resizing:aBoolean |
|
166 |
"realize the view at aPoint" |
|
167 |
||
168 |
aBoolean ifTrue:[ |
|
1732 | 169 |
self fixSize. |
269 | 170 |
]. |
171 |
self origin:aPoint. |
|
172 |
self makeFullyVisible. |
|
3154
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
173 |
self open |
269 | 174 |
! |
175 |
||
176 |
showAtPointer |
|
177 |
"realize the view at the current pointer position" |
|
178 |
||
7261 | 179 |
self showAt:(device pointerPosition) resizing:true |
269 | 180 |
! |
181 |
||
182 |
showCenteredIn:aView |
|
183 |
"make myself visible at the screen center." |
|
184 |
||
185 |
|top| |
|
186 |
||
187 |
top := aView topView. |
|
188 |
top raise. |
|
189 |
self showAt:(top origin |
|
190 |
+ (aView originRelativeTo:top) |
|
191 |
+ (aView extent // 2) |
|
192 |
- (self extent // 2)) |
|
193 |
! ! |
|
194 |
||
2412 | 195 |
!PopUpView methodsFor:'defaults'! |
196 |
||
197 |
defaultShadow |
|
2876
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
198 |
"obsoleted by PopUpView defaultShadowOn:aDevice" |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
199 |
|
3588 | 200 |
<resource: #obsolete> |
201 |
||
2876
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
202 |
self obsoleteMethodWarning. |
2412 | 203 |
^ DefaultShadow |
204 |
||
205 |
"Created: / 4.12.1998 / 15:11:20 / cg" |
|
206 |
! ! |
|
207 |
||
3088 | 208 |
!PopUpView methodsFor:'grabbing'! |
209 |
||
210 |
grabKeyboard |
|
7261 | 211 |
previousKeyboardGrab := device activeKeyboardGrab. |
3088 | 212 |
"/ Transcript show:'k-ggg by '; show:self; show:'[',self identityHash printString,']'; showCR:' - previous is ' , previousKeyboardGrab printString. |
213 |
^ super grabKeyboard |
|
214 |
! |
|
215 |
||
216 |
grabPointerWithCursor:aCursorOrNil |
|
7261 | 217 |
previousPointerGrab := device activePointerGrab. |
3088 | 218 |
"/ Transcript show:'ggg by '; show:self; show:'[',self identityHash printString,']'; showCR:' - previous is ' , previousPointerGrab printString. |
219 |
^ super grabPointerWithCursor:aCursorOrNil |
|
220 |
! |
|
221 |
||
222 |
ungrabKeyboard |
|
223 |
"/ Transcript show:'k-uuu by '; show:self; show:'[',self identityHash printString,']'; showCR:' - previous is ' , previousKeyboardGrab printString. |
|
224 |
super ungrabKeyboard. |
|
225 |
previousKeyboardGrab notNil ifTrue:[ |
|
7261 | 226 |
device grabKeyboardInView:previousKeyboardGrab |
3088 | 227 |
]. |
228 |
! |
|
229 |
||
230 |
ungrabPointer |
|
231 |
"/ Transcript show:'uuu by '; show:self; show:'[',self identityHash printString,']'; showCR:' - previous is ' , previousPointerGrab printString. |
|
232 |
super ungrabPointer. |
|
233 |
previousPointerGrab notNil ifTrue:[ |
|
7261 | 234 |
device grabPointerInView:previousPointerGrab |
3088 | 235 |
]. |
236 |
! ! |
|
237 |
||
3884 | 238 |
!PopUpView methodsFor:'initialization & release'! |
0 | 239 |
|
269 | 240 |
create |
241 |
super create. |
|
1732 | 242 |
|
269 | 243 |
shadowView isNil ifTrue:[ |
1732 | 244 |
self saveUnder:true |
269 | 245 |
] |
246 |
! |
|
247 |
||
248 |
destroy |
|
141 | 249 |
haveControl := false. |
269 | 250 |
super destroy. |
251 |
shadowView notNil ifTrue:[shadowView destroy. shadowView := nil] |
|
81 | 252 |
! |
253 |
||
254 |
initStyle |
|
1263 | 255 |
"setup viewStyle specifics" |
256 |
||
5416 | 257 |
|l bw| |
81 | 258 |
|
2574 | 259 |
super initStyle. |
0 | 260 |
|
81 | 261 |
DefaultBorderColor notNil ifTrue:[ |
7261 | 262 |
self borderColor:(DefaultBorderColor onDevice:device). |
81 | 263 |
]. |
5416 | 264 |
(bw := DefaultBorderWidth) isNil ifTrue:[ |
265 |
bw := (styleSheet is3D ifTrue:[0] ifFalse:[1]). |
|
81 | 266 |
]. |
5416 | 267 |
self borderWidth:bw. |
268 |
||
2574 | 269 |
DefaultLevel isNil ifTrue:[ |
270 |
l := styleSheet is3D ifTrue:[1] ifFalse:[0]. |
|
271 |
] ifFalse:[ |
|
272 |
l := DefaultLevel. |
|
81 | 273 |
]. |
2574 | 274 |
self level:l. |
81 | 275 |
|
7261 | 276 |
(self class shadowsOnDevice:device) ifTrue:[ |
277 |
shadowView := (ShadowView onDevice:device) for:self. |
|
0 | 278 |
]. |
1263 | 279 |
|
2412 | 280 |
"Modified: / 4.12.1998 / 15:11:28 / cg" |
0 | 281 |
! |
282 |
||
269 | 283 |
initialize |
284 |
super initialize. |
|
285 |
exclusivePointer := true. |
|
0 | 286 |
haveControl := false. |
4080 | 287 |
self bePopUpView |
162 | 288 |
! |
289 |
||
3307 | 290 |
releaseDeviceResources |
291 |
shadowView notNil ifTrue:[shadowView destroy. shadowView := nil]. |
|
292 |
super releaseDeviceResources |
|
293 |
! |
|
294 |
||
162 | 295 |
releasePointer |
677
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
296 |
"release the mouse pointer" |
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
297 |
|
7261 | 298 |
device activePointerGrab == self ifTrue:[ |
299 |
device ungrabPointer. |
|
162 | 300 |
]. |
677
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
301 |
|
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
302 |
"Modified: 12.5.1996 / 22:04:09 / cg" |
2387
cfd8fa32799b
also release keyboard when unmapped
Claus Gittinger <cg@exept.de>
parents:
2335
diff
changeset
|
303 |
! |
cfd8fa32799b
also release keyboard when unmapped
Claus Gittinger <cg@exept.de>
parents:
2335
diff
changeset
|
304 |
|
cfd8fa32799b
also release keyboard when unmapped
Claus Gittinger <cg@exept.de>
parents:
2335
diff
changeset
|
305 |
releasePointerAndKeyboard |
cfd8fa32799b
also release keyboard when unmapped
Claus Gittinger <cg@exept.de>
parents:
2335
diff
changeset
|
306 |
"release the pointer and keyboard" |
cfd8fa32799b
also release keyboard when unmapped
Claus Gittinger <cg@exept.de>
parents:
2335
diff
changeset
|
307 |
|
3088 | 308 |
self ungrabPointer. |
309 |
self ungrabKeyboard. |
|
0 | 310 |
! ! |
311 |
||
269 | 312 |
!PopUpView methodsFor:'private'! |
0 | 313 |
|
677
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
314 |
regainControl |
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
315 |
"get exclusive access to pointer and keyboard" |
0 | 316 |
|
648 | 317 |
shown ifTrue:[ |
3088 | 318 |
self grabPointer. |
319 |
self grabKeyboard. |
|
320 |
self sensor flushMotionEventsFor:nil; flushKeyboardFor:nil. |
|
648 | 321 |
]. |
493 | 322 |
|
648 | 323 |
"Modified: 6.5.1996 / 22:33:39 / stefan" |
677
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
324 |
"Modified: 12.5.1996 / 22:04:42 / cg" |
89 | 325 |
! ! |
326 |
||
269 | 327 |
!PopUpView methodsFor:'queries'! |
89 | 328 |
|
3154
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
329 |
grabWhenMapped |
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
330 |
"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
|
331 |
Redefinable for subclasses." |
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
332 |
|
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
333 |
^ true |
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 |
"Modified: 12.5.1996 / 21:57:51 / cg" |
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 |
|
269 | 338 |
isPopUpView |
677
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
339 |
"return true, since I want to come up without decoration |
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
340 |
and popUp to top immediately." |
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
341 |
|
269 | 342 |
^ true |
677
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
343 |
|
069dd8cd00d1
removed obsolete stuff & commentary
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
344 |
"Modified: 12.5.1996 / 21:57:51 / cg" |
0 | 345 |
! ! |
346 |
||
3882 | 347 |
!PopUpView methodsFor:'realize & unrealize'! |
0 | 348 |
|
2574 | 349 |
hide |
350 |
"hide the view, leave its modal event loop" |
|
351 |
||
2579 | 352 |
|masterGroup| |
353 |
||
2574 | 354 |
windowGroup notNil ifTrue:[ |
2579 | 355 |
masterGroup := windowGroup previousGroup. |
2574 | 356 |
windowGroup removeView:self. |
357 |
windowGroup := nil. |
|
358 |
]. |
|
359 |
self unmap. |
|
360 |
||
361 |
"/ allow for redraw events to arrive |
|
362 |
"/ (actually, only req'd for win32 systems, |
|
363 |
"/ but that short delay does not hurt on others) |
|
364 |
||
2579 | 365 |
"/ Delay waitForSeconds:0.05. |
366 |
masterGroup notNil ifTrue:[ |
|
367 |
" |
|
368 |
this is a kludge for IRIS and others which do not provide backingstore: |
|
369 |
when we hide a modalbox (such as a searchbox) which covered |
|
370 |
a scrollbar, the scrollbars bitblt-method will copy from the |
|
371 |
not-yet redrawn area - effectively clearing the scroller. |
|
372 |
We need a short delay here, since at this time, the expose event has |
|
373 |
not yet arrived. |
|
374 |
" |
|
375 |
Delay waitForSeconds:0.05. |
|
376 |
masterGroup processExposeEvents |
|
377 |
]. |
|
2574 | 378 |
|
379 |
"Modified: / 3.5.1996 / 23:48:22 / stefan" |
|
380 |
"Modified: / 12.9.1998 / 14:58:33 / cg" |
|
381 |
! |
|
382 |
||
0 | 383 |
mapped |
162 | 384 |
"grab the pointer here, when visible (but not control is already lost). |
643 | 385 |
If the grab fails, try again and unmap myself if that fails too." |
0 | 386 |
|
3952
b96c9aaa2c63
retry grabPointer a few times (in case the initial grab fails)
Claus Gittinger <cg@exept.de>
parents:
3887
diff
changeset
|
387 |
|count grabbed| |
b96c9aaa2c63
retry grabPointer a few times (in case the initial grab fails)
Claus Gittinger <cg@exept.de>
parents:
3887
diff
changeset
|
388 |
|
523 | 389 |
mapTime := Time millisecondClockValue. |
390 |
||
0 | 391 |
super mapped. |
162 | 392 |
|
157 | 393 |
(haveControl |
162 | 394 |
and:[true "/ exclusivePointer |
3154
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
395 |
and:[realized |
2c9c64a64c20
some changes to make subclassing easier.
Claus Gittinger <cg@exept.de>
parents:
3088
diff
changeset
|
396 |
and:[self grabWhenMapped]]]) ifTrue:[ |
3088 | 397 |
(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
|
398 |
count := 0. |
b96c9aaa2c63
retry grabPointer a few times (in case the initial grab fails)
Claus Gittinger <cg@exept.de>
parents:
3887
diff
changeset
|
399 |
[ |
b96c9aaa2c63
retry grabPointer a few times (in case the initial grab fails)
Claus Gittinger <cg@exept.de>
parents:
3887
diff
changeset
|
400 |
"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
|
401 |
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
|
402 |
count := count + 1. |
b96c9aaa2c63
retry grabPointer a few times (in case the initial grab fails)
Claus Gittinger <cg@exept.de>
parents:
3887
diff
changeset
|
403 |
] 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
|
404 |
grabbed ifFalse:[ |
493 | 405 |
"give up" |
1174
6889dc61d701
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
406 |
'PopUpView [warning]: could not grab pointer' errorPrintCR. |
643 | 407 |
self unmap |
493 | 408 |
] |
409 |
]. |
|
410 |
exclusivePointer ifFalse:[ |
|
411 |
self releasePointer |
|
412 |
]. |
|
3088 | 413 |
self grabKeyboard. |
493 | 414 |
self getKeyboardFocus |
81 | 415 |
] |
493 | 416 |
|
643 | 417 |
"Modified: 3.5.1996 / 23:48:37 / stefan" |
1174
6889dc61d701
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
418 |
"Modified: 10.1.1997 / 18:00:31 / cg" |
0 | 419 |
! |
420 |
||
421 |
realize |
|
422 |
shadowView notNil ifTrue:[shadowView realize]. |
|
423 |
self raise. |
|
81 | 424 |
haveControl := true. |
3219 | 425 |
|
426 |
"/ device zoom:(device pointerPosition extent:1@1)to:(self bounds) duration:10. |
|
0 | 427 |
super realize. |
428 |
! |
|
429 |
||
643 | 430 |
unmap |
0 | 431 |
haveControl := false. |
1732 | 432 |
|
2387
cfd8fa32799b
also release keyboard when unmapped
Claus Gittinger <cg@exept.de>
parents:
2335
diff
changeset
|
433 |
self releasePointerAndKeyboard. |
643 | 434 |
super unmap. |
435 |
shadowView notNil ifTrue:[shadowView unmap]. |
|
436 |
||
437 |
"Modified: 3.5.1996 / 23:46:06 / stefan" |
|
0 | 438 |
! ! |
439 |
||
1174
6889dc61d701
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
922
diff
changeset
|
440 |
!PopUpView class methodsFor:'documentation'! |
0 | 441 |
|
269 | 442 |
version |
7261 | 443 |
^ '$Header$' |
5387
be2ff936d043
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
4738
diff
changeset
|
444 |
! |
be2ff936d043
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
4738
diff
changeset
|
445 |
|
be2ff936d043
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
4738
diff
changeset
|
446 |
version_CVS |
7261 | 447 |
^ '$Header$' |
157 | 448 |
! ! |
6086 | 449 |