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
|
2
|
14 |
instanceVariableNames:''
|
0
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Views-Basic'
|
|
18 |
!
|
|
19 |
|
|
20 |
DisplayRootView comment:'
|
6
|
21 |
COPYRIGHT (c) 1988 by Claus Gittinger
|
71
|
22 |
All Rights Reserved
|
54
|
23 |
|
134
|
24 |
$Header: /cvs/stx/stx/libview/DisplayRootView.st,v 1.11 1995-05-03 00:01:39 claus Exp $
|
0
|
25 |
'!
|
|
26 |
|
45
|
27 |
!DisplayRootView class methodsFor:'documentation'!
|
|
28 |
|
|
29 |
copyright
|
|
30 |
"
|
|
31 |
COPYRIGHT (c) 1988 by Claus Gittinger
|
71
|
32 |
All Rights Reserved
|
45
|
33 |
|
|
34 |
This software is furnished under a license and may be used
|
|
35 |
only in accordance with the terms of that license and with the
|
|
36 |
inclusion of the above copyright notice. This software may not
|
|
37 |
be provided or otherwise made available to, or used by, any
|
|
38 |
other person. No title to or ownership of the software is
|
|
39 |
hereby transferred.
|
|
40 |
"
|
|
41 |
!
|
|
42 |
|
|
43 |
version
|
|
44 |
"
|
134
|
45 |
$Header: /cvs/stx/stx/libview/DisplayRootView.st,v 1.11 1995-05-03 00:01:39 claus Exp $
|
45
|
46 |
"
|
|
47 |
!
|
|
48 |
|
|
49 |
documentation
|
|
50 |
"
|
|
51 |
this class describes Xs rootWindow (which is the background window and
|
89
|
52 |
must be used for drawing outside of Views i.e. for dragging between Views).
|
|
53 |
|
134
|
54 |
There is one global variable (RootView) which is the Displays rootview.
|
|
55 |
(this is the default displays rootView; to access other devices' rootView,
|
|
56 |
use aDisplay rootView),
|
|
57 |
|
|
58 |
To draw in the (Displays) root window:
|
89
|
59 |
|
|
60 |
RootView paint:(Color red).
|
|
61 |
RootView fillRectangleX:10 y:10 width:100 height:100.
|
|
62 |
|
|
63 |
of course, all stuff from View and its superclasses can be used:
|
|
64 |
|
|
65 |
RootView paint:(Color red).
|
|
66 |
RootView noClipByChildren.
|
|
67 |
RootView fillRectangleX:10 y:10 width:100 height:100.
|
|
68 |
|
|
69 |
you have to be careful with some window managers, since what you
|
|
70 |
see on the screen is not always really the root window. Some Desktops
|
|
71 |
add their own view in between (although the Xworkstation class does
|
|
72 |
care for this, it seems not to work correctly on all systems).
|
|
73 |
In general, you should never use the RootView for normal applications.
|
45
|
74 |
"
|
|
75 |
! !
|
|
76 |
|
0
|
77 |
!DisplayRootView class methodsFor:'initialization'!
|
|
78 |
|
|
79 |
initialize
|
|
80 |
Display isNil ifTrue:[
|
71
|
81 |
Workstation initialize
|
0
|
82 |
].
|
|
83 |
super initialize
|
|
84 |
! !
|
|
85 |
|
|
86 |
!DisplayRootView class methodsFor:'instance creation'!
|
|
87 |
|
134
|
88 |
on:aDisplay
|
89
|
89 |
"since there is only one RootView - catch new and return
|
|
90 |
the one and only rootView."
|
|
91 |
|
134
|
92 |
aDisplay == Display ifTrue:[
|
|
93 |
RootView notNil ifTrue:[^ RootView].
|
|
94 |
RootView := super on:aDisplay.
|
|
95 |
^ RootView
|
0
|
96 |
].
|
134
|
97 |
^ super on:aDisplay
|
0
|
98 |
! !
|
|
99 |
|
|
100 |
!DisplayRootView methodsFor:'initialization'!
|
|
101 |
|
|
102 |
initialize
|
|
103 |
super initialize.
|
89
|
104 |
|
0
|
105 |
width := device width.
|
|
106 |
height := device height.
|
89
|
107 |
drawableId := device rootWindowFor:self.
|
0
|
108 |
realized := true.
|
|
109 |
!
|
|
110 |
|
|
111 |
reinitialize
|
|
112 |
"reinit after snapin"
|
|
113 |
|
|
114 |
width := device width.
|
|
115 |
height := device height.
|
2
|
116 |
drawableId := device rootWindowFor:self.
|
89
|
117 |
realized := true.
|
2
|
118 |
gcId := nil.
|
0
|
119 |
! !
|
|
120 |
|
|
121 |
!DisplayRootView methodsFor:'accessing'!
|
|
122 |
|
|
123 |
name
|
|
124 |
^ 'RootWindow'
|
|
125 |
!
|
|
126 |
|
|
127 |
controller
|
|
128 |
^ nil
|
23
|
129 |
!
|
|
130 |
|
|
131 |
sensor
|
|
132 |
^ nil
|
0
|
133 |
! !
|
|
134 |
|
71
|
135 |
!DisplayRootView methodsFor:'destroying'!
|
|
136 |
|
|
137 |
destroy
|
|
138 |
"catch destroy - some windowmanagers get confused if
|
|
139 |
we destroy the rootWindow if its a virtual root window"
|
|
140 |
|
|
141 |
^ self
|
|
142 |
! !
|
|
143 |
|
0
|
144 |
!DisplayRootView methodsFor:'queries'!
|
|
145 |
|
|
146 |
canDrop:anObjectOrCollection
|
|
147 |
"return true, if anObjectOrCollection can be
|
|
148 |
dropped in the receiver. This method should be
|
|
149 |
redefined in views which can take objects"
|
|
150 |
|
|
151 |
^ false
|
2
|
152 |
!
|
0
|
153 |
|
|
154 |
isWindowManagerRunning
|
2
|
155 |
"answer true, if a window manager is currently running.
|
|
156 |
This is done by performing an action (enabling button events of
|
23
|
157 |
root window), which will fail if a window manager is running."
|
0
|
158 |
|
2
|
159 |
|errorOccured|
|
0
|
160 |
|
|
161 |
errorOccured := false.
|
2
|
162 |
device class deviceErrorSignal handle:[:ex |
|
71
|
163 |
errorOccured := true.
|
|
164 |
ex return
|
2
|
165 |
] do:[
|
134
|
166 |
self enableButtonEvents.
|
71
|
167 |
device synchronizeOutput.
|
2
|
168 |
].
|
0
|
169 |
^ errorOccured
|
23
|
170 |
|
134
|
171 |
"
|
|
172 |
DisplayRootView new
|
|
173 |
RootView isWindowManagerRunning
|
|
174 |
"
|
0
|
175 |
! !
|