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