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 |
|
|
13 |
PseudoView subclass:#DisplayRootView
|
616
|
14 |
instanceVariableNames:''
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
626
|
17 |
category:'Views-Special'
|
0
|
18 |
!
|
|
19 |
|
45
|
20 |
!DisplayRootView class methodsFor:'documentation'!
|
|
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 |
|
0
|
73 |
!DisplayRootView class methodsFor:'initialization'!
|
|
74 |
|
|
75 |
initialize
|
|
76 |
Display isNil ifTrue:[
|
71
|
77 |
Workstation initialize
|
0
|
78 |
].
|
|
79 |
super initialize
|
|
80 |
! !
|
|
81 |
|
|
82 |
!DisplayRootView class methodsFor:'instance creation'!
|
|
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 |
|
|
160 |
isWindowManagerRunning
|
2
|
161 |
"answer true, if a window manager is currently running.
|
|
162 |
This is done by performing an action (enabling button events of
|
23
|
163 |
root window), which will fail if a window manager is running."
|
0
|
164 |
|
2
|
165 |
|errorOccured|
|
0
|
166 |
|
|
167 |
errorOccured := false.
|
2
|
168 |
device class deviceErrorSignal handle:[:ex |
|
71
|
169 |
errorOccured := true.
|
|
170 |
ex return
|
2
|
171 |
] do:[
|
134
|
172 |
self enableButtonEvents.
|
180
|
173 |
device flush.
|
2
|
174 |
].
|
0
|
175 |
^ errorOccured
|
23
|
176 |
|
134
|
177 |
"
|
|
178 |
DisplayRootView new
|
|
179 |
RootView isWindowManagerRunning
|
|
180 |
"
|
0
|
181 |
! !
|
269
|
182 |
|
|
183 |
!DisplayRootView class methodsFor:'documentation'!
|
|
184 |
|
|
185 |
version
|
626
|
186 |
^ '$Header: /cvs/stx/stx/libview/DisplayRootView.st,v 1.16 1996-04-30 13:43:23 cg Exp $'
|
269
|
187 |
! !
|
|
188 |
DisplayRootView initialize!
|