author | Stefan Vogel <sv@exept.de> |
Fri, 06 Nov 2009 18:51:38 +0100 | |
changeset 5495 | 451ba572dffa |
parent 5386 | 7bb5b24b9bb2 |
child 5513 | 9af55a873ca9 |
permissions | -rw-r--r-- |
0 | 1 |
" |
6 | 2 |
COPYRIGHT (c) 1990 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 |
" |
|
3266 | 12 |
"{ Package: 'stx:libview' }" |
13 |
||
0 | 14 |
StandardSystemView subclass:#ModalBox |
1221
7ae7d7a901de
added escapeIsCancel flag (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
15 |
instanceVariableNames:'shadowView exclusiveKeyboard escapeIsCancel' |
1865
43c2eaba229d
allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents:
1826
diff
changeset
|
16 |
classVariableNames:'UseTransientViews DefaultExtent' |
514 | 17 |
poolDictionaries:'' |
18 |
category:'Views-Basic' |
|
0 | 19 |
! |
20 |
||
1232 | 21 |
!ModalBox class methodsFor:'documentation'! |
2 | 22 |
|
46 | 23 |
copyright |
24 |
" |
|
25 |
COPYRIGHT (c) 1990 by Claus Gittinger |
|
72 | 26 |
All Rights Reserved |
46 | 27 |
|
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
2 | 37 |
documentation |
38 |
" |
|
46 | 39 |
this class implements modal boxes; ModalBoxes are different from |
81 | 40 |
others, in that they take control over the current topview, until |
41 |
all processing is done (i.e. the currently active topview and all of |
|
42 |
its subviews will not handle user events while the box is active). |
|
89 | 43 |
|
44 |
ModalBoxes are either implemented as transient windows |
|
45 |
(if UseTransientViews := true) or as override redirect views. |
|
46 |
Some window managers have problems with either; so you may want to |
|
47 |
change the default setting from your display.rc file. |
|
616 | 48 |
|
49 |
[see also:] |
|
50 |
StandardSystemView |
|
51 |
DialogBox |
|
52 |
( introduction to view programming :html: programming/viewintro.html ) |
|
53 |
||
54 |
[author:] |
|
55 |
Claus Gittinger |
|
2 | 56 |
" |
57 |
! ! |
|
58 |
||
1232 | 59 |
!ModalBox class methodsFor:'initialization'! |
0 | 60 |
|
2 | 61 |
initialize |
89 | 62 |
UseTransientViews := true. |
1825 | 63 |
|
64 |
" |
|
65 |
UseTransientViews := false |
|
66 |
" |
|
67 |
||
68 |
"Modified: 24.7.1997 / 15:18:59 / cg" |
|
89 | 69 |
! ! |
70 |
||
1232 | 71 |
!ModalBox class methodsFor:'defaults'! |
89 | 72 |
|
73 |
defaultExtent |
|
74 |
"this defines the defaultExtent for instances of me; |
|
75 |
the value returned here is usually not correct for concrete subclasses, |
|
587 | 76 |
so you better redefine this method. |
77 |
The value returned here is usually ignored, and |
|
78 |
the value from preferredExtent taken instead." |
|
79 |
||
1865
43c2eaba229d
allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents:
1826
diff
changeset
|
80 |
DefaultExtent notNil ifTrue:[ |
2193
8ef9d174d111
default extent a bit bigger.
Claus Gittinger <cg@exept.de>
parents:
1970
diff
changeset
|
81 |
^ DefaultExtent |
1865
43c2eaba229d
allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents:
1826
diff
changeset
|
82 |
]. |
2193
8ef9d174d111
default extent a bit bigger.
Claus Gittinger <cg@exept.de>
parents:
1970
diff
changeset
|
83 |
^ (Screen current pixelPerMillimeter * (60 @ 20)) rounded |
587 | 84 |
|
2193
8ef9d174d111
default extent a bit bigger.
Claus Gittinger <cg@exept.de>
parents:
1970
diff
changeset
|
85 |
"Modified: / 27.7.1998 / 20:15:15 / cg" |
89 | 86 |
! |
87 |
||
596 | 88 |
defaultLabel |
89 |
"return the boxes default window title." |
|
90 |
||
91 |
^ 'PopUp' |
|
92 |
||
93 |
"Created: 23.4.1996 / 17:14:21 / cg" |
|
94 |
! |
|
95 |
||
1865
43c2eaba229d
allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents:
1826
diff
changeset
|
96 |
updateStyleCache |
43c2eaba229d
allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents:
1826
diff
changeset
|
97 |
"extract values from the styleSheet and cache them in class variables" |
43c2eaba229d
allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents:
1826
diff
changeset
|
98 |
|
1931 | 99 |
<resource: #style (#'modalBox.defaultExtent')> |
1865
43c2eaba229d
allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents:
1826
diff
changeset
|
100 |
|
1931 | 101 |
DefaultExtent := StyleSheet at:'modalBox.defaultExtent' default:nil. |
1865
43c2eaba229d
allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents:
1826
diff
changeset
|
102 |
|
43c2eaba229d
allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents:
1826
diff
changeset
|
103 |
" |
43c2eaba229d
allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents:
1826
diff
changeset
|
104 |
self updateStyleCache |
43c2eaba229d
allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents:
1826
diff
changeset
|
105 |
" |
43c2eaba229d
allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents:
1826
diff
changeset
|
106 |
|
43c2eaba229d
allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents:
1826
diff
changeset
|
107 |
"Modified: 31.8.1995 / 03:01:14 / claus" |
43c2eaba229d
allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents:
1826
diff
changeset
|
108 |
"Created: 15.8.1997 / 01:40:53 / cg" |
1931 | 109 |
"Modified: 20.10.1997 / 15:07:37 / cg" |
1865
43c2eaba229d
allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents:
1826
diff
changeset
|
110 |
! |
43c2eaba229d
allow default topViews extends to be overwritten by styleSheet
Claus Gittinger <cg@exept.de>
parents:
1826
diff
changeset
|
111 |
|
89 | 112 |
useTransientViews:aBoolean |
113 |
"change the way modalBoxes are created on the Display. |
|
1397
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
114 |
If the argument is true, transient views are used; |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
115 |
otherwise override redirect views are used. |
959
a47e44337899
modalBoxes from non-windowGroup processes (background process)
Claus Gittinger <cg@exept.de>
parents:
953
diff
changeset
|
116 |
Depending on your windowmanager, either one may have problems. |
a47e44337899
modalBoxes from non-windowGroup processes (background process)
Claus Gittinger <cg@exept.de>
parents:
953
diff
changeset
|
117 |
You may want to change the setting |
1397
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
118 |
from your display.rc or d_xxx.rc file. |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
119 |
This is now obsolete - transient views work and are always used." |
89 | 120 |
|
121 |
UseTransientViews := aBoolean. |
|
122 |
||
123 |
" |
|
144 | 124 |
ModalBox useTransientViews:false |
125 |
ModalBox useTransientViews:true |
|
89 | 126 |
" |
959
a47e44337899
modalBoxes from non-windowGroup processes (background process)
Claus Gittinger <cg@exept.de>
parents:
953
diff
changeset
|
127 |
|
1397
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
128 |
"Modified: 28.2.1997 / 22:27:46 / cg" |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
129 |
! |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
130 |
|
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
131 |
usingTransientViews |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
132 |
"return true, if transient views are used |
5495
451ba572dffa
changed comment: #usingTransientViews
Stefan Vogel <sv@exept.de>
parents:
5386
diff
changeset
|
133 |
for modalBoxes. This is somewhat obsolete." |
1397
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
134 |
|
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
135 |
^ UseTransientViews |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
136 |
|
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
137 |
" |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
138 |
ModalBox usingTransientViews |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
139 |
" |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
140 |
|
959
a47e44337899
modalBoxes from non-windowGroup processes (background process)
Claus Gittinger <cg@exept.de>
parents:
953
diff
changeset
|
141 |
"Modified: 18.7.1996 / 19:18:46 / cg" |
1397
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
142 |
"Created: 28.2.1997 / 22:27:12 / cg" |
2 | 143 |
! ! |
0 | 144 |
|
296 | 145 |
!ModalBox methodsFor:'accessing'! |
146 |
||
3460
d60f9cd59bdb
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
3440
diff
changeset
|
147 |
escapeIsCancel |
d60f9cd59bdb
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
3440
diff
changeset
|
148 |
"return the escapeIsCancel setting - defaults to true for modalMox here." |
d60f9cd59bdb
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
3440
diff
changeset
|
149 |
|
d60f9cd59bdb
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
3440
diff
changeset
|
150 |
^ escapeIsCancel |
d60f9cd59bdb
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
3440
diff
changeset
|
151 |
! |
d60f9cd59bdb
optionBox: cancel-value corrected
Claus Gittinger <cg@exept.de>
parents:
3440
diff
changeset
|
152 |
|
296 | 153 |
exclusiveKeyboard:aBoolean |
154 |
"set/clear exclusive locking of the keyboard; |
|
155 |
If set, the box will take total control over the |
|
156 |
keyboard, not allowing input to other views/boxes |
|
157 |
while active. |
|
675
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
158 |
DANGER: |
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
159 |
only use this for very very urgent boxes, since |
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
160 |
no interaction with ANY view on the screen is possible then." |
296 | 161 |
|
162 |
exclusiveKeyboard := aBoolean |
|
675
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
163 |
|
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
164 |
"Modified: 12.5.1996 / 21:55:09 / cg" |
296 | 165 |
! ! |
166 |
||
167 |
!ModalBox methodsFor:'event handling'! |
|
168 |
||
169 |
coveredBy:aView |
|
170 |
"the receiver has been covered by another view. |
|
171 |
If the other view is a non-modal one, raise" |
|
172 |
||
173 |
|mainGroup topViews| |
|
174 |
||
175 |
" |
|
176 |
if the other view is not a modal- (or shadow-, or popup-) -view, |
|
177 |
bring myself to the front again. |
|
178 |
" |
|
179 |
aView isPopUpView ifFalse:[ |
|
5226 | 180 |
" |
181 |
if I have a mainGroup, |
|
182 |
only raise if its one of my maingroup-views |
|
183 |
" |
|
184 |
windowGroup notNil ifTrue:[ |
|
185 |
mainGroup := windowGroup mainGroup. |
|
186 |
mainGroup notNil ifTrue:[ |
|
187 |
topViews := mainGroup topViews. |
|
188 |
topViews notNil ifTrue:[ |
|
189 |
topViews do:[:eachTopView | |
|
190 |
aView == eachTopView ifTrue:[ |
|
191 |
self raise. |
|
192 |
^ self |
|
193 |
] |
|
194 |
] |
|
195 |
]. |
|
196 |
^ self |
|
197 |
] |
|
198 |
]. |
|
199 |
self raise |
|
296 | 200 |
] |
201 |
! |
|
202 |
||
203 |
terminate |
|
204 |
"this is the close from a windowmanager |
|
205 |
(only if UseTransientViews == true)" |
|
206 |
||
207 |
" |
|
208 |
if I am a dialog, make the receiver invisible and leave control. |
|
209 |
But, do not destroy the underlying view resources, to allow for |
|
210 |
another open/show to occur later. |
|
211 |
if I have been opened modeLess, perform the normal destroy operation. |
|
212 |
" |
|
213 |
(windowGroup isNil or:[windowGroup isModal]) ifTrue:[ |
|
214 |
self hide |
|
215 |
] ifFalse:[ |
|
216 |
super terminate |
|
217 |
] |
|
218 |
! |
|
219 |
||
220 |
visibilityChange:how |
|
221 |
"raise when covered - this should not be needed, since we |
|
222 |
have been created as override-redirect window (which should |
|
223 |
stay on top - but some window managers (fvwm) seem to ignore |
|
224 |
this ..." |
|
225 |
||
226 |
"the code below is not good, since it will lead to |
|
227 |
oscillating raises when two modalBoxes are going to cover |
|
228 |
each other - see coveredBy:-handling ..." |
|
229 |
||
230 |
"/ how ~~ #fullyVisible ifTrue:[ |
|
231 |
"/ self raise |
|
232 |
"/ ] |
|
1970
5b602928ee03
experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
233 |
! |
5b602928ee03
experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
234 |
|
5b602928ee03
experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
235 |
xxxpointerEnter:state x:x y:y |
5b602928ee03
experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
236 |
"mhmh: this seems to be a special X kludge; |
5b602928ee03
experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
237 |
without the following, we will not regain input focus after |
5b602928ee03
experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
238 |
pointer is reentered." |
5b602928ee03
experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
239 |
|
5b602928ee03
experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
240 |
"/ |
5b602928ee03
experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
241 |
"/ experimental: disabled; bad behavior with some windowManagers, |
5b602928ee03
experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
242 |
"/ if enter/leave events are processed late. |
5b602928ee03
experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
243 |
"/ |
5b602928ee03
experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
244 |
self getKeyboardFocus. |
5b602928ee03
experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
245 |
super pointerEnter:state x:x y:y |
5b602928ee03
experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
246 |
|
5b602928ee03
experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
247 |
"Created: / 8.12.1997 / 19:18:45 / cg" |
5b602928ee03
experimental: no longer grab the keyboardFocus in a dialogs
Claus Gittinger <cg@exept.de>
parents:
1931
diff
changeset
|
248 |
"Modified: / 8.12.1997 / 19:19:39 / cg" |
296 | 249 |
! ! |
250 |
||
3884 | 251 |
!ModalBox methodsFor:'initialization & release'! |
0 | 252 |
|
296 | 253 |
addToCurrentProject |
254 |
"ignored here" |
|
255 |
||
256 |
^ self |
|
257 |
! |
|
258 |
||
259 |
create |
|
260 |
super create. |
|
261 |
shadowView notNil ifTrue:[ |
|
262 |
self saveUnder:true |
|
263 |
] |
|
264 |
! |
|
265 |
||
266 |
destroy |
|
675
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
267 |
"destroy the view. |
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
268 |
redefined to also destroy my shadow, if there is one, |
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
269 |
and to release the global keyboard grab (if there is one)" |
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
270 |
|
296 | 271 |
shadowView notNil ifTrue:[ |
675
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
272 |
shadowView destroy. |
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
273 |
shadowView := nil |
296 | 274 |
]. |
675
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
275 |
exclusiveKeyboard ifTrue:[ |
3093 | 276 |
self forceUngrabKeyboard |
675
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
277 |
]. |
296 | 278 |
super destroy. |
675
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
279 |
|
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
280 |
"Modified: 12.5.1996 / 21:56:10 / cg" |
296 | 281 |
! |
282 |
||
283 |
initEvents |
|
675
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
284 |
"initialize event handling; redefined to enable visibility changes" |
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
285 |
|
296 | 286 |
super initEvents. |
1221
7ae7d7a901de
added escapeIsCancel flag (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
287 |
self enableEvent:#visibilityChange. |
7ae7d7a901de
added escapeIsCancel flag (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
288 |
escapeIsCancel := true. |
675
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
289 |
|
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
290 |
"Modified: 12.5.1996 / 21:56:31 / cg" |
296 | 291 |
! |
292 |
||
293 |
initStyle |
|
1263 | 294 |
"setup viewStyle specifics" |
295 |
||
296 | 296 |
|style| |
297 |
||
298 |
super initStyle. |
|
299 |
style := styleSheet name. |
|
300 |
((style ~~ #normal) and:[style ~~ #mswindows]) ifTrue:[ |
|
5386
7bb5b24b9bb2
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
5226
diff
changeset
|
301 |
self borderWidth:0. |
1263 | 302 |
UseTransientViews ifFalse:[ |
303 |
self level:2 |
|
304 |
] |
|
296 | 305 |
] |
1263 | 306 |
|
307 |
"Modified: 22.1.1997 / 11:57:35 / cg" |
|
296 | 308 |
! |
309 |
||
0 | 310 |
initialize |
89 | 311 |
|form resizeButton moveButton| |
81 | 312 |
|
0 | 313 |
super initialize. |
314 |
||
4272 | 315 |
"/ self beDialogView. |
316 |
self beToolDialog. |
|
317 |
||
12 | 318 |
exclusiveKeyboard := false. |
596 | 319 |
"/ label := ' '. |
12 | 320 |
|
596 | 321 |
"/ label := 'Popup'. |
89 | 322 |
|
81 | 323 |
UseTransientViews ifFalse:[ |
2876
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2690
diff
changeset
|
324 |
(PopUpView shadowsOnDevice:device) ifTrue:[ |
596 | 325 |
shadowView := (ShadowView onDevice:device) for:self |
326 |
]. |
|
89 | 327 |
|
596 | 328 |
form := Form width:8 height:8 |
329 |
fromArray:#[2r00000000 |
|
330 |
2r00000000 |
|
331 |
2r00000000 |
|
332 |
2r00000001 |
|
333 |
2r00000011 |
|
334 |
2r00000111 |
|
335 |
2r00001111 |
|
336 |
2r00011111 |
|
337 |
] |
|
4771
7ffe69dd0a1a
Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents:
4413
diff
changeset
|
338 |
onDevice:device. |
1826 | 339 |
resizeButton := Button label:form in:self. |
596 | 340 |
resizeButton origin:1.0 @ 1.0 corner:1.0@1.0. |
341 |
resizeButton activeForegroundColor:(resizeButton foregroundColor). |
|
342 |
resizeButton activeBackgroundColor:(resizeButton backgroundColor). |
|
343 |
resizeButton enteredBackgroundColor:(resizeButton backgroundColor). |
|
344 |
resizeButton leftInset:-8; topInset:-8. |
|
345 |
resizeButton releaseAction:[]. |
|
346 |
resizeButton pressAction:[resizeButton turnOff; redraw. self doResize]. |
|
347 |
resizeButton borderWidth:0. |
|
752 | 348 |
resizeButton activeLevel:0; passiveLevel:0. |
596 | 349 |
resizeButton cursor:(Cursor corner). |
89 | 350 |
|
596 | 351 |
form := Form width:8 height:8 |
352 |
fromArray:#[2r11111000 |
|
353 |
2r11110000 |
|
354 |
2r11100000 |
|
355 |
2r11000000 |
|
356 |
2r10000000 |
|
357 |
2r00000000 |
|
358 |
2r00000000 |
|
359 |
2r00000000 |
|
360 |
] |
|
4771
7ffe69dd0a1a
Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents:
4413
diff
changeset
|
361 |
onDevice:device. |
1826 | 362 |
moveButton := Button label:form in:self. |
596 | 363 |
moveButton origin:0.0 @ 0.0 corner:0.0@0.0. |
364 |
moveButton activeForegroundColor:(moveButton foregroundColor). |
|
365 |
moveButton activeBackgroundColor:(moveButton backgroundColor). |
|
366 |
moveButton enteredBackgroundColor:(moveButton backgroundColor). |
|
367 |
moveButton rightInset:-8; bottomInset:-8. |
|
368 |
moveButton releaseAction:[]. |
|
369 |
moveButton pressAction:[moveButton turnOff; redraw. self doMove]. |
|
370 |
moveButton borderWidth:0. |
|
752 | 371 |
moveButton activeLevel:0; passiveLevel:0. |
596 | 372 |
moveButton cursor:(Cursor origin) |
81 | 373 |
]. |
374 |
||
1826 | 375 |
"Modified: 24.7.1997 / 16:08:11 / cg" |
12 | 376 |
! |
377 |
||
296 | 378 |
isPopUpView |
675
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
379 |
"return true, if I want to come up without decoration |
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
380 |
and popUp to top immediately." |
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
381 |
|
296 | 382 |
^ UseTransientViews not |
675
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
383 |
|
1825 | 384 |
"Modified: 24.7.1997 / 15:20:14 / cg" |
0 | 385 |
! |
386 |
||
2480
b4ffc5f3377f
when realized, automatically assign the focus to the
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
387 |
realize |
2690
f3d660bbe4a3
changed initial focus assignment
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
388 |
super realize. |
4179 | 389 |
self assignInitialKeyboardFocus. |
2690
f3d660bbe4a3
changed initial focus assignment
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
390 |
|
f3d660bbe4a3
changed initial focus assignment
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
391 |
"Modified: / 3.5.1996 / 23:48:04 / stefan" |
f3d660bbe4a3
changed initial focus assignment
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
392 |
"Modified: / 20.5.1999 / 18:17:34 / cg" |
2480
b4ffc5f3377f
when realized, automatically assign the focus to the
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
393 |
! |
b4ffc5f3377f
when realized, automatically assign the focus to the
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
394 |
|
72 | 395 |
reinitialize |
2644
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2589
diff
changeset
|
396 |
"if I have already been reinited - return" |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2589
diff
changeset
|
397 |
drawableId notNil ifTrue:[ |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2589
diff
changeset
|
398 |
^ self |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2589
diff
changeset
|
399 |
]. |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2589
diff
changeset
|
400 |
"physically create the view & subviews" |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2589
diff
changeset
|
401 |
self recreate. |
644 | 402 |
|
2644
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2589
diff
changeset
|
403 |
"/ super reinitialize. |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2589
diff
changeset
|
404 |
"/ self unmap. |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2589
diff
changeset
|
405 |
|
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2589
diff
changeset
|
406 |
"Modified: / 3.5.1996 / 23:48:04 / stefan" |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2589
diff
changeset
|
407 |
"Modified: / 6.5.1999 / 09:38:06 / cg" |
72 | 408 |
! |
409 |
||
81 | 410 |
resize |
411 |
"resize myself to make everything visible" |
|
412 |
||
4197
1984b2ba83de
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
4179
diff
changeset
|
413 |
|newExtent maxExtent| |
81 | 414 |
|
151 | 415 |
newExtent := self preferredExtent. |
4197
1984b2ba83de
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
4179
diff
changeset
|
416 |
maxExtent := self maxExtent. |
1984b2ba83de
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
4179
diff
changeset
|
417 |
maxExtent notNil ifTrue:[ |
1984b2ba83de
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
4179
diff
changeset
|
418 |
newExtent := newExtent min:maxExtent. |
81 | 419 |
]. |
4197
1984b2ba83de
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
4179
diff
changeset
|
420 |
newExtent ~= self extent ifTrue:[ |
1984b2ba83de
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
4179
diff
changeset
|
421 |
(shown and:[shadowView notNil]) ifTrue:[ |
1984b2ba83de
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
4179
diff
changeset
|
422 |
shadowView unmap. |
1984b2ba83de
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
4179
diff
changeset
|
423 |
self extent:newExtent. |
1984b2ba83de
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
4179
diff
changeset
|
424 |
shadowView realize. |
1984b2ba83de
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
4179
diff
changeset
|
425 |
self raise |
1984b2ba83de
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
4179
diff
changeset
|
426 |
] ifFalse:[ |
1984b2ba83de
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
4179
diff
changeset
|
427 |
self extent:newExtent. |
1984b2ba83de
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
4179
diff
changeset
|
428 |
]. |
1984b2ba83de
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
4179
diff
changeset
|
429 |
]. |
180 | 430 |
! |
431 |
||
432 |
resizeUnderPointer |
|
433 |
"resize myself to make everything visible, AND possibly change the origin |
|
434 |
to have the mouse pointer stay within my bounds. |
|
435 |
This is used for self-resizing enterBoxes, to avoid moving |
|
436 |
the box away from the cursor." |
|
437 |
||
4935
57354733f7d4
use usableExtent in resizeUnderPointer (multi-screen configurations)
Claus Gittinger <cg@exept.de>
parents:
4771
diff
changeset
|
438 |
|newExtent newLeft delta screenWidth| |
180 | 439 |
|
440 |
newExtent := self preferredExtent. |
|
441 |
newExtent = self extent ifTrue:[^ self]. |
|
442 |
||
443 |
shown ifTrue:[ |
|
644 | 444 |
delta := width - newExtent x. |
445 |
newLeft := left + delta. |
|
446 |
(((newLeft @ top) extent:newExtent) |
|
447 |
containsPoint:device pointerPosition) |
|
448 |
ifFalse:[newLeft := left]. |
|
449 |
newLeft < 0 ifTrue:[newLeft := 0]. |
|
4935
57354733f7d4
use usableExtent in resizeUnderPointer (multi-screen configurations)
Claus Gittinger <cg@exept.de>
parents:
4771
diff
changeset
|
450 |
screenWidth := device usableExtent x. |
57354733f7d4
use usableExtent in resizeUnderPointer (multi-screen configurations)
Claus Gittinger <cg@exept.de>
parents:
4771
diff
changeset
|
451 |
newLeft + newExtent x > screenWidth ifTrue:[ |
57354733f7d4
use usableExtent in resizeUnderPointer (multi-screen configurations)
Claus Gittinger <cg@exept.de>
parents:
4771
diff
changeset
|
452 |
newLeft := screenWidth - newExtent x |
644 | 453 |
]. |
454 |
shadowView notNil ifTrue:[ |
|
455 |
shadowView unmap. |
|
456 |
]. |
|
457 |
self origin:(newLeft @ top) extent:newExtent. |
|
458 |
shadowView notNil ifTrue:[ |
|
459 |
shadowView realize. |
|
460 |
self raise. |
|
461 |
]. |
|
180 | 462 |
] ifFalse:[ |
644 | 463 |
self extent:newExtent. |
180 | 464 |
]. |
465 |
||
466 |
"Modified: 6.9.1995 / 15:31:21 / claus" |
|
644 | 467 |
"Modified: 3.5.1996 / 23:48:17 / stefan" |
81 | 468 |
! ! |
469 |
||
296 | 470 |
!ModalBox methodsFor:'move & resize'! |
471 |
||
472 |
doMove |
|
1825 | 473 |
"the move button was pressed. |
474 |
This method is only used with non-transient views |
|
475 |
(UseTransientViews == false)." |
|
296 | 476 |
|
477 |
|r| |
|
478 |
||
1825 | 479 |
r := device rectangleFromUser:(self origin corner:self corner) keepExtent:true. |
296 | 480 |
shadowView notNil ifTrue:[ |
644 | 481 |
shadowView unmap |
296 | 482 |
]. |
1825 | 483 |
self origin:r origin extent:(self extent). |
296 | 484 |
shadowView notNil ifTrue:[ |
644 | 485 |
shadowView realize. |
1825 | 486 |
self raise. |
296 | 487 |
]. |
644 | 488 |
|
489 |
"Modified: 3.5.1996 / 23:47:38 / stefan" |
|
1825 | 490 |
"Modified: 24.7.1997 / 16:07:18 / cg" |
296 | 491 |
! |
492 |
||
493 |
doResize |
|
1825 | 494 |
"the resize button was pressed. |
495 |
This method is only used with non-transient views |
|
496 |
(UseTransientViews == false)." |
|
296 | 497 |
|
498 |
|r| |
|
499 |
||
500 |
r := device rectangleFromUser:(self origin corner:self corner). |
|
501 |
shadowView notNil ifTrue:[ |
|
644 | 502 |
shadowView unmap |
296 | 503 |
]. |
504 |
self origin:r origin extent:(r extent max:(100@100)). |
|
505 |
shadowView notNil ifTrue:[ |
|
644 | 506 |
shadowView realize. |
507 |
self raise |
|
296 | 508 |
]. |
644 | 509 |
|
510 |
"Modified: 3.5.1996 / 23:47:47 / stefan" |
|
1825 | 511 |
"Modified: 24.7.1997 / 15:18:46 / cg" |
296 | 512 |
! ! |
513 |
||
3266 | 514 |
!ModalBox methodsFor:'queries-internal'! |
1700
ea1abaa7901d
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1400
diff
changeset
|
515 |
|
1915
f86162de1a2f
extracted windowLabel generation into a separate method
Claus Gittinger <cg@exept.de>
parents:
1865
diff
changeset
|
516 |
windowLabelFor:labelString |
f86162de1a2f
extracted windowLabel generation into a separate method
Claus Gittinger <cg@exept.de>
parents:
1865
diff
changeset
|
517 |
"dialogs do not include the hostname in the window label" |
f86162de1a2f
extracted windowLabel generation into a separate method
Claus Gittinger <cg@exept.de>
parents:
1865
diff
changeset
|
518 |
|
f86162de1a2f
extracted windowLabel generation into a separate method
Claus Gittinger <cg@exept.de>
parents:
1865
diff
changeset
|
519 |
^ labelString |
f86162de1a2f
extracted windowLabel generation into a separate method
Claus Gittinger <cg@exept.de>
parents:
1865
diff
changeset
|
520 |
|
f86162de1a2f
extracted windowLabel generation into a separate method
Claus Gittinger <cg@exept.de>
parents:
1865
diff
changeset
|
521 |
"Created: 22.9.1997 / 10:14:02 / cg" |
f86162de1a2f
extracted windowLabel generation into a separate method
Claus Gittinger <cg@exept.de>
parents:
1865
diff
changeset
|
522 |
! |
f86162de1a2f
extracted windowLabel generation into a separate method
Claus Gittinger <cg@exept.de>
parents:
1865
diff
changeset
|
523 |
|
1700
ea1abaa7901d
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1400
diff
changeset
|
524 |
windowStyle |
3715 | 525 |
"return a symbol describing my style (one of: #dialog, #popUp or #normal) |
1700
ea1abaa7901d
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1400
diff
changeset
|
526 |
(may be used internally by the device as a decoration hint)" |
ea1abaa7901d
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1400
diff
changeset
|
527 |
|
4272 | 528 |
UseTransientViews ifFalse:[ |
529 |
^ #popUp |
|
1825 | 530 |
]. |
4272 | 531 |
^ super windowStyle |
1700
ea1abaa7901d
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1400
diff
changeset
|
532 |
|
ea1abaa7901d
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1400
diff
changeset
|
533 |
"Created: 2.5.1997 / 14:34:17 / cg" |
1825 | 534 |
"Modified: 24.7.1997 / 15:22:39 / cg" |
1700
ea1abaa7901d
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1400
diff
changeset
|
535 |
! ! |
ea1abaa7901d
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
1400
diff
changeset
|
536 |
|
3881 | 537 |
!ModalBox methodsFor:'show & hide'! |
296 | 538 |
|
539 |
autoHideAfter:seconds with:anAction |
|
540 |
"install a background process, which hides the box |
|
541 |
after some time. Also, if non-nil, anAction will be |
|
542 |
evaluated then. The action will not be evaluated if |
|
543 |
the box is closed by the user pressing a button." |
|
544 |
||
545 |
"the implementation is simple: just fork of a process |
|
546 |
to hide me." |
|
547 |
[ |
|
4413 | 548 |
Delay waitForSeconds:seconds. |
549 |
self shown ifTrue:[ |
|
550 |
self hide. |
|
551 |
anAction value |
|
552 |
] |
|
296 | 553 |
] forkAt:4. |
554 |
||
555 |
" |
|
556 |
|b| |
|
557 |
||
558 |
b := InfoBox title:'hello there'. |
|
559 |
b autoHideAfter:5 with:[]. |
|
560 |
b showAtCenter. |
|
561 |
" |
|
562 |
! |
|
563 |
||
564 |
fixSize |
|
565 |
"this is sent right before the modalBox is made visible; |
|
566 |
If the size is not fixed, adjust my size." |
|
567 |
||
568 |
sizeFixed == true ifFalse:[ |
|
569 |
self resize. |
|
570 |
]. |
|
571 |
super fixSize. |
|
572 |
! |
|
573 |
||
574 |
hide |
|
575 |
"make the receiver invisible and leave control" |
|
576 |
||
2579 | 577 |
|masterGroup| |
54 | 578 |
|
1314 | 579 |
realized ifFalse:[^ self]. |
580 |
||
644 | 581 |
shadowView notNil ifTrue:[shadowView unmap]. |
3313 | 582 |
windowGroup notNil ifTrue:[ |
583 |
windowGroup focusView:nil. |
|
584 |
masterGroup := windowGroup previousGroup. |
|
585 |
]. |
|
586 |
||
675
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
587 |
exclusiveKeyboard ifTrue:[ |
3093 | 588 |
self forceUngrabKeyboard |
675
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
589 |
]. |
fc15e8886089
removed leaveCOntrol (not used); added comments
Claus Gittinger <cg@exept.de>
parents:
644
diff
changeset
|
590 |
|
644 | 591 |
self unmap. |
54 | 592 |
|
2579 | 593 |
masterGroup notNil ifTrue:[ |
644 | 594 |
" |
2579 | 595 |
this is a kludge for IRIS and others which do not provide backingstore: |
644 | 596 |
when we hide a modalbox (such as a searchbox) which covered |
597 |
a scrollbar, the scrollbars bitblt-method will copy from the |
|
598 |
not-yet redrawn area - effectively clearing the scroller. |
|
599 |
We need a short delay here, since at this time, the expose event has |
|
600 |
not yet arrived. |
|
601 |
" |
|
3649 | 602 |
device sync. "/ thats a round trip, to ensure that all expose events are present..." |
2579 | 603 |
Delay waitForSeconds:0.05. |
604 |
masterGroup processExposeEvents |
|
296 | 605 |
]. |
644 | 606 |
|
607 |
"Modified: 3.5.1996 / 23:47:57 / stefan" |
|
1314 | 608 |
"Modified: 8.2.1997 / 17:41:16 / cg" |
296 | 609 |
! |
0 | 610 |
|
393
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
611 |
hideRequest |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
612 |
"hide request from windowGroup (i.e. via Escape key). |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
613 |
Can be redefined in subclasses which dont like this" |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
614 |
|
3440 | 615 |
self hide |
393
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
616 |
! |
3504a0adbb2d
use hideRequest to close via Escape key (allows redefinition);
Claus Gittinger <cg@exept.de>
parents:
371
diff
changeset
|
617 |
|
0 | 618 |
mapped |
619 |
"wait till visible for grabbing" |
|
620 |
||
621 |
super mapped. |
|
12 | 622 |
|
3344
4c3428823365
moved focus & grabHandling to TopViews openModal handling
ca
parents:
3328
diff
changeset
|
623 |
"/ "take it away from any popup menu possibly still active" |
4c3428823365
moved focus & grabHandling to TopViews openModal handling
ca
parents:
3328
diff
changeset
|
624 |
"/ |
4c3428823365
moved focus & grabHandling to TopViews openModal handling
ca
parents:
3328
diff
changeset
|
625 |
"/ self forceUngrabKeyboard. |
4c3428823365
moved focus & grabHandling to TopViews openModal handling
ca
parents:
3328
diff
changeset
|
626 |
"/ self forceUngrabPointer. |
4c3428823365
moved focus & grabHandling to TopViews openModal handling
ca
parents:
3328
diff
changeset
|
627 |
"/ |
54 | 628 |
" |
629 |
if I am a super-modal box, take the keyboard |
|
630 |
" |
|
12 | 631 |
exclusiveKeyboard ifTrue:[ |
3344
4c3428823365
moved focus & grabHandling to TopViews openModal handling
ca
parents:
3328
diff
changeset
|
632 |
self forceUngrabKeyboard. |
3093 | 633 |
self grabKeyboard. |
12 | 634 |
]. |
3344
4c3428823365
moved focus & grabHandling to TopViews openModal handling
ca
parents:
3328
diff
changeset
|
635 |
"/ |
4c3428823365
moved focus & grabHandling to TopViews openModal handling
ca
parents:
3328
diff
changeset
|
636 |
"/"/ UseTransientViews ifFalse:[ |
4c3428823365
moved focus & grabHandling to TopViews openModal handling
ca
parents:
3328
diff
changeset
|
637 |
"/ " |
4c3428823365
moved focus & grabHandling to TopViews openModal handling
ca
parents:
3328
diff
changeset
|
638 |
"/ get the focus |
4c3428823365
moved focus & grabHandling to TopViews openModal handling
ca
parents:
3328
diff
changeset
|
639 |
"/ " |
4c3428823365
moved focus & grabHandling to TopViews openModal handling
ca
parents:
3328
diff
changeset
|
640 |
"/ self getKeyboardFocus. |
4c3428823365
moved focus & grabHandling to TopViews openModal handling
ca
parents:
3328
diff
changeset
|
641 |
"/ self enableEnterLeaveEvents |
3351 | 642 |
"/"/ ] |
3440 | 643 |
! |
0 | 644 |
|
46 | 645 |
open |
72 | 646 |
"default for modalboxes is to come up modal at the pointer position" |
46 | 647 |
|
3520 | 648 |
ForceModalBoxesToOpenAtCenter == true ifTrue:[ |
649 |
^ self showAtCenter |
|
650 |
]. |
|
72 | 651 |
^ self showAtPointer |
46 | 652 |
! |
653 |
||
953 | 654 |
openAt:aPoint |
655 |
"default for modalboxes is to come up modal at the pointer position" |
|
656 |
||
657 |
^ self openModalAt:aPoint |
|
658 |
||
659 |
"Created: 17.7.1996 / 14:50:44 / cg" |
|
660 |
! |
|
661 |
||
662 |
openAtCenter |
|
663 |
"default for modalboxes is to come up modal at the pointer position" |
|
664 |
||
665 |
^ self openModalAtCenter |
|
666 |
||
667 |
"Created: 17.7.1996 / 14:50:35 / cg" |
|
668 |
! |
|
669 |
||
72 | 670 |
openModal:aBlock |
54 | 671 |
"open the box modal; |
672 |
In addition to the basic (inherited) modalloop, change |
|
72 | 673 |
the current active windowgroups cursors to the busy-stop cursor, show |
54 | 674 |
a shadow, and raise the box." |
675 |
||
1397
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
676 |
shadowView notNil ifTrue:[shadowView realize]. |
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
677 |
super openModal:aBlock. |
300
6a63af1fec3e
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
296
diff
changeset
|
678 |
|
6a63af1fec3e
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
296
diff
changeset
|
679 |
"Created: 10.12.1995 / 14:07:01 / cg" |
1397
932c517ad29c
moved tranientView setup up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
680 |
"Modified: 28.2.1997 / 22:32:49 / cg" |
54 | 681 |
! |
682 |
||
12 | 683 |
show |
514 | 684 |
"make myself visible (at the last or default position) and take control. |
685 |
If that position is out of the screen area, moves the receiver to make |
|
686 |
it fully visible." |
|
12 | 687 |
|
688 |
self fixSize. |
|
72 | 689 |
self makeFullyVisible. |
54 | 690 |
self openModal |
72 | 691 |
|
692 |
" |
|
693 |
|b| |
|
694 |
||
695 |
b := InfoBox title:'hello'. |
|
696 |
b show. |
|
697 |
" |
|
514 | 698 |
|
699 |
"Modified: 7.3.1996 / 17:57:49 / cg" |
|
12 | 700 |
! |
701 |
||
702 |
showAt:aPoint |
|
703 |
"make myself visible at aPoint. |
|
704 |
Fix position to make box fully visible" |
|
705 |
||
706 |
self fixSize. |
|
707 |
self fixPosition:aPoint. |
|
54 | 708 |
self openModal |
72 | 709 |
|
710 |
" |
|
711 |
|b| |
|
712 |
||
713 |
b := InfoBox title:'hello'. |
|
714 |
b showAt:(0 @ 0). |
|
715 |
b showAt:(400 @ 400). |
|
716 |
" |
|
717 |
! |
|
718 |
||
719 |
showAt:aPoint center:center |
|
720 |
"make myself visible at aPoint. center specifies |
|
721 |
if the view should show up centered around aPoint." |
|
722 |
||
723 |
self showAt:aPoint centerX:center centerY:center |
|
724 |
||
725 |
" |
|
726 |
|b| |
|
727 |
||
728 |
b := InfoBox title:'hello'. |
|
729 |
b showAt:(100 @ 100) center:true. |
|
730 |
b showAt:(100 @ 100) center:false. |
|
731 |
" |
|
732 |
! |
|
733 |
||
734 |
showAt:aPoint centerX:centerX centerY:centerY |
|
735 |
"make myself visible at aPoint. centerX/centerY specify |
|
736 |
if the view should show up centered around aPoint. |
|
737 |
Fix position to make box fully visible" |
|
738 |
||
739 |
|dx dy| |
|
740 |
||
741 |
self fixSize. |
|
742 |
centerX ifTrue:[ |
|
743 |
dx := self width // 2. |
|
744 |
] ifFalse:[ |
|
745 |
dx := 0 |
|
746 |
]. |
|
747 |
centerY ifTrue:[ |
|
748 |
dy := self height // 2. |
|
749 |
] ifFalse:[ |
|
750 |
dy := 0 |
|
751 |
]. |
|
752 |
self origin:(aPoint - (dx @ dy)). |
|
753 |
self makeFullyVisible. |
|
754 |
self openModal |
|
755 |
||
756 |
" |
|
757 |
|b| |
|
758 |
||
759 |
b := InfoBox title:'hello'. |
|
760 |
b showAt:(100 @ 100). |
|
761 |
b showAt:(100 @ 100) centerX:true centerY:false. |
|
762 |
" |
|
54 | 763 |
! |
764 |
||
765 |
showAtCenter |
|
766 |
"make myself visible at the screen center." |
|
767 |
||
72 | 768 |
self showAt:(device center) center:true |
769 |
||
770 |
" |
|
771 |
|b| |
|
772 |
||
773 |
b := InfoBox title:'hello'. |
|
774 |
b showAtCenter. |
|
775 |
" |
|
776 |
! |
|
777 |
||
0 | 778 |
showAtPointer |
12 | 779 |
"make myself visible at mouse pointer shifted to have |
66 | 780 |
convenient button under cursor. self positionOffset should |
781 |
return that offset (usually redefined, since we dont know here, |
|
782 |
which button should be under cursor)." |
|
12 | 783 |
|
3859
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
784 |
|first positionOffset| |
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
785 |
|
12 | 786 |
self fixSize. |
3859
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
787 |
positionOffset := self positionOffset. |
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
788 |
self fixPosition:(device pointerPosition - positionOffset). |
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
789 |
|
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
790 |
"We have got a problem here: |
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
791 |
X11 adds some window decoration. The size of the decoration is only known |
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
792 |
after the view is visible!! |
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
793 |
|
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
794 |
So there is a (hopefully) small offset from the pointer to the requested |
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
795 |
position. The only way to resolve this, is to move the pointer to |
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
796 |
the requested position after the view is visible" |
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
797 |
|
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
798 |
first := true. |
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
799 |
self openModal:[ |
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
800 |
(first and:[shown]) ifTrue:[ |
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
801 |
first := false. |
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
802 |
self setPointerPosition:positionOffset. |
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
803 |
]. |
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
804 |
true |
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
805 |
]. |
72 | 806 |
|
514 | 807 |
"/ cannot use: |
808 |
"/ self showAt:(device pointerPosition - self positionOffset). |
|
809 |
"/ because the resizing must be done before the |
|
810 |
"/ positionOffset is grabbed (it may change due to the resize) |
|
811 |
||
72 | 812 |
" |
813 |
|b| |
|
814 |
||
815 |
b := InfoBox title:'hello'. |
|
816 |
b showAtPointer. |
|
817 |
" |
|
514 | 818 |
|
819 |
"Modified: 7.3.1996 / 17:56:53 / cg" |
|
0 | 820 |
! |
821 |
||
822 |
showAtPointerNotCovering:aView |
|
12 | 823 |
"make myself visible at mouse pointer shifted to have |
824 |
convenient button under cursor. |
|
514 | 825 |
Fix position to make the box fully visible AND to make sure that |
12 | 826 |
aView is not covered." |
827 |
||
54 | 828 |
|pos newX| |
0 | 829 |
|
12 | 830 |
pos := device pointerPosition - self positionOffset. |
54 | 831 |
|
832 |
((Rectangle origin:pos extent:self extent) |
|
514 | 833 |
intersects: (aView origin corner: aView corner)) |
54 | 834 |
ifTrue:[ |
514 | 835 |
" |
836 |
try to the right of the untouchable view |
|
837 |
" |
|
838 |
newX := (aView origin x + aView width). |
|
4936
9ac25d62f361
usableExtent vs. width/height of a display
Claus Gittinger <cg@exept.de>
parents:
4935
diff
changeset
|
839 |
newX + width > device usableExtent x ifTrue:[ |
9ac25d62f361
usableExtent vs. width/height of a display
Claus Gittinger <cg@exept.de>
parents:
4935
diff
changeset
|
840 |
newX := device usableExtent x - width |
514 | 841 |
]. |
842 |
pos x:newX. |
|
54 | 843 |
|
844 |
||
514 | 845 |
((Rectangle origin:pos extent:self extent) |
846 |
intersects: (aView origin corner: aView corner)) |
|
847 |
ifTrue:[ |
|
848 |
" |
|
849 |
try to the left of the untouchable view |
|
850 |
" |
|
851 |
newX := aView origin x - width. |
|
852 |
" |
|
853 |
should look for vertical possibilities too ... |
|
854 |
" |
|
855 |
pos x:newX. |
|
856 |
] |
|
270 | 857 |
|
858 |
]. |
|
859 |
self showAt:pos |
|
514 | 860 |
|
861 |
"Modified: 7.3.1996 / 17:58:10 / cg" |
|
270 | 862 |
! |
863 |
||
296 | 864 |
showCenteredIn:aView |
514 | 865 |
"make myself visible at the center if aView." |
270 | 866 |
|
296 | 867 |
|top| |
270 | 868 |
|
296 | 869 |
top := aView topView. |
870 |
top raise. |
|
871 |
self showAt:(top center + (aView originRelativeTo:top)) center:true |
|
270 | 872 |
|
873 |
" |
|
874 |
|b| |
|
875 |
||
296 | 876 |
b := InfoBox title:'hello'. |
877 |
b showCenteredIn:Transcript. |
|
270 | 878 |
" |
514 | 879 |
|
880 |
"Modified: 7.3.1996 / 17:58:53 / cg" |
|
2577
c7c9b49a3794
kludge workaround - keep realized flag value when unmapped
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
881 |
! |
c7c9b49a3794
kludge workaround - keep realized flag value when unmapped
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
882 |
|
c7c9b49a3794
kludge workaround - keep realized flag value when unmapped
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
883 |
unmapped |
c7c9b49a3794
kludge workaround - keep realized flag value when unmapped
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
884 |
"mhmh - unmapped by the windowManager - if realized (i.e. not closing), |
c7c9b49a3794
kludge workaround - keep realized flag value when unmapped
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
885 |
keep the realized flag true (to avoid exiting the modal event loop). |
c7c9b49a3794
kludge workaround - keep realized flag value when unmapped
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
886 |
Consider this a kludge." |
c7c9b49a3794
kludge workaround - keep realized flag value when unmapped
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
887 |
|
c7c9b49a3794
kludge workaround - keep realized flag value when unmapped
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
888 |
|r| |
c7c9b49a3794
kludge workaround - keep realized flag value when unmapped
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
889 |
|
c7c9b49a3794
kludge workaround - keep realized flag value when unmapped
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
890 |
r := realized. |
c7c9b49a3794
kludge workaround - keep realized flag value when unmapped
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
891 |
super unmapped. |
c7c9b49a3794
kludge workaround - keep realized flag value when unmapped
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
892 |
realized := r. |
270 | 893 |
! ! |
894 |
||
1232 | 895 |
!ModalBox class methodsFor:'documentation'! |
270 | 896 |
|
296 | 897 |
version |
5495
451ba572dffa
changed comment: #usingTransientViews
Stefan Vogel <sv@exept.de>
parents:
5386
diff
changeset
|
898 |
^ '$Header: /cvs/stx/stx/libview/ModalBox.st,v 1.99 2009-11-06 17:51:38 stefan Exp $' |
5386
7bb5b24b9bb2
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
5226
diff
changeset
|
899 |
! |
7bb5b24b9bb2
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
5226
diff
changeset
|
900 |
|
7bb5b24b9bb2
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
5226
diff
changeset
|
901 |
version_CVS |
5495
451ba572dffa
changed comment: #usingTransientViews
Stefan Vogel <sv@exept.de>
parents:
5386
diff
changeset
|
902 |
^ '$Header: /cvs/stx/stx/libview/ModalBox.st,v 1.99 2009-11-06 17:51:38 stefan Exp $' |
270 | 903 |
! ! |
3859
a11d876ebc26
Fix #showAtPointer to take care of window manager title bars.
Stefan Vogel <sv@exept.de>
parents:
3715
diff
changeset
|
904 |
|
296 | 905 |
ModalBox initialize! |