author | Claus Gittinger <cg@exept.de> |
Mon, 04 Sep 2000 17:35:30 +0200 | |
changeset 3289 | 04fd7c7009b8 |
parent 3285 | b39fff2bf608 |
child 3444 | 850728294356 |
permissions | -rw-r--r-- |
1284 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger |
|
2840 | 3 |
All Rights Reserved |
1284 | 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 |
||
14 |
||
3285 | 15 |
"{ Package: 'stx:libview' }" |
16 |
||
1284 | 17 |
GraphicsDevice subclass:#HostGraphicsDevice |
2840 | 18 |
instanceVariableNames:'deviceColors deviceFonts deviceViews deviceForms deviceCursors' |
1284 | 19 |
classVariableNames:'' |
20 |
poolDictionaries:'' |
|
21 |
category:'Interface-Graphics' |
|
22 |
! |
|
23 |
||
24 |
!HostGraphicsDevice class methodsFor:'documentation'! |
|
25 |
||
26 |
copyright |
|
27 |
" |
|
28 |
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger |
|
2840 | 29 |
All Rights Reserved |
1284 | 30 |
|
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
||
39 |
||
40 |
! |
|
41 |
||
42 |
documentation |
|
43 |
" |
|
44 |
this abstract class was inserted to provide a home for ST-80 classes |
|
45 |
(previously, DeviceWorkstation was directly under Object). |
|
2813
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
46 |
We will (over time) move common functionality from there into this class. |
1284 | 47 |
|
48 |
In ST/X, this is mostly dummy. |
|
49 |
||
50 |
[see also:] |
|
2840 | 51 |
DeviceWorkstation XWorkstation |
1284 | 52 |
|
53 |
[author:] |
|
2840 | 54 |
Claus Gittinger |
1284 | 55 |
" |
56 |
||
57 |
||
58 |
! ! |
|
59 |
||
3289
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
60 |
!HostGraphicsDevice class methodsFor:'instance creation'! |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
61 |
|
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
62 |
newDispatchingFor:aScreenName |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
63 |
"create a new instance of mySelf, which serves aDeviceName. |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
64 |
Only useful for device-classes which support multiple devices - |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
65 |
i.e. X-Workstations" |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
66 |
|
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
67 |
|newDevice someScreen app| |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
68 |
|
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
69 |
newDevice := self new. |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
70 |
newDevice := newDevice initializeFor:aScreenName. |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
71 |
newDevice isNil ifTrue:[ |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
72 |
^ nil. |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
73 |
]. |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
74 |
newDevice startDispatch. |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
75 |
(someScreen := Screen current) isNil ifTrue:[ |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
76 |
someScreen := Screen default. |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
77 |
]. |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
78 |
someScreen notNil ifTrue:[ |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
79 |
newDevice keyboardMap:(someScreen keyboardMap). |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
80 |
newDevice buttonTranslation:(someScreen buttonTranslation). |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
81 |
]. |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
82 |
|
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
83 |
"/ arrange for it to finish its event dispatch loop, |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
84 |
"/ when the last view on it is closed. |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
85 |
newDevice exitOnLastClose:true. |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
86 |
|
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
87 |
^ newDevice. |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
88 |
! ! |
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
89 |
|
2961 | 90 |
!HostGraphicsDevice methodsFor:'Compatibility - Squeak'! |
91 |
||
92 |
deferUpdates: aBoolean |
|
93 |
"Set the deferUpdates flag in the virtual machine. |
|
94 |
When this flag is true, BitBlt operations on the Display are not |
|
95 |
automatically propagated to the screen. |
|
96 |
If this underlying platform does not support deferred updates, |
|
97 |
this primitive will fail. |
|
98 |
Answer the receiver if the primitive succeeds, nil if it fails." |
|
99 |
||
100 |
"/ <primitive: 126> |
|
101 |
^ nil "answer nil if primitive fails" |
|
102 |
||
103 |
! |
|
104 |
||
105 |
forceDisplayUpdate |
|
106 |
"On platforms that buffer screen updates, |
|
107 |
force the screen to be updated immediately. |
|
108 |
On other platforms, or if the primitive is not implemented, do nothing." |
|
109 |
||
110 |
"/ <primitive: 231> |
|
111 |
"do nothing if primitive fails" |
|
112 |
! ! |
|
113 |
||
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
114 |
!HostGraphicsDevice methodsFor:'accessing'! |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
115 |
|
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
116 |
deviceColors |
1371 | 117 |
"return the registry keeping track of colors which were allocated |
2813
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
118 |
on this device." |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
119 |
|
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
120 |
^ deviceColors |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
121 |
|
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
122 |
"Created: 24.2.1997 / 18:01:41 / cg" |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
123 |
! |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
124 |
|
2843
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
125 |
deviceCursors |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
126 |
"return the registry keeping track of cursors which were allocated |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
127 |
on this device." |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
128 |
|
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
129 |
^ deviceCursors |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
130 |
|
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
131 |
"Created: 24.2.1997 / 18:01:41 / cg" |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
132 |
! |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
133 |
|
1371 | 134 |
deviceFonts |
135 |
"return the registry keeping track of fonts which were allocated |
|
2813
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
136 |
on this device." |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
137 |
|
1371 | 138 |
^ deviceFonts |
2813
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
139 |
! |
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
140 |
|
2839 | 141 |
deviceForms |
142 |
"return the registry keeping track of forms which were allocated |
|
143 |
on this device." |
|
144 |
||
145 |
^ deviceForms |
|
146 |
! |
|
147 |
||
2813
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
148 |
deviceViews |
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
149 |
"return the registry keeping track of views which were allocated |
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
150 |
on this device." |
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
151 |
|
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
152 |
^ deviceViews |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
153 |
! ! |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
154 |
|
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
155 |
!HostGraphicsDevice methodsFor:'initialize / release'! |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
156 |
|
1367 | 157 |
initializeDeviceResourceTables |
2813
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
158 |
deviceViews := Registry new. |
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
159 |
deviceForms := Registry new. |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
160 |
deviceColors := Registry new. |
2843
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
161 |
deviceCursors := Registry new. |
2809
96f6b7b449c7
use a CachingRegistry for fonts.
Claus Gittinger <cg@exept.de>
parents:
1371
diff
changeset
|
162 |
deviceFonts := CachingRegistry new cacheSize:10. |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
163 |
|
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
164 |
"Created: 24.2.1997 / 18:29:53 / cg" |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
165 |
! |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
166 |
|
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
167 |
releaseDeviceColors |
2839 | 168 |
deviceColors do:[:aColor | |
2845 | 169 |
aColor releaseFromDevice |
2839 | 170 |
]. |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
171 |
deviceColors := Registry new. |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
172 |
|
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
173 |
"Created: 24.2.1997 / 18:07:49 / cg" |
2839 | 174 |
|
1371 | 175 |
! |
176 |
||
2843
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
177 |
releaseDeviceCursors |
2847 | 178 |
deviceCursors do:[:aCursor | |
2845 | 179 |
aCursor releaseFromDevice |
2843
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
180 |
]. |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
181 |
deviceCursors := Registry new. |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
182 |
|
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
183 |
"Created: 24.2.1997 / 18:07:49 / cg" |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
184 |
|
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
185 |
! |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
186 |
|
1371 | 187 |
releaseDeviceFonts |
2846 | 188 |
deviceFonts do:[:aFont | |
189 |
aFont releaseFromDevice. |
|
190 |
]. |
|
2809
96f6b7b449c7
use a CachingRegistry for fonts.
Claus Gittinger <cg@exept.de>
parents:
1371
diff
changeset
|
191 |
deviceFonts := CachingRegistry new cacheSize:10. |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
192 |
! ! |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
193 |
|
3285 | 194 |
!HostGraphicsDevice methodsFor:'misc'! |
195 |
||
196 |
recolorCursorsToFgColor:fgColor defaultBgColor:bgColor |
|
197 |
"change the colors of all existing cursors" |
|
198 |
||
199 |
"/ recolor existing cursors |
|
200 |
deviceCursors do:[:eachCursor | eachCursor foreground:fgColor background:bgColor]. |
|
201 |
||
202 |
" |
|
203 |
Display recolorCursorsToFgColor:(Color red) defaultBgColor:(Color white) |
|
204 |
||
205 |
Display recolorCursorsToFgColor:(Color blue) defaultBgColor:(Color white) |
|
206 |
Display recolorCursorsToFgColor:(Color blue) defaultBgColor:(Color black) |
|
207 |
Display recolorCursorsToFgColor:(Color white) defaultBgColor:(Color black) |
|
208 |
Display recolorCursorsToFgColor:(Color white) defaultBgColor:(Color red) |
|
209 |
" |
|
210 |
! ! |
|
211 |
||
2846 | 212 |
!HostGraphicsDevice methodsFor:'registration'! |
213 |
||
214 |
registerColor:aColor |
|
215 |
deviceColors register:aColor. |
|
216 |
||
217 |
"Created: 24.2.1997 / 18:29:10 / cg" |
|
218 |
! |
|
219 |
||
220 |
registerCursor:aCursor |
|
221 |
deviceCursors register:aCursor. |
|
222 |
||
223 |
"Created: 24.2.1997 / 18:29:10 / cg" |
|
224 |
! |
|
225 |
||
226 |
registerFont:aFont |
|
227 |
deviceFonts register:aFont. |
|
228 |
||
229 |
"Created: 24.2.1997 / 18:29:10 / cg" |
|
230 |
! |
|
231 |
||
232 |
registerForm:aForm |
|
233 |
deviceForms register:aForm. |
|
234 |
||
235 |
"Created: 24.2.1997 / 18:29:10 / cg" |
|
236 |
! |
|
237 |
||
238 |
registerView:aView |
|
239 |
deviceViews register:aView. |
|
240 |
||
241 |
"Created: 24.2.1997 / 18:29:10 / cg" |
|
242 |
! |
|
243 |
||
244 |
unregisterColor:aColor |
|
245 |
deviceColors unregister:aColor. |
|
246 |
||
247 |
"Created: 24.2.1997 / 18:29:14 / cg" |
|
248 |
! |
|
249 |
||
250 |
unregisterCursor:aCursor |
|
251 |
deviceCursors unregister:aCursor. |
|
252 |
||
253 |
"Created: 24.2.1997 / 18:29:14 / cg" |
|
254 |
! |
|
255 |
||
256 |
unregisterFont:aFont |
|
257 |
deviceFonts unregister:aFont. |
|
258 |
||
259 |
"Created: 24.2.1997 / 18:29:14 / cg" |
|
260 |
! |
|
261 |
||
262 |
unregisterForm:aForm |
|
263 |
deviceForms unregister:aForm. |
|
264 |
||
265 |
"Created: 24.2.1997 / 18:29:14 / cg" |
|
266 |
! |
|
267 |
||
268 |
unregisterView:aView |
|
269 |
deviceViews unregister:aView. |
|
270 |
||
271 |
"Created: 24.2.1997 / 18:29:14 / cg" |
|
272 |
! ! |
|
273 |
||
1284 | 274 |
!HostGraphicsDevice class methodsFor:'documentation'! |
275 |
||
276 |
version |
|
3289
04fd7c7009b8
utility method to create a dispatching instance
Claus Gittinger <cg@exept.de>
parents:
3285
diff
changeset
|
277 |
^ '$Header: /cvs/stx/stx/libview/HostGraphicsDevice.st,v 1.16 2000-09-04 15:35:30 cg Exp $' |
1284 | 278 |
! ! |