author | Claus Gittinger <cg@exept.de> |
Wed, 09 Aug 2000 21:12:52 +0200 | |
changeset 3253 | 0dd15811ccc2 |
parent 2916 | 79eedd2e05ac |
child 3337 | 65bba570ff76 |
permissions | -rw-r--r-- |
0 | 1 |
" |
6 | 2 |
COPYRIGHT (c) 1988 by Claus Gittinger |
71 | 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 |
" |
|
12 |
||
3253 | 13 |
"{ Package: 'stx:libview' }" |
14 |
||
727
bf23a306b6f2
renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents:
626
diff
changeset
|
15 |
DisplaySurface subclass:#DisplayRootView |
616 | 16 |
instanceVariableNames:'' |
17 |
classVariableNames:'' |
|
18 |
poolDictionaries:'' |
|
626 | 19 |
category:'Views-Special' |
0 | 20 |
! |
21 |
||
1254 | 22 |
!DisplayRootView class methodsFor:'documentation'! |
45 | 23 |
|
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1988 by Claus Gittinger |
|
71 | 27 |
All Rights Reserved |
45 | 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 |
||
38 |
documentation |
|
39 |
" |
|
2916 | 40 |
this class describes the rootWindow (which is the background window or |
41 |
desktop and can be used for drawing outside of Views |
|
42 |
i.e. for dragging between Views). |
|
89 | 43 |
|
1254 | 44 |
For historic and compatibility reasons, there is a global variable |
45 |
called 'RootView', which is bound to the default displays ('Display') |
|
46 |
rootview. We recommend, not to access this variable, instead, get a |
|
47 |
displays rootView via the #rootView message (sent to the device). |
|
48 |
Otherwise, your application will not work in a multiScreen environment. |
|
180 | 49 |
|
50 |
Instances of myself (i.e. these rootViews) are light-weight views; |
|
51 |
they do not support events, models etc. |
|
52 |
They are pure drawing canvases and should be only used for special |
|
1254 | 53 |
applications (i.e. dragging). |
54 |
There may be display systems in which rootViews are not |
|
180 | 55 |
supported/allowed implemented. So be VERY careful when using them. |
134 | 56 |
|
1254 | 57 |
Be aware, that the rootView is not always visible - some |
58 |
windowManagers install another (pseudoRoot), into which icons and |
|
59 |
windowManager menus are drawn. If that is the case, your paining |
|
60 |
into the rootView may not be visible, unless you set the #noClipByChildren |
|
61 |
option (see below). |
|
2916 | 62 |
Also, it is not guaranteed, that all devices support drawing in the |
63 |
root window - especially if the device is a simulated one, such as |
|
64 |
a remote webBrowser ... |
|
1254 | 65 |
In general, you should never use the rootView for normal applications. |
66 |
||
134 | 67 |
To draw in the (Displays) root window: |
89 | 68 |
|
1254 | 69 |
|rootView| |
70 |
||
71 |
rootView := Screen current rootView. |
|
72 |
rootView paint:(Color red). |
|
73 |
rootView fillRectangleX:10 y:10 width:100 height:100. |
|
89 | 74 |
|
75 |
of course, all stuff from View and its superclasses can be used: |
|
76 |
||
1254 | 77 |
|rootView| |
89 | 78 |
|
1254 | 79 |
rootView := Screen current rootView. |
80 |
rootView paint:(Color red). |
|
81 |
rootView noClipByChildren. |
|
82 |
rootView fillRectangleX:10 y:10 width:100 height:100. |
|
83 |
||
616 | 84 |
|
85 |
[author:] |
|
86 |
Claus Gittinger |
|
45 | 87 |
" |
88 |
! ! |
|
89 |
||
1254 | 90 |
!DisplayRootView class methodsFor:'initialization'! |
0 | 91 |
|
92 |
initialize |
|
93 |
Display isNil ifTrue:[ |
|
71 | 94 |
Workstation initialize |
0 | 95 |
]. |
96 |
super initialize |
|
97 |
! ! |
|
98 |
||
1254 | 99 |
!DisplayRootView class methodsFor:'instance creation'! |
0 | 100 |
|
1256 | 101 |
onDevice:aDisplay |
89 | 102 |
"since there is only one RootView - catch new and return |
103 |
the one and only rootView." |
|
104 |
||
134 | 105 |
aDisplay == Display ifTrue:[ |
1256 | 106 |
RootView notNil ifTrue:[^ RootView]. |
107 |
RootView := super onDevice:aDisplay. |
|
108 |
^ RootView |
|
0 | 109 |
]. |
1256 | 110 |
^ super onDevice:aDisplay |
111 |
||
112 |
"Created: 18.1.1997 / 18:23:22 / cg" |
|
0 | 113 |
! ! |
114 |
||
115 |
!DisplayRootView methodsFor:'accessing'! |
|
116 |
||
117 |
controller |
|
2916 | 118 |
"return nil - I have no controller" |
180 | 119 |
|
0 | 120 |
^ nil |
23 | 121 |
! |
122 |
||
269 | 123 |
name |
2916 | 124 |
"return my name - always 'RootWindow'" |
125 |
||
269 | 126 |
^ 'RootWindow' |
127 |
! |
|
128 |
||
23 | 129 |
sensor |
2916 | 130 |
"return nil, since I have no sensor" |
180 | 131 |
|
132 |
^ nil |
|
133 |
! |
|
134 |
||
3253 | 135 |
subViews |
136 |
"return the collection of subviews - none here" |
|
137 |
||
138 |
^ #() |
|
139 |
||
140 |
||
141 |
! |
|
142 |
||
180 | 143 |
windowGroup |
2916 | 144 |
"return nil - I have no windowGroup" |
180 | 145 |
|
23 | 146 |
^ nil |
0 | 147 |
! ! |
148 |
||
71 | 149 |
!DisplayRootView methodsFor:'destroying'! |
150 |
||
151 |
destroy |
|
152 |
"catch destroy - some windowmanagers get confused if |
|
153 |
we destroy the rootWindow if its a virtual root window" |
|
154 |
||
155 |
^ self |
|
156 |
! ! |
|
157 |
||
3253 | 158 |
!DisplayRootView methodsFor:'dummy'! |
159 |
||
160 |
redrawX:x y:y width:width height:height |
|
161 |
"ignored" |
|
162 |
! ! |
|
163 |
||
2572 | 164 |
!DisplayRootView methodsFor:'initialize / release'! |
269 | 165 |
|
166 |
initialize |
|
167 |
super initialize. |
|
168 |
||
169 |
width := device width. |
|
170 |
height := device height. |
|
171 |
drawableId := device rootWindowFor:self. |
|
172 |
realized := true. |
|
173 |
! |
|
174 |
||
175 |
reinitialize |
|
176 |
"reinit after snapin" |
|
177 |
||
178 |
width := device width. |
|
179 |
height := device height. |
|
180 |
drawableId := device rootWindowFor:self. |
|
181 |
realized := true. |
|
182 |
gcId := nil. |
|
183 |
! ! |
|
184 |
||
0 | 185 |
!DisplayRootView methodsFor:'queries'! |
186 |
||
1584
03d62f063935
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
187 |
canDrop:aCollectionOfDropObjects |
03d62f063935
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
188 |
"return true, if aCollectionOfDropObjects can be |
2916 | 189 |
dropped in the receiver. |
190 |
False is returned here, since nothing can be dropped on the desktop. |
|
191 |
(for now - actually some systems do allow dropping things on the desktop |
|
192 |
and this query should be forwarded to my display device)" |
|
0 | 193 |
|
194 |
^ false |
|
1584
03d62f063935
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
195 |
|
03d62f063935
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
196 |
"Modified: 11.4.1997 / 12:41:38 / cg" |
269 | 197 |
! |
0 | 198 |
|
919
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
199 |
isRootView |
2916 | 200 |
"return true, since yes, I am a rootview" |
919
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
201 |
|
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
202 |
^ true |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
203 |
|
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
204 |
"Created: 5.7.1996 / 13:48:24 / cg" |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
205 |
"Modified: 5.7.1996 / 14:57:44 / cg" |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
206 |
! |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
207 |
|
0 | 208 |
isWindowManagerRunning |
2 | 209 |
"answer true, if a window manager is currently running. |
210 |
This is done by performing an action (enabling button events of |
|
23 | 211 |
root window), which will fail if a window manager is running." |
0 | 212 |
|
2 | 213 |
|errorOccured| |
0 | 214 |
|
2916 | 215 |
device platformName = 'WIN32' ifTrue:[^ true]. |
216 |
||
0 | 217 |
errorOccured := false. |
2 | 218 |
device class deviceErrorSignal handle:[:ex | |
2916 | 219 |
errorOccured := true. |
220 |
ex return |
|
2 | 221 |
] do:[ |
2916 | 222 |
self enableButtonEvents. |
223 |
device flush. |
|
2 | 224 |
]. |
2916 | 225 |
^ errorOccured not |
23 | 226 |
|
134 | 227 |
" |
228 |
DisplayRootView new |
|
229 |
RootView isWindowManagerRunning |
|
230 |
" |
|
919
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
231 |
! |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
232 |
|
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
233 |
shown |
2916 | 234 |
"return true - a rootview is always assumed to be visible" |
919
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
235 |
|
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
236 |
^ true |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
237 |
|
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
238 |
"Created: 5.7.1996 / 13:48:05 / cg" |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
239 |
"Modified: 5.7.1996 / 14:57:34 / cg" |
0 | 240 |
! ! |
269 | 241 |
|
1254 | 242 |
!DisplayRootView class methodsFor:'documentation'! |
269 | 243 |
|
244 |
version |
|
3253 | 245 |
^ '$Header: /cvs/stx/stx/libview/DisplayRootView.st,v 1.24 2000-08-09 19:12:52 cg Exp $' |
269 | 246 |
! ! |
247 |
DisplayRootView initialize! |