author | Claus Gittinger <cg@exept.de> |
Thu, 26 Feb 2004 12:27:39 +0100 | |
changeset 4042 | 4ca4bc8ac76a |
parent 3883 | 4e01a59afccb |
child 4213 | 38e47961a6cc |
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 |
||
269 | 112 |
name |
2916 | 113 |
"return my name - always 'RootWindow'" |
114 |
||
269 | 115 |
^ 'RootWindow' |
116 |
! |
|
117 |
||
23 | 118 |
sensor |
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3675
diff
changeset
|
119 |
"return a SynchronousWindowSensor, since I have no windoe group" |
180 | 120 |
|
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3675
diff
changeset
|
121 |
^ SynchronousWindowSensor new |
180 | 122 |
! |
123 |
||
3253 | 124 |
subViews |
125 |
"return the collection of subviews - none here" |
|
126 |
||
127 |
^ #() |
|
128 |
||
129 |
||
130 |
! |
|
131 |
||
180 | 132 |
windowGroup |
2916 | 133 |
"return nil - I have no windowGroup" |
180 | 134 |
|
23 | 135 |
^ nil |
0 | 136 |
! ! |
137 |
||
71 | 138 |
!DisplayRootView methodsFor:'destroying'! |
139 |
||
140 |
destroy |
|
141 |
"catch destroy - some windowmanagers get confused if |
|
142 |
we destroy the rootWindow if its a virtual root window" |
|
143 |
||
144 |
^ self |
|
145 |
! ! |
|
146 |
||
3253 | 147 |
!DisplayRootView methodsFor:'dummy'! |
148 |
||
149 |
redrawX:x y:y width:width height:height |
|
150 |
"ignored" |
|
151 |
! ! |
|
152 |
||
3883 | 153 |
!DisplayRootView methodsFor:'initialization & release'! |
269 | 154 |
|
155 |
initialize |
|
156 |
super initialize. |
|
157 |
||
158 |
width := device width. |
|
159 |
height := device height. |
|
160 |
drawableId := device rootWindowFor:self. |
|
161 |
realized := true. |
|
162 |
! |
|
163 |
||
164 |
reinitialize |
|
165 |
"reinit after snapin" |
|
166 |
||
167 |
width := device width. |
|
168 |
height := device height. |
|
169 |
drawableId := device rootWindowFor:self. |
|
170 |
realized := true. |
|
171 |
gcId := nil. |
|
172 |
! ! |
|
173 |
||
0 | 174 |
!DisplayRootView methodsFor:'queries'! |
175 |
||
1584
03d62f063935
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
176 |
canDrop:aCollectionOfDropObjects |
03d62f063935
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
177 |
"return true, if aCollectionOfDropObjects can be |
2916 | 178 |
dropped in the receiver. |
179 |
False is returned here, since nothing can be dropped on the desktop. |
|
180 |
(for now - actually some systems do allow dropping things on the desktop |
|
181 |
and this query should be forwarded to my display device)" |
|
0 | 182 |
|
183 |
^ false |
|
1584
03d62f063935
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
184 |
|
03d62f063935
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
185 |
"Modified: 11.4.1997 / 12:41:38 / cg" |
269 | 186 |
! |
0 | 187 |
|
919
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
188 |
isRootView |
2916 | 189 |
"return true, since yes, I am a rootview" |
919
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
190 |
|
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
191 |
^ true |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
192 |
|
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
193 |
"Created: 5.7.1996 / 13:48:24 / cg" |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
194 |
"Modified: 5.7.1996 / 14:57:44 / cg" |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
195 |
! |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
196 |
|
0 | 197 |
isWindowManagerRunning |
2 | 198 |
"answer true, if a window manager is currently running. |
199 |
This is done by performing an action (enabling button events of |
|
23 | 200 |
root window), which will fail if a window manager is running." |
0 | 201 |
|
2 | 202 |
|errorOccured| |
0 | 203 |
|
2916 | 204 |
device platformName = 'WIN32' ifTrue:[^ true]. |
205 |
||
0 | 206 |
errorOccured := false. |
2 | 207 |
device class deviceErrorSignal handle:[:ex | |
2916 | 208 |
errorOccured := true. |
209 |
ex return |
|
2 | 210 |
] do:[ |
2916 | 211 |
self enableButtonEvents. |
212 |
device flush. |
|
2 | 213 |
]. |
2916 | 214 |
^ errorOccured not |
23 | 215 |
|
134 | 216 |
" |
217 |
DisplayRootView new |
|
218 |
RootView isWindowManagerRunning |
|
219 |
" |
|
0 | 220 |
! ! |
269 | 221 |
|
1254 | 222 |
!DisplayRootView class methodsFor:'documentation'! |
269 | 223 |
|
224 |
version |
|
4042 | 225 |
^ '$Header: /cvs/stx/stx/libview/DisplayRootView.st,v 1.30 2004-02-26 11:27:39 cg Exp $' |
269 | 226 |
! ! |