author | mawalch |
Thu, 07 Jul 2016 20:21:22 +0200 | |
changeset 7403 | 9a4c5d6da62c |
parent 7362 | 8ac49e48c3a9 |
child 7366 | 18c5cd709f5c |
child 7487 | 39fb74b4ade1 |
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 |
]. |
|
3198 | 111 |
! ! |
112 |
||
6220 | 113 |
!GraphicsDevice methodsFor:'creating graphics contexts'! |
114 |
||
115 |
newGraphicsContextFor:aGraphicsMedium |
|
116 |
"create a new graphics context. |
|
117 |
The defaults is to use the inherited graphics context. |
|
118 |
Subclasses may redefine this to use their own graphics context" |
|
119 |
||
6357 | 120 |
|gc| |
121 |
||
122 |
GraphicsMedium superclass == DeviceGraphicsContext ifTrue:[ |
|
123 |
"this is for transition to delegatest GC" |
|
124 |
^ aGraphicsMedium. |
|
125 |
]. |
|
126 |
||
127 |
gc := DeviceGraphicsContext onDevice:self. |
|
128 |
gc font:aGraphicsMedium class defaultFont. |
|
129 |
^ gc. |
|
6220 | 130 |
! ! |
131 |
||
3198 | 132 |
!GraphicsDevice methodsFor:'event processing'! |
133 |
||
134 |
notifyEventListenersAbout:anEvent |
|
135 |
"notify all eventHandlers about an incoming event. |
|
136 |
If any returns true, it is assumed to be eaten by the handler and not |
|
137 |
enqueued (i.e. not passed to the windowGroup process)" |
|
138 |
||
139 |
|anyListenerReturnedTrue| |
|
140 |
||
141 |
anyListenerReturnedTrue := false. |
|
142 |
||
143 |
"/ local listeners ... |
|
144 |
eventListeners notNil ifTrue:[ |
|
7362 | 145 |
eventListeners do:[:aListener | |
146 |
"/ notice: evaluating or here; all listeners get a chance |
|
147 |
anyListenerReturnedTrue := anyListenerReturnedTrue | |
|
148 |
(aListener processEvent:anEvent) |
|
149 |
] |
|
3198 | 150 |
]. |
151 |
||
152 |
^ anyListenerReturnedTrue. |
|
153 |
! ! |
|
154 |
||
3577 | 155 |
!GraphicsDevice methodsFor:'misc'! |
156 |
||
157 |
roundTripTime |
|
158 |
"answer the round trip time in milliseconds. |
|
5561 | 159 |
May be used to detect slow device connections. |
3577 | 160 |
Subclasses redefine this. Assume a fast Diplay connection |
161 |
and answer 0 here" |
|
162 |
||
163 |
^ 0 |
|
164 |
||
165 |
" |
|
166 |
Screen current roundTripTime |
|
167 |
" |
|
168 |
! ! |
|
169 |
||
7357 | 170 |
!GraphicsDevice::GraphicResourceAllocationFailure class methodsFor:'documentation'! |
171 |
||
172 |
copyright |
|
173 |
" |
|
174 |
COPYRIGHT (c) 2016 by eXept Software AG |
|
175 |
All Rights Reserved |
|
176 |
||
177 |
This software is furnished under a license and may be used |
|
178 |
only in accordance with the terms of that license and with the |
|
179 |
inclusion of the above copyright notice. This software may not |
|
180 |
be provided or otherwise made available to, or used by, any |
|
181 |
other person. No title to or ownership of the software is |
|
182 |
hereby transferred. |
|
183 |
" |
|
184 |
! |
|
185 |
||
186 |
documentation |
|
187 |
" |
|
188 |
raised when allocation of a graphics resource (pixmap, bitmap, cursor, font, etc.) |
|
189 |
fails. |
|
190 |
" |
|
191 |
! ! |
|
192 |
||
193 |
!GraphicsDevice::GraphicResourceAllocationFailure class methodsFor:'queries'! |
|
194 |
||
195 |
defaultAnswer |
|
196 |
^ nil |
|
197 |
! |
|
198 |
||
199 |
isQuerySignal |
|
200 |
^ true |
|
201 |
! ! |
|
202 |
||
203 |
!GraphicsDevice::GraphicResourceAllocationFailure class methodsFor:'raising'! |
|
204 |
||
205 |
query |
|
206 |
^ self raiseAsQuery |
|
207 |
! ! |
|
208 |
||
1282 | 209 |
!GraphicsDevice class methodsFor:'documentation'! |
210 |
||
211 |
version |
|
7357 | 212 |
^ '$Header$' |
5561 | 213 |
! |
214 |
||
215 |
version_CVS |
|
7357 | 216 |
^ '$Header$' |
1282 | 217 |
! ! |
6220 | 218 |