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