author | Stefan Vogel <sv@exept.de> |
Fri, 07 Dec 2001 17:16:00 +0100 | |
changeset 3577 | c0282d4e18d6 |
parent 3488 | b6605e20bfde |
child 5561 | 5d0f94937438 |
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 |
" |
|
12 |
||
13 |
||
3198 | 14 |
"{ Package: 'stx:libview' }" |
15 |
||
1282 | 16 |
Object subclass:#GraphicsDevice |
3443 | 17 |
instanceVariableNames:'displayId screen eventListeners deviceType' |
1282 | 18 |
classVariableNames:'' |
19 |
poolDictionaries:'' |
|
20 |
category:'Interface-Graphics' |
|
21 |
! |
|
22 |
||
23 |
!GraphicsDevice class methodsFor:'documentation'! |
|
24 |
||
25 |
copyright |
|
26 |
" |
|
1283 | 27 |
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
28 |
All Rights Reserved |
1282 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
||
38 |
! |
|
39 |
||
40 |
documentation |
|
41 |
" |
|
42 |
this abstract class was inserted to provide a home for ST-80 classes |
|
43 |
(previously, DeviceWorkstation was directly under Object). |
|
44 |
||
1283 | 45 |
In ST/X, this is mostly dummy. |
46 |
||
1282 | 47 |
[instance variables:] |
3443 | 48 |
displayId <Handle> the device handle |
49 |
screen any another some device specific id |
|
50 |
eventListeners <Collection> | nil bunch of objects interested in events. |
|
51 |
deviceType <Symbol> some arbitrary symbol, used to choose windowSpecs. |
|
1282 | 52 |
|
53 |
[see also:] |
|
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
54 |
DeviceWorkstation XWorkstation |
1282 | 55 |
|
56 |
[author:] |
|
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
57 |
Claus Gittinger |
1282 | 58 |
" |
59 |
||
60 |
! ! |
|
61 |
||
3445 | 62 |
!GraphicsDevice methodsFor:'accessing & queries'! |
3198 | 63 |
|
64 |
addEventListener:aListener |
|
65 |
"add a local eventListener (with new protocol - #processEvent:) |
|
66 |
This one gets a chance to intercept all events for this device" |
|
67 |
||
68 |
eventListeners isNil ifTrue:[ |
|
3488 | 69 |
eventListeners := OrderedCollection new:2 |
3198 | 70 |
]. |
3488 | 71 |
(eventListeners includesIdentical:aListener) ifFalse:[ |
72 |
eventListeners add:aListener |
|
73 |
]. |
|
3198 | 74 |
! |
75 |
||
3445 | 76 |
bePDA |
77 |
self deviceType:#pda |
|
3443 | 78 |
! |
3198 | 79 |
|
3443 | 80 |
deviceType |
81 |
^ deviceType |
|
82 |
! |
|
3198 | 83 |
|
3443 | 84 |
deviceType:aSymbol |
85 |
deviceType := aSymbol |
|
3445 | 86 |
! |
87 |
||
88 |
isPDA |
|
89 |
^ self deviceType == #pda |
|
90 |
! |
|
91 |
||
92 |
removeEventListener:aListener |
|
93 |
"remove a local eventListener (with new protocol - #processEvent:)" |
|
94 |
||
95 |
eventListeners notNil ifTrue:[ |
|
96 |
eventListeners removeIdentical:aListener ifAbsent:nil |
|
97 |
]. |
|
3198 | 98 |
! ! |
99 |
||
100 |
!GraphicsDevice methodsFor:'event processing'! |
|
101 |
||
102 |
notifyEventListenersAbout:anEvent |
|
103 |
"notify all eventHandlers about an incoming event. |
|
104 |
If any returns true, it is assumed to be eaten by the handler and not |
|
105 |
enqueued (i.e. not passed to the windowGroup process)" |
|
106 |
||
107 |
|anyListenerReturnedTrue| |
|
108 |
||
109 |
anyListenerReturnedTrue := false. |
|
110 |
||
111 |
"/ local listeners ... |
|
112 |
eventListeners notNil ifTrue:[ |
|
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
113 |
eventListeners do:[:aListener | |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
114 |
anyListenerReturnedTrue := anyListenerReturnedTrue | |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
115 |
(aListener processEvent:anEvent) |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
116 |
] |
3198 | 117 |
]. |
118 |
||
119 |
^ anyListenerReturnedTrue. |
|
120 |
||
121 |
! ! |
|
122 |
||
3577 | 123 |
!GraphicsDevice methodsFor:'misc'! |
124 |
||
125 |
roundTripTime |
|
126 |
"answer the round trip time in milliseconds. |
|
127 |
May be used to detect slow Device connections. |
|
128 |
Subclasses redefine this. Assume a fast Diplay connection |
|
129 |
and answer 0 here" |
|
130 |
||
131 |
^ 0 |
|
132 |
||
133 |
" |
|
134 |
Screen current roundTripTime |
|
135 |
" |
|
136 |
! ! |
|
137 |
||
1282 | 138 |
!GraphicsDevice class methodsFor:'documentation'! |
139 |
||
140 |
version |
|
3577 | 141 |
^ '$Header: /cvs/stx/stx/libview/GraphicsDevice.st,v 1.9 2001-12-07 16:16:00 stefan Exp $' |
1282 | 142 |
! ! |