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