author | Claus Gittinger <cg@exept.de> |
Fri, 15 Dec 1995 13:20:16 +0100 | |
changeset 320 | b7b8dc88fe9f |
parent 310 | 6ed27eebc243 |
child 332 | 48f78f549e5f |
permissions | -rw-r--r-- |
0 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
71 | 3 |
All Rights Reserved |
0 | 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 |
Object subclass:#DeviceWorkstation |
|
293 | 14 |
instanceVariableNames:'displayId visualType monitorType depth ncells bitsPerRGB bitsRed |
310 | 15 |
bitsGreen bitsBlue redMask greenMask blueMask redShift greenShift |
16 |
blueShift hasColors hasGreyscales width height widthMM heightMM |
|
17 |
resolutionHor resolutionVer idToViewMapping knownViews knownIds |
|
18 |
knownBitmaps knownBitmapIds dispatching dispatchProcess ctrlDown |
|
19 |
shiftDown metaDown altDown motionEventCompression lastId lastView |
|
20 |
keyboardMap rootView isSlow activeKeyboardGrab activePointerGrab |
|
21 |
buttonTranslation multiClickTimeDelta altModifiers metaModifiers |
|
22 |
ctrlModifiers shiftModifiers' |
|
293 | 23 |
classVariableNames:'ButtonTranslation MultiClickTimeDelta DeviceErrorSignal |
310 | 24 |
ErrorPrinting DefaultScreen AllScreens' |
293 | 25 |
poolDictionaries:'' |
26 |
category:'Interface-Graphics' |
|
0 | 27 |
! |
28 |
||
46 | 29 |
!DeviceWorkstation class methodsFor:'documentation'! |
30 |
||
31 |
copyright |
|
32 |
" |
|
0 | 33 |
COPYRIGHT (c) 1993 by Claus Gittinger |
71 | 34 |
All Rights Reserved |
0 | 35 |
|
46 | 36 |
This software is furnished under a license and may be used |
37 |
only in accordance with the terms of that license and with the |
|
38 |
inclusion of the above copyright notice. This software may not |
|
39 |
be provided or otherwise made available to, or used by, any |
|
40 |
other person. No title to or ownership of the software is |
|
41 |
hereby transferred. |
|
42 |
" |
|
43 |
! |
|
0 | 44 |
|
45 |
documentation |
|
46 |
" |
|
38 | 47 |
this abstract class defines common protocol to all Display types. |
151 | 48 |
For compatibility with ST-80, this class (or a subclass) is also |
49 |
bound to the global Screen. |
|
50 |
||
0 | 51 |
|
38 | 52 |
instance variables: |
0 | 53 |
|
134 | 54 |
displayId <Number> the device id of the display |
55 |
visualType <Symbol> one of #StaticGray, #PseudoColor, ... #TrueColor |
|
56 |
monitorType <Symbol> one of #monochrome, #color, #unknown |
|
57 |
||
193 | 58 |
depth <SmallInteger> bits per color |
59 |
ncells <SmallInteger> number of colors (i.e. colormap size; not always == 2^depth) |
|
60 |
bitsPerRGB <SmallInteger> number of valid bits per rgb component |
|
134 | 61 |
(actual number taken in A/D converter; not all devices report the true value) |
193 | 62 |
bitsRed <SmallInteger> number of red bits (only valid for TrueColor displays) |
63 |
bitsGreen <SmallInteger> number of green bits (only valid for TrueColor displays) |
|
64 |
bitsBlue <SmallInteger> number of blue bits (only valid for TrueColor displays) |
|
65 |
redMask <SmallInteger> shifted red mask (only useful for TrueColor displays) |
|
66 |
greenMask <SmallInteger> shifted green mask (only useful for TrueColor displays) |
|
67 |
blueMask <SmallInteger> shifted blue mask (only useful for TrueColor displays) |
|
68 |
shiftRed <SmallInteger> number of bits to shift red bits (only valid for TrueColor displays) |
|
69 |
shiftGreen <SmallInteger> number of bits to shift green bits (only valid for TrueColor displays) |
|
70 |
shiftBlue <SmallInteger> number of bits to shift blue bits (only valid for TrueColor displays) |
|
71 |
||
134 | 72 |
hasColors <Boolean> true, if display supports colors |
73 |
hasGreyscales <Boolean> true, if display supports grey-scales (i.e is not b/w display) |
|
193 | 74 |
width <SmallInteger> number of horizontal pixels |
75 |
height <SmallInteger> number of vertical pixels |
|
134 | 76 |
heightMM <Number> screen height in millimeter |
77 |
widthMM <Number> screen width in millimeter |
|
78 |
resolutionHor <Number> pixels per horizontal millimeter |
|
79 |
resolutionVer <Number> pixels per vertical millimeter |
|
80 |
||
81 |
idToViewMapping <Dictionary> maps view-ids to views |
|
82 |
knownViews <Collection> all views known |
|
83 |
knownIds <Collection> corresponding device-view ids |
|
84 |
knownBitmaps <Collection> all known device bitmaps |
|
85 |
knownBitmapIds <Collection> corresponding device-bitmap ids |
|
86 |
||
87 |
dispatching <Boolean> true, if currently in dispatch loop |
|
88 |
||
151 | 89 |
ctrlDown <Boolean> true, if control key currently pressed |
134 | 90 |
shiftDown <Boolean> true, if shift key currently pressed |
91 |
metaDown <Boolean> true, if meta key (cmd-key) is currently pressed |
|
92 |
altDown <Boolean> true, if alt key is currently pressed |
|
93 |
||
94 |
motionEventCompression |
|
95 |
<Boolean> if true motion events are compressed |
|
96 |
(obsolete: now done in sensor) |
|
97 |
||
98 |
lastId <Number> the id of the last events view (internal) |
|
99 |
lastView <View> the last events view (internal, for faster id->view mapping) |
|
100 |
||
101 |
keyboardMap <KeyBdMap> mapping for keys |
|
102 |
rootView <DisplayRootView> this displays root window |
|
103 |
isSlow <Boolean> set/cleared from startup - used to turn off |
|
104 |
things like popup-shadows etc. |
|
0 | 105 |
" |
151 | 106 |
! |
107 |
||
293 | 108 |
events |
109 |
" |
|
110 |
All events are processed in a workstations dispatchEvent method. |
|
111 |
There, incoming events are first sent to itself, for a first (view independent) |
|
112 |
preprocessing. For example, the devices state of the shift-, alt-, control and |
|
113 |
meta keys are updated there. After that, the event is forwarded either to |
|
114 |
the views sensor or to the view directly (if it has no sensor). |
|
115 |
(Sensorless views are a leftover from ancient times and will sooner or |
|
116 |
later vanish - simplifying things a bit. Do not depend on views without |
|
117 |
sensors to work correctly in future versions.) |
|
118 |
||
119 |
This event processing is done by the event dispatcher process, which is |
|
120 |
launched in ST/X's startup sequence (see Smalltalk>>start). |
|
121 |
Event processing is done at a high priority, to allow keyboad processing |
|
122 |
and CTRL-C handling to be performed even while other processes are running. |
|
123 |
The code executed by thr event process is found in startDispatch. |
|
124 |
||
125 |
Individual events can be enabled or disabled. The ones that are enabled |
|
126 |
by default are: |
|
127 |
keypress / keyRelease |
|
128 |
buttonPress / buttonRelease / buttonMotion (i.e. motion with button pressed) |
|
129 |
pointerEnter / pointerLeave |
|
130 |
||
131 |
other events have to be enabled by sending a corresponding #enableXXXEvent |
|
132 |
message to the view which shall receive those events. |
|
133 |
For example, pointerMotion events (i.e. motion without button being pressed) |
|
134 |
are enable by: 'aView enableMotionEvent' |
|
135 |
||
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
136 |
The above is only of interest, if you write your own widget classes, |
293 | 137 |
existing widgets set things as required in their #initEvents method. |
138 |
" |
|
139 |
! |
|
140 |
||
151 | 141 |
workstationDevices |
142 |
" |
|
143 |
In ST/X, all interaction with the graphics device is done through |
|
144 |
an instance of (a subclass) of DeviceWorkstation. |
|
145 |
Every view has a reference to the device it has been created on in |
|
146 |
its device instance variable. |
|
147 |
||
148 |
One particular device instance is bound to the global variable Display: |
|
149 |
this is the default graphics display, on which new views are created |
|
150 |
(however, provisions exist for multi-display operation) |
|
151 |
||
152 |
Currently, there is are only two classes (released to the public): |
|
153 |
||
154 |
XWorkstation - a plain X window interface |
|
155 |
||
156 |
GLXWorkstation - an X window interface with a GL (3D graphic library) |
|
157 |
extension; either simulated (VGL) or a real GL |
|
158 |
(real GL is only available on SGI machines) |
|
159 |
||
160 |
An experimental version for a NeXTStep interface exists, but is currently |
|
161 |
no longer maintained and not released. |
|
162 |
Also, interfaces for other graphic systems (i.e. OS/2 and Windows) are |
|
163 |
planned for and will be available (hopefully) in late 95. |
|
164 |
||
165 |
DeviceWorkstation itself is an abstract class; the methods as defined |
|
166 |
here perform things which are common to all graphic devices or block |
|
167 |
methods and raise a subclassResponsibilty error condition. |
|
168 |
To create a new graphic interface, at least the subclassResponsibilty-methods |
|
169 |
have to be reimplemented in a concrete subclass. |
|
170 |
||
171 |
In theory, ST/X is designed to allow the use of multiple workstation |
|
172 |
devices in parallel; for example, in X, it is possible to create another |
|
173 |
instance of XWorkstation, start a dispatch process for it, and to create and |
|
174 |
open views on this display. However, (currently) some mechanisms are badly |
|
175 |
implemented and therefore, things do not work fully satisfying. |
|
176 |
(for example, popUpMenus are currently opened on the workstation which is |
|
177 |
bound to the global variable 'Display' - independent of the active |
|
178 |
windowgroups display.) |
|
179 |
These bugs will be fixed and fully working multi-display operation can be |
|
180 |
expected for one of the next releases. |
|
181 |
||
182 |
If you want to experiment with multi-display applications, |
|
183 |
you have to: |
|
184 |
||
185 |
- create a new instance of XWorkstation: |
|
186 |
||
187 |
Smalltalk at:#Display2 put:(XWorkstation new). |
|
188 |
||
189 |
- have it connect to the display (i.e. the xServer): |
|
190 |
(replace 'porty' below with the name of your display) |
|
191 |
||
192 |
Display2 := Display2 initializeFor:'porty:0.0' |
|
193 |
||
194 |
returns nil, if connection is refused |
|
195 |
- leaving you with Display2==nil in this case. |
|
196 |
||
197 |
- start an event dispatcher process for it: |
|
198 |
||
199 |
Display2 startDispatch |
|
200 |
||
201 |
- optionally set its keyboard map |
|
202 |
(since this is usually done for Display in the startup-file, |
|
203 |
the new display does not have all your added key bindings) |
|
204 |
||
205 |
Display2 keyboardMap:(Display keyboardMap) |
|
206 |
||
207 |
- create a view for it: |
|
208 |
||
209 |
(FileBrowser onDevice:Display2) open |
|
210 |
||
211 |
(Workspace onDevice:Display2) open |
|
212 |
||
213 |
(Launcher onDevice:Display2) open |
|
214 |
||
215 |
NewLauncher openOnDevice:Display2 |
|
216 |
--> does not work, since ApplicationModel is not prepared |
|
217 |
to open views on other devices. (and may never be, since |
|
218 |
it was written for ST-80 compatibility, which seems not to |
|
219 |
support this.) |
|
220 |
To do the above, try: |
|
221 |
||
222 |
Smalltalk at:#OldDisplay put:Display. |
|
223 |
Display := Display2. |
|
224 |
NewLauncher open. |
|
225 |
Display := OldDisplay. |
|
226 |
||
227 |
Consider this is an ugly kludge ... |
|
228 |
||
229 |
However, as mentioned above, there are a few places, where the default |
|
230 |
display 'Display' is still hard-coded. But, beside from this (little bug ;-), |
|
231 |
remote display operation works pretty well. If you write your application to |
|
232 |
work around those (to-be-fixed) bugs, multi-display applications are |
|
233 |
even possible in the current release. (avoid popUps and use simple buttons |
|
234 |
only). |
|
235 |
||
236 |
Things are being changed to introduce the concept of a 'current' display, |
|
237 |
which is the device on which the current windowGroup has its topView. |
|
238 |
All places in the system whit explicit accesses to Display will be changed |
|
239 |
to use 'Screen current' instead. Especially, this will create popups and |
|
240 |
modalBoxes on the display of the active windowGroup. |
|
241 |
||
242 |
There is no easy solution for things like Notifiers, WarnBoxes or |
|
243 |
Debuggers when opened from some background or non-view process. |
|
244 |
These will come up one the default Display, as returned by 'Screen default'. |
|
245 |
||
246 |
Late note: the above has been mostly fixed, multidisplay applications |
|
247 |
work pretty well. However, there are still some problems to be expected, |
|
248 |
if the screens have different display capabilities (b&w vs. greyscale vs. |
|
249 |
color display). The current styleSheet approach keeps default values |
|
250 |
only once (it should do so per display ...) For now, expect ugly looking |
|
251 |
views in this case - or set your styleSheet for the smallest common |
|
252 |
capabilities (i.e. for b&w). |
|
253 |
" |
|
0 | 254 |
! ! |
255 |
||
256 |
!DeviceWorkstation class methodsFor:'initialization'! |
|
257 |
||
2 | 258 |
initialize |
259 |
DeviceErrorSignal isNil ifTrue:[ |
|
71 | 260 |
DeviceErrorSignal := (Signal new) mayProceed:true. |
261 |
DeviceErrorSignal notifierString:'device error'. |
|
2 | 262 |
]. |
218
10072d9beba5
can now turn off Xlib error messages from the errorHandler
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
263 |
ErrorPrinting := true. |
134 | 264 |
self initializeConstants. |
2 | 265 |
! |
266 |
||
0 | 267 |
initializeConstants |
268 |
"initialize some (soft) constants" |
|
269 |
||
51 | 270 |
MultiClickTimeDelta := 300. "a click within 300ms is considered a double one" |
0 | 271 |
ButtonTranslation := #(1 2 3) "identity translation" |
272 |
! ! |
|
273 |
||
144 | 274 |
!DeviceWorkstation class methodsFor:'Signal constants'! |
2 | 275 |
|
276 |
deviceErrorSignal |
|
277 |
"return the signal used for device error reporting" |
|
278 |
||
279 |
^ DeviceErrorSignal |
|
280 |
! ! |
|
281 |
||
0 | 282 |
!DeviceWorkstation class methodsFor:'accessing'! |
283 |
||
284 |
buttonTranslation:anArray |
|
285 |
"set the button translation, #(1 2 3) is no-translation, |
|
286 |
#(3 2 1) is ok for left-handers" |
|
287 |
||
75 | 288 |
ButtonTranslation := anArray. |
289 |
Display notNil ifTrue:[ |
|
290 |
Display buttonTranslation:anArray |
|
291 |
]. |
|
0 | 292 |
! ! |
293 |
||
293 | 294 |
!DeviceWorkstation class methodsFor:'error handling'! |
295 |
||
296 |
errorInterrupt:errID with:aParameter |
|
297 |
"DisplayError interrupt. |
|
298 |
This is invoked via |
|
299 |
XError->errorInterrupt:#DisplayError->registeredErrorInterruptHandlers |
|
300 |
||
301 |
looks if a signal handler for DeviceErrorSignal is present, |
|
302 |
and - if so raises the signal. If the signal not handled, simply output a |
|
303 |
message and continue. |
|
304 |
This allows for non disrupted error reporting OR to catch and |
|
305 |
investigate errors as required." |
|
306 |
||
307 |
|badId badResource msg| |
|
308 |
||
309 |
badId := self resourceIdOfLastError. |
|
310 |
badId ~~ 0 ifTrue:[ |
|
311 |
badResource := self resourceOfId:badId. |
|
312 |
]. |
|
313 |
msg := 'Display error: ' , (self lastErrorString). |
|
314 |
||
315 |
DeviceErrorSignal isHandled ifFalse:[ |
|
316 |
ErrorPrinting ifTrue:[msg errorPrintNL]. |
|
317 |
^ self |
|
318 |
]. |
|
319 |
||
320 |
^ DeviceErrorSignal |
|
321 |
raiseRequestWith:badResource |
|
322 |
errorString:msg |
|
323 |
! |
|
324 |
||
325 |
errorPrinting |
|
326 |
ErrorPrinting isNil ifTrue:[^ false]. |
|
327 |
^ ErrorPrinting |
|
328 |
! |
|
329 |
||
330 |
errorPrinting:aBoolean |
|
331 |
ErrorPrinting := aBoolean |
|
332 |
! |
|
333 |
||
334 |
lastErrorString |
|
335 |
"return a string describing the last error" |
|
336 |
||
337 |
^ self subclassResponsibility |
|
338 |
! |
|
339 |
||
340 |
resourceIdOfLastError |
|
341 |
"return the resource id responsible for the last error" |
|
342 |
||
343 |
^ self subclassResponsibility |
|
344 |
! |
|
345 |
||
346 |
resourceOfId:id |
|
347 |
"search thru all device stuff for a resource. |
|
348 |
Needed for error handling" |
|
349 |
||
350 |
Form allInstances do:[:f | |
|
351 |
f id == id ifTrue:[^ f] |
|
352 |
]. |
|
353 |
||
354 |
self allInstances do:[:aDisplay | |
|
355 |
aDisplay allViewsDo:[:aView | |
|
356 |
aView id == id ifTrue:[^ aView]. |
|
357 |
aView gcId == id ifTrue:[^ aView] |
|
358 |
]. |
|
359 |
||
360 |
"/ |views| |
|
361 |
"/ views := aDisplay knownViews. |
|
362 |
"/ views notNil ifTrue:[ |
|
363 |
"/ views do:[:v | |
|
364 |
"/ v id == id ifTrue:[^ v]. |
|
365 |
"/ v gcId == id ifTrue:[^ v] |
|
366 |
"/ ]. |
|
367 |
"/ ]. |
|
368 |
]. |
|
369 |
||
370 |
Color allInstances do:[:c | |
|
371 |
c colorId == id ifTrue:[^ c] |
|
372 |
]. |
|
373 |
||
374 |
Font allInstances do:[:f | |
|
375 |
f fontId == id ifTrue:[^ f] |
|
376 |
]. |
|
377 |
^ nil |
|
378 |
! ! |
|
379 |
||
380 |
!DeviceWorkstation class methodsFor:'queries'! |
|
381 |
||
382 |
allScreens |
|
383 |
"EXPERIMENTAL: return a collection of active display devices. |
|
384 |
Typically, there is only one, Display or Screen current." |
|
385 |
||
386 |
^ AllScreens |
|
387 |
||
388 |
" |
|
389 |
Screen allScreens |
|
390 |
" |
|
391 |
||
392 |
"Modified: 1.9.1995 / 13:38:35 / claus" |
|
393 |
! |
|
394 |
||
395 |
current |
|
396 |
"EXPERIMENTAL: this should return the currently active screen, |
|
397 |
that is, the device of the currently executing windowGroup. |
|
398 |
It will be used in multi-display operation, to launch views on |
|
399 |
the correct device - even if not specified explicitely. |
|
400 |
This does not yet work fully satisfying ..." |
|
401 |
||
402 |
|wg tops v dev| |
|
403 |
||
404 |
AllScreens size == 1 ifTrue:[ |
|
405 |
^ AllScreens anElement |
|
406 |
]. |
|
407 |
||
408 |
" |
|
409 |
mhmh - multiple screens are active. |
|
410 |
be careful, to not run into an error in case |
|
411 |
the current windowGroup got corrupted somehow ... |
|
412 |
" |
|
413 |
(wg := WindowGroup activeGroup) notNil ifTrue:[ |
|
414 |
" |
|
415 |
ok, not a background process or scheduler ... |
|
416 |
" |
|
417 |
(tops := wg topViews) notNil ifTrue:[ |
|
418 |
tops isEmpty ifFalse:[ |
|
419 |
(v := tops first) notNil ifTrue:[ |
|
420 |
" |
|
421 |
ok, it has a view ... |
|
422 |
" |
|
423 |
(dev := v device) notNil ifTrue:[ |
|
424 |
^ dev |
|
425 |
] |
|
426 |
] |
|
427 |
] |
|
428 |
] |
|
429 |
]. |
|
430 |
" |
|
431 |
in all other cases, return the default display |
|
432 |
" |
|
433 |
^ Display |
|
434 |
||
435 |
" |
|
436 |
Screen current |
|
437 |
" |
|
438 |
||
439 |
"Modified: 1.9.1995 / 13:40:05 / claus" |
|
440 |
! |
|
441 |
||
442 |
default |
|
443 |
"ST-80 compatibility. |
|
444 |
Return the default screen. This is typically the first opened |
|
445 |
Display screen in a session. Use of the global variable Display |
|
446 |
should vanish over time - replace it by Screen default." |
|
447 |
||
448 |
^ DefaultScreen |
|
449 |
||
450 |
" |
|
451 |
Screen default |
|
452 |
" |
|
453 |
! |
|
454 |
||
455 |
default:aDevice |
|
456 |
"Set the default screen. This is sent very early during startup, |
|
457 |
and assigns the first opened screenDevice to both Display and the default |
|
458 |
screen." |
|
459 |
||
460 |
DefaultScreen := aDevice |
|
461 |
! |
|
462 |
||
463 |
platformName |
|
464 |
"ST-80 compatibility. |
|
465 |
Return a string describing the display systems platform. |
|
466 |
Returns a dummy here. This must be redefined in concrete |
|
467 |
Workstation classes, to return somthing like 'X', 'MSWindows', 'OS/2' etc." |
|
468 |
||
469 |
^ 'unknown' |
|
470 |
! ! |
|
471 |
||
472 |
!DeviceWorkstation methodsFor:'accessing & queries'! |
|
473 |
||
474 |
bitsBlue |
|
475 |
"return the number of valid bits in the red component." |
|
476 |
||
477 |
bitsBlue isNil ifTrue:[ |
|
478 |
"/ not a truecolor display |
|
479 |
^ bitsPerRGB |
|
480 |
]. |
|
481 |
^ bitsBlue |
|
482 |
||
483 |
" |
|
484 |
Display bitsBlue |
|
485 |
" |
|
486 |
||
487 |
"Created: 21.10.1995 / 00:45:27 / cg" |
|
488 |
! |
|
489 |
||
490 |
bitsGreen |
|
491 |
"return the number of valid bits in the red component." |
|
492 |
||
493 |
bitsGreen isNil ifTrue:[ |
|
494 |
"/ not a truecolor display |
|
495 |
^ bitsPerRGB |
|
496 |
]. |
|
497 |
^ bitsGreen |
|
498 |
||
499 |
" |
|
500 |
Display bitsGreen |
|
501 |
" |
|
502 |
||
503 |
"Created: 21.10.1995 / 00:45:11 / cg" |
|
504 |
! |
|
505 |
||
506 |
bitsPerRGB |
|
507 |
"return the number of valid bits per rgb component; |
|
508 |
Currently, assume that r/g/b all have the same precision, |
|
509 |
which is a stupid assumption (there may be some, where less |
|
510 |
resolution is available in the blue component). |
|
511 |
Therefore, this may be changed to return a 3-element vector. |
|
512 |
In the meantime, use bitsRed/bitsGreen/bitsBlue to get this information." |
|
513 |
||
514 |
^ bitsPerRGB |
|
515 |
||
516 |
" |
|
517 |
Display bitsPerRGB |
|
518 |
" |
|
519 |
||
520 |
"Modified: 21.10.1995 / 00:46:27 / cg" |
|
521 |
! |
|
522 |
||
523 |
bitsRed |
|
524 |
"return the number of valid bits in the red component." |
|
525 |
||
526 |
bitsRed isNil ifTrue:[ |
|
527 |
"/ not a truecolor display |
|
528 |
^ bitsPerRGB |
|
529 |
]. |
|
530 |
^ bitsRed |
|
531 |
||
532 |
" |
|
533 |
Display bitsRed |
|
534 |
" |
|
535 |
||
536 |
"Created: 21.10.1995 / 00:44:55 / cg" |
|
537 |
! |
|
538 |
||
539 |
blackpixel |
|
540 |
"return the colorId of black" |
|
541 |
||
542 |
^ self subclassResponsibility |
|
543 |
! |
|
544 |
||
545 |
boundingBox |
|
546 |
"return a rectangle representing the displays bounding box. |
|
547 |
For Smalltalk-80 2.x compatibility" |
|
548 |
||
549 |
^ self bounds |
|
550 |
! |
|
551 |
||
552 |
bounds |
|
553 |
"return a rectangle representing the displays bounding box. |
|
554 |
For Smalltalk-80 4.x compatibility" |
|
555 |
||
556 |
^ Rectangle origin:(0 @ 0) extent:(width @ height) |
|
557 |
||
558 |
" |
|
559 |
Screen default bounds |
|
560 |
" |
|
561 |
"/ thats the same as: |
|
562 |
" |
|
563 |
Display bounds |
|
564 |
" |
|
565 |
! |
|
566 |
||
567 |
buttonMotionMask:aMask includesButton:aButton |
|
568 |
"given a device button mask, return true if a logical button |
|
569 |
(1 .. 3 for left .. right) is included." |
|
570 |
||
571 |
|buttonNr| |
|
572 |
||
573 |
"reverse buttonTranslation" |
|
574 |
buttonTranslation notNil ifTrue:[ |
|
575 |
buttonNr := buttonTranslation indexOf:aButton ifAbsent:[1]. |
|
576 |
] ifFalse:[ |
|
577 |
buttonNr := aButton. |
|
578 |
]. |
|
579 |
^ (aMask bitTest:(self buttonMotionMask:buttonNr)) |
|
580 |
! |
|
581 |
||
582 |
buttonTranslation |
|
583 |
^ buttonTranslation |
|
584 |
! |
|
585 |
||
586 |
buttonTranslation:anArray |
|
587 |
buttonTranslation := anArray |
|
588 |
! |
|
589 |
||
590 |
center |
|
591 |
"return the centerpoint in pixels of the display" |
|
592 |
||
593 |
^ (width // 2) @ (height // 2) |
|
594 |
! |
|
595 |
||
596 |
depth |
|
597 |
"return the depth in pixels of the display" |
|
598 |
||
599 |
^ depth |
|
600 |
||
601 |
" |
|
602 |
Display depth |
|
603 |
" |
|
604 |
! |
|
605 |
||
606 |
dispatchProcess |
|
607 |
^ dispatchProcess |
|
608 |
! |
|
609 |
||
610 |
displayFileDescriptor |
|
611 |
"return the file descriptor associated with the display |
|
612 |
if any. If there is no underlying filedescriptor, return nil. |
|
613 |
(used for event select/polling)" |
|
614 |
||
615 |
^ nil |
|
616 |
! |
|
617 |
||
618 |
displayName |
|
619 |
"return the display name - that is the name of the display connection |
|
620 |
or nil, for default display. For example, in X, this returns a string |
|
621 |
like 'hostname:0' for remote connections, and nil for a default local |
|
622 |
connection. |
|
623 |
- nothing known here, but maybe redefined in subclasses." |
|
624 |
||
625 |
^ nil |
|
626 |
||
627 |
" |
|
628 |
Display displayName |
|
629 |
" |
|
630 |
! |
|
631 |
||
632 |
extent |
|
633 |
"return the extent of the display (in pixels)" |
|
634 |
||
635 |
^ width @ height |
|
636 |
||
637 |
" |
|
638 |
Display extent |
|
639 |
" |
|
640 |
! |
|
641 |
||
642 |
glVersion |
|
643 |
"return a string describing the GL version. |
|
644 |
Since the generic display does not support 3D GL graphics, |
|
645 |
a dummy is returned here." |
|
646 |
||
647 |
^ 'noGL' |
|
648 |
||
649 |
" |
|
650 |
Display glVersion |
|
651 |
" |
|
652 |
! |
|
653 |
||
654 |
hasColors |
|
655 |
"return true, if its a color display" |
|
656 |
||
657 |
^ hasColors |
|
658 |
||
659 |
" |
|
660 |
Display hasColors |
|
661 |
" |
|
662 |
! |
|
663 |
||
664 |
hasDPS |
|
665 |
"return true, if this workstation supports postscript output into views. |
|
666 |
Should be reimplemented in concrete classes which do support this." |
|
667 |
||
668 |
^ false |
|
669 |
||
670 |
" |
|
671 |
Display hasDPS |
|
672 |
" |
|
673 |
! |
|
674 |
||
675 |
hasExtension:extensionString |
|
676 |
"query for an X extension. The method here is provide for XWorkstation |
|
677 |
protocol compatibility only." |
|
678 |
||
679 |
^ false |
|
680 |
||
681 |
" |
|
682 |
Display hasExtension:'XVideo' |
|
683 |
Display hasExtension:'Input' |
|
684 |
Display hasExtension:'GLX' |
|
685 |
Display hasExtension:'X3D-PEX' |
|
686 |
Display hasExtension:'XInputExtension' |
|
687 |
Display hasExtension:'SHAPE' |
|
688 |
Display hasExtension:'MIT-SHM' |
|
689 |
Display hasExtension:'SGIFullScreenStereo' |
|
690 |
" |
|
691 |
! |
|
692 |
||
693 |
hasFax |
|
694 |
"return true, if this workstation supports decompression of fax images. |
|
695 |
Should be reimplemented in concrete classes which do support this." |
|
696 |
||
697 |
^ false |
|
698 |
||
699 |
" |
|
700 |
Display hasFax |
|
701 |
" |
|
702 |
! |
|
703 |
||
704 |
hasGreyscales |
|
705 |
"return true, if this workstation supports greyscales |
|
706 |
(also true for color displays)" |
|
707 |
||
708 |
^ hasGreyscales |
|
709 |
||
710 |
" |
|
711 |
Display hasGreyscales |
|
712 |
" |
|
713 |
! |
|
714 |
||
715 |
hasImageExtension |
|
716 |
"return true, if this workstation supports the X Image extension" |
|
717 |
||
718 |
^ false |
|
719 |
||
720 |
" |
|
721 |
Display hasImageExtension |
|
722 |
" |
|
723 |
! |
|
724 |
||
725 |
hasInputExtension |
|
726 |
"return true, if this workstation supports the X Input extension" |
|
727 |
||
728 |
^ false |
|
729 |
||
730 |
" |
|
731 |
Display hasInputExtension |
|
732 |
" |
|
733 |
! |
|
734 |
||
735 |
hasMultibuffer |
|
736 |
"return true, if this workstation supports the X multibuffer extension" |
|
737 |
||
738 |
^ false |
|
739 |
||
740 |
" |
|
741 |
Display hasMultibuffer |
|
742 |
" |
|
743 |
! |
|
744 |
||
745 |
hasPEX |
|
746 |
"return true, if this workstation supports PEX graphics. |
|
747 |
Should be reimplemented in concrete classes which do support this." |
|
748 |
||
749 |
^ false |
|
750 |
||
751 |
" |
|
752 |
Display hasPEX |
|
753 |
" |
|
754 |
! |
|
755 |
||
756 |
hasShape |
|
757 |
"return true, if this workstation supports non-rectangular windows. |
|
758 |
Should be reimplemented in concrete classes which do support this." |
|
759 |
||
760 |
^ false |
|
761 |
||
762 |
" |
|
763 |
Display hasShape |
|
764 |
" |
|
765 |
! |
|
766 |
||
767 |
hasShm |
|
768 |
"return true, if this workstation supports shared memory pixmaps. |
|
769 |
Should be reimplemented in concrete classes which do support this." |
|
770 |
||
771 |
^ false |
|
772 |
||
773 |
" |
|
774 |
Display hasShm |
|
775 |
" |
|
776 |
! |
|
777 |
||
778 |
hasStereoExtension |
|
779 |
"return true, if this workstation supports stereo GL drawing. |
|
780 |
Both the server must support it, and the feature must have been |
|
781 |
enabled in the smalltalk system, for true to be returned." |
|
782 |
||
783 |
^ false |
|
784 |
||
785 |
" |
|
786 |
Display hasStereoExtension |
|
787 |
" |
|
788 |
! |
|
789 |
||
790 |
hasXVideo |
|
791 |
"return true, if this workstation supports the XVideo extension" |
|
792 |
||
793 |
^ false |
|
794 |
||
795 |
" |
|
796 |
Display hasXVideo |
|
797 |
" |
|
798 |
! |
|
799 |
||
800 |
height |
|
801 |
"return the height of the display (in pixels)" |
|
802 |
||
803 |
^ height |
|
804 |
||
805 |
"Display height" |
|
806 |
! |
|
807 |
||
808 |
heightInMillimeter |
|
809 |
"return the height in millimeter of the display" |
|
810 |
||
811 |
^ heightMM |
|
812 |
||
813 |
"Display heightInMillimeter" |
|
814 |
! |
|
815 |
||
816 |
heightInMillimeter:aNumber |
|
817 |
"set the height in millimeter of the display |
|
818 |
- needed since some displays do not tell the truth or do not know it" |
|
819 |
||
820 |
heightMM := aNumber |
|
821 |
! |
|
822 |
||
823 |
horizontalPixelPerInch |
|
824 |
"return the number of horizontal pixels per inch of the display" |
|
825 |
||
826 |
^ (width / widthMM) * 25.4 |
|
827 |
! |
|
828 |
||
829 |
horizontalPixelPerMillimeter |
|
830 |
"return the number of horizontal pixels per millimeter of the display" |
|
831 |
||
832 |
^ width / widthMM |
|
833 |
! |
|
834 |
||
835 |
id |
|
836 |
"return the displayId" |
|
837 |
||
838 |
^ displayId |
|
839 |
! |
|
840 |
||
841 |
isSlow |
|
842 |
"return true, if this is a relatively slow device - |
|
843 |
used to turn off things like popup-shadows" |
|
844 |
||
845 |
^ isSlow |
|
846 |
! |
|
847 |
||
848 |
keyboardMap |
|
849 |
"return the keyboard map" |
|
850 |
||
851 |
^ keyboardMap |
|
852 |
! |
|
853 |
||
854 |
keyboardMap:aMap |
|
855 |
"set the keyboard map" |
|
856 |
||
857 |
keyboardMap := aMap |
|
858 |
! |
|
859 |
||
860 |
knownViews |
|
861 |
"return a collection of all known views" |
|
862 |
||
863 |
^ knownViews |
|
864 |
! |
|
865 |
||
866 |
knownViews:aCollection |
|
867 |
"set the collection of all known views - take care, |
|
868 |
bad use of this will create funny results; use only for snapshot support" |
|
869 |
||
870 |
knownViews := aCollection |
|
871 |
! |
|
872 |
||
873 |
monitorType |
|
874 |
"return a symbol representing the monitor type of the display. |
|
875 |
It is usually set to #unknown, #color or #monochrome. |
|
876 |
But it can be set to any value from the startup file, for later |
|
877 |
testing from anywhere. For example the startup for plasma-displays |
|
878 |
can set it to #plasma to later influence the colors used in widgets |
|
879 |
(indirectly through the resource file)." |
|
880 |
||
881 |
^ monitorType |
|
882 |
||
883 |
" |
|
884 |
Display monitorType |
|
885 |
" |
|
886 |
! |
|
887 |
||
888 |
monitorType:aSymbol |
|
889 |
"set the monitorType - see comment in DeviceWorkstation>>montorType" |
|
890 |
||
891 |
monitorType := aSymbol |
|
892 |
! |
|
893 |
||
894 |
multiClickTimeDelta |
|
895 |
^ multiClickTimeDelta |
|
896 |
! |
|
897 |
||
898 |
multiClickTimeDelta:milliseconds |
|
899 |
multiClickTimeDelta := milliseconds |
|
900 |
! |
|
901 |
||
902 |
ncells |
|
903 |
"return the number of usable color cells, the display has |
|
904 |
- this is not always 2 to the power of depth |
|
905 |
(for example, on 6bit displays, ncells is 64 while depth is 8)" |
|
906 |
||
907 |
^ ncells |
|
908 |
||
909 |
" |
|
910 |
Display ncells |
|
911 |
" |
|
912 |
! |
|
913 |
||
914 |
pixelPerInch |
|
915 |
"return the number of horizontal/vertical pixels per inch of the display as Point" |
|
916 |
||
917 |
^ ((width / widthMM) @ (height / heightMM)) * 25.4 |
|
918 |
||
919 |
"Display pixelPerInch" |
|
920 |
! |
|
921 |
||
922 |
pixelPerMillimeter |
|
923 |
"return the number of horizontal/vertical pixels per millimeter of the display as Point" |
|
924 |
||
925 |
^ (width / widthMM) @ (height / heightMM) |
|
926 |
||
927 |
"Display pixelPerMillimeter" |
|
928 |
! |
|
929 |
||
930 |
platformName |
|
931 |
"return a string describing the display systems platform. |
|
932 |
Returns a dummy here." |
|
933 |
||
934 |
^ self class platformName |
|
935 |
||
936 |
" |
|
937 |
Display platformName |
|
938 |
" |
|
939 |
! |
|
940 |
||
941 |
protocolVersion |
|
942 |
"return the display systems protocol version number. |
|
943 |
Returns a dummy here" |
|
944 |
||
945 |
^ 0 |
|
946 |
||
947 |
" |
|
948 |
Display protocolVersion |
|
949 |
" |
|
950 |
! |
|
951 |
||
952 |
serverVendor |
|
953 |
"return a string describing the display systems server vendor. |
|
954 |
Returns a dummy here" |
|
955 |
||
956 |
^ 'generic' |
|
957 |
||
958 |
" |
|
959 |
Display serverVendor |
|
960 |
" |
|
961 |
! |
|
962 |
||
963 |
shiftBlue |
|
964 |
"return the count by which the blue bits are to be shifted |
|
965 |
when forming a color index. |
|
966 |
This only makes sense with trueColor displays; therefore, |
|
967 |
nil is returned on all others." |
|
968 |
||
969 |
^ blueShift |
|
970 |
||
971 |
" |
|
972 |
Display shiftBlue |
|
973 |
" |
|
974 |
||
975 |
"Created: 21.10.1995 / 00:45:27 / cg" |
|
976 |
"Modified: 21.10.1995 / 00:47:58 / cg" |
|
977 |
! |
|
978 |
||
979 |
shiftGreen |
|
980 |
"return the count by which the red bits are to be shifted |
|
981 |
when forming a color index. |
|
982 |
This only makes sense with trueColor displays; therefore, |
|
983 |
nil is returned on all others." |
|
984 |
||
985 |
^ greenShift |
|
986 |
||
987 |
" |
|
988 |
Display shiftGreen |
|
989 |
" |
|
990 |
||
991 |
"Created: 21.10.1995 / 00:45:27 / cg" |
|
992 |
"Modified: 21.10.1995 / 00:48:28 / cg" |
|
993 |
! |
|
994 |
||
995 |
shiftRed |
|
996 |
"return the count by which the red bits are to be shifted |
|
997 |
when forming a color index. |
|
998 |
This only makes sense with trueColor displays; therefore, |
|
999 |
nil is returned on all others." |
|
1000 |
||
1001 |
^ redShift |
|
1002 |
||
1003 |
" |
|
1004 |
Display shiftRed |
|
1005 |
" |
|
1006 |
||
1007 |
"Created: 21.10.1995 / 00:45:27 / cg" |
|
1008 |
"Modified: 21.10.1995 / 00:48:10 / cg" |
|
1009 |
! |
|
1010 |
||
1011 |
supportedImageFormats |
|
1012 |
"return an array with supported image formats; each array entry |
|
1013 |
is another array, consisting of depth and bitsPerPixel values. |
|
1014 |
Here, we return a single format only; every graphics device must |
|
1015 |
support b&w single bit images." |
|
1016 |
||
1017 |
|info| |
|
1018 |
||
1019 |
info := IdentityDictionary new. |
|
1020 |
info at:#depth put:1. |
|
1021 |
info at:#bitsPerPixel put:1. |
|
1022 |
info at:#padding put:32. |
|
1023 |
^ Array with:info |
|
1024 |
! |
|
1025 |
||
1026 |
supportsDeepIcons |
|
1027 |
"return true, if this device supports non b&w (i.e. greyScale |
|
1028 |
or colored icons). We really dont know here." |
|
1029 |
||
1030 |
"This method has to be reimplemented in concrete display classes." |
|
1031 |
^ self subclassResponsibility |
|
1032 |
||
1033 |
" |
|
1034 |
Display supportsDeepIcons |
|
1035 |
" |
|
1036 |
! |
|
1037 |
||
1038 |
supportsGLDrawing |
|
1039 |
"return true, if this device supports 3D GL drawing. |
|
1040 |
We do not depend on that being implemented." |
|
1041 |
||
1042 |
"This method should to be reimplemented in concrete display classes." |
|
1043 |
^ false |
|
1044 |
||
1045 |
" |
|
1046 |
Display supportsGLDrawing |
|
1047 |
" |
|
1048 |
! |
|
1049 |
||
1050 |
supportsViewGravity |
|
1051 |
"return true, if this device supports gravity attributes. |
|
1052 |
We do not depend on the being implemented, but some resizing operations |
|
1053 |
are faster, it is is." |
|
1054 |
||
1055 |
"This method should to be reimplemented in concrete display classes." |
|
1056 |
^ false |
|
1057 |
||
1058 |
" |
|
1059 |
Display supportsViewGravity |
|
1060 |
" |
|
1061 |
! |
|
1062 |
||
1063 |
translatePoint:aPoint from:windowId1 to:windowId2 |
|
1064 |
"given a point in window1 (defined by its id), return the coordinate of |
|
1065 |
aPoint in window2 (defined by its id). |
|
1066 |
Use to xlate points from a window to rootwindow, mainly for rubber-line |
|
1067 |
drawing on the displays root window." |
|
1068 |
||
1069 |
"This method has to be reimplemented in concrete display classes." |
|
1070 |
||
1071 |
^ self subclassResponsibility |
|
1072 |
||
1073 |
" |
|
1074 |
|v p root| |
|
1075 |
||
1076 |
v := View new. |
|
1077 |
v openAndWait. |
|
1078 |
||
1079 |
root := v device rootView. |
|
1080 |
||
1081 |
p := v device translatePoint:10@10 from:(v id) to:(root id). |
|
1082 |
||
1083 |
root clippedByChildren:false. |
|
1084 |
root displayLineFrom:0@0 to:p. |
|
1085 |
root clippedByChildren:true. |
|
1086 |
" |
|
1087 |
" |
|
1088 |
|v1 v2 p1 p2 root| |
|
1089 |
||
1090 |
v1 := View new. |
|
1091 |
v1 openAndWait. |
|
1092 |
||
1093 |
v2 := View new. |
|
1094 |
v2 openAndWait. |
|
1095 |
||
1096 |
root := v1 device rootView. |
|
1097 |
||
1098 |
p1 := v1 device translatePoint:10@10 from:(v1 id) to:(root id). |
|
1099 |
p2 := v1 device translatePoint:10@10 from:(v2 id) to:(root id). |
|
1100 |
||
1101 |
root clippedByChildren:false. |
|
1102 |
root displayLineFrom:p1 to:p2. |
|
1103 |
root clippedByChildren:true. |
|
1104 |
" |
|
1105 |
! |
|
1106 |
||
1107 |
vendorRelease |
|
1108 |
"return the display systems release number. |
|
1109 |
Returns a dummy here." |
|
1110 |
||
1111 |
^ 0 |
|
1112 |
||
1113 |
" |
|
1114 |
Display vendorRelease |
|
1115 |
" |
|
1116 |
! |
|
1117 |
||
1118 |
verticalPixelPerInch |
|
1119 |
"return the number of vertical pixels per inch of the display" |
|
1120 |
||
1121 |
^ (height / heightMM) * 25.4 |
|
1122 |
! |
|
1123 |
||
1124 |
verticalPixelPerMillimeter |
|
1125 |
"return the number of vertical pixels per millimeter of the display" |
|
1126 |
||
1127 |
^ height / heightMM |
|
1128 |
! |
|
1129 |
||
1130 |
viewFromPoint:aPoint |
|
1131 |
"given a point on the screen, return the ST/X view in which that |
|
1132 |
point is (this may be a subview). Return nil, if its not an ST/X view |
|
1133 |
or if the point is on the background" |
|
1134 |
||
1135 |
|view id| |
|
1136 |
||
1137 |
id := self viewIdFromPoint:aPoint. |
|
1138 |
view := self viewFromId:id. |
|
1139 |
^ view |
|
1140 |
! |
|
1141 |
||
1142 |
viewIdFromPoint:aPoint |
|
1143 |
"given a point on the screen, return the id of the ST/X view in which that |
|
1144 |
point is (this may be a subview). Return nil, if its not an ST/X view |
|
1145 |
or if the point is on the background" |
|
1146 |
||
1147 |
|view id searchId foundId| |
|
1148 |
||
1149 |
searchId := self rootWindowId. |
|
1150 |
[searchId notNil] whileTrue:[ |
|
1151 |
id := self viewIdFromPoint:aPoint in:searchId. |
|
1152 |
foundId := searchId. |
|
1153 |
searchId := id |
|
1154 |
]. |
|
1155 |
^ foundId |
|
1156 |
! |
|
1157 |
||
1158 |
viewIdFromPoint:aPoint in:windowId |
|
1159 |
"given a point in rootWindow, return the viewId of the subview of windowId |
|
1160 |
hit by this coordinate. Return nil if no view was hit. |
|
1161 |
- use to find window to drop objects after a cross-view drag" |
|
1162 |
||
1163 |
"returning nil here actually makes drag&drop impossible |
|
1164 |
- could also be reimplemented to make a search over all knownViews here. |
|
1165 |
This method has to be reimplemented in concrete display classes." |
|
1166 |
||
1167 |
^ nil |
|
1168 |
! |
|
1169 |
||
1170 |
virtualExtent |
|
1171 |
"return the virtual extent of the display (in pixels). |
|
1172 |
On most systems, this is the same as the physical width; |
|
1173 |
except, if a window manager with a virtual desktop like olvwm |
|
1174 |
(simulating a bigger screen) is running." |
|
1175 |
||
1176 |
^ width @ height |
|
1177 |
! |
|
1178 |
||
1179 |
virtualHeight |
|
1180 |
"return the virtual height of the display (in pixels). |
|
1181 |
On most systems, this is the same as the physical height; |
|
1182 |
except, if a window manager with a virtual desktop like olvwm |
|
1183 |
(simulating a bigger screen) is running." |
|
1184 |
||
1185 |
^ self virtualExtent y |
|
1186 |
||
1187 |
"Display virtualHeight" |
|
1188 |
! |
|
1189 |
||
1190 |
virtualWidth |
|
1191 |
"return the virtual width of the display (in pixels). |
|
1192 |
On most systems, this is the same as the physical width; |
|
1193 |
except, if a window manager with a virtual desktop like olvwm |
|
1194 |
(simulating a bigger screen) is running." |
|
1195 |
||
1196 |
^ self virtualExtent x |
|
1197 |
||
1198 |
"Display virtualWidth" |
|
1199 |
! |
|
1200 |
||
1201 |
visualType |
|
1202 |
"return a symbol representing the visual type of the display" |
|
1203 |
||
1204 |
^ visualType |
|
1205 |
||
1206 |
" |
|
1207 |
Display visualType |
|
1208 |
" |
|
1209 |
! |
|
1210 |
||
1211 |
visualType:aSymbol |
|
1212 |
"set the visual type. |
|
1213 |
The only situation, where setting the visual makes sense, |
|
1214 |
is with my plasma-display, which ignores the palette and spits out |
|
1215 |
grey scales, independent of color LUT definitions. |
|
1216 |
(of which the server knows nothing). |
|
1217 |
So, this should be used from a display-specific startup file only." |
|
1218 |
||
1219 |
visualType := aSymbol. |
|
1220 |
(visualType == #StaticGray or:[visualType == #GrayScale]) ifTrue:[ |
|
1221 |
hasColors := false |
|
1222 |
] ifFalse:[ |
|
1223 |
hasColors := true |
|
1224 |
] |
|
1225 |
! |
|
1226 |
||
1227 |
whitepixel |
|
1228 |
"return the colorId of white" |
|
1229 |
||
1230 |
^ self subclassResponsibility |
|
1231 |
! |
|
1232 |
||
1233 |
width |
|
1234 |
"return the width of the display (in pixels)" |
|
1235 |
||
1236 |
^ width |
|
1237 |
||
1238 |
"Display width" |
|
1239 |
! |
|
1240 |
||
1241 |
widthInMillimeter |
|
1242 |
"return the width in millimeter of the display" |
|
1243 |
||
1244 |
^ widthMM |
|
1245 |
||
1246 |
"Display widthInMillimeter" |
|
1247 |
! |
|
1248 |
||
1249 |
widthInMillimeter:aNumber |
|
1250 |
"set the width in millimeter of the display |
|
1251 |
- needed since some displays do not tell the truth or do not know it" |
|
1252 |
||
1253 |
widthMM := aNumber |
|
1254 |
! |
|
1255 |
||
1256 |
windowAt:aPoint |
|
1257 |
"given a point on the screen, return the ST/X topview in which that |
|
1258 |
point is. |
|
1259 |
Return nil, if its not an ST/X view or if the point is on the background. |
|
1260 |
Alias for viewFromPoint: - ST-80 compatibility" |
|
1261 |
||
1262 |
^ self viewFromPoint:aPoint |
|
1263 |
! ! |
|
1264 |
||
1265 |
!DeviceWorkstation methodsFor:'bitmap/window creation'! |
|
1266 |
||
1267 |
createBitmapFromArray:anArray width:w height:h |
|
1268 |
^ self subclassResponsibility |
|
1269 |
! |
|
1270 |
||
1271 |
createBitmapFromFile:aString for:aForm |
|
1272 |
^ self subclassResponsibility |
|
1273 |
! |
|
1274 |
||
1275 |
createBitmapWidth:w height:h |
|
1276 |
"allocate a bitmap on the Xserver, the contents is undefined |
|
1277 |
(i.e. random). Return a bitmap id or nil" |
|
1278 |
||
1279 |
^ self subclassResponsibility |
|
1280 |
! |
|
1281 |
||
1282 |
createFaxImageFromArray:data width:w height:h type:type k:k msbFirst:msbFirst |
|
1283 |
"create a new faxImage in the workstation. |
|
1284 |
This is a special interface to servers with the fax-image |
|
1285 |
extension (you won't find it in standard X-servers). |
|
1286 |
||
1287 |
type: 0 -> uncompressed |
|
1288 |
1 -> group3 1D (k is void) |
|
1289 |
2 -> group3 2D |
|
1290 |
3 -> group4 2D (k is void) |
|
1291 |
" |
|
1292 |
||
1293 |
^ nil |
|
1294 |
! |
|
1295 |
||
1296 |
createPixmapWidth:w height:h depth:d |
|
1297 |
"allocate a pixmap on the Xserver, the contents is undefined |
|
1298 |
(i.e. random). Return a bitmap id or nil" |
|
1299 |
||
1300 |
^ self subclassResponsibility |
|
1301 |
! |
|
1302 |
||
1303 |
createWindowFor:aView left:xpos top:ypos width:wwidth height:wheight |
|
1304 |
^ self subclassResponsibility |
|
1305 |
! |
|
1306 |
||
1307 |
destroyFaxImage:aFaxImageId |
|
1308 |
^ self subclassResponsibility |
|
1309 |
! |
|
1310 |
||
1311 |
destroyGC:aGCId |
|
1312 |
"destroy a GC" |
|
1313 |
||
1314 |
^ self subclassResponsibility |
|
1315 |
! |
|
1316 |
||
1317 |
destroyPixmap:aDrawableId |
|
1318 |
^ self subclassResponsibility |
|
1319 |
! |
|
1320 |
||
1321 |
destroyView:aView withId:aWindowId |
|
1322 |
^ self subclassResponsibility |
|
1323 |
! |
|
1324 |
||
1325 |
gcFor:aDrawableId |
|
1326 |
"create a GC for drawing into aDrawable" |
|
1327 |
||
1328 |
^ self subclassResponsibility |
|
1329 |
! |
|
1330 |
||
1331 |
rootWindowFor:aView |
|
1332 |
^ self subclassResponsibility |
|
1333 |
! ! |
|
1334 |
||
1335 |
!DeviceWorkstation methodsFor:'color stuff'! |
|
1336 |
||
1337 |
blueComponentOfColor:colorId |
|
1338 |
"get blue component (0..100) of color in map at:index" |
|
1339 |
||
1340 |
self getRGBFrom:colorId into:[:r :g :b | ^ b] |
|
1341 |
! |
|
1342 |
||
1343 |
colorCell |
|
1344 |
"allocate a color - return index" |
|
1345 |
||
1346 |
^ self subclassResponsibility |
|
1347 |
! |
|
1348 |
||
1349 |
colorNamed:aString |
|
1350 |
"allocate a color with color name - return index. |
|
1351 |
Colors should not be allocated by name, since most colors |
|
1352 |
are X specific - get colors by rgb instead." |
|
1353 |
||
1354 |
"support some of them ..." |
|
1355 |
||
1356 |
self getRGBFromName:aString into:[:r :g :b | |
|
1357 |
^ self colorRed:r green:g blue:b |
|
1358 |
]. |
|
1359 |
^ nil |
|
1360 |
! |
|
1361 |
||
1362 |
colorRed:redVal green:greenVal blue:blueVal |
|
1363 |
"allocate a color with rgb values (0..100) - return index" |
|
1364 |
||
1365 |
^ self subclassResponsibility |
|
1366 |
! |
|
1367 |
||
1368 |
freeColor:colorIndex |
|
1369 |
"free a color on the display, when its no longer needed" |
|
1370 |
||
1371 |
^ self subclassResponsibility |
|
1372 |
! |
|
1373 |
||
1374 |
getRGBFrom:index into:aBlock |
|
1375 |
"get rgb components (0..100) of color in map at:index, |
|
1376 |
and evaluate the 3-arg block, aBlock with them" |
|
1377 |
||
1378 |
^ self subclassResponsibility |
|
1379 |
! |
|
1380 |
||
1381 |
getRGBFromName:colorName into:aBlock |
|
1382 |
"get rgb components (0..100) of color named colorName, |
|
1383 |
and evaluate the 3-arg block, aBlock with them. |
|
1384 |
The method here only handles some often used colors; |
|
1385 |
getRGBFromName should not be used, since colorNames other |
|
1386 |
than those below are X specific." |
|
1387 |
||
1388 |
|idx names triple| |
|
1389 |
||
1390 |
names := #('red' 'green' 'blue' 'yellow' 'magenta' 'cyan' 'white' 'black'). |
|
1391 |
idx := names indexOf:colorName. |
|
1392 |
idx == 0 ifTrue:[ |
|
1393 |
idx := (names asLowercase) indexOf:colorName. |
|
1394 |
]. |
|
1395 |
idx == 0 ifFalse:[ |
|
1396 |
triple := #( |
|
1397 |
(100 0 0) "red" |
|
1398 |
( 0 100 0) "green" |
|
1399 |
( 0 0 100) "blue" |
|
1400 |
(100 100 0) "yellow" |
|
1401 |
(100 0 100) "magenta" |
|
1402 |
( 0 100 100) "cyan" |
|
1403 |
(100 100 100) "white" |
|
1404 |
( 0 0 0) "black" |
|
1405 |
) at:idx. |
|
1406 |
||
1407 |
^ aBlock value:(triple at:1) |
|
1408 |
value:(triple at:2) |
|
1409 |
value:(triple at:3) |
|
1410 |
]. |
|
1411 |
^ nil |
|
1412 |
! |
|
1413 |
||
1414 |
greenComponentOfColor:colorId |
|
1415 |
"get green component (0..100) of color in map at:index" |
|
1416 |
||
1417 |
self getRGBFrom:colorId into:[:r :g :b | ^ g] |
|
1418 |
! |
|
1419 |
||
1420 |
listOfAvailableColors |
|
1421 |
"return a list of all available colornames; |
|
1422 |
This method should not be used, since colornames are |
|
1423 |
very X specific. However, the names defined here are pretty common" |
|
1424 |
||
1425 |
^ #('red' 'green' 'blue' 'yellow' 'magenta' 'cyan' 'white' 'black') |
|
1426 |
! |
|
1427 |
||
1428 |
redComponentOfColor:colorId |
|
1429 |
"get red component (0..100) of color in map at:index" |
|
1430 |
||
1431 |
self getRGBFrom:colorId into:[:r :g :b | ^ r] |
|
1432 |
! |
|
1433 |
||
1434 |
setColor:index red:redVal green:greenVal blue:blueVal |
|
1435 |
"change color in map at:index to rgb (0..100)" |
|
1436 |
||
1437 |
^ self subclassResponsibility |
|
1438 |
! ! |
|
1439 |
||
1440 |
!DeviceWorkstation methodsFor:'cursor stuff'! |
|
1441 |
||
1442 |
colorCursor:aCursorId foreground:fgColor background:bgColor |
|
1443 |
"change a cursors colors" |
|
1444 |
||
1445 |
^ self subclassResponsibility |
|
1446 |
! |
|
1447 |
||
1448 |
createCursorShape:aShape |
|
1449 |
"create a cursor given a shape-symbol" |
|
1450 |
||
1451 |
^ self subclassResponsibility |
|
1452 |
! |
|
1453 |
||
1454 |
createCursorSourceForm:sourceForm maskForm:maskForm hotX:hx hotY:hy |
|
1455 |
"create a cursor given 2 bitmaps (source, mask) and a hotspot" |
|
1456 |
^ self subclassResponsibility |
|
1457 |
! |
|
1458 |
||
1459 |
destroyCursor:aCursorId |
|
1460 |
"free a cursor" |
|
1461 |
||
1462 |
^ self subclassResponsibility |
|
1463 |
! ! |
|
1464 |
||
1465 |
!DeviceWorkstation methodsFor:'drawing'! |
|
1466 |
||
1467 |
copyFromFaxImage:sourceId x:srcX y:srcY to:destId x:dstX y:dstY |
|
1468 |
width:w height:h with:aGCId scaleX:scaleX scaleY:scaleY |
|
1469 |
"do a bit-blt" |
|
1470 |
||
1471 |
^ self subclassResponsibility |
|
1472 |
! |
|
1473 |
||
1474 |
copyFromId:sourceId x:srcX y:srcY to:destId x:dstX y:dstY |
|
1475 |
width:w height:h with:aGCId |
|
1476 |
"do a bit-blt" |
|
1477 |
||
1478 |
^ self subclassResponsibility |
|
1479 |
! |
|
1480 |
||
1481 |
copyPlaneFromId:sourceId x:srcX y:srcY to:destId x:dstX y:dstY |
|
1482 |
width:w height:h with:aGCId |
|
1483 |
"do a bit-blt, using the low-bit plane of the source only" |
|
1484 |
||
1485 |
^ self subclassResponsibility |
|
1486 |
! |
|
1487 |
||
1488 |
displayArcX:x y:y w:width h:height from:startAngle angle:angle |
|
1489 |
in:aDrawableId with:aGCId |
|
1490 |
"draw an arc" |
|
1491 |
||
1492 |
^ self subclassResponsibility |
|
1493 |
! |
|
1494 |
||
1495 |
displayLineFromX:x0 y:y0 toX:x1 y:y1 in:aDrawableId with:aGCId |
|
1496 |
"draw a line" |
|
1497 |
||
1498 |
"could add a bresenham line drawer here ..." |
|
1499 |
^ self subclassResponsibility |
|
1500 |
! |
|
1501 |
||
1502 |
displayOpaqueString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId |
|
1503 |
"draw a sub-string - draw foreground on background. |
|
1504 |
If the coordinates are not integers, retry with rounded." |
|
1505 |
||
1506 |
self displayString:aString |
|
1507 |
from:index1 |
|
1508 |
to:index2 |
|
1509 |
x:x |
|
1510 |
y:y |
|
1511 |
in:aDrawableId |
|
1512 |
with:aGCId |
|
1513 |
opaque:true |
|
1514 |
! |
|
1515 |
||
1516 |
displayOpaqueString:aString x:x y:y in:aDrawableId with:aGCId |
|
1517 |
"draw a string - draw foreground on background. |
|
1518 |
If the coordinates are not integers, retry with rounded." |
|
1519 |
||
1520 |
self displayString:aString |
|
1521 |
x:x |
|
1522 |
y:y |
|
1523 |
in:aDrawableId |
|
1524 |
with:aGCId |
|
1525 |
opaque:true |
|
1526 |
! |
|
1527 |
||
1528 |
displayPointX:x y:y in:aDrawableId with:aGCId |
|
1529 |
"draw a point" |
|
1530 |
||
1531 |
^ self subclassResponsibility |
|
1532 |
! |
|
1533 |
||
1534 |
displayPolygon:aPolygon in:aDrawableId with:aGCId |
|
1535 |
"draw a polygon" |
|
1536 |
||
1537 |
" |
|
1538 |
should draw the lines here |
|
1539 |
but then, we have to reimplement all line and join styles here |
|
1540 |
" |
|
1541 |
^ self subclassResponsibility |
|
1542 |
! |
|
1543 |
||
1544 |
displayRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
|
1545 |
"draw a rectangle" |
|
1546 |
||
1547 |
" |
|
1548 |
should draw four lines here |
|
1549 |
but then, we have to reimplement all line and join styles here |
|
1550 |
" |
|
1551 |
^ self subclassResponsibility |
|
1552 |
! |
|
1553 |
||
1554 |
displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId |
|
1555 |
"draw a sub-string - draw foreground only. |
|
1556 |
If the coordinates are not integers, retry with rounded." |
|
1557 |
||
1558 |
self |
|
1559 |
displayString:aString |
|
1560 |
from:index1 |
|
1561 |
to:index2 |
|
1562 |
x:x |
|
1563 |
y:y |
|
1564 |
in:aDrawableId |
|
1565 |
with:aGCId |
|
1566 |
opaque:false |
|
1567 |
! |
|
1568 |
||
1569 |
displayString:aString from:i1 to:i2 x:x y:y in:aDrawableId with:aGCId opaque:opaque |
|
1570 |
"draw part of a string" |
|
1571 |
||
1572 |
" |
|
1573 |
should be redefined in concrete subclasses |
|
1574 |
to avoid creation of throw-away string |
|
1575 |
" |
|
1576 |
self displayString:(aString copyFrom:i1 to:i2) |
|
1577 |
x:x |
|
1578 |
y:y |
|
1579 |
in:aDrawableId |
|
1580 |
with:aGCId |
|
1581 |
opaque:opaque |
|
1582 |
! |
|
1583 |
||
1584 |
displayString:aString x:x y:y in:aDrawableId with:aGCId |
|
1585 |
"draw a string - draw foreground only. |
|
1586 |
If the coordinates are not integers, retry with rounded." |
|
1587 |
||
1588 |
self |
|
1589 |
displayString:aString |
|
1590 |
x:x |
|
1591 |
y:y |
|
1592 |
in:aDrawableId |
|
1593 |
with:aGCId |
|
1594 |
opaque:false |
|
1595 |
! |
|
1596 |
||
1597 |
displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque |
|
1598 |
"draw a string" |
|
1599 |
||
1600 |
^ self subclassResponsibility |
|
1601 |
! |
|
1602 |
||
1603 |
drawBits:imageBits depth:imageDepth width:imageWidth height:imageHeight |
|
1604 |
x:srcx y:srcy |
|
1605 |
into:aDrawableId x:dstx y:dsty width:w height:h with:aGCId |
|
1606 |
||
1607 |
"draw a bitimage which has depth id, width iw and height ih into |
|
1608 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
|
1609 |
It has to be checked elsewhere, that server can do it with the given |
|
1610 |
depth; also it is assumed, that the colormap is setup correctly" |
|
1611 |
||
1612 |
^ self subclassResponsibility |
|
1613 |
! |
|
1614 |
||
1615 |
fillArcX:x y:y w:width h:height from:startAngle angle:angle |
|
1616 |
in:aDrawableId with:aGCId |
|
1617 |
"fill an arc" |
|
1618 |
||
1619 |
^ self subclassResponsibility |
|
1620 |
! |
|
1621 |
||
1622 |
fillPolygon:aPolygon in:aDrawableId with:aGCId |
|
1623 |
"fill a polygon" |
|
1624 |
||
1625 |
^ self subclassResponsibility |
|
1626 |
! |
|
1627 |
||
1628 |
fillRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
|
1629 |
"fill a rectangle" |
|
1630 |
||
1631 |
^ self subclassResponsibility |
|
1632 |
! ! |
|
1633 |
||
1634 |
!DeviceWorkstation methodsFor:'enumerating'! |
|
1635 |
||
1636 |
allViewsDo:aBlock |
|
1637 |
"evaluate the argument, aBlock for all of my known views" |
|
1638 |
||
1639 |
"/ idToViewMapping notNil ifTrue:[ |
|
1640 |
"/ idToViewMapping keysAndValuesDo:[:id :aView | |
|
1641 |
"/ aView notNil ifTrue:[ |
|
1642 |
"/ aBlock value:aView |
|
1643 |
"/ ] |
|
1644 |
"/ ] |
|
1645 |
||
1646 |
||
1647 |
knownViews notNil ifTrue:[ |
|
1648 |
knownViews do:[:aView | |
|
1649 |
aView notNil ifTrue:[ |
|
1650 |
aBlock value:aView |
|
1651 |
] |
|
1652 |
] |
|
1653 |
] |
|
1654 |
||
1655 |
" |
|
1656 |
View defaultStyle:#iris. |
|
1657 |
Display allViewsDo:[:v | v initStyle. v redraw] |
|
1658 |
" |
|
1659 |
" |
|
1660 |
View defaultStyle:#next. |
|
1661 |
Display allViewsDo:[:v | v initStyle. v redraw] |
|
1662 |
" |
|
1663 |
" |
|
1664 |
View defaultStyle:#normal. |
|
1665 |
Display allViewsDo:[:v | v initStyle. v redraw] |
|
1666 |
" |
|
1667 |
! ! |
|
1668 |
||
1669 |
!DeviceWorkstation methodsFor:'event forwarding'! |
|
1670 |
||
1671 |
buttonMotion:button x:x y:y view:aView |
|
1672 |
"forward a button-motion for some view" |
|
1673 |
||
1674 |
|sensor| |
|
1675 |
||
1676 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1677 |
sensor buttonMotion:button x:x y:y view:aView |
|
1678 |
] ifFalse:[ |
|
1679 |
" |
|
1680 |
if there is no sensor ... |
|
1681 |
" |
|
1682 |
WindowEvent |
|
1683 |
sendEvent:#buttonMotion:x:y: |
|
1684 |
arguments:(Array with:button with:x with:y) |
|
1685 |
view:aView |
|
1686 |
] |
|
1687 |
! |
|
1688 |
||
1689 |
buttonMultiPress:button x:x y:y view:aView |
|
1690 |
"forward a button-multi-press event for some view" |
|
1691 |
||
1692 |
|sensor| |
|
1693 |
||
1694 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1695 |
sensor buttonMultiPress:button x:x y:y view:aView |
|
1696 |
] ifFalse:[ |
|
1697 |
" |
|
1698 |
if there is no sensor ... |
|
1699 |
" |
|
1700 |
WindowEvent |
|
1701 |
sendEvent:#buttonMultiPress:x:y: |
|
1702 |
arguments:(Array with:button with:x with:y) |
|
1703 |
view:aView |
|
1704 |
] |
|
1705 |
! |
|
1706 |
||
1707 |
buttonPress:button x:x y:y view:aView |
|
1708 |
"forward a button-press event for some view" |
|
1709 |
||
1710 |
|sensor| |
|
1711 |
||
1712 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1713 |
sensor buttonPress:button x:x y:y view:aView |
|
1714 |
] ifFalse:[ |
|
1715 |
" |
|
1716 |
if there is no sensor ... |
|
1717 |
" |
|
1718 |
WindowEvent |
|
1719 |
sendEvent:#buttonPress:x:y: |
|
1720 |
arguments:(Array with:button with:x with:y) |
|
1721 |
view:aView |
|
1722 |
] |
|
1723 |
! |
|
1724 |
||
1725 |
buttonRelease:button x:x y:y view:aView |
|
1726 |
"forward a button-release event for some view" |
|
1727 |
||
1728 |
|sensor| |
|
1729 |
||
1730 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1731 |
sensor buttonRelease:button x:x y:y view:aView |
|
1732 |
] ifFalse:[ |
|
1733 |
" |
|
1734 |
if there is no sensor ... |
|
1735 |
" |
|
1736 |
WindowEvent |
|
1737 |
sendEvent:#buttonRelease:x:y: |
|
1738 |
arguments:(Array with:button with:x with:y) |
|
1739 |
view:aView |
|
1740 |
] |
|
1741 |
! |
|
1742 |
||
1743 |
buttonShiftPress:button x:x y:y view:aView |
|
1744 |
"forward a button-shift-press event for some view" |
|
1745 |
||
1746 |
|sensor| |
|
1747 |
||
1748 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1749 |
sensor buttonShiftPress:button x:x y:y view:aView |
|
1750 |
] ifFalse:[ |
|
1751 |
" |
|
1752 |
if there is no sensor ... |
|
1753 |
" |
|
1754 |
WindowEvent |
|
1755 |
sendEvent:#buttonShiftPress:x:y: |
|
1756 |
arguments:(Array with:button with:x with:y) |
|
1757 |
view:aView |
|
1758 |
] |
|
1759 |
! |
|
1760 |
||
1761 |
configureX:x y:y width:w height:h view:aView |
|
1762 |
"forward a configure for some view" |
|
1763 |
||
1764 |
|sensor| |
|
1765 |
||
1766 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1767 |
sensor configureX:x y:y width:w height:h view:aView |
|
1768 |
] ifFalse:[ |
|
1769 |
" |
|
1770 |
if there is no sensor ... |
|
1771 |
" |
|
1772 |
aView configureX:x y:y width:w height:h |
|
1773 |
] |
|
1774 |
! |
|
1775 |
||
1776 |
coveredBy:otherView view:aView |
|
1777 |
"forward a covered for some view" |
|
1778 |
||
1779 |
|sensor| |
|
1780 |
||
1781 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1782 |
sensor coveredBy:otherView view:aView |
|
1783 |
] ifFalse:[ |
|
1784 |
" |
|
1785 |
if there is no sensor ... |
|
1786 |
" |
|
1787 |
aView coveredBy:otherView |
|
1788 |
] |
|
1789 |
! |
|
1790 |
||
1791 |
destroyedView:aView |
|
1792 |
"forward a destroyed event for some view" |
|
1793 |
||
1794 |
|sensor| |
|
1795 |
||
1796 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1797 |
sensor destroyedView:aView |
|
1798 |
] ifFalse:[ |
|
1799 |
" |
|
1800 |
if there is no sensor ... |
|
1801 |
" |
|
1802 |
aView destroyed |
|
1803 |
] |
|
1804 |
! |
|
1805 |
||
1806 |
exposeX:x y:y width:w height:h view:aView |
|
1807 |
"forward an expose for some view" |
|
1808 |
||
1809 |
|sensor| |
|
1810 |
||
1811 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1812 |
sensor exposeX:x y:y width:w height:h view:aView |
|
1813 |
] ifFalse:[ |
|
1814 |
" |
|
1815 |
if there is no sensor ... |
|
1816 |
" |
|
1817 |
WindowEvent |
|
1818 |
sendEvent:#exposeX:y:width:height: |
|
1819 |
arguments:(Array with:x with:y with:w with:h) |
|
1820 |
view:aView |
|
1821 |
] |
|
1822 |
! |
|
1823 |
||
1824 |
focusInView:aView |
|
1825 |
"forward a focusIn event for some view" |
|
1826 |
||
1827 |
|sensor| |
|
1828 |
||
1829 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1830 |
sensor focusInView:aView |
|
1831 |
] ifFalse:[ |
|
1832 |
" |
|
1833 |
if there is no sensor ... |
|
1834 |
" |
|
1835 |
WindowEvent |
|
1836 |
sendEvent:#focusIn |
|
1837 |
arguments:nil |
|
1838 |
view:aView |
|
1839 |
] |
|
1840 |
! |
|
1841 |
||
1842 |
focusOutView:aView |
|
1843 |
"forward a focusOut event for some view" |
|
1844 |
||
1845 |
|sensor| |
|
1846 |
||
1847 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1848 |
sensor focusOutView:aView |
|
1849 |
] ifFalse:[ |
|
1850 |
" |
|
1851 |
if there is no sensor ... |
|
1852 |
" |
|
1853 |
WindowEvent |
|
1854 |
sendEvent:#focusOut |
|
1855 |
arguments:nil |
|
1856 |
view:aView |
|
1857 |
] |
|
1858 |
! |
|
1859 |
||
1860 |
graphicExposeX:x y:y width:w height:h view:aView |
|
1861 |
"forward a graphic expose for some view" |
|
1862 |
||
1863 |
|sensor| |
|
1864 |
||
1865 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1866 |
sensor graphicExposeX:x y:y width:w height:h view:aView |
|
1867 |
] ifFalse:[ |
|
1868 |
" |
|
1869 |
if there is no sensor ... |
|
1870 |
" |
|
1871 |
WindowEvent |
|
1872 |
sendEvent:#graphicExposeX:y:width:height: |
|
1873 |
arguments:(Array with:x with:y with:w with:h) |
|
1874 |
view:aView |
|
1875 |
] |
|
1876 |
! |
|
1877 |
||
1878 |
keyPress:untranslatedKey x:x y:y view:aView |
|
1879 |
"forward a key-press event for some view" |
|
1880 |
||
1881 |
|xlatedKey sensor| |
|
1882 |
||
1883 |
self modifierKeyProcessing:untranslatedKey down:true. |
|
1884 |
||
1885 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1886 |
sensor keyPress:untranslatedKey x:x y:y view:aView |
|
1887 |
] ifFalse:[ |
|
1888 |
" |
|
1889 |
if there is no sensor ... |
|
1890 |
" |
|
1891 |
xlatedKey := self translateKey:untranslatedKey. |
|
1892 |
xlatedKey notNil ifTrue:[ |
|
1893 |
WindowEvent |
|
1894 |
sendEvent:#keyPress:x:y: |
|
1895 |
arguments:(Array with:xlatedKey with:x with:y) |
|
1896 |
view:aView |
|
1897 |
] |
|
1898 |
] |
|
1899 |
! |
|
1900 |
||
1901 |
keyRelease:untranslatedKey x:x y:y view:aView |
|
1902 |
"forward a key-release event for some view" |
|
1903 |
||
1904 |
|xlatedKey sensor| |
|
1905 |
||
1906 |
self modifierKeyProcessing:untranslatedKey down:false. |
|
1907 |
||
1908 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1909 |
sensor keyRelease:untranslatedKey x:x y:y view:aView |
|
1910 |
] ifFalse:[ |
|
1911 |
" |
|
1912 |
if there is no sensor ... |
|
1913 |
" |
|
1914 |
xlatedKey := self translateKey:untranslatedKey. |
|
1915 |
xlatedKey notNil ifTrue:[ |
|
1916 |
WindowEvent |
|
1917 |
sendEvent:#keyRelease:x:y: |
|
1918 |
arguments:(Array with:xlatedKey with:x with:y) |
|
1919 |
view:aView |
|
1920 |
] |
|
1921 |
] |
|
1922 |
! |
|
1923 |
||
1924 |
mappedView:aView |
|
1925 |
"forward a mapped event for some view" |
|
1926 |
||
1927 |
|sensor| |
|
1928 |
||
1929 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1930 |
sensor mappedView:aView |
|
1931 |
] ifFalse:[ |
|
1932 |
" |
|
1933 |
if there is no sensor ... |
|
1934 |
" |
|
1935 |
aView mapped |
|
1936 |
] |
|
1937 |
! |
|
1938 |
||
1939 |
noExposeView:aView |
|
1940 |
"forward a noExpose event for some view" |
|
1941 |
||
1942 |
|sensor| |
|
1943 |
||
1944 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1945 |
sensor noExposeView:aView |
|
1946 |
] ifFalse:[ |
|
1947 |
" |
|
1948 |
if there is no sensor ... |
|
1949 |
" |
|
1950 |
aView noExpose |
|
1951 |
] |
|
1952 |
! |
|
1953 |
||
1954 |
pointerEnter:buttonState x:x y:y view:aView |
|
1955 |
"forward a pointer enter for some view" |
|
1956 |
||
1957 |
|sensor| |
|
1958 |
||
1959 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1960 |
sensor pointerEnter:buttonState x:x y:y view:aView |
|
1961 |
] ifFalse:[ |
|
1962 |
" |
|
1963 |
if there is no sensor ... |
|
1964 |
" |
|
1965 |
WindowEvent |
|
1966 |
sendEvent:#pointerEnter:x:y: |
|
1967 |
arguments:(Array with:buttonState with:x with:y) |
|
1968 |
view:aView |
|
1969 |
] |
|
1970 |
! |
|
1971 |
||
1972 |
pointerLeave:buttonState view:aView |
|
1973 |
"forward a pointer leave for some view" |
|
1974 |
||
1975 |
|sensor| |
|
1976 |
||
1977 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1978 |
sensor pointerLeave:buttonState view:aView |
|
1979 |
] ifFalse:[ |
|
1980 |
" |
|
1981 |
if there is no sensor ... |
|
1982 |
" |
|
1983 |
WindowEvent |
|
1984 |
sendEvent:#pointerLeave: |
|
1985 |
arguments:(Array with:buttonState) |
|
1986 |
view:aView |
|
1987 |
] |
|
1988 |
! |
|
1989 |
||
1990 |
saveAndTerminateView:aView |
|
1991 |
"forward a saveAndTerminate event for some view" |
|
1992 |
||
1993 |
|sensor| |
|
1994 |
||
1995 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1996 |
sensor saveAndTerminateView:aView |
|
1997 |
] ifFalse:[ |
|
1998 |
" |
|
1999 |
if there is no sensor ... |
|
2000 |
" |
|
2001 |
aView saveAndTerminate |
|
2002 |
] |
|
2003 |
! |
|
2004 |
||
2005 |
terminateView:aView |
|
2006 |
"forward a terminate event for some view" |
|
2007 |
||
2008 |
|sensor| |
|
2009 |
||
2010 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2011 |
sensor terminateView:aView |
|
2012 |
] ifFalse:[ |
|
2013 |
" |
|
2014 |
if there is no sensor ... |
|
2015 |
" |
|
2016 |
aView terminate |
|
2017 |
] |
|
2018 |
! |
|
2019 |
||
2020 |
unmappedView:aView |
|
2021 |
"forward an unmapped event for some view" |
|
2022 |
||
2023 |
|sensor| |
|
2024 |
||
2025 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2026 |
sensor unmappedView:aView |
|
2027 |
] ifFalse:[ |
|
2028 |
" |
|
2029 |
if there is no sensor ... |
|
2030 |
" |
|
2031 |
aView unmapped |
|
2032 |
] |
|
2033 |
! ! |
|
2034 |
||
2035 |
!DeviceWorkstation methodsFor:'event handling'! |
|
2036 |
||
2037 |
checkForEndOfDispatch |
|
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
2038 |
"return true, if there are still any views of interest - |
293 | 2039 |
if not, stop dispatch. This ends the dispatcher process when the |
2040 |
last view is closed on that device." |
|
2041 |
||
2042 |
knownViews notNil ifTrue:[ |
|
2043 |
(knownViews findFirst:[:slot | slot notNil]) == 0 ifTrue:[ |
|
2044 |
"/ my last view was closed |
|
2045 |
dispatching := false |
|
2046 |
] |
|
2047 |
] |
|
2048 |
||
2049 |
"Modified: 19.9.1995 / 11:31:54 / claus" |
|
2050 |
! |
|
2051 |
||
2052 |
dispatchEvent |
|
2053 |
"get and process the next pending event - for any view" |
|
2054 |
||
2055 |
self dispatchEventFor:nil withMask:nil |
|
2056 |
! |
|
2057 |
||
2058 |
dispatchEventFor:aViewIdOrNil withMask:eventMask |
|
2059 |
"central event handling method: |
|
2060 |
get next event and send an appropriate message to the views sensor, |
|
2061 |
or to the view directly (if the view has none). |
|
2062 |
If the argument aViewIdOrNil is nil, events for any view are processed, |
|
2063 |
otherwise only events for the view with given id are processed |
|
2064 |
(in this case, nothing is done if no events are pending); |
|
2065 |
if the argument aMask is nonNil, only events for this eventMask are |
|
2066 |
handled. The mask is a device dependent event mask." |
|
2067 |
||
2068 |
^ self subclassResponsibility |
|
2069 |
! |
|
2070 |
||
2071 |
dispatchModalWhile:aBlock |
|
2072 |
"get and process next event for any view as long as the |
|
2073 |
argument-block evaluates to true. |
|
2074 |
This is a modal loop, not switching to other processes, |
|
2075 |
effectively polling the device in a (nice) busy loop. |
|
2076 |
This should only be (and is only) used for emergency cases. |
|
2077 |
(such as a graphical debugger, debugging the event-dispatcher itself)" |
|
2078 |
||
2079 |
|myFd| |
|
2080 |
||
2081 |
" |
|
2082 |
if this display has a fileDescriptor to wait on, |
|
2083 |
it is used; otherwise we poll (with a delay to not lock up |
|
2084 |
the workstation) |
|
2085 |
" |
|
2086 |
myFd := self displayFileDescriptor. |
|
2087 |
[aBlock value] whileTrue:[ |
|
2088 |
self eventPending ifFalse:[ |
|
2089 |
myFd isNil ifTrue:[ |
|
2090 |
OperatingSystem millisecondDelay:50 |
|
2091 |
] ifFalse:[ |
|
2092 |
OperatingSystem selectOn:myFd withTimeOut:50. |
|
2093 |
]. |
|
2094 |
Processor evaluateTimeouts. |
|
2095 |
]. |
|
2096 |
self eventPending ifTrue:[ |
|
2097 |
self dispatchEvent |
|
2098 |
]. |
|
2099 |
] |
|
2100 |
! |
|
2101 |
||
2102 |
dispatchPendingEvents |
|
2103 |
"go dispatch events as long as there is one." |
|
2104 |
||
2105 |
[self eventPending] whileTrue:[ |
|
2106 |
self dispatchEventFor:nil withMask:nil |
|
2107 |
] |
|
2108 |
! |
|
2109 |
||
2110 |
disposeButtonEventsFor:aViewIdOrNil |
|
2111 |
"dispose (i.e. forget) all pending button events on this display" |
|
2112 |
||
2113 |
|mask| |
|
2114 |
||
2115 |
mask := self eventMaskFor:#buttonPress. |
|
2116 |
mask := mask bitOr:(self eventMaskFor:#buttonRelease). |
|
2117 |
mask := mask bitOr:(self eventMaskFor:#buttonMotion). |
|
2118 |
self disposeEventsWithMask:mask for:aViewIdOrNil |
|
2119 |
! |
|
2120 |
||
2121 |
disposeEvents |
|
2122 |
"dispose (i.e. forget) all events pending on this display" |
|
2123 |
||
2124 |
[self eventPending] whileTrue:[ |
|
2125 |
self getEventFor:nil withMask:nil |
|
2126 |
]. |
|
2127 |
! |
|
2128 |
||
2129 |
disposeEventsWithMask:aMask for:aWindowId |
|
2130 |
"dispose (throw away) specific events" |
|
2131 |
||
2132 |
^ self subclassResponsibility |
|
2133 |
! |
|
2134 |
||
2135 |
eventMaskFor:anEventSymbol |
|
2136 |
^ self subclassResponsibility |
|
2137 |
! |
|
2138 |
||
310 | 2139 |
eventQueued |
2140 |
"return true, if any event is pending in some internal queue. |
|
2141 |
The fallBack here returns true if events are pending on the display connection; |
|
2142 |
only devices which use internal queues (i.e. Xlib) need to redefine this." |
|
2143 |
||
2144 |
^ self eventPending |
|
2145 |
! |
|
2146 |
||
293 | 2147 |
eventPending |
2148 |
"return true, if any event is pending" |
|
2149 |
||
2150 |
^ self subclassResponsibility |
|
2151 |
! |
|
2152 |
||
2153 |
eventPending:anEventSymbol for:aWindowId |
|
2154 |
"return true, if a specific event is pending for a specific window. |
|
2155 |
This expects device independent event symbols (such as #buttonPress, |
|
2156 |
#buttonRelease etc.) as first argument." |
|
2157 |
||
2158 |
^ self subclassResponsibility |
|
2159 |
! |
|
2160 |
||
2161 |
eventPendingWithoutSync |
|
2162 |
"return true, if any event is pending" |
|
2163 |
||
2164 |
^ self subclassResponsibility |
|
2165 |
! |
|
2166 |
||
2167 |
eventsPending:anEventMask for:aWindowId |
|
2168 |
"return true, if any of the masked events is pending |
|
2169 |
for a specific window. |
|
2170 |
This expects a device dependent event mask as first argument." |
|
2171 |
||
2172 |
^ self subclassResponsibility |
|
2173 |
! |
|
2174 |
||
2175 |
setEventMask:aMask in:aWindowId |
|
310 | 2176 |
"arrange that only events from aMask are reported to a view. |
2177 |
Highly device specific, to be defined in concrete subclasses" |
|
2178 |
||
293 | 2179 |
^ self subclassResponsibility |
2180 |
! |
|
2181 |
||
2182 |
startDispatch |
|
2183 |
"create the display dispatch process." |
|
2184 |
||
2185 |
|inputSema fd p nm| |
|
2186 |
||
2187 |
" |
|
2188 |
only allow one dispatcher process per display |
|
2189 |
" |
|
2190 |
dispatching ifTrue:[^ self]. |
|
2191 |
dispatching := true. |
|
2192 |
||
2193 |
AllScreens isNil ifTrue:[ |
|
2194 |
AllScreens := Set new:1 |
|
2195 |
]. |
|
2196 |
AllScreens add:self. |
|
2197 |
||
2198 |
" |
|
2199 |
The code below (still) handles the situation where ST/X was built |
|
2200 |
without lightweight process support. Since there are many other places |
|
2201 |
in the system whic depend on lightweight processes to function, this |
|
2202 |
may be a stupid thing to do ... expect it to vanish sooner or later. |
|
2203 |
" |
|
2204 |
||
2205 |
fd := self displayFileDescriptor. |
|
2206 |
||
2207 |
ProcessorScheduler isPureEventDriven ifTrue:[ |
|
2208 |
" |
|
2209 |
no threads built in; |
|
2210 |
handle all events by having processor call a block when something |
|
2211 |
arrives on my filedescriptor. Dispatch the event in that block. |
|
2212 |
" |
|
2213 |
Processor enableIOAction:[ |
|
2214 |
dispatching ifTrue:[ |
|
2215 |
[self eventPending] whileTrue:[ |
|
2216 |
self dispatchPendingEvents. |
|
2217 |
self checkForEndOfDispatch. |
|
2218 |
]. |
|
2219 |
dispatching ifFalse:[ |
|
2220 |
Processor disableFd:fd. |
|
2221 |
AllScreens remove:self. |
|
2222 |
] |
|
2223 |
] |
|
2224 |
] |
|
2225 |
onInput:fd |
|
2226 |
||
2227 |
] ifFalse:[ |
|
2228 |
" |
|
2229 |
handle stuff as a process - sitting on a semaphore. |
|
2230 |
Tell Processor to trigger this semaphore when something arrives |
|
2231 |
on my filedescriptor. Since a select alone is not enough to |
|
2232 |
know if events are pending (Xlib reads out event-queue while |
|
2233 |
doing output), we also have to install a poll-check block. |
|
2234 |
" |
|
2235 |
inputSema := Semaphore new. |
|
2236 |
p := [ |
|
2237 |
[dispatching] whileTrue:[ |
|
2238 |
AbortSignal handle:[:ex | |
|
2239 |
ex return |
|
2240 |
] do:[ |
|
2241 |
self eventPending ifFalse:[ |
|
2242 |
Processor activeProcess setStateTo:#ioWait if:#active. |
|
2243 |
inputSema wait. |
|
2244 |
]. |
|
2245 |
||
2246 |
self dispatchPendingEvents. |
|
2247 |
self checkForEndOfDispatch. |
|
2248 |
] |
|
2249 |
]. |
|
2250 |
Processor disableSemaphore:inputSema. |
|
2251 |
inputSema := nil. |
|
2252 |
AllScreens remove:self. |
|
2253 |
dispatchProcess := nil |
|
2254 |
] forkAt:(Processor userInterruptPriority). |
|
2255 |
" |
|
2256 |
give the process a nice name (for the processMonitor) |
|
2257 |
" |
|
2258 |
(nm := self displayName) notNil ifTrue:[ |
|
2259 |
nm := 'event dispatcher (' , nm , ')'. |
|
2260 |
] ifFalse:[ |
|
2261 |
nm := 'event dispatcher'. |
|
2262 |
]. |
|
2263 |
p name:nm. |
|
310 | 2264 |
Processor signal:inputSema onInput:fd orCheck:[self eventQueued]. |
293 | 2265 |
dispatchProcess := p. |
2266 |
] |
|
310 | 2267 |
|
2268 |
"Modified: 12.12.1995 / 20:52:57 / stefan" |
|
293 | 2269 |
! ! |
2270 |
||
2271 |
!DeviceWorkstation methodsFor:'font stuff'! |
|
2272 |
||
2273 |
ascentOf:aFontId |
|
2274 |
"return the number of pixels above the base line of a font" |
|
2275 |
||
2276 |
^ self subclassResponsibility |
|
2277 |
! |
|
2278 |
||
2279 |
descentOf:aFontId |
|
2280 |
"return the number of pixels below the base line of a font" |
|
2281 |
||
2282 |
^ self subclassResponsibility |
|
2283 |
! |
|
2284 |
||
2285 |
facesInFamily:aFamilyName |
|
2286 |
"return a set of all available font faces in aFamily on this display" |
|
2287 |
||
2288 |
|allFonts faces "family face"| |
|
2289 |
||
2290 |
allFonts := self listOfAvailableFonts. |
|
2291 |
allFonts isNil ifTrue:[^ nil]. |
|
2292 |
||
2293 |
faces := Set new. |
|
2294 |
allFonts do:[:fntDescr | |
|
2295 |
aFamilyName = fntDescr family ifTrue:[ |
|
2296 |
faces add:(fntDescr face) |
|
2297 |
] |
|
2298 |
]. |
|
2299 |
^ faces asSortedCollection |
|
2300 |
||
2301 |
" |
|
2302 |
Display facesInFamily:'times' |
|
2303 |
Display facesInFamily:'fixed' |
|
2304 |
" |
|
2305 |
! |
|
2306 |
||
2307 |
fontFamilies |
|
2308 |
"return a set of all available font families on this display" |
|
2309 |
||
2310 |
|allFonts families family| |
|
2311 |
||
2312 |
allFonts := self listOfAvailableFonts. |
|
2313 |
allFonts isNil ifTrue:[^ nil]. |
|
2314 |
families := Set new. |
|
2315 |
allFonts do:[:fntDescr | |
|
2316 |
family := fntDescr family. |
|
2317 |
family notNil ifTrue:[ |
|
2318 |
families add:family |
|
2319 |
] |
|
2320 |
]. |
|
2321 |
^ families asSortedCollection |
|
2322 |
||
2323 |
" |
|
2324 |
Display fontFamilies |
|
2325 |
" |
|
2326 |
! |
|
2327 |
||
2328 |
getDefaultFont |
|
2329 |
"return a default font id |
|
2330 |
- used when class Font cannot find anything usable" |
|
2331 |
||
2332 |
^ self subclassResponsibility |
|
2333 |
! |
|
2334 |
||
2335 |
getFontWithFamily:familyString |
|
2336 |
face:faceString |
|
2337 |
style:styleString |
|
2338 |
size:sizeArg |
|
2339 |
encoding:encodingSym |
|
2340 |
||
2341 |
"try to get the specified font, return id. |
|
2342 |
If not available, try next smaller font. |
|
2343 |
If no font fits, return nil" |
|
2344 |
||
2345 |
^ self subclassResponsibility |
|
2346 |
! |
|
2347 |
||
2348 |
listOfAvailableFonts |
|
2349 |
"return a list containing all fonts on this display. |
|
2350 |
The returned list is an array of 4-element arrays, each |
|
2351 |
containing family, face, style, size and encoding." |
|
2352 |
||
2353 |
self subclassResponsibility |
|
2354 |
! |
|
2355 |
||
2356 |
maxWidthOfFont:aFontId |
|
2357 |
"return the width in pixels of the widest character a specific font" |
|
2358 |
||
2359 |
^ self subclassResponsibility |
|
2360 |
! |
|
2361 |
||
2362 |
minWidthOfFont:aFontId |
|
2363 |
"return the width in pixels of the smallest character a specific font" |
|
2364 |
||
2365 |
^ self subclassResponsibility |
|
2366 |
! |
|
2367 |
||
2368 |
releaseFont:aFontId |
|
2369 |
"free a font" |
|
2370 |
||
2371 |
^ self subclassResponsibility |
|
2372 |
! |
|
2373 |
||
2374 |
sizesInFamily:aFamilyName face:aFaceName style:aStyleName |
|
2375 |
"return a set of all available font sizes in aFamily/aFace/aStyle |
|
2376 |
on this display" |
|
2377 |
||
2378 |
|allFonts sizes "family face style size"| |
|
2379 |
||
2380 |
allFonts := self listOfAvailableFonts. |
|
2381 |
allFonts isNil ifTrue:[^ nil]. |
|
2382 |
||
2383 |
sizes := Set new. |
|
2384 |
allFonts do:[:fntDescr | |
|
2385 |
"/ family := fntDescr at:1. |
|
2386 |
"/ (family = aFamilyName) ifTrue:[ |
|
2387 |
"/ face := fntDescr at:2. |
|
2388 |
"/ (face = aFaceName) ifTrue:[ |
|
2389 |
"/ style := fntDescr at:3. |
|
2390 |
"/ (style = aStyleName) ifTrue:[ |
|
2391 |
"/ size := fntDescr at:4. |
|
2392 |
"/ sizes add:size |
|
2393 |
"/ ] |
|
2394 |
"/ ] |
|
2395 |
"/ ] |
|
2396 |
(aFamilyName = fntDescr family) ifTrue:[ |
|
2397 |
(aFaceName = fntDescr face) ifTrue:[ |
|
2398 |
(aStyleName = fntDescr style) ifTrue:[ |
|
2399 |
sizes add:fntDescr size |
|
2400 |
] |
|
2401 |
] |
|
2402 |
] |
|
2403 |
]. |
|
2404 |
^ sizes |
|
2405 |
||
2406 |
" |
|
2407 |
Display sizesInFamily:'times' face:'medium' style:'italic' |
|
2408 |
" |
|
2409 |
! |
|
2410 |
||
2411 |
stylesInFamily:aFamilyName face:aFaceName |
|
2412 |
"return a set of all available font styles in aFamily/aFace on this display" |
|
2413 |
||
2414 |
|allFonts styles "family face style"| |
|
2415 |
||
2416 |
allFonts := self listOfAvailableFonts. |
|
2417 |
allFonts isNil ifTrue:[^ nil]. |
|
2418 |
||
2419 |
styles := Set new. |
|
2420 |
allFonts do:[:fntDescr | |
|
2421 |
(aFamilyName = fntDescr family) ifTrue:[ |
|
2422 |
(aFaceName = fntDescr face) ifTrue:[ |
|
2423 |
styles add:fntDescr style |
|
2424 |
] |
|
2425 |
] |
|
2426 |
]. |
|
2427 |
^ styles asSortedCollection |
|
2428 |
||
2429 |
" |
|
2430 |
Display stylesInFamily:'times' face:'medium' |
|
2431 |
Display stylesInFamily:'times' face:'bold' |
|
2432 |
" |
|
2433 |
! |
|
2434 |
||
2435 |
widthOf:aString from:index1 to:index2 inFont:aFontId |
|
2436 |
"return the width in pixels of a substring in a specific font" |
|
2437 |
||
2438 |
^ self subclassResponsibility |
|
2439 |
! |
|
2440 |
||
2441 |
widthOf:aString inFont:aFontId |
|
2442 |
"return the width in pixels of a string in a specific font" |
|
2443 |
||
2444 |
^ self subclassResponsibility |
|
2445 |
! ! |
|
2446 |
||
2447 |
!DeviceWorkstation methodsFor:'grabbing '! |
|
2448 |
||
2449 |
activeKeyboardGrab |
|
2450 |
"return the view, which currently has the keyboard grabbed, |
|
2451 |
or nil, if there is none" |
|
2452 |
||
2453 |
^ activeKeyboardGrab |
|
2454 |
! |
|
2455 |
||
2456 |
activePointerGrab |
|
2457 |
"return the view, which currently has the pointer grabbed, |
|
2458 |
or nil, if there is none" |
|
2459 |
||
2460 |
^ activePointerGrab |
|
2461 |
! |
|
2462 |
||
2463 |
grabKeyboardIn:aWindowId |
|
2464 |
"grab the keyboard - all keyboard input will be sent to the view |
|
2465 |
with id aWindowId" |
|
2466 |
||
2467 |
^ self subclassResponsibility |
|
2468 |
! |
|
2469 |
||
2470 |
grabKeyboardInView:aView |
|
2471 |
"grab the keyboard - all keyboard input will be sent to aView. |
|
2472 |
Return true if ok, false if it failed for some reason." |
|
2473 |
||
2474 |
activeKeyboardGrab notNil ifTrue:[ |
|
2475 |
self ungrabKeyboard. |
|
2476 |
activeKeyboardGrab := nil |
|
2477 |
]. |
|
2478 |
(self grabKeyboardIn:(aView id)) ifTrue:[ |
|
2479 |
activeKeyboardGrab := aView. |
|
2480 |
^ true |
|
2481 |
]. |
|
2482 |
^ false |
|
2483 |
! |
|
2484 |
||
2485 |
grabPointerIn:aWindowId |
|
2486 |
"grap the pointer; all pointer events will be reported to the view |
|
2487 |
with id aWindowId. Return true if ok, false if it failed for some reason." |
|
2488 |
||
2489 |
^ self grabPointerIn:aWindowId withCursor:nil pointerMode:#async keyboardMode:#sync confineTo:nil |
|
2490 |
! |
|
2491 |
||
2492 |
grabPointerIn:aWindowId withCursor:cursorId pointerMode:pMode keyboardMode:kMode confineTo:confineId |
|
2493 |
"grap the pointer - all pointer events will be reported to aWindowId. The cursor will be set to cursorId |
|
2494 |
for the duration of the grab. For pMode/kMode, see X documentation. The pointer is restricted to |
|
2495 |
confineId - if non-nil." |
|
2496 |
||
2497 |
^ self subclassResponsibility |
|
2498 |
! |
|
2499 |
||
2500 |
grabPointerInView:aView |
|
2501 |
"grap the pointer; all pointer events will be reported to |
|
2502 |
aView. Return true if ok, false if it failed for some reason." |
|
2503 |
||
2504 |
activePointerGrab notNil ifTrue:[ |
|
2505 |
self ungrabPointer. |
|
2506 |
activePointerGrab := nil |
|
2507 |
]. |
|
2508 |
(self grabPointerIn:(aView id)) ifTrue:[ |
|
2509 |
activePointerGrab := aView. |
|
2510 |
^ true |
|
2511 |
]. |
|
2512 |
^ false |
|
2513 |
! |
|
2514 |
||
2515 |
setActivePointerGrab:aView |
|
2516 |
"DO NOT USE. private kludge - will vanish" |
|
2517 |
||
2518 |
activePointerGrab := aView |
|
2519 |
! |
|
2520 |
||
2521 |
ungrabKeyboard |
|
2522 |
"release the keyboard" |
|
2523 |
||
2524 |
^ self subclassResponsibility |
|
2525 |
! |
|
2526 |
||
2527 |
ungrabPointer |
|
2528 |
"release the pointer" |
|
2529 |
||
2530 |
^ self subclassResponsibility |
|
2531 |
! ! |
|
2532 |
||
2533 |
!DeviceWorkstation methodsFor:'graphic context stuff'! |
|
2534 |
||
2535 |
noClipIn:aGCId |
|
2536 |
"disable clipping rectangle" |
|
2537 |
||
2538 |
^ self subclassResponsibility |
|
2539 |
! |
|
2540 |
||
2541 |
setBackground:bgColorIndex in:aGCId |
|
2542 |
"set background color to be drawn with" |
|
2543 |
||
2544 |
^ self subclassResponsibility |
|
2545 |
! |
|
2546 |
||
2547 |
setBitmapMask:aBitmapId in:aGCId |
|
2548 |
"set or clear the drawing mask - a bitmap mask using current fg/bg" |
|
2549 |
||
2550 |
^ self subclassResponsibility |
|
2551 |
! |
|
2552 |
||
2553 |
setClipByChildren:aBool in:aGCId |
|
2554 |
"enable/disable drawing into child views" |
|
2555 |
||
2556 |
^ self subclassResponsibility |
|
2557 |
! |
|
2558 |
||
2559 |
setClipX:clipX y:clipY width:clipWidth height:clipHeight in:aGCId |
|
2560 |
"clip to a rectangle" |
|
2561 |
||
2562 |
^ self subclassResponsibility |
|
2563 |
! |
|
2564 |
||
2565 |
setFont:aFontId in:aGCId |
|
2566 |
"set font to be drawn in" |
|
2567 |
||
2568 |
^ self subclassResponsibility |
|
2569 |
! |
|
2570 |
||
2571 |
setForeground:fgColorIndex background:bgColorIndex in:aGCId |
|
2572 |
"set foreground and background colors to be drawn with" |
|
2573 |
||
2574 |
^ self subclassResponsibility |
|
2575 |
! |
|
2576 |
||
2577 |
setForeground:fgColor background:bgColor mask:aBitmapId in:aGCId |
|
2578 |
"set foreground and background colors to be drawn with using mask or |
|
2579 |
solid (if aBitmapId is nil)" |
|
2580 |
||
2581 |
^ self subclassResponsibility |
|
2582 |
! |
|
2583 |
||
2584 |
setForeground:fgColor background:bgColor mask:aBitmapId lineWidth:lw in:aGCId |
|
2585 |
"set foreground and background colors to be drawn with using mask or |
|
2586 |
solid (if aBitmapId is nil); also set lineWidth" |
|
2587 |
||
2588 |
^ self subclassResponsibility |
|
2589 |
! |
|
2590 |
||
2591 |
setForeground:fgColorIndex in:aGCId |
|
2592 |
"set foreground color to be drawn with" |
|
2593 |
||
2594 |
^ self subclassResponsibility |
|
2595 |
! |
|
2596 |
||
2597 |
setFunction:aFunctionSymbol in:aGCId |
|
2598 |
"set alu function to be drawn with" |
|
2599 |
||
2600 |
^ self subclassResponsibility |
|
2601 |
! |
|
2602 |
||
2603 |
setGraphicsExposures:aBoolean in:aGCId |
|
2604 |
"set or clear the graphics exposures flag" |
|
2605 |
||
2606 |
^ self subclassResponsibility |
|
2607 |
! |
|
2608 |
||
2609 |
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId |
|
2610 |
"set line attributes" |
|
2611 |
||
2612 |
^ self subclassResponsibility |
|
2613 |
! |
|
2614 |
||
2615 |
setMaskOriginX:orgX y:orgY in:aGCid |
|
2616 |
"set the mask origin" |
|
2617 |
||
2618 |
^ self subclassResponsibility |
|
2619 |
! |
|
2620 |
||
2621 |
setPixmapMask:aPixmapId in:aGCId |
|
2622 |
"set or clear the drawing mask - a pixmap mask providing full color" |
|
2623 |
||
2624 |
^ self subclassResponsibility |
|
2625 |
! ! |
|
2626 |
||
0 | 2627 |
!DeviceWorkstation methodsFor:'initialize / release'! |
2628 |
||
293 | 2629 |
close |
2630 |
"close down connection to Display - usually never done" |
|
2631 |
||
2632 |
^ self subclassResponsibility |
|
2633 |
! |
|
2634 |
||
0 | 2635 |
initialize |
2636 |
"initialize the receiver for a connection to the default display" |
|
2637 |
||
2638 |
^ self initializeFor:nil |
|
2639 |
! |
|
2640 |
||
2641 |
initializeFor:aDisplayOrNilForAny |
|
2642 |
"initialize the receiver for a connection to a display. If the |
|
2643 |
argument is non-nil, it should specify which workstation should be |
|
2644 |
connected to (in a device specific manner). For X displays, this is |
|
2645 |
to be the display-string i.e. hostname:displayNr. |
|
2646 |
If the argument is nil, connect to the default display." |
|
2647 |
||
71 | 2648 |
^ self subclassResponsibility |
0 | 2649 |
! |
2650 |
||
293 | 2651 |
initializeKeyboardMap |
2652 |
"keystrokes from the server are translated via the keyboard map. |
|
2653 |
Untranslated keystrokes arrive either as characters, or symbols |
|
2654 |
(which are the keySyms as symbol). The mapping table which is |
|
2655 |
setup here, is used in sendKeyPress:... later. |
|
2656 |
" |
|
2657 |
||
2658 |
keyboardMap isNil ifTrue:[ |
|
2659 |
keyboardMap := KeyboardMap new. |
|
2660 |
]. |
|
2661 |
||
2662 |
" |
|
2663 |
no more setup here - moved everything out into 'display.rc' file |
|
2664 |
" |
|
0 | 2665 |
! |
2666 |
||
276
160e1410c537
entry to invalidate display connection during early initialization
Claus Gittinger <cg@exept.de>
parents:
261
diff
changeset
|
2667 |
invalidateConnection |
160e1410c537
entry to invalidate display connection during early initialization
Claus Gittinger <cg@exept.de>
parents:
261
diff
changeset
|
2668 |
displayId := nil |
160e1410c537
entry to invalidate display connection during early initialization
Claus Gittinger <cg@exept.de>
parents:
261
diff
changeset
|
2669 |
! |
160e1410c537
entry to invalidate display connection during early initialization
Claus Gittinger <cg@exept.de>
parents:
261
diff
changeset
|
2670 |
|
0 | 2671 |
reinitialize |
2672 |
"reinit after snapin" |
|
2673 |
||
46 | 2674 |
|prevKnownViews prevMapping| |
0 | 2675 |
|
2676 |
displayId := nil. |
|
51 | 2677 |
dispatching := false. |
151 | 2678 |
dispatchProcess := nil. |
46 | 2679 |
|
2680 |
"/ prevMapping := idToViewMapping. |
|
2681 |
"/ idToViewMapping := nil. |
|
2682 |
||
0 | 2683 |
prevKnownViews := knownViews. |
2684 |
knownViews := nil. |
|
2685 |
knownIds := nil. |
|
2686 |
||
2687 |
self initializeFor:nil. |
|
2688 |
||
43 | 2689 |
" |
2690 |
first, all Forms must be recreated |
|
51 | 2691 |
(since they may be needed for view recreation as |
43 | 2692 |
background or icons) |
2693 |
" |
|
0 | 2694 |
Form reinitializeAllOn:self. |
2695 |
||
46 | 2696 |
"/ prevMapping notNil ifTrue:[ |
0 | 2697 |
prevKnownViews notNil ifTrue:[ |
71 | 2698 |
" |
2699 |
first round: flush all device specific stuff |
|
2700 |
" |
|
51 | 2701 |
"/ prevMapping keysAndValuesDo:[:anId :aView | |
71 | 2702 |
prevKnownViews do:[:aView | |
2703 |
aView notNil ifTrue:[ |
|
2704 |
aView prepareForReinit |
|
2705 |
] |
|
2706 |
]. |
|
2707 |
||
2708 |
" |
|
2709 |
2nd round: all views should reinstall themself |
|
2710 |
on the new display |
|
2711 |
" |
|
51 | 2712 |
"/ prevMapping keysAndValuesDo:[:anId :aView | |
71 | 2713 |
prevKnownViews do:[:aView | |
2714 |
aView notNil ifTrue:[ |
|
2715 |
"have to re-create the view" |
|
2716 |
aView reinitialize |
|
2717 |
] |
|
2718 |
]. |
|
2719 |
" |
|
2720 |
3rd round: all views get a chance to handle |
|
2721 |
changed environment (colors, font sizes etc) |
|
2722 |
" |
|
51 | 2723 |
"/ prevMapping keysAndValuesDo:[:anId :aView | |
71 | 2724 |
prevKnownViews do:[:aView | |
2725 |
aView notNil ifTrue:[ |
|
2726 |
aView reAdjustGeometry |
|
2727 |
] |
|
2728 |
] |
|
0 | 2729 |
]. |
8 | 2730 |
dispatching := false. |
133 | 2731 |
! ! |
2732 |
||
71 | 2733 |
!DeviceWorkstation methodsFor:'interactive queries'! |
2734 |
||
293 | 2735 |
originFromUser:extent |
2736 |
"let user specify a rectangles origin on the screen, return the rectangle. |
|
2737 |
Start with initialRectangle. |
|
2738 |
Can be used for dragging operations." |
|
2739 |
||
2740 |
|curs origin root rect| |
|
2741 |
||
2742 |
curs := Cursor origin on:self. |
|
2743 |
||
2744 |
" |
|
2745 |
just in case; wait for button to be down ... |
|
2746 |
" |
|
2747 |
[self leftButtonPressed] whileFalse:[Processor yield]. |
|
2748 |
||
2749 |
root := self rootView. |
|
2750 |
||
2751 |
" |
|
2752 |
grab and wait for leftButton being pressed |
|
2753 |
" |
|
2754 |
origin := self pointerPosition. |
|
2755 |
||
2756 |
root noClipByChildren. |
|
2757 |
root foreground:Color black background:Color white. |
|
2758 |
||
2759 |
root xoring:[ |
|
2760 |
|left right top bottom newOrigin newCorner p| |
|
2761 |
||
2762 |
rect := origin extent:extent. |
|
2763 |
root displayRectangle:rect. |
|
2764 |
||
2765 |
self |
|
2766 |
grabPointerIn:root id |
|
2767 |
withCursor:curs id |
|
2768 |
pointerMode:#async |
|
2769 |
keyboardMode:#sync |
|
2770 |
confineTo:nil. |
|
2771 |
||
2772 |
[self leftButtonPressed] whileTrue:[ |
|
2773 |
newOrigin := self pointerPosition. |
|
2774 |
||
2775 |
(newOrigin ~= origin) ifTrue:[ |
|
2776 |
root displayRectangle:rect. |
|
2777 |
||
2778 |
self |
|
2779 |
grabPointerIn:root id |
|
2780 |
withCursor:curs id |
|
2781 |
pointerMode:#async |
|
2782 |
keyboardMode:#sync |
|
2783 |
confineTo:nil. |
|
2784 |
||
2785 |
rect := newOrigin extent:extent. |
|
2786 |
root displayRectangle:rect. |
|
2787 |
self disposeButtonEventsFor:nil. |
|
2788 |
self flush. |
|
2789 |
origin := newOrigin. |
|
2790 |
] ifFalse:[ |
|
2791 |
Processor yield |
|
2792 |
] |
|
2793 |
]. |
|
2794 |
root displayRectangle:rect. |
|
2795 |
self ungrabPointer. |
|
2796 |
]. |
|
2797 |
||
2798 |
self ungrabPointer. |
|
2799 |
||
2800 |
"flush all events pending on my display" |
|
2801 |
||
2802 |
root clipByChildren. |
|
2803 |
||
2804 |
self flush. |
|
2805 |
self disposeButtonEventsFor:nil. |
|
2806 |
||
2807 |
^ rect |
|
2808 |
||
2809 |
" |
|
2810 |
Display originFromUser:200@200 |
|
2811 |
" |
|
2812 |
! |
|
2813 |
||
2814 |
pointFromUser |
|
2815 |
"let user specify a point on the screen (by pressing the left button)" |
|
2816 |
||
2817 |
^ self pointFromUserShowing:(Cursor crossHair). |
|
2818 |
||
2819 |
" |
|
2820 |
Display pointFromUser |
|
2821 |
" |
|
2822 |
! |
|
2823 |
||
81 | 2824 |
pointFromUserShowing:aCursor |
2825 |
"let user specify a point on the screen (by pressing leftButton). |
|
2826 |
Show aCursor while waiting." |
|
2827 |
||
2828 |
|p| |
|
23 | 2829 |
|
2830 |
self ungrabPointer. |
|
151 | 2831 |
self grabPointerIn:(self rootWindowId) withCursor:((aCursor on:self) id) |
75 | 2832 |
pointerMode:#async keyboardMode:#sync confineTo:nil. |
134 | 2833 |
activePointerGrab := rootView. |
81 | 2834 |
|
157 | 2835 |
" |
2836 |
wait for leftButton ... |
|
2837 |
" |
|
81 | 2838 |
[self leftButtonPressed] whileFalse:[Processor yield]. |
157 | 2839 |
|
23 | 2840 |
p := self pointerPosition. |
2841 |
||
2842 |
self ungrabPointer. |
|
2843 |
||
2844 |
"flush all events pending on myself" |
|
81 | 2845 |
self disposeButtonEventsFor:nil. |
23 | 2846 |
^ p |
2847 |
||
71 | 2848 |
" |
81 | 2849 |
Display pointFromUserShowing:(Cursor stop) |
133 | 2850 |
Display pointFromUserShowing:(Cursor crossHair) |
157 | 2851 |
Display pointFromUserShowing:(Cursor origin) |
81 | 2852 |
Display pointFromUser |
2853 |
" |
|
2854 |
! |
|
2855 |
||
293 | 2856 |
rectangleFromUser |
2857 |
"let user specify a rectangle in the screen, return the rectangle" |
|
2858 |
||
2859 |
|origin| |
|
81 | 2860 |
|
2861 |
" |
|
293 | 2862 |
get origin |
2863 |
" |
|
2864 |
origin := self pointFromUserShowing:(Cursor origin on:self). |
|
2865 |
||
2866 |
" |
|
2867 |
get corner |
|
2868 |
" |
|
2869 |
^ self rectangleFromUser:(origin corner:origin). |
|
2870 |
||
2871 |
" |
|
2872 |
Display rectangleFromUser |
|
71 | 2873 |
" |
23 | 2874 |
! |
2875 |
||
81 | 2876 |
rectangleFromUser:initialRectangle |
2877 |
"let user specify a rectangle on the screen, return the rectangle. |
|
133 | 2878 |
Start with initialRectangle. |
2879 |
A helper for rectangleFromUser; can also be used for resizing operations." |
|
81 | 2880 |
|
157 | 2881 |
|curs1 origin corner root rect| |
2882 |
||
2883 |
curs1 := Cursor corner on:self. |
|
23 | 2884 |
|
134 | 2885 |
root := self rootView. |
81 | 2886 |
|
2887 |
" |
|
2888 |
grab and wait for leftButton being pressed |
|
2889 |
" |
|
2890 |
origin := initialRectangle origin. |
|
2891 |
||
2892 |
root noClipByChildren. |
|
2893 |
root foreground:Color black background:Color white. |
|
2894 |
||
2895 |
root xoring:[ |
|
2896 |
|left right top bottom newOrigin newCorner p curs| |
|
2897 |
||
71 | 2898 |
corner := origin. |
81 | 2899 |
rect := origin corner:corner. |
2900 |
root displayRectangle:rect. |
|
2901 |
||
157 | 2902 |
self |
2903 |
grabPointerIn:root id |
|
2904 |
withCursor:curs1 id |
|
2905 |
pointerMode:#async |
|
2906 |
keyboardMode:#sync |
|
2907 |
confineTo:nil. |
|
2908 |
||
2909 |
" |
|
2910 |
just in case; wait for button to be down ... |
|
2911 |
" |
|
2912 |
[self leftButtonPressed] whileFalse:[Processor yield]. |
|
81 | 2913 |
|
71 | 2914 |
[self leftButtonPressed] whileTrue:[ |
81 | 2915 |
left := initialRectangle origin x. |
2916 |
top := initialRectangle origin y. |
|
2917 |
right := initialRectangle corner x. |
|
2918 |
bottom := initialRectangle corner y. |
|
2919 |
||
2920 |
p := self pointerPosition. |
|
2921 |
p x < initialRectangle left ifTrue:[ |
|
2922 |
p y < initialRectangle top ifTrue:[ |
|
2923 |
curs := Cursor topLeft. |
|
2924 |
left := p x. |
|
2925 |
top := p y. |
|
2926 |
] ifFalse:[ |
|
2927 |
curs := Cursor bottomLeft. |
|
2928 |
left := p x. |
|
2929 |
bottom := p y |
|
2930 |
] |
|
2931 |
] ifFalse:[ |
|
2932 |
p y < initialRectangle top ifTrue:[ |
|
2933 |
curs := Cursor topRight. |
|
2934 |
right := p x. |
|
2935 |
top := p y |
|
2936 |
] ifFalse:[ |
|
2937 |
curs := Cursor bottomRight. |
|
2938 |
right := p x. |
|
2939 |
bottom := p y |
|
2940 |
] |
|
2941 |
]. |
|
2942 |
||
2943 |
newOrigin := left @ top. |
|
2944 |
newCorner := right @ bottom. |
|
2945 |
||
2946 |
((newOrigin ~= origin) or:[newCorner ~= corner]) ifTrue:[ |
|
2947 |
root displayRectangle:rect. |
|
2948 |
||
2949 |
self grabPointerIn:root id withCursor:curs id |
|
71 | 2950 |
pointerMode:#async keyboardMode:#sync confineTo:nil. |
2951 |
||
81 | 2952 |
origin := newOrigin. |
71 | 2953 |
corner := newCorner. |
81 | 2954 |
rect := origin corner:corner. |
2955 |
root displayRectangle:rect. |
|
2956 |
self disposeButtonEventsFor:nil. |
|
151 | 2957 |
self flush. |
157 | 2958 |
] ifFalse:[ |
2959 |
Processor yield |
|
71 | 2960 |
] |
2961 |
]. |
|
81 | 2962 |
root displayRectangle:rect. |
2963 |
self ungrabPointer. |
|
23 | 2964 |
]. |
2965 |
||
2966 |
self ungrabPointer. |
|
2967 |
||
2968 |
"flush all events pending on my display" |
|
81 | 2969 |
|
2970 |
root clipByChildren. |
|
2971 |
||
151 | 2972 |
self flush. |
81 | 2973 |
self disposeButtonEventsFor:nil. |
2974 |
||
2975 |
^ rect |
|
157 | 2976 |
|
2977 |
" |
|
2978 |
Display rectangleFromUser:(100@100 corner:300@300) |
|
2979 |
" |
|
81 | 2980 |
! |
2981 |
||
293 | 2982 |
topviewFromUser |
2983 |
"let user specify a view on the screen; if the selected view is |
|
2984 |
not an ST/X view, nil is returned. |
|
2985 |
Otherwise, the topview is returned." |
|
2986 |
||
2987 |
|v| |
|
2988 |
||
2989 |
v := self viewFromUser. |
|
2990 |
v notNil ifTrue:[ |
|
2991 |
v := v topView |
|
2992 |
]. |
|
2993 |
^ v |
|
157 | 2994 |
|
2995 |
" |
|
293 | 2996 |
Display topviewFromUser |
157 | 2997 |
" |
190 | 2998 |
! |
2999 |
||
23 | 3000 |
viewFromUser |
3001 |
"let user specify a view on the screen; if the selected view is |
|
133 | 3002 |
not an ST/X view, nil is returned. |
3003 |
This returns the view being clicked in, which is not always a topView. |
|
3004 |
(send topView to the returned view or use topviewFromUser, |
|
3005 |
to get the topview)" |
|
23 | 3006 |
|
71 | 3007 |
^ self viewFromPoint:(self pointFromUser) |
3008 |
||
3009 |
" |
|
133 | 3010 |
Display viewFromUser |
71 | 3011 |
" |
3012 |
" |
|
3013 |
|v| |
|
3014 |
v := Display viewFromUser. |
|
3015 |
v notNil ifTrue:[v topView] ifFalse:[nil] |
|
3016 |
" |
|
3017 |
! |
|
3018 |
||
293 | 3019 |
viewIdFromUser |
3020 |
"let user specify a view on the screen, return its window id. |
|
3021 |
This works even for non smalltalk views. |
|
3022 |
This returns the id of the view being clicked in, |
|
3023 |
which is not always a topView." |
|
3024 |
||
3025 |
^ self viewIdFromPoint:(self pointFromUser) |
|
71 | 3026 |
|
3027 |
" |
|
293 | 3028 |
Display viewIdFromUser |
71 | 3029 |
" |
293 | 3030 |
|
3031 |
"Created: 18.9.1995 / 23:07:20 / claus" |
|
0 | 3032 |
! ! |
3033 |
||
3034 |
!DeviceWorkstation methodsFor:'keyboard mapping'! |
|
3035 |
||
293 | 3036 |
modifierKeyProcessing:key down:pressed |
3037 |
(altModifiers notNil and:[altModifiers includes:key]) ifTrue:[ |
|
3038 |
altDown := pressed |
|
3039 |
] ifFalse:[ |
|
3040 |
(metaModifiers notNil and:[metaModifiers includes:key]) ifTrue:[ |
|
3041 |
metaDown := pressed |
|
3042 |
] ifFalse:[ |
|
3043 |
(shiftModifiers notNil and:[shiftModifiers includes:key]) ifTrue:[ |
|
3044 |
shiftDown := pressed |
|
3045 |
] ifFalse:[ |
|
3046 |
(ctrlModifiers notNil and:[ctrlModifiers includes:key]) ifTrue:[ |
|
3047 |
ctrlDown := pressed |
|
3048 |
] |
|
3049 |
] |
|
3050 |
] |
|
3051 |
] |
|
3052 |
! |
|
3053 |
||
51 | 3054 |
translateKey:untranslatedKey |
3055 |
"Return the key translated via the translation table. |
|
89 | 3056 |
Your application program should never depend on the values returned |
3057 |
by this method, but instead use symbolic keys (such as #FindNext). |
|
3058 |
Doing so allows easier reconfiguration by changing the translation map |
|
3059 |
in the 'smalltalk.rc' or 'display.rc' startup files. |
|
51 | 3060 |
|
3061 |
First, the modifier is prepended, making character X into |
|
3062 |
AltX, CtrlX or CmdX (on most systems, no separate Cmd (or Meta) |
|
3063 |
key exists; on those we always get AltX). |
|
89 | 3064 |
If multiple modifiers are active, the symbol becoms the concatenation |
3065 |
as in AltCtrlq (for control-alt-q). Shift will affect the last component, |
|
3066 |
thus the above with shift becoms: AltCtrlQ instead. |
|
3067 |
Some keyboards offer both Alt and Meta keys - on those, the first has a |
|
3068 |
prefix of Alt, the second has Cmd as prefix. Keyboards with only an Alt |
|
3069 |
key will will create prefix codes of Cmd for that. |
|
3070 |
For symbolic keys (i.e.Tab, Backspace etc, shift is ignored). |
|
51 | 3071 |
Then the result is used as a key into the translation keyboardMap |
3072 |
to get the final return value." |
|
3073 |
||
145 | 3074 |
|xlatedKey dontTranslate| |
51 | 3075 |
|
3076 |
xlatedKey := untranslatedKey. |
|
145 | 3077 |
|
3078 |
"should this come from a configurable variable ?" |
|
3079 |
dontTranslate := (untranslatedKey == #Control |
|
3080 |
or:[untranslatedKey == #'Control_L' |
|
3081 |
or:[untranslatedKey == #'Control_R' |
|
3082 |
or:[untranslatedKey == #'Shift' |
|
3083 |
or:[untranslatedKey == #'Shift_L' |
|
3084 |
or:[untranslatedKey == #'Shift_R' |
|
3085 |
or:[untranslatedKey == #'Alt' |
|
3086 |
or:[untranslatedKey == #'Alt_L' |
|
3087 |
or:[untranslatedKey == #'Alt_R' |
|
3088 |
or:[untranslatedKey == #'Meta' |
|
3089 |
or:[untranslatedKey == #'Meta_L' |
|
3090 |
or:[untranslatedKey == #'Meta_R' |
|
3091 |
or:[untranslatedKey == #'Cmd' |
|
3092 |
or:[untranslatedKey == #'Cmd_L' |
|
3093 |
or:[untranslatedKey == #'Cmd_R']]]]]]]]]]]]]]). |
|
3094 |
||
259 | 3095 |
dontTranslate ifFalse:[ |
261
fe0966138972
oops - expose areas were way too large in non-process view event processing
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
3096 |
ctrlDown ifTrue:[ |
259 | 3097 |
xlatedKey := 'Ctrl' , xlatedKey asString |
261
fe0966138972
oops - expose areas were way too large in non-process view event processing
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
3098 |
]. |
fe0966138972
oops - expose areas were way too large in non-process view event processing
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
3099 |
metaDown ifTrue:[ |
259 | 3100 |
xlatedKey := 'Cmd' , xlatedKey asString |
261
fe0966138972
oops - expose areas were way too large in non-process view event processing
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
3101 |
]. |
fe0966138972
oops - expose areas were way too large in non-process view event processing
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
3102 |
altDown ifTrue:[ |
259 | 3103 |
xlatedKey := 'Alt' , xlatedKey asString |
3104 |
]. |
|
261
fe0966138972
oops - expose areas were way too large in non-process view event processing
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
3105 |
xlatedKey isCharacter ifFalse:[ |
259 | 3106 |
xlatedKey := xlatedKey asSymbol |
261
fe0966138972
oops - expose areas were way too large in non-process view event processing
Claus Gittinger <cg@exept.de>
parents:
259
diff
changeset
|
3107 |
]. |
51 | 3108 |
]. |
3109 |
||
3110 |
xlatedKey := keyboardMap valueFor:xlatedKey. |
|
259 | 3111 |
xlatedKey isCharacter ifFalse:[ |
3112 |
xlatedKey := xlatedKey asSymbol |
|
3113 |
]. |
|
51 | 3114 |
^ xlatedKey |
293 | 3115 |
! ! |
3116 |
||
3117 |
!DeviceWorkstation methodsFor:'misc'! |
|
3118 |
||
3119 |
altDown |
|
3120 |
"return true, if the alt-key is currently pressed." |
|
3121 |
||
3122 |
^ altDown |
|
249
f33de7016dba
modifierKeyProcessing (altDown/metaDown ...) now done in smalltalk
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
3123 |
! |
f33de7016dba
modifierKeyProcessing (altDown/metaDown ...) now done in smalltalk
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
3124 |
|
293 | 3125 |
beep |
3126 |
"output an audible beep or bell" |
|
3127 |
||
3128 |
Stdout nextPut:(Character bell) |
|
3129 |
! |
|
3130 |
||
3131 |
buffered |
|
3132 |
"buffer drawing - do not send it immediately to the display. |
|
3133 |
This is the default; see comment in #unBuffered." |
|
3134 |
||
3135 |
^ self |
|
3136 |
! |
|
3137 |
||
3138 |
compressMotionEvents:aBoolean |
|
3139 |
"turn on/off motion event compression |
|
3140 |
- compressions makes always sense except in free-hand drawing of curves" |
|
3141 |
||
3142 |
motionEventCompression := aBoolean |
|
115 | 3143 |
! |
3144 |
||
293 | 3145 |
ctrlDown |
3146 |
"return true, if the control-key is currently pressed." |
|
3147 |
||
3148 |
^ ctrlDown |
|
115 | 3149 |
! |
3150 |
||
293 | 3151 |
flush |
3152 |
"send all buffered drawing to the display. |
|
3153 |
This used to be called #synchronizeOutput, but has been renamed |
|
3154 |
for ST-80 compatibility." |
|
3155 |
||
3156 |
^ self |
|
3157 |
! |
|
3158 |
||
3159 |
hasColors:aBoolean |
|
3160 |
"set the hasColors flag - needed since some servers dont tell the |
|
3161 |
truth if a monochrome monitor is connected to a color server. |
|
3162 |
Clearing the hasColors flag in the rc file will force use of grey |
|
3163 |
colors (which might make a difference, since some colors are hard to |
|
3164 |
distinguish on a greyscale monitor)." |
|
3165 |
||
3166 |
hasColors := aBoolean |
|
115 | 3167 |
! |
3168 |
||
293 | 3169 |
hasGreyscales:aBoolean |
3170 |
"set the hasGreyscales flag - can be used to simulate b&w behavior |
|
3171 |
on greyScale and color monitors. |
|
3172 |
(You may want to check if your application looks ok if displayed on |
|
3173 |
a b&w monitor - even if you have a color display. To do so, clear |
|
3174 |
the hasGreyscales flag from your .rc file)" |
|
3175 |
||
3176 |
hasGreyscales := aBoolean |
|
115 | 3177 |
! |
3178 |
||
293 | 3179 |
ignoreBackingStore:aBoolean |
3180 |
"if the argument is true, the views backingStore setting will be ignored, and |
|
3181 |
no backing store used - this can be used on servers where backing store is |
|
3182 |
very slow (from rc-file)" |
|
3183 |
||
3184 |
^ self |
|
3185 |
! |
|
3186 |
||
3187 |
isSlow:aBoolean |
|
3188 |
"set/clear the slow flag. |
|
3189 |
The slow-flag has no semantic meaning by itself; |
|
3190 |
however, it can be set via the display.rc file and tested at various |
|
3191 |
other places to turn off some bells&whistles which might slow down |
|
3192 |
the drawing. For example, shadows under popUps are suppressed if isSlow |
|
3193 |
is set." |
|
3194 |
||
3195 |
isSlow := aBoolean |
|
115 | 3196 |
! |
3197 |
||
293 | 3198 |
metaDown |
3199 |
"return true, if the meta-key (alt-key on systems without meta) |
|
3200 |
is currently pressed." |
|
3201 |
||
3202 |
^ metaDown |
|
3203 |
! |
|
3204 |
||
3205 |
ringBell |
|
3206 |
"alias for beep; for ST-80 compatibility" |
|
3207 |
||
3208 |
self beep |
|
115 | 3209 |
! |
3210 |
||
293 | 3211 |
setInputFocusTo:aWindowId |
3212 |
^ self subclassResponsibility |
|
115 | 3213 |
! |
3214 |
||
293 | 3215 |
shiftDown |
3216 |
"return true, if the shift-key is currently pressed." |
|
3217 |
||
3218 |
^ shiftDown |
|
3219 |
! |
|
3220 |
||
3221 |
sync |
|
3222 |
"for ST-80 compatibility" |
|
3223 |
||
3224 |
self flush |
|
115 | 3225 |
! |
3226 |
||
293 | 3227 |
synchronizeOutput |
3228 |
"send all buffered drawing to the display. |
|
3229 |
OBSOLETE: please use #flush for ST-80 compatibility." |
|
3230 |
||
3231 |
self obsoleteMethodWarning:'use #flush'. |
|
3232 |
^ self flush |
|
115 | 3233 |
! |
3234 |
||
293 | 3235 |
unBuffered |
3236 |
"make all drawing be sent immediately to the display. |
|
3237 |
This may horribly slow down your drawings, but will result |
|
3238 |
in any errors to be delivered right after the bad operation |
|
3239 |
(in X only). Only useful for debugging." |
|
3240 |
||
3241 |
^ self |
|
3242 |
! ! |
|
3243 |
||
3244 |
!DeviceWorkstation methodsFor:'pointer queries'! |
|
3245 |
||
3246 |
buttonStates |
|
3247 |
"return an integer representing the state of the pointer buttons; |
|
3248 |
a one-bit represents a pressed button. The bit positions are device specific |
|
3249 |
and to be returned by the *ButtonStateMask methods. |
|
3250 |
Must be redefined by concrete subclasses." |
|
3251 |
||
3252 |
^ self subclassResponsibility |
|
115 | 3253 |
! |
3254 |
||
293 | 3255 |
leftButtonPressed |
3256 |
"return true, if the left button is currently pressed" |
|
3257 |
||
3258 |
^ (self buttonStates bitAnd:self leftButtonStateMask) ~~ 0 |
|
3259 |
! |
|
3260 |
||
3261 |
leftButtonStateMask |
|
3262 |
"return an integer for masking out the left button from a |
|
3263 |
buttonStates value. This is very device specific and to |
|
3264 |
be redefined by concrete subclasses." |
|
3265 |
||
3266 |
^ self subclassResponsibility |
|
115 | 3267 |
! |
3268 |
||
293 | 3269 |
middleButtonPressed |
3270 |
"return true, if the middle button is currently pressed" |
|
3271 |
||
3272 |
^ (self buttonStates bitAnd:self middleButtonStateMask) ~~ 0 |
|
115 | 3273 |
! |
3274 |
||
293 | 3275 |
middleButtonStateMask |
3276 |
"return an integer for masking out the middle button from a |
|
3277 |
buttonStates value. This is very device specific and to |
|
3278 |
be redefined by concrete subclasses." |
|
3279 |
||
3280 |
^ self subclassResponsibility |
|
115 | 3281 |
! |
3282 |
||
293 | 3283 |
pointerPosition |
3284 |
"return the current pointer position in root-window coordinates. |
|
3285 |
Must be redefined by concrete subclasses." |
|
3286 |
||
3287 |
^ self subclassResponsibility |
|
115 | 3288 |
! |
3289 |
||
293 | 3290 |
rightButtonPressed |
3291 |
"return true, if the right button is currently pressed" |
|
3292 |
||
3293 |
^ (self buttonStates bitAnd:self rightButtonStateMask) ~~ 0 |
|
115 | 3294 |
! |
3295 |
||
293 | 3296 |
rightButtonStateMask |
3297 |
"return an integer for masking out the right button from a |
|
3298 |
buttonStates value. This is very device specific and to |
|
3299 |
be redefined by concrete subclasses." |
|
3300 |
||
3301 |
^ self subclassResponsibility |
|
115 | 3302 |
! |
3303 |
||
293 | 3304 |
rootPositionOfLastEvent |
3305 |
"return the position in root-window coordinates |
|
3306 |
of the last button, key or pointer event. |
|
3307 |
Must be redefined by concrete subclasses." |
|
3308 |
||
3309 |
^ self subclassResponsibility |
|
3310 |
! ! |
|
3311 |
||
3312 |
!DeviceWorkstation methodsFor:'printing & storing'! |
|
3313 |
||
3314 |
printOn:aStream |
|
3315 |
"for your convenience, add the name of the display connection |
|
3316 |
or 'default' to the printed representation." |
|
3317 |
||
3318 |
|name| |
|
3319 |
||
3320 |
super printOn:aStream. |
|
3321 |
||
3322 |
aStream nextPut:$(. |
|
3323 |
(name := self displayName) isNil ifTrue:[ |
|
3324 |
name := 'defaultDisplay' |
|
3325 |
]. |
|
3326 |
aStream nextPutAll:name. |
|
3327 |
aStream nextPut:$) |
|
3328 |
! ! |
|
3329 |
||
3330 |
!DeviceWorkstation methodsFor:'retrieving pixels'! |
|
3331 |
||
3332 |
getPixelX:x y:y from:aDrawableId |
|
3333 |
"return the pixel value at x/y" |
|
3334 |
||
3335 |
^ self subclassResponsibility |
|
115 | 3336 |
! ! |
3337 |
||
54 | 3338 |
!DeviceWorkstation methodsFor:'view registration'! |
0 | 3339 |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
3340 |
addKnownView:aView withId:aWindowID |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
3341 |
"add the View aView with id:aWindowID to the list of known views/id's. |
51 | 3342 |
This map is needed later (on event arrival) to get the view from |
3343 |
the views id (which is passed along with the devices event) quickly." |
|
0 | 3344 |
|
151 | 3345 |
|freeIdx newArr sz newSize| |
46 | 3346 |
|
0 | 3347 |
knownViews isNil ifTrue:[ |
118 | 3348 |
knownViews := WeakArray new:50. |
71 | 3349 |
knownIds := Array new:50. |
3350 |
freeIdx := 1. |
|
54 | 3351 |
] ifFalse:[ |
118 | 3352 |
freeIdx := knownViews identityIndexOf:nil. |
3353 |
||
3354 |
"/ 1 to:knownViews size do:[:idx | |
|
151 | 3355 |
"/ |id| |
118 | 3356 |
"/ (knownViews at:idx) isNil ifTrue:[ |
3357 |
"/ freeIdx := idx |
|
3358 |
"/ id := knownIds at:idx. |
|
3359 |
"/ id notNil ifTrue:[ |
|
3360 |
"/ "/ this one is no longer valid ... |
|
3361 |
"/ knownIds at:idx put:nil. |
|
3362 |
"/ ]. |
|
133 | 3363 |
"/ ] |
3364 |
"/ ]. |
|
0 | 3365 |
]. |
46 | 3366 |
|
118 | 3367 |
freeIdx == 0 ifTrue:[ |
71 | 3368 |
sz := knownViews size. |
3369 |
newSize := sz * 2. |
|
3370 |
newArr := WeakArray new:newSize. |
|
3371 |
newArr replaceFrom:1 to:sz with:knownViews. |
|
3372 |
knownViews := newArr. |
|
3373 |
||
3374 |
newArr := Array new:newSize. |
|
3375 |
newArr replaceFrom:1 to:sz with:knownIds. |
|
3376 |
knownIds := newArr. |
|
3377 |
freeIdx := sz + 1 |
|
54 | 3378 |
]. |
3379 |
knownViews at:freeIdx put:aView. |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
3380 |
knownIds at:freeIdx put:aWindowID. |
190 | 3381 |
|
3382 |
dispatching ifFalse:[ |
|
3383 |
self startDispatch |
|
3384 |
]. |
|
0 | 3385 |
! |
3386 |
||
3387 |
removeKnownView:aView |
|
51 | 3388 |
"remove aView from the list of known views/id's." |
0 | 3389 |
|
54 | 3390 |
|index| |
3391 |
||
3392 |
aView isNil ifTrue:[^ self]. |
|
3393 |
||
46 | 3394 |
"/ idToViewMapping removeValue:aView ifAbsent:[]. |
3395 |
"/ lastId := nil. |
|
3396 |
"/ lastView := nil |
|
3397 |
||
0 | 3398 |
knownViews notNil ifTrue:[ |
71 | 3399 |
index := knownViews identityIndexOf:aView. |
3400 |
index == 0 ifFalse:[ |
|
3401 |
knownViews at:index put:nil. |
|
3402 |
knownIds at:index put:nil. |
|
3403 |
lastId := nil. |
|
190 | 3404 |
lastView := nil. |
3405 |
||
3406 |
(knownViews findFirst:[:slot | slot notNil]) == 0 ifTrue:[ |
|
3407 |
"/ my last view was closed |
|
3408 |
dispatching := false |
|
3409 |
] |
|
71 | 3410 |
] |
0 | 3411 |
] |
3412 |
! |
|
3413 |
||
54 | 3414 |
update:something |
3415 |
|id| |
|
3416 |
||
118 | 3417 |
"/ no longer called for ... |
3418 |
"/ |
|
54 | 3419 |
something == knownViews ifTrue:[ |
71 | 3420 |
" |
3421 |
some view was garbage-collected; |
|
3422 |
destroy it ... |
|
3423 |
" |
|
3424 |
1 to:knownViews size do:[:idx | |
|
3425 |
(knownViews at:idx) isNil ifTrue:[ |
|
3426 |
id := knownIds at:idx. |
|
3427 |
id notNil ifTrue:[ |
|
3428 |
knownIds at:idx put:nil. |
|
3429 |
]. |
|
3430 |
] |
|
3431 |
]. |
|
54 | 3432 |
|
3433 |
] |
|
293 | 3434 |
! |
3435 |
||
3436 |
viewFromId:aWindowID |
|
3437 |
"given an Id, return the corresponding view." |
|
3438 |
||
3439 |
|index| |
|
3440 |
||
3441 |
"/ ^ idToViewMapping at:aNumber ifAbsent:[nil]. |
|
3442 |
||
3443 |
index := knownIds indexOf:aWindowID. |
|
3444 |
index == 0 ifTrue:[^ nil]. |
|
3445 |
^ knownViews at:index. |
|
0 | 3446 |
! ! |
3447 |
||
12 | 3448 |
!DeviceWorkstation methodsFor:'window stuff'! |
3449 |
||
293 | 3450 |
clearRectangleX:x y:y width:width height:height in:aWindowId |
3451 |
"clear a rectangular area of a window to its view background" |
|
3452 |
||
3453 |
^ self subclassResponsibility |
|
3454 |
! |
|
3455 |
||
3456 |
clearWindow:aWindowId |
|
3457 |
"clear a windows to its view background" |
|
3458 |
||
3459 |
^ self subclassResponsibility |
|
3460 |
! |
|
3461 |
||
3462 |
lowerWindow:aWindowId |
|
3463 |
^ self subclassResponsibility |
|
3464 |
! |
|
3465 |
||
3466 |
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos width:w height:h |
|
3467 |
^ self subclassResponsibility |
|
3468 |
! |
|
3469 |
||
3470 |
mapWindow:aWindowId |
|
3471 |
^ self subclassResponsibility |
|
3472 |
! |
|
3473 |
||
3474 |
moveResizeWindow:aWindowId x:x y:y width:w height:h |
|
3475 |
^ self subclassResponsibility |
|
3476 |
! |
|
3477 |
||
3478 |
moveWindow:aWindowId x:x y:y |
|
3479 |
^ self subclassResponsibility |
|
3480 |
! |
|
3481 |
||
3482 |
raiseWindow:aWindowId |
|
3483 |
^ self subclassResponsibility |
|
3484 |
! |
|
3485 |
||
3486 |
resizeWindow:aWindowId width:w height:h |
|
3487 |
^ self subclassResponsibility |
|
12 | 3488 |
! |
3489 |
||
3490 |
restoreCursors |
|
3491 |
"restore the cursors of all views to their current cursor" |
|
3492 |
||
46 | 3493 |
"/ idToViewMapping notNil ifTrue:[ |
51 | 3494 |
"/ idToViewMapping keysAndValuesDo:[:viewId :view | |
3495 |
"/ |curs cid| |
|
3496 |
"/ curs := view cursor. |
|
3497 |
"/ curs notNil ifTrue:[ |
|
3498 |
"/ cid := curs id. |
|
3499 |
"/ cid notNil ifTrue:[ |
|
3500 |
"/ self setCursor:cid in:viewId |
|
3501 |
"/ ] |
|
3502 |
"/ ] |
|
3503 |
"/ ]. |
|
151 | 3504 |
"/ self flush |
46 | 3505 |
"/ ] |
3506 |
||
12 | 3507 |
knownViews notNil ifTrue:[ |
71 | 3508 |
knownViews do:[:aView | |
3509 |
|c vid cid| |
|
3510 |
||
3511 |
(aView notNil and:[(vid := aView id) notNil]) ifTrue:[ |
|
3512 |
c := aView cursor. |
|
3513 |
(c notNil and:[(cid := c id) notNil]) ifTrue:[ |
|
3514 |
self setCursor:cid in:vid |
|
3515 |
] |
|
3516 |
] |
|
3517 |
]. |
|
151 | 3518 |
self flush |
12 | 3519 |
] |
3520 |
||
3521 |
"Display setCursors:(Cursor wait)" |
|
3522 |
"Display restoreCursors" |
|
3523 |
! |
|
3524 |
||
293 | 3525 |
setBackingStore:how in:aWindowId |
3526 |
"turn on/off backing-store for a window" |
|
23 | 3527 |
|
3528 |
^ self subclassResponsibility |
|
3529 |
! |
|
3530 |
||
293 | 3531 |
setCursor:aCursorId in:aWindowId |
3532 |
"set a windows visible shape" |
|
12 | 3533 |
|
3534 |
^ self subclassResponsibility |
|
3535 |
! |
|
3536 |
||
293 | 3537 |
setCursors:aCursor |
3538 |
"change the cursor of all views to aCursorId" |
|
3539 |
||
3540 |
| id | |
|
3541 |
||
3542 |
id := (aCursor on:self) id. |
|
3543 |
id notNil ifTrue:[ |
|
3544 |
"/ idToViewMapping notNil ifTrue:[ |
|
3545 |
"/ idToViewMapping keysAndValuesDo:[:viewId :view | |
|
3546 |
"/ self setCursor:id in:viewId |
|
3547 |
"/ ]. |
|
3548 |
knownViews do:[:aView | |
|
3549 |
|vid| |
|
3550 |
||
3551 |
(aView notNil and:[(vid := aView id) notNil]) ifTrue:[ |
|
3552 |
self setCursor:id in:vid |
|
3553 |
] |
|
3554 |
]. |
|
3555 |
self flush |
|
51 | 3556 |
"/ ] |
293 | 3557 |
] |
3558 |
||
3559 |
"Display setCursors:Cursor wait" |
|
3560 |
"Display restoreCursors" |
|
0 | 3561 |
! |
3562 |
||
293 | 3563 |
setIconName:aString in:aWindowId |
3564 |
"set a windows icon name" |
|
10 | 3565 |
|
0 | 3566 |
^ self subclassResponsibility |
3567 |
! |
|
3568 |
||
3569 |
setSaveUnder:yesOrNo in:aWindowId |
|
3570 |
"turn on/off save-under for a window" |
|
10 | 3571 |
|
0 | 3572 |
^ self subclassResponsibility |
3573 |
! |
|
3574 |
||
3575 |
setWindowBackground:aColorIndex in:aWindowId |
|
10 | 3576 |
"set a windows background color" |
0 | 3577 |
|
3578 |
^ self subclassResponsibility |
|
3579 |
! |
|
3580 |
||
3581 |
setWindowBackgroundPixmap:aPixmapId in:aWindowId |
|
10 | 3582 |
"set a windows background pattern to be a form" |
3583 |
||
0 | 3584 |
^ self subclassResponsibility |
3585 |
! |
|
3586 |
||
3587 |
setWindowBorderColor:aColorIndex in:aWindowId |
|
10 | 3588 |
"set a windows border color" |
3589 |
||
0 | 3590 |
^ self subclassResponsibility |
3591 |
! |
|
3592 |
||
3593 |
setWindowBorderPixmap:aPixmapId in:aWindowId |
|
10 | 3594 |
"set a windows border pattern" |
3595 |
||
0 | 3596 |
^ self subclassResponsibility |
3597 |
! |
|
3598 |
||
3599 |
setWindowBorderShape:aPixmapId in:aWindowId |
|
10 | 3600 |
"set a windows border shape" |
3601 |
||
0 | 3602 |
^ self subclassResponsibility |
3603 |
! |
|
3604 |
||
293 | 3605 |
setWindowBorderWidth:aNumber in:aWindowId |
3606 |
"set a windows border width" |
|
10 | 3607 |
|
0 | 3608 |
^ self subclassResponsibility |
3609 |
! |
|
3610 |
||
3611 |
setWindowIcon:aForm in:aWindowId |
|
10 | 3612 |
"set a windows icon" |
3613 |
||
0 | 3614 |
^ self subclassResponsibility |
3615 |
! |
|
3616 |
||
3617 |
setWindowIconWindow:aView in:aWindowId |
|
10 | 3618 |
"set a windows icon window" |
3619 |
||
0 | 3620 |
^ self subclassResponsibility |
3621 |
! |
|
3622 |
||
293 | 3623 |
setWindowName:aString in:aWindowId |
3624 |
"set a windows name" |
|
10 | 3625 |
|
0 | 3626 |
^ self subclassResponsibility |
3627 |
! |
|
3628 |
||
293 | 3629 |
setWindowShape:aPixmapId in:aWindowId |
3630 |
"set a windows visible shape" |
|
3631 |
||
0 | 3632 |
^ self subclassResponsibility |
3633 |
! |
|
3634 |
||
3635 |
unmapWindow:aWindowId |
|
3636 |
^ self subclassResponsibility |
|
3637 |
! ! |
|
3638 |
||
293 | 3639 |
!DeviceWorkstation class methodsFor:'documentation'! |
3640 |
||
3641 |
version |
|
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
3642 |
^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.58 1995-12-15 12:18:40 cg Exp $' |
0 | 3643 |
! ! |
293 | 3644 |
DeviceWorkstation initialize! |