author | Claus Gittinger <cg@exept.de> |
Tue, 16 Jul 2019 15:06:06 +0200 | |
changeset 8732 | 2126b6c5f654 |
parent 8693 | 294ef31da5dd |
child 8774 | b7b97afe2599 |
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" |
3198 | 135 |
! ! |
136 |
||
6220 | 137 |
!GraphicsDevice methodsFor:'creating graphics contexts'! |
138 |
||
139 |
newGraphicsContextFor:aGraphicsMedium |
|
140 |
"create a new graphics context. |
|
141 |
The defaults is to use the inherited graphics context. |
|
142 |
Subclasses may redefine this to use their own graphics context" |
|
143 |
||
7487 | 144 |
^ DeviceGraphicsContext onDevice:self. |
6220 | 145 |
! ! |
146 |
||
3198 | 147 |
!GraphicsDevice methodsFor:'event processing'! |
148 |
||
149 |
notifyEventListenersAbout:anEvent |
|
150 |
"notify all eventHandlers about an incoming event. |
|
151 |
If any returns true, it is assumed to be eaten by the handler and not |
|
152 |
enqueued (i.e. not passed to the windowGroup process)" |
|
153 |
||
154 |
|anyListenerReturnedTrue| |
|
155 |
||
156 |
anyListenerReturnedTrue := false. |
|
157 |
||
158 |
"/ local listeners ... |
|
159 |
eventListeners notNil ifTrue:[ |
|
7362 | 160 |
eventListeners do:[:aListener | |
161 |
"/ notice: evaluating or here; all listeners get a chance |
|
162 |
anyListenerReturnedTrue := anyListenerReturnedTrue | |
|
163 |
(aListener processEvent:anEvent) |
|
164 |
] |
|
3198 | 165 |
]. |
166 |
||
167 |
^ anyListenerReturnedTrue. |
|
168 |
! ! |
|
169 |
||
3577 | 170 |
!GraphicsDevice methodsFor:'misc'! |
171 |
||
172 |
roundTripTime |
|
173 |
"answer the round trip time in milliseconds. |
|
5561 | 174 |
May be used to detect slow device connections. |
3577 | 175 |
Subclasses redefine this. Assume a fast Diplay connection |
176 |
and answer 0 here" |
|
177 |
||
178 |
^ 0 |
|
179 |
||
180 |
" |
|
181 |
Screen current roundTripTime |
|
182 |
" |
|
183 |
! ! |
|
184 |
||
7357 | 185 |
!GraphicsDevice::GraphicResourceAllocationFailure class methodsFor:'documentation'! |
186 |
||
187 |
copyright |
|
188 |
" |
|
189 |
COPYRIGHT (c) 2016 by eXept Software AG |
|
190 |
All Rights Reserved |
|
191 |
||
192 |
This software is furnished under a license and may be used |
|
193 |
only in accordance with the terms of that license and with the |
|
194 |
inclusion of the above copyright notice. This software may not |
|
195 |
be provided or otherwise made available to, or used by, any |
|
196 |
other person. No title to or ownership of the software is |
|
197 |
hereby transferred. |
|
198 |
" |
|
199 |
! |
|
200 |
||
201 |
documentation |
|
202 |
" |
|
203 |
raised when allocation of a graphics resource (pixmap, bitmap, cursor, font, etc.) |
|
204 |
fails. |
|
205 |
" |
|
206 |
! ! |
|
207 |
||
208 |
!GraphicsDevice::GraphicResourceAllocationFailure class methodsFor:'queries'! |
|
209 |
||
210 |
defaultAnswer |
|
211 |
^ nil |
|
212 |
! |
|
213 |
||
214 |
isQuerySignal |
|
215 |
^ true |
|
216 |
! ! |
|
217 |
||
218 |
!GraphicsDevice::GraphicResourceAllocationFailure class methodsFor:'raising'! |
|
219 |
||
220 |
query |
|
221 |
^ self raiseAsQuery |
|
222 |
! ! |
|
223 |
||
1282 | 224 |
!GraphicsDevice class methodsFor:'documentation'! |
225 |
||
226 |
version |
|
7357 | 227 |
^ '$Header$' |
5561 | 228 |
! |
229 |
||
230 |
version_CVS |
|
7357 | 231 |
^ '$Header$' |
1282 | 232 |
! ! |
6220 | 233 |