author | fm |
Wed, 09 Jul 2008 14:44:23 +0200 | |
changeset 4989 | 99ac92b85e4d |
parent 4981 | 780ccc05227b |
child 6233 | b746fb9ba0e3 |
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 |
" |
|
3253 | 12 |
"{ Package: 'stx:libview' }" |
13 |
||
727
bf23a306b6f2
renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents:
626
diff
changeset
|
14 |
DisplaySurface subclass:#DisplayRootView |
616 | 15 |
instanceVariableNames:'' |
16 |
classVariableNames:'' |
|
17 |
poolDictionaries:'' |
|
626 | 18 |
category:'Views-Special' |
0 | 19 |
! |
20 |
||
1254 | 21 |
!DisplayRootView class methodsFor:'documentation'! |
45 | 22 |
|
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1988 by Claus Gittinger |
|
71 | 26 |
All Rights Reserved |
45 | 27 |
|
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
37 |
documentation |
|
38 |
" |
|
2916 | 39 |
this class describes the rootWindow (which is the background window or |
40 |
desktop and can be used for drawing outside of Views |
|
41 |
i.e. for dragging between Views). |
|
89 | 42 |
|
1254 | 43 |
For historic and compatibility reasons, there is a global variable |
44 |
called 'RootView', which is bound to the default displays ('Display') |
|
45 |
rootview. We recommend, not to access this variable, instead, get a |
|
46 |
displays rootView via the #rootView message (sent to the device). |
|
47 |
Otherwise, your application will not work in a multiScreen environment. |
|
180 | 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 |
|
1254 | 52 |
applications (i.e. dragging). |
53 |
There may be display systems in which rootViews are not |
|
180 | 54 |
supported/allowed implemented. So be VERY careful when using them. |
134 | 55 |
|
1254 | 56 |
Be aware, that the rootView is not always visible - some |
57 |
windowManagers install another (pseudoRoot), into which icons and |
|
58 |
windowManager menus are drawn. If that is the case, your paining |
|
59 |
into the rootView may not be visible, unless you set the #noClipByChildren |
|
60 |
option (see below). |
|
2916 | 61 |
Also, it is not guaranteed, that all devices support drawing in the |
62 |
root window - especially if the device is a simulated one, such as |
|
63 |
a remote webBrowser ... |
|
1254 | 64 |
In general, you should never use the rootView for normal applications. |
65 |
||
134 | 66 |
To draw in the (Displays) root window: |
89 | 67 |
|
1254 | 68 |
|rootView| |
69 |
||
70 |
rootView := Screen current rootView. |
|
71 |
rootView paint:(Color red). |
|
72 |
rootView fillRectangleX:10 y:10 width:100 height:100. |
|
89 | 73 |
|
74 |
of course, all stuff from View and its superclasses can be used: |
|
75 |
||
1254 | 76 |
|rootView| |
89 | 77 |
|
1254 | 78 |
rootView := Screen current rootView. |
79 |
rootView paint:(Color red). |
|
80 |
rootView noClipByChildren. |
|
81 |
rootView fillRectangleX:10 y:10 width:100 height:100. |
|
82 |
||
616 | 83 |
|
84 |
[author:] |
|
85 |
Claus Gittinger |
|
45 | 86 |
" |
87 |
! ! |
|
88 |
||
1254 | 89 |
!DisplayRootView class methodsFor:'instance creation'! |
0 | 90 |
|
1256 | 91 |
onDevice:aDisplay |
89 | 92 |
"since there is only one RootView - catch new and return |
93 |
the one and only rootView." |
|
94 |
||
134 | 95 |
aDisplay == Display ifTrue:[ |
3337 | 96 |
RootView notNil ifTrue:[ |
97 |
RootView device == aDisplay ifTrue:[ |
|
98 |
^ RootView |
|
99 |
] |
|
100 |
]. |
|
1256 | 101 |
RootView := super onDevice:aDisplay. |
102 |
^ RootView |
|
0 | 103 |
]. |
1256 | 104 |
^ super onDevice:aDisplay |
105 |
||
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3337
diff
changeset
|
106 |
"Created: 18.1.1997 / 18:23:22 / cg" |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3337
diff
changeset
|
107 |
! ! |
0 | 108 |
|
109 |
!DisplayRootView methodsFor:'accessing'! |
|
110 |
||
4213 | 111 |
application |
112 |
^ nil |
|
113 |
! |
|
114 |
||
4214 | 115 |
model |
116 |
^ nil |
|
117 |
! |
|
118 |
||
269 | 119 |
name |
2916 | 120 |
"return my name - always 'RootWindow'" |
121 |
||
269 | 122 |
^ 'RootWindow' |
123 |
! |
|
124 |
||
3253 | 125 |
subViews |
126 |
"return the collection of subviews - none here" |
|
127 |
||
128 |
^ #() |
|
129 |
||
130 |
||
4981 | 131 |
! |
132 |
||
133 |
uuid |
|
4989 | 134 |
"return my uuid - always the same here. |
135 |
TODO: think what happens with multiple screens..." |
|
4981 | 136 |
|
137 |
^ UUID readFrom:'31be9300-41fc-11dd-b99f-001558137da0' "/ do not change - ask cg if you dont know why |
|
0 | 138 |
! ! |
139 |
||
71 | 140 |
!DisplayRootView methodsFor:'destroying'! |
141 |
||
142 |
destroy |
|
143 |
"catch destroy - some windowmanagers get confused if |
|
144 |
we destroy the rootWindow if its a virtual root window" |
|
145 |
||
146 |
^ self |
|
147 |
! ! |
|
148 |
||
3253 | 149 |
!DisplayRootView methodsFor:'dummy'! |
150 |
||
151 |
redrawX:x y:y width:width height:height |
|
152 |
"ignored" |
|
153 |
! ! |
|
154 |
||
3883 | 155 |
!DisplayRootView methodsFor:'initialization & release'! |
269 | 156 |
|
157 |
initialize |
|
158 |
super initialize. |
|
159 |
||
160 |
width := device width. |
|
161 |
height := device height. |
|
162 |
drawableId := device rootWindowFor:self. |
|
163 |
realized := true. |
|
164 |
! |
|
165 |
||
166 |
reinitialize |
|
167 |
"reinit after snapin" |
|
168 |
||
169 |
width := device width. |
|
170 |
height := device height. |
|
171 |
drawableId := device rootWindowFor:self. |
|
172 |
realized := true. |
|
173 |
gcId := nil. |
|
174 |
! ! |
|
175 |
||
0 | 176 |
!DisplayRootView methodsFor:'queries'! |
177 |
||
4650 | 178 |
canDropObjects:aCollectionOfDropObjects |
1584
03d62f063935
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
179 |
"return true, if aCollectionOfDropObjects can be |
2916 | 180 |
dropped in the receiver. |
181 |
False is returned here, since nothing can be dropped on the desktop. |
|
182 |
(for now - actually some systems do allow dropping things on the desktop |
|
183 |
and this query should be forwarded to my display device)" |
|
0 | 184 |
|
185 |
^ false |
|
1584
03d62f063935
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1256
diff
changeset
|
186 |
|
4650 | 187 |
"Created: / 13-10-2006 / 15:55:54 / cg" |
269 | 188 |
! |
0 | 189 |
|
919
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
190 |
isRootView |
2916 | 191 |
"return true, since yes, I am a rootview" |
919
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
192 |
|
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
193 |
^ true |
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 |
"Created: 5.7.1996 / 13:48:24 / cg" |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
196 |
"Modified: 5.7.1996 / 14:57:44 / cg" |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
197 |
! |
47b7aff0f1e4
added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents:
727
diff
changeset
|
198 |
|
0 | 199 |
isWindowManagerRunning |
2 | 200 |
"answer true, if a window manager is currently running. |
201 |
This is done by performing an action (enabling button events of |
|
23 | 202 |
root window), which will fail if a window manager is running." |
0 | 203 |
|
2916 | 204 |
device platformName = 'WIN32' ifTrue:[^ true]. |
205 |
||
2 | 206 |
device class deviceErrorSignal handle:[:ex | |
4221
666dea8f4aa7
Do not move messages to superclass (where they are sent)
Stefan Vogel <sv@exept.de>
parents:
4214
diff
changeset
|
207 |
^ false. |
2 | 208 |
] do:[ |
2916 | 209 |
self enableButtonEvents. |
210 |
device flush. |
|
2 | 211 |
]. |
4221
666dea8f4aa7
Do not move messages to superclass (where they are sent)
Stefan Vogel <sv@exept.de>
parents:
4214
diff
changeset
|
212 |
^ true |
23 | 213 |
|
134 | 214 |
" |
215 |
DisplayRootView new |
|
216 |
RootView isWindowManagerRunning |
|
217 |
" |
|
0 | 218 |
! ! |
269 | 219 |
|
1254 | 220 |
!DisplayRootView class methodsFor:'documentation'! |
269 | 221 |
|
222 |
version |
|
4989 | 223 |
^ '$Header: /cvs/stx/stx/libview/DisplayRootView.st,v 1.36 2008-07-09 12:44:23 fm Exp $' |
269 | 224 |
! ! |