author | Claus Gittinger <cg@exept.de> |
Thu, 03 Mar 2011 22:35:05 +0100 | |
changeset 5726 | 7dba4467bf1b |
parent 4541 | a2ff52d645ea |
child 6212 | 3c308b5defa7 |
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 |
||
3880 | 60 |
!HostGraphicsDevice methodsFor:'Compatibility-Squeak'! |
2961 | 61 |
|
62 |
deferUpdates: aBoolean |
|
63 |
"Set the deferUpdates flag in the virtual machine. |
|
64 |
When this flag is true, BitBlt operations on the Display are not |
|
65 |
automatically propagated to the screen. |
|
66 |
If this underlying platform does not support deferred updates, |
|
67 |
this primitive will fail. |
|
68 |
Answer the receiver if the primitive succeeds, nil if it fails." |
|
69 |
||
70 |
"/ <primitive: 126> |
|
71 |
^ nil "answer nil if primitive fails" |
|
72 |
||
73 |
! |
|
74 |
||
75 |
forceDisplayUpdate |
|
76 |
"On platforms that buffer screen updates, |
|
77 |
force the screen to be updated immediately. |
|
78 |
On other platforms, or if the primitive is not implemented, do nothing." |
|
79 |
||
80 |
"/ <primitive: 231> |
|
81 |
"do nothing if primitive fails" |
|
82 |
! ! |
|
83 |
||
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
84 |
!HostGraphicsDevice methodsFor:'accessing'! |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
85 |
|
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
86 |
deviceColors |
1371 | 87 |
"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
|
88 |
on this device." |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
89 |
|
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
90 |
^ deviceColors |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
91 |
|
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
92 |
"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
|
93 |
! |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
94 |
|
2843
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
95 |
deviceCursors |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
96 |
"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
|
97 |
on this device." |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
98 |
|
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
99 |
^ deviceCursors |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
100 |
|
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
101 |
"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
|
102 |
! |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
103 |
|
1371 | 104 |
deviceFonts |
105 |
"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
|
106 |
on this device." |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
107 |
|
4541 | 108 |
^ deviceFonts ? #() |
109 |
||
110 |
"Modified: / 28-07-2006 / 19:48:23 / fm" |
|
2813
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
111 |
! |
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
112 |
|
2839 | 113 |
deviceForms |
114 |
"return the registry keeping track of forms which were allocated |
|
115 |
on this device." |
|
116 |
||
117 |
^ deviceForms |
|
118 |
! |
|
119 |
||
2813
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
120 |
deviceViews |
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
121 |
"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
|
122 |
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
|
123 |
|
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
124 |
^ deviceViews |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
125 |
! ! |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
126 |
|
3444 | 127 |
!HostGraphicsDevice methodsFor:'accessing & queries'! |
128 |
||
129 |
defaultExtentForTopViews |
|
3447 | 130 |
|w h| |
131 |
||
132 |
w := self width. |
|
133 |
h := self height. |
|
134 |
||
135 |
self isPDA ifTrue:[ |
|
136 |
^ (w - 16) @ (h - 20) |
|
137 |
]. |
|
138 |
^ (w // 3 * 2) @ (h // 3 * 2) |
|
3444 | 139 |
! ! |
140 |
||
3883 | 141 |
!HostGraphicsDevice methodsFor:'initialization & release'! |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
142 |
|
1367 | 143 |
initializeDeviceResourceTables |
2813
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
144 |
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
|
145 |
deviceForms := Registry new. |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
146 |
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
|
147 |
deviceCursors := Registry new. |
2809
96f6b7b449c7
use a CachingRegistry for fonts.
Claus Gittinger <cg@exept.de>
parents:
1371
diff
changeset
|
148 |
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
|
149 |
|
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
150 |
"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
|
151 |
! |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
152 |
|
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
153 |
releaseDeviceColors |
2839 | 154 |
deviceColors do:[:aColor | |
2845 | 155 |
aColor releaseFromDevice |
2839 | 156 |
]. |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
157 |
deviceColors := Registry new. |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
158 |
|
4222
4fee2e231633
Take care to relases the device of TrueColors.
Stefan Vogel <sv@exept.de>
parents:
3927
diff
changeset
|
159 |
"TrueColors are not registered. |
4fee2e231633
Take care to relases the device of TrueColors.
Stefan Vogel <sv@exept.de>
parents:
3927
diff
changeset
|
160 |
Release the the hard way" |
4fee2e231633
Take care to relases the device of TrueColors.
Stefan Vogel <sv@exept.de>
parents:
3927
diff
changeset
|
161 |
Color flushDeviceColorsFor:self. |
4fee2e231633
Take care to relases the device of TrueColors.
Stefan Vogel <sv@exept.de>
parents:
3927
diff
changeset
|
162 |
|
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
163 |
"Created: 24.2.1997 / 18:07:49 / cg" |
1371 | 164 |
! |
165 |
||
2843
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
166 |
releaseDeviceCursors |
2847 | 167 |
deviceCursors do:[:aCursor | |
2845 | 168 |
aCursor releaseFromDevice |
2843
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
169 |
]. |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
170 |
deviceCursors := Registry new. |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
171 |
|
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
172 |
"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
|
173 |
|
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
174 |
! |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
175 |
|
1371 | 176 |
releaseDeviceFonts |
2846 | 177 |
deviceFonts do:[:aFont | |
178 |
aFont releaseFromDevice. |
|
179 |
]. |
|
2809
96f6b7b449c7
use a CachingRegistry for fonts.
Claus Gittinger <cg@exept.de>
parents:
1371
diff
changeset
|
180 |
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
|
181 |
! ! |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
182 |
|
3285 | 183 |
!HostGraphicsDevice methodsFor:'misc'! |
184 |
||
185 |
recolorCursorsToFgColor:fgColor defaultBgColor:bgColor |
|
186 |
"change the colors of all existing cursors" |
|
187 |
||
188 |
"/ recolor existing cursors |
|
189 |
deviceCursors do:[:eachCursor | eachCursor foreground:fgColor background:bgColor]. |
|
190 |
||
191 |
" |
|
192 |
Display recolorCursorsToFgColor:(Color red) defaultBgColor:(Color white) |
|
193 |
||
194 |
Display recolorCursorsToFgColor:(Color blue) defaultBgColor:(Color white) |
|
195 |
Display recolorCursorsToFgColor:(Color blue) defaultBgColor:(Color black) |
|
196 |
Display recolorCursorsToFgColor:(Color white) defaultBgColor:(Color black) |
|
197 |
Display recolorCursorsToFgColor:(Color white) defaultBgColor:(Color red) |
|
198 |
" |
|
199 |
! ! |
|
200 |
||
2846 | 201 |
!HostGraphicsDevice methodsFor:'registration'! |
202 |
||
203 |
registerColor:aColor |
|
204 |
deviceColors register:aColor. |
|
205 |
||
206 |
"Created: 24.2.1997 / 18:29:10 / cg" |
|
207 |
! |
|
208 |
||
209 |
registerCursor:aCursor |
|
210 |
deviceCursors register:aCursor. |
|
211 |
||
212 |
"Created: 24.2.1997 / 18:29:10 / cg" |
|
213 |
! |
|
214 |
||
215 |
registerFont:aFont |
|
216 |
deviceFonts register:aFont. |
|
217 |
||
218 |
"Created: 24.2.1997 / 18:29:10 / cg" |
|
219 |
! |
|
220 |
||
221 |
registerForm:aForm |
|
222 |
deviceForms register:aForm. |
|
223 |
||
224 |
"Created: 24.2.1997 / 18:29:10 / cg" |
|
225 |
! |
|
226 |
||
227 |
registerView:aView |
|
228 |
deviceViews register:aView. |
|
229 |
||
230 |
"Created: 24.2.1997 / 18:29:10 / cg" |
|
231 |
! |
|
232 |
||
233 |
unregisterColor:aColor |
|
234 |
deviceColors unregister:aColor. |
|
235 |
||
236 |
"Created: 24.2.1997 / 18:29:14 / cg" |
|
237 |
! |
|
238 |
||
239 |
unregisterCursor:aCursor |
|
240 |
deviceCursors unregister:aCursor. |
|
241 |
||
242 |
"Created: 24.2.1997 / 18:29:14 / cg" |
|
243 |
! |
|
244 |
||
245 |
unregisterFont:aFont |
|
246 |
deviceFonts unregister:aFont. |
|
247 |
||
248 |
"Created: 24.2.1997 / 18:29:14 / cg" |
|
249 |
! |
|
250 |
||
251 |
unregisterForm:aForm |
|
252 |
deviceForms unregister:aForm. |
|
253 |
||
254 |
"Created: 24.2.1997 / 18:29:14 / cg" |
|
255 |
! |
|
256 |
||
257 |
unregisterView:aView |
|
258 |
deviceViews unregister:aView. |
|
259 |
||
260 |
"Created: 24.2.1997 / 18:29:14 / cg" |
|
261 |
! ! |
|
262 |
||
1284 | 263 |
!HostGraphicsDevice class methodsFor:'documentation'! |
264 |
||
265 |
version |
|
4541 | 266 |
^ '$Header: /cvs/stx/stx/libview/HostGraphicsDevice.st,v 1.24 2006-08-07 13:06:44 fm Exp $' |
1284 | 267 |
! ! |