author | Stefan Vogel <sv@exept.de> |
Tue, 28 Apr 2020 15:28:14 +0200 | |
changeset 9038 | dd177fea6408 |
parent 8927 | 970fc2d97125 |
permissions | -rw-r--r-- |
8560 | 1 |
"{ Encoding: utf8 }" |
2 |
||
1282 | 3 |
" |
1283 | 4 |
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
5 |
All Rights Reserved |
1282 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
3198 | 14 |
"{ Package: 'stx:libview' }" |
15 |
||
7357 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
1282 | 18 |
Object subclass:#GraphicsDevice |
3443 | 19 |
instanceVariableNames:'displayId screen eventListeners deviceType' |
1282 | 20 |
classVariableNames:'' |
21 |
poolDictionaries:'' |
|
22 |
category:'Interface-Graphics' |
|
23 |
! |
|
24 |
||
7357 | 25 |
AllocationFailure subclass:#GraphicResourceAllocationFailure |
26 |
instanceVariableNames:'' |
|
27 |
classVariableNames:'' |
|
28 |
poolDictionaries:'' |
|
29 |
privateIn:GraphicsDevice |
|
30 |
! |
|
31 |
||
1282 | 32 |
!GraphicsDevice class methodsFor:'documentation'! |
33 |
||
34 |
copyright |
|
35 |
" |
|
1283 | 36 |
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
37 |
All Rights Reserved |
1282 | 38 |
|
39 |
This software is furnished under a license and may be used |
|
40 |
only in accordance with the terms of that license and with the |
|
41 |
inclusion of the above copyright notice. This software may not |
|
42 |
be provided or otherwise made available to, or used by, any |
|
43 |
other person. No title to or ownership of the software is |
|
44 |
hereby transferred. |
|
45 |
" |
|
46 |
||
47 |
! |
|
48 |
||
49 |
documentation |
|
50 |
" |
|
51 |
this abstract class was inserted to provide a home for ST-80 classes |
|
52 |
(previously, DeviceWorkstation was directly under Object). |
|
53 |
||
1283 | 54 |
In ST/X, this is mostly dummy. |
55 |
||
1282 | 56 |
[instance variables:] |
3443 | 57 |
displayId <Handle> the device handle |
58 |
screen any another some device specific id |
|
59 |
eventListeners <Collection> | nil bunch of objects interested in events. |
|
60 |
deviceType <Symbol> some arbitrary symbol, used to choose windowSpecs. |
|
1282 | 61 |
|
62 |
[see also:] |
|
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
63 |
DeviceWorkstation XWorkstation |
1282 | 64 |
|
65 |
[author:] |
|
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
66 |
Claus Gittinger |
1282 | 67 |
" |
68 |
||
69 |
! ! |
|
70 |
||
3445 | 71 |
!GraphicsDevice methodsFor:'accessing & queries'! |
3198 | 72 |
|
73 |
addEventListener:aListener |
|
74 |
"add a local eventListener (with new protocol - #processEvent:) |
|
75 |
This one gets a chance to intercept all events for this device" |
|
76 |
||
77 |
eventListeners isNil ifTrue:[ |
|
3488 | 78 |
eventListeners := OrderedCollection new:2 |
3198 | 79 |
]. |
3488 | 80 |
(eventListeners includesIdentical:aListener) ifFalse:[ |
81 |
eventListeners add:aListener |
|
82 |
]. |
|
3198 | 83 |
! |
84 |
||
3445 | 85 |
bePDA |
86 |
self deviceType:#pda |
|
3443 | 87 |
! |
3198 | 88 |
|
3443 | 89 |
deviceType |
90 |
^ deviceType |
|
91 |
! |
|
3198 | 92 |
|
3443 | 93 |
deviceType:aSymbol |
94 |
deviceType := aSymbol |
|
3445 | 95 |
! |
96 |
||
97 |
isPDA |
|
98 |
^ self deviceType == #pda |
|
99 |
! |
|
100 |
||
5561 | 101 |
isWebServiceDevice |
8693 | 102 |
"I am not a WebService pseudo-device" |
5561 | 103 |
|
104 |
^ false |
|
8693 | 105 |
|
106 |
"Modified (comment): / 27-05-2019 / 20:05:12 / Claus Gittinger" |
|
5561 | 107 |
! |
108 |
||
8560 | 109 |
literalArrayEncoding |
110 |
self shouldNeverBeSent |
|
111 |
||
112 |
"Created: / 28-10-2018 / 11:34:08 / Claus Gittinger" |
|
113 |
! |
|
114 |
||
3445 | 115 |
removeEventListener:aListener |
116 |
"remove a local eventListener (with new protocol - #processEvent:)" |
|
117 |
||
118 |
eventListeners notNil ifTrue:[ |
|
119 |
eventListeners removeIdentical:aListener ifAbsent:nil |
|
120 |
]. |
|
7998 | 121 |
! |
122 |
||
123 |
supportsAlphaChannel |
|
8006 | 124 |
"return true, if this device supports alpha information. |
7998 | 125 |
Currently none does" |
126 |
||
127 |
^ false |
|
128 |
||
129 |
" |
|
130 |
Display supportsAlpha |
|
131 |
" |
|
132 |
||
133 |
"Created: / 11-04-2017 / 01:41:52 / cg" |
|
8006 | 134 |
"Modified (comment): / 12-04-2017 / 09:57:43 / cg" |
8924 | 135 |
! |
136 |
||
137 |
supportsJPGImages |
|
138 |
"return true, if this device directly supports jpg images. |
|
139 |
Currently none does (except browser windows)" |
|
140 |
||
141 |
^ false |
|
142 |
||
143 |
" |
|
144 |
Display supportsJPGImages |
|
145 |
" |
|
146 |
! |
|
147 |
||
8927 | 148 |
supportsNativeImages |
149 |
"return true, if this device directly supports images (png, jpg, tiff, etc.). |
|
150 |
If true is returned, the concrete image format to use must be negotiated further. |
|
151 |
Currently none does (except browser windows and electron)" |
|
152 |
||
153 |
^ false |
|
154 |
||
155 |
" |
|
156 |
Display supportsPNGImages |
|
157 |
" |
|
158 |
! |
|
159 |
||
8924 | 160 |
supportsPNGImages |
161 |
"return true, if this device directly supports png images. |
|
162 |
Currently none does (except browser windows)" |
|
163 |
||
164 |
^ false |
|
165 |
||
166 |
" |
|
167 |
Display supportsPNGImages |
|
168 |
" |
|
169 |
! |
|
170 |
||
171 |
supportsTIFFImages |
|
172 |
"return true, if this device directly supports tiff images. |
|
173 |
Currently none does (except browser windows)" |
|
174 |
||
175 |
^ false |
|
176 |
||
177 |
" |
|
178 |
Display supportsTIFFImages |
|
179 |
" |
|
3198 | 180 |
! ! |
181 |
||
6220 | 182 |
!GraphicsDevice methodsFor:'creating graphics contexts'! |
183 |
||
184 |
newGraphicsContextFor:aGraphicsMedium |
|
185 |
"create a new graphics context. |
|
8774 | 186 |
The default is to use the inherited graphics context. |
6220 | 187 |
Subclasses may redefine this to use their own graphics context" |
188 |
||
7487 | 189 |
^ DeviceGraphicsContext onDevice:self. |
6220 | 190 |
! ! |
191 |
||
3198 | 192 |
!GraphicsDevice methodsFor:'event processing'! |
193 |
||
194 |
notifyEventListenersAbout:anEvent |
|
195 |
"notify all eventHandlers about an incoming event. |
|
196 |
If any returns true, it is assumed to be eaten by the handler and not |
|
197 |
enqueued (i.e. not passed to the windowGroup process)" |
|
198 |
||
199 |
|anyListenerReturnedTrue| |
|
200 |
||
201 |
anyListenerReturnedTrue := false. |
|
202 |
||
203 |
"/ local listeners ... |
|
204 |
eventListeners notNil ifTrue:[ |
|
7362 | 205 |
eventListeners do:[:aListener | |
206 |
"/ notice: evaluating or here; all listeners get a chance |
|
207 |
anyListenerReturnedTrue := anyListenerReturnedTrue | |
|
208 |
(aListener processEvent:anEvent) |
|
209 |
] |
|
3198 | 210 |
]. |
8839 | 211 |
"/ anyListenerReturnedTrue ifTrue:[ |
212 |
"/ 'eaten by device listener' infoPrintCR. |
|
213 |
"/ ]. |
|
3198 | 214 |
^ anyListenerReturnedTrue. |
215 |
! ! |
|
216 |
||
3577 | 217 |
!GraphicsDevice methodsFor:'misc'! |
218 |
||
219 |
roundTripTime |
|
220 |
"answer the round trip time in milliseconds. |
|
5561 | 221 |
May be used to detect slow device connections. |
3577 | 222 |
Subclasses redefine this. Assume a fast Diplay connection |
223 |
and answer 0 here" |
|
224 |
||
225 |
^ 0 |
|
226 |
||
227 |
" |
|
228 |
Screen current roundTripTime |
|
229 |
" |
|
230 |
! ! |
|
231 |
||
7357 | 232 |
!GraphicsDevice::GraphicResourceAllocationFailure class methodsFor:'documentation'! |
233 |
||
234 |
copyright |
|
235 |
" |
|
236 |
COPYRIGHT (c) 2016 by eXept Software AG |
|
237 |
All Rights Reserved |
|
238 |
||
239 |
This software is furnished under a license and may be used |
|
240 |
only in accordance with the terms of that license and with the |
|
241 |
inclusion of the above copyright notice. This software may not |
|
242 |
be provided or otherwise made available to, or used by, any |
|
243 |
other person. No title to or ownership of the software is |
|
244 |
hereby transferred. |
|
245 |
" |
|
246 |
! |
|
247 |
||
248 |
documentation |
|
249 |
" |
|
250 |
raised when allocation of a graphics resource (pixmap, bitmap, cursor, font, etc.) |
|
251 |
fails. |
|
252 |
" |
|
253 |
! ! |
|
254 |
||
255 |
!GraphicsDevice::GraphicResourceAllocationFailure class methodsFor:'queries'! |
|
256 |
||
257 |
defaultAnswer |
|
258 |
^ nil |
|
259 |
! |
|
260 |
||
261 |
isQuerySignal |
|
262 |
^ true |
|
263 |
! ! |
|
264 |
||
265 |
!GraphicsDevice::GraphicResourceAllocationFailure class methodsFor:'raising'! |
|
266 |
||
267 |
query |
|
268 |
^ self raiseAsQuery |
|
269 |
! ! |
|
270 |
||
1282 | 271 |
!GraphicsDevice class methodsFor:'documentation'! |
272 |
||
273 |
version |
|
7357 | 274 |
^ '$Header$' |
5561 | 275 |
! |
276 |
||
277 |
version_CVS |
|
7357 | 278 |
^ '$Header$' |
1282 | 279 |
! ! |
6220 | 280 |