author | Claus Gittinger <cg@exept.de> |
Mon, 20 Jan 1997 11:49:15 +0100 | |
changeset 1256 | 4a633daff594 |
parent 1254 | 6bb4afe072f1 |
child 1584 | 03d62f063935 |
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 |
||
727
bf23a306b6f2
renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents:
626
diff
changeset
|
13 |
DisplaySurface subclass:#DisplayRootView |
616 | 14 |
instanceVariableNames:'' |
15 |
classVariableNames:'' |
|
16 |
poolDictionaries:'' |
|
626 | 17 |
category:'Views-Special' |
0 | 18 |
! |
19 |
||
1254 | 20 |
!DisplayRootView class methodsFor:'documentation'! |
45 | 21 |
|
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1988 by Claus Gittinger |
|
71 | 25 |
All Rights Reserved |
45 | 26 |
|
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
36 |
documentation |
|
37 |
" |
|
38 |
this class describes Xs rootWindow (which is the background window and |
|
180 | 39 |
can be used for drawing outside of Views i.e. for dragging between Views). |
89 | 40 |
|
1254 | 41 |
For historic and compatibility reasons, there is a global variable |
42 |
called 'RootView', which is bound to the default displays ('Display') |
|
43 |
rootview. We recommend, not to access this variable, instead, get a |
|
44 |
displays rootView via the #rootView message (sent to the device). |
|
45 |
Otherwise, your application will not work in a multiScreen environment. |
|
180 | 46 |
|
47 |
Instances of myself (i.e. these rootViews) are light-weight views; |
|
48 |
they do not support events, models etc. |
|
49 |
They are pure drawing canvases and should be only used for special |
|
1254 | 50 |
applications (i.e. dragging). |
51 |
There may be display systems in which rootViews are not |
|
180 | 52 |
supported/allowed implemented. So be VERY careful when using them. |
134 | 53 |
|
1254 | 54 |
Be aware, that the rootView is not always visible - some |
55 |
windowManagers install another (pseudoRoot), into which icons and |
|
56 |
windowManager menus are drawn. If that is the case, your paining |
|
57 |
into the rootView may not be visible, unless you set the #noClipByChildren |
|
58 |
option (see below). |
|
59 |
||
60 |
In general, you should never use the rootView for normal applications. |
|
61 |
||
134 | 62 |
To draw in the (Displays) root window: |
89 | 63 |
|
1254 | 64 |
|rootView| |
65 |
||
66 |
rootView := Screen current rootView. |
|
67 |
rootView paint:(Color red). |
|
68 |
rootView fillRectangleX:10 y:10 width:100 height:100. |
|
89 | 69 |
|
70 |
of course, all stuff from View and its superclasses can be used: |
|
71 |
||
1254 | 72 |
|rootView| |
89 | 73 |
|
1254 | 74 |
rootView := Screen current rootView. |
75 |
rootView paint:(Color red). |
|
76 |
rootView noClipByChildren. |
|
77 |
rootView fillRectangleX:10 y:10 width:100 height:100. |
|
78 |
||
616 | 79 |
|
80 |
[author:] |
|
81 |
Claus Gittinger |
|
45 | 82 |
" |
83 |
! ! |
|
84 |
||
1254 | 85 |
!DisplayRootView class methodsFor:'initialization'! |
0 | 86 |
|
87 |
initialize |
|
88 |
Display isNil ifTrue:[ |
|
71 | 89 |
Workstation initialize |
0 | 90 |
]. |
91 |
super initialize |
|
92 |
! ! |
|
93 |
||
1254 | 94 |
!DisplayRootView class methodsFor:'instance creation'! |
0 | 95 |
|
1256 | 96 |
onDevice:aDisplay |
89 | 97 |
"since there is only one RootView - catch new and return |
98 |
the one and only rootView." |
|
99 |
||
134 | 100 |
aDisplay == Display ifTrue:[ |
1256 | 101 |
RootView notNil ifTrue:[^ RootView]. |
102 |
RootView := super onDevice:aDisplay. |
|
103 |
^ RootView |
|
0 | 104 |
]. |
1256 | 105 |
^ super onDevice:aDisplay |
106 |
||
107 |
"Created: 18.1.1997 / 18:23:22 / cg" |
|
0 | 108 |
! ! |
109 |
||
110 |
!DisplayRootView methodsFor:'accessing'! |
|
111 |
||
112 |
controller |
|
180 | 113 |
"I have no controller" |
114 |
||
0 | 115 |
^ nil |
23 | 116 |
! |
117 |
||
269 | 118 |
name |
119 |
^ 'RootWindow' |
|
120 |
! |
|
121 |
||
23 | 122 |
sensor |
180 | 123 |
"I have no sensor" |
124 |
||
125 |
^ nil |
|
126 |
! |
|
127 |
||
128 |
windowGroup |
|
129 |
"I have no windowGroup" |
|
130 |
||
23 | 131 |
^ nil |
0 | 132 |
! ! |
133 |
||
71 | 134 |
!DisplayRootView methodsFor:'destroying'! |
135 |
||
136 |
destroy |
|
137 |
"catch destroy - some windowmanagers get confused if |
|
138 |
we destroy the rootWindow if its a virtual root window" |
|
139 |
||
140 |
^ self |
|
141 |
! ! |
|
142 |
||
269 | 143 |
!DisplayRootView methodsFor:'initialization'! |
144 |
||
145 |
initialize |
|
146 |
super initialize. |
|
147 |
||
148 |
width := device width. |
|
149 |
height := device height. |
|
150 |
drawableId := device rootWindowFor:self. |
|
151 |
realized := true. |
|
152 |
! |
|
153 |
||
154 |
reinitialize |
|
155 |
"reinit after snapin" |
|
156 |
||
157 |
width := device width. |
|
158 |
height := device height. |
|
159 |
drawableId := device rootWindowFor:self. |
|
160 |
realized := true. |
|
161 |
gcId := nil. |
|
162 |
! ! |
|
163 |
||
0 | 164 |
!DisplayRootView methodsFor:'queries'! |
165 |
||
166 |
canDrop:anObjectOrCollection |
|
167 |
"return true, if anObjectOrCollection can be |
|
168 |
dropped in the receiver. This method should be |
|
169 |
redefined in views which can take objects" |
|
170 |
||
171 |
^ false |
|
269 | 172 |
! |
0 | 173 |
|
919
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
174 |
isRootView |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
175 |
"yes, I am a rootview" |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
176 |
|
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
177 |
^ true |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
178 |
|
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
179 |
"Created: 5.7.1996 / 13:48:24 / cg" |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
180 |
"Modified: 5.7.1996 / 14:57:44 / cg" |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
181 |
! |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
182 |
|
0 | 183 |
isWindowManagerRunning |
2 | 184 |
"answer true, if a window manager is currently running. |
185 |
This is done by performing an action (enabling button events of |
|
23 | 186 |
root window), which will fail if a window manager is running." |
0 | 187 |
|
2 | 188 |
|errorOccured| |
0 | 189 |
|
190 |
errorOccured := false. |
|
2 | 191 |
device class deviceErrorSignal handle:[:ex | |
71 | 192 |
errorOccured := true. |
193 |
ex return |
|
2 | 194 |
] do:[ |
134 | 195 |
self enableButtonEvents. |
180 | 196 |
device flush. |
2 | 197 |
]. |
0 | 198 |
^ errorOccured |
23 | 199 |
|
134 | 200 |
" |
201 |
DisplayRootView new |
|
202 |
RootView isWindowManagerRunning |
|
203 |
" |
|
919
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
204 |
! |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
205 |
|
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
206 |
shown |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
207 |
"a rootview is always assumed to be visible" |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
208 |
|
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
209 |
^ true |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
210 |
|
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
211 |
"Created: 5.7.1996 / 13:48:05 / cg" |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
212 |
"Modified: 5.7.1996 / 14:57:34 / cg" |
0 | 213 |
! ! |
269 | 214 |
|
1254 | 215 |
!DisplayRootView class methodsFor:'documentation'! |
269 | 216 |
|
217 |
version |
|
1256 | 218 |
^ '$Header: /cvs/stx/stx/libview/DisplayRootView.st,v 1.20 1997-01-20 10:49:15 cg Exp $' |
269 | 219 |
! ! |
220 |
DisplayRootView initialize! |