GraphicsDevice.st
author Claus Gittinger <cg@exept.de>
Fri, 22 Jun 2001 17:04:07 +0200
changeset 3443 ab7697bff56c
parent 3222 0bb571e07c0e
child 3445 0967a57d0350
permissions -rw-r--r--
added deviceType

"
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"


"{ Package: 'stx:libview' }"

Object subclass:#GraphicsDevice
	instanceVariableNames:'displayId screen eventListeners deviceType'
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Graphics'
!

!GraphicsDevice class methodsFor:'documentation'!

copyright
"
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

!

documentation
"
    this abstract class was inserted to provide a home for ST-80 classes
    (previously, DeviceWorkstation was directly under Object).

    In ST/X, this is mostly dummy.

    [instance variables:]
      displayId       <Handle>            the device handle
      screen          any                 another some device specific id
      eventListeners  <Collection> | nil  bunch of objects interested in events.
      deviceType      <Symbol>             some arbitrary symbol, used to choose windowSpecs.

    [see also:]
	DeviceWorkstation XWorkstation

    [author:]
	Claus Gittinger
"

! !

!GraphicsDevice methodsFor:'accessing'!

addEventListener:aListener
    "add a local eventListener (with new protocol - #processEvent:)
     This one gets a chance to intercept all events for this device"

    eventListeners isNil ifTrue:[
	eventListeners := OrderedCollection new:2
    ].
    eventListeners add:aListener


!

removeEventListener:aListener
    "remove a local eventListener (with new protocol - #processEvent:)"

    eventListeners notNil ifTrue:[
	eventListeners removeIdentical:aListener ifAbsent:nil
    ].
!

deviceType
    ^ deviceType
!

deviceType:aSymbol
    deviceType := aSymbol
! !

!GraphicsDevice methodsFor:'event processing'!

notifyEventListenersAbout:anEvent
    "notify all eventHandlers about an incoming event.
     If any returns true, it is assumed to be eaten by the handler and not
     enqueued (i.e. not passed to the windowGroup process)"

    |anyListenerReturnedTrue|

    anyListenerReturnedTrue := false.

    "/ local listeners ...
    eventListeners notNil ifTrue:[
	eventListeners do:[:aListener |
	    anyListenerReturnedTrue := anyListenerReturnedTrue |
				       (aListener processEvent:anEvent)
	]
    ].

    ^ anyListenerReturnedTrue.

! !

!GraphicsDevice class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libview/GraphicsDevice.st,v 1.6 2001-06-22 15:04:07 cg Exp $'
! !