author | Claus Gittinger <cg@exept.de> |
Thu, 28 Apr 2016 14:18:50 +0200 | |
changeset 7319 | a7aeb15d709f |
parent 6357 | bc674a4f8cfd |
child 7166 | 1f7489fd814e |
child 7357 | bfc2b9583931 |
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 |
||
1282 | 14 |
Object subclass:#GraphicsDevice |
3443 | 15 |
instanceVariableNames:'displayId screen eventListeners deviceType' |
1282 | 16 |
classVariableNames:'' |
17 |
poolDictionaries:'' |
|
18 |
category:'Interface-Graphics' |
|
19 |
! |
|
20 |
||
21 |
!GraphicsDevice class methodsFor:'documentation'! |
|
22 |
||
23 |
copyright |
|
24 |
" |
|
1283 | 25 |
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
26 |
All Rights Reserved |
1282 | 27 |
|
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
||
36 |
! |
|
37 |
||
38 |
documentation |
|
39 |
" |
|
40 |
this abstract class was inserted to provide a home for ST-80 classes |
|
41 |
(previously, DeviceWorkstation was directly under Object). |
|
42 |
||
1283 | 43 |
In ST/X, this is mostly dummy. |
44 |
||
1282 | 45 |
[instance variables:] |
3443 | 46 |
displayId <Handle> the device handle |
47 |
screen any another some device specific id |
|
48 |
eventListeners <Collection> | nil bunch of objects interested in events. |
|
49 |
deviceType <Symbol> some arbitrary symbol, used to choose windowSpecs. |
|
1282 | 50 |
|
51 |
[see also:] |
|
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
52 |
DeviceWorkstation XWorkstation |
1282 | 53 |
|
54 |
[author:] |
|
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
55 |
Claus Gittinger |
1282 | 56 |
" |
57 |
||
58 |
! ! |
|
59 |
||
3445 | 60 |
!GraphicsDevice methodsFor:'accessing & queries'! |
3198 | 61 |
|
62 |
addEventListener:aListener |
|
63 |
"add a local eventListener (with new protocol - #processEvent:) |
|
64 |
This one gets a chance to intercept all events for this device" |
|
65 |
||
66 |
eventListeners isNil ifTrue:[ |
|
3488 | 67 |
eventListeners := OrderedCollection new:2 |
3198 | 68 |
]. |
3488 | 69 |
(eventListeners includesIdentical:aListener) ifFalse:[ |
70 |
eventListeners add:aListener |
|
71 |
]. |
|
3198 | 72 |
! |
73 |
||
3445 | 74 |
bePDA |
75 |
self deviceType:#pda |
|
3443 | 76 |
! |
3198 | 77 |
|
3443 | 78 |
deviceType |
79 |
^ deviceType |
|
80 |
! |
|
3198 | 81 |
|
3443 | 82 |
deviceType:aSymbol |
83 |
deviceType := aSymbol |
|
3445 | 84 |
! |
85 |
||
86 |
isPDA |
|
87 |
^ self deviceType == #pda |
|
88 |
! |
|
89 |
||
5561 | 90 |
isWebServiceDevice |
91 |
"I am not a WebService pseude-device" |
|
92 |
||
93 |
^ false |
|
94 |
! |
|
95 |
||
3445 | 96 |
removeEventListener:aListener |
97 |
"remove a local eventListener (with new protocol - #processEvent:)" |
|
98 |
||
99 |
eventListeners notNil ifTrue:[ |
|
100 |
eventListeners removeIdentical:aListener ifAbsent:nil |
|
101 |
]. |
|
3198 | 102 |
! ! |
103 |
||
6220 | 104 |
!GraphicsDevice methodsFor:'creating graphics contexts'! |
105 |
||
106 |
newGraphicsContextFor:aGraphicsMedium |
|
107 |
"create a new graphics context. |
|
108 |
The defaults is to use the inherited graphics context. |
|
109 |
Subclasses may redefine this to use their own graphics context" |
|
110 |
||
6357 | 111 |
|gc| |
112 |
||
113 |
GraphicsMedium superclass == DeviceGraphicsContext ifTrue:[ |
|
114 |
"this is for transition to delegatest GC" |
|
115 |
^ aGraphicsMedium. |
|
116 |
]. |
|
117 |
||
118 |
gc := DeviceGraphicsContext onDevice:self. |
|
119 |
gc font:aGraphicsMedium class defaultFont. |
|
120 |
^ gc. |
|
6220 | 121 |
! ! |
122 |
||
3198 | 123 |
!GraphicsDevice methodsFor:'event processing'! |
124 |
||
125 |
notifyEventListenersAbout:anEvent |
|
126 |
"notify all eventHandlers about an incoming event. |
|
127 |
If any returns true, it is assumed to be eaten by the handler and not |
|
128 |
enqueued (i.e. not passed to the windowGroup process)" |
|
129 |
||
130 |
|anyListenerReturnedTrue| |
|
131 |
||
132 |
anyListenerReturnedTrue := false. |
|
133 |
||
134 |
"/ local listeners ... |
|
135 |
eventListeners notNil ifTrue:[ |
|
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
136 |
eventListeners do:[:aListener | |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
137 |
anyListenerReturnedTrue := anyListenerReturnedTrue | |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
138 |
(aListener processEvent:anEvent) |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
139 |
] |
3198 | 140 |
]. |
141 |
||
142 |
^ anyListenerReturnedTrue. |
|
143 |
||
144 |
! ! |
|
145 |
||
3577 | 146 |
!GraphicsDevice methodsFor:'misc'! |
147 |
||
148 |
roundTripTime |
|
149 |
"answer the round trip time in milliseconds. |
|
5561 | 150 |
May be used to detect slow device connections. |
3577 | 151 |
Subclasses redefine this. Assume a fast Diplay connection |
152 |
and answer 0 here" |
|
153 |
||
154 |
^ 0 |
|
155 |
||
156 |
" |
|
157 |
Screen current roundTripTime |
|
158 |
" |
|
159 |
! ! |
|
160 |
||
1282 | 161 |
!GraphicsDevice class methodsFor:'documentation'! |
162 |
||
163 |
version |
|
6357 | 164 |
^ '$Header: /cvs/stx/stx/libview/GraphicsDevice.st,v 1.14 2014-03-25 09:01:41 stefan Exp $' |
5561 | 165 |
! |
166 |
||
167 |
version_CVS |
|
6357 | 168 |
^ '$Header: /cvs/stx/stx/libview/GraphicsDevice.st,v 1.14 2014-03-25 09:01:41 stefan Exp $' |
1282 | 169 |
! ! |
6220 | 170 |