author | Stefan Vogel <sv@exept.de> |
Thu, 25 Jul 2002 12:11:51 +0200 | |
changeset 3675 | 1530f7067667 |
parent 3630 | 2b2f6649c014 |
child 3856 | 45fccc92d834 |
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:'instance creation'! |
0 | 91 |
|
1256 | 92 |
onDevice:aDisplay |
89 | 93 |
"since there is only one RootView - catch new and return |
94 |
the one and only rootView." |
|
95 |
||
134 | 96 |
aDisplay == Display ifTrue:[ |
3337 | 97 |
RootView notNil ifTrue:[ |
98 |
RootView device == aDisplay ifTrue:[ |
|
99 |
^ RootView |
|
100 |
] |
|
101 |
]. |
|
1256 | 102 |
RootView := super onDevice:aDisplay. |
103 |
^ RootView |
|
0 | 104 |
]. |
1256 | 105 |
^ super onDevice:aDisplay |
106 |
||
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3337
diff
changeset
|
107 |
"Created: 18.1.1997 / 18:23:22 / cg" |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3337
diff
changeset
|
108 |
! ! |
0 | 109 |
|
110 |
!DisplayRootView methodsFor:'accessing'! |
|
111 |
||
112 |
controller |
|
2916 | 113 |
"return nil - I have no controller" |
180 | 114 |
|
0 | 115 |
^ nil |
23 | 116 |
! |
117 |
||
269 | 118 |
name |
2916 | 119 |
"return my name - always 'RootWindow'" |
120 |
||
269 | 121 |
^ 'RootWindow' |
122 |
! |
|
123 |
||
23 | 124 |
sensor |
2916 | 125 |
"return nil, since I have no sensor" |
180 | 126 |
|
127 |
^ nil |
|
128 |
! |
|
129 |
||
3253 | 130 |
subViews |
131 |
"return the collection of subviews - none here" |
|
132 |
||
133 |
^ #() |
|
134 |
||
135 |
||
136 |
! |
|
137 |
||
180 | 138 |
windowGroup |
2916 | 139 |
"return nil - I have no windowGroup" |
180 | 140 |
|
23 | 141 |
^ nil |
0 | 142 |
! ! |
143 |
||
71 | 144 |
!DisplayRootView methodsFor:'destroying'! |
145 |
||
146 |
destroy |
|
147 |
"catch destroy - some windowmanagers get confused if |
|
148 |
we destroy the rootWindow if its a virtual root window" |
|
149 |
||
150 |
^ self |
|
151 |
! ! |
|
152 |
||
3253 | 153 |
!DisplayRootView methodsFor:'dummy'! |
154 |
||
155 |
redrawX:x y:y width:width height:height |
|
156 |
"ignored" |
|
157 |
! ! |
|
158 |
||
2572 | 159 |
!DisplayRootView methodsFor:'initialize / release'! |
269 | 160 |
|
161 |
initialize |
|
162 |
super initialize. |
|
163 |
||
164 |
width := device width. |
|
165 |
height := device height. |
|
166 |
drawableId := device rootWindowFor:self. |
|
167 |
realized := true. |
|
168 |
! |
|
169 |
||
170 |
reinitialize |
|
171 |
"reinit after snapin" |
|
172 |
||
173 |
width := device width. |
|
174 |
height := device height. |
|
175 |
drawableId := device rootWindowFor:self. |
|
176 |
realized := true. |
|
177 |
gcId := nil. |
|
178 |
! ! |
|
179 |
||
0 | 180 |
!DisplayRootView methodsFor:'queries'! |
181 |
||
1584
03d62f063935
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
182 |
canDrop:aCollectionOfDropObjects |
03d62f063935
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
183 |
"return true, if aCollectionOfDropObjects can be |
2916 | 184 |
dropped in the receiver. |
185 |
False is returned here, since nothing can be dropped on the desktop. |
|
186 |
(for now - actually some systems do allow dropping things on the desktop |
|
187 |
and this query should be forwarded to my display device)" |
|
0 | 188 |
|
189 |
^ false |
|
1584
03d62f063935
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
190 |
|
03d62f063935
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
191 |
"Modified: 11.4.1997 / 12:41:38 / cg" |
269 | 192 |
! |
0 | 193 |
|
919
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
194 |
isRootView |
2916 | 195 |
"return true, since yes, I am a rootview" |
919
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
196 |
|
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
197 |
^ true |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
198 |
|
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
199 |
"Created: 5.7.1996 / 13:48:24 / cg" |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
200 |
"Modified: 5.7.1996 / 14:57:44 / cg" |
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 |
|
0 | 203 |
isWindowManagerRunning |
2 | 204 |
"answer true, if a window manager is currently running. |
205 |
This is done by performing an action (enabling button events of |
|
23 | 206 |
root window), which will fail if a window manager is running." |
0 | 207 |
|
2 | 208 |
|errorOccured| |
0 | 209 |
|
2916 | 210 |
device platformName = 'WIN32' ifTrue:[^ true]. |
211 |
||
0 | 212 |
errorOccured := false. |
2 | 213 |
device class deviceErrorSignal handle:[:ex | |
2916 | 214 |
errorOccured := true. |
215 |
ex return |
|
2 | 216 |
] do:[ |
2916 | 217 |
self enableButtonEvents. |
218 |
device flush. |
|
2 | 219 |
]. |
2916 | 220 |
^ errorOccured not |
23 | 221 |
|
134 | 222 |
" |
223 |
DisplayRootView new |
|
224 |
RootView isWindowManagerRunning |
|
225 |
" |
|
0 | 226 |
! ! |
269 | 227 |
|
1254 | 228 |
!DisplayRootView class methodsFor:'documentation'! |
269 | 229 |
|
230 |
version |
|
3675 | 231 |
^ '$Header: /cvs/stx/stx/libview/DisplayRootView.st,v 1.27 2002-07-25 10:11:51 stefan Exp $' |
269 | 232 |
! ! |