author | Claus Gittinger <cg@exept.de> |
Fri, 05 Jul 1996 14:58:04 +0200 | |
changeset 919 | 47b7aff0f1e4 |
parent 727 | bf23a306b6f2 |
child 1254 | 6bb4afe072f1 |
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 |
||
919
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
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 |
|
134 | 41 |
There is one global variable (RootView) which is the Displays rootview. |
42 |
(this is the default displays rootView; to access other devices' rootView, |
|
180 | 43 |
use someDisplay rootView), |
44 |
||
45 |
Instances of myself (i.e. these rootViews) are light-weight views; |
|
46 |
they do not support events, models etc. |
|
47 |
They are pure drawing canvases and should be only used for special |
|
48 |
applications. There may be display systems in which rootViews are not |
|
49 |
supported/allowed implemented. So be VERY careful when using them. |
|
134 | 50 |
|
51 |
To draw in the (Displays) root window: |
|
89 | 52 |
|
616 | 53 |
RootView paint:(Color red). |
54 |
RootView fillRectangleX:10 y:10 width:100 height:100. |
|
89 | 55 |
|
56 |
of course, all stuff from View and its superclasses can be used: |
|
57 |
||
616 | 58 |
RootView paint:(Color red). |
59 |
RootView noClipByChildren. |
|
60 |
RootView fillRectangleX:10 y:10 width:100 height:100. |
|
89 | 61 |
|
62 |
you have to be careful with some window managers, since what you |
|
63 |
see on the screen is not always really the root window. Some Desktops |
|
64 |
add their own view in between (although the Xworkstation class does |
|
65 |
care for this, it seems not to work correctly on all systems). |
|
66 |
In general, you should never use the RootView for normal applications. |
|
616 | 67 |
|
68 |
[author:] |
|
69 |
Claus Gittinger |
|
45 | 70 |
" |
71 |
! ! |
|
72 |
||
919
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
73 |
!DisplayRootView class methodsFor:'initialization'! |
0 | 74 |
|
75 |
initialize |
|
76 |
Display isNil ifTrue:[ |
|
71 | 77 |
Workstation initialize |
0 | 78 |
]. |
79 |
super initialize |
|
80 |
! ! |
|
81 |
||
919
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
82 |
!DisplayRootView class methodsFor:'instance creation'! |
0 | 83 |
|
134 | 84 |
on:aDisplay |
89 | 85 |
"since there is only one RootView - catch new and return |
86 |
the one and only rootView." |
|
87 |
||
134 | 88 |
aDisplay == Display ifTrue:[ |
89 |
RootView notNil ifTrue:[^ RootView]. |
|
90 |
RootView := super on:aDisplay. |
|
91 |
^ RootView |
|
0 | 92 |
]. |
134 | 93 |
^ super on:aDisplay |
0 | 94 |
! ! |
95 |
||
96 |
!DisplayRootView methodsFor:'accessing'! |
|
97 |
||
98 |
controller |
|
180 | 99 |
"I have no controller" |
100 |
||
0 | 101 |
^ nil |
23 | 102 |
! |
103 |
||
269 | 104 |
name |
105 |
^ 'RootWindow' |
|
106 |
! |
|
107 |
||
23 | 108 |
sensor |
180 | 109 |
"I have no sensor" |
110 |
||
111 |
^ nil |
|
112 |
! |
|
113 |
||
114 |
windowGroup |
|
115 |
"I have no windowGroup" |
|
116 |
||
23 | 117 |
^ nil |
0 | 118 |
! ! |
119 |
||
71 | 120 |
!DisplayRootView methodsFor:'destroying'! |
121 |
||
122 |
destroy |
|
123 |
"catch destroy - some windowmanagers get confused if |
|
124 |
we destroy the rootWindow if its a virtual root window" |
|
125 |
||
126 |
^ self |
|
127 |
! ! |
|
128 |
||
269 | 129 |
!DisplayRootView methodsFor:'initialization'! |
130 |
||
131 |
initialize |
|
132 |
super initialize. |
|
133 |
||
134 |
width := device width. |
|
135 |
height := device height. |
|
136 |
drawableId := device rootWindowFor:self. |
|
137 |
realized := true. |
|
138 |
! |
|
139 |
||
140 |
reinitialize |
|
141 |
"reinit after snapin" |
|
142 |
||
143 |
width := device width. |
|
144 |
height := device height. |
|
145 |
drawableId := device rootWindowFor:self. |
|
146 |
realized := true. |
|
147 |
gcId := nil. |
|
148 |
! ! |
|
149 |
||
0 | 150 |
!DisplayRootView methodsFor:'queries'! |
151 |
||
152 |
canDrop:anObjectOrCollection |
|
153 |
"return true, if anObjectOrCollection can be |
|
154 |
dropped in the receiver. This method should be |
|
155 |
redefined in views which can take objects" |
|
156 |
||
157 |
^ false |
|
269 | 158 |
! |
0 | 159 |
|
919
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
160 |
isRootView |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
161 |
"yes, I am a rootview" |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
162 |
|
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
163 |
^ true |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
164 |
|
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
165 |
"Created: 5.7.1996 / 13:48:24 / cg" |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
166 |
"Modified: 5.7.1996 / 14:57:44 / cg" |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
167 |
! |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
168 |
|
0 | 169 |
isWindowManagerRunning |
2 | 170 |
"answer true, if a window manager is currently running. |
171 |
This is done by performing an action (enabling button events of |
|
23 | 172 |
root window), which will fail if a window manager is running." |
0 | 173 |
|
2 | 174 |
|errorOccured| |
0 | 175 |
|
176 |
errorOccured := false. |
|
2 | 177 |
device class deviceErrorSignal handle:[:ex | |
71 | 178 |
errorOccured := true. |
179 |
ex return |
|
2 | 180 |
] do:[ |
134 | 181 |
self enableButtonEvents. |
180 | 182 |
device flush. |
2 | 183 |
]. |
0 | 184 |
^ errorOccured |
23 | 185 |
|
134 | 186 |
" |
187 |
DisplayRootView new |
|
188 |
RootView isWindowManagerRunning |
|
189 |
" |
|
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 |
|
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
192 |
shown |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
193 |
"a rootview is always assumed to be visible" |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
194 |
|
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
195 |
^ true |
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 |
"Created: 5.7.1996 / 13:48:05 / cg" |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
198 |
"Modified: 5.7.1996 / 14:57:34 / cg" |
0 | 199 |
! ! |
269 | 200 |
|
919
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
201 |
!DisplayRootView class methodsFor:'documentation'! |
269 | 202 |
|
203 |
version |
|
919
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
204 |
^ '$Header: /cvs/stx/stx/libview/DisplayRootView.st,v 1.18 1996-07-05 12:58:04 cg Exp $' |
269 | 205 |
! ! |
206 |
DisplayRootView initialize! |