"
COPYRIGHT (c) 1996 by 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.
"
Object subclass:#VisualComponent
instanceVariableNames:'bounds fgColor bgColor'
classVariableNames:''
poolDictionaries:''
category:'Graphics-Display Objects'
!
!VisualComponent class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1996 by 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
"
abstract superclass for all kinds of visual components.
This class and its subclasses (currently) exist mostly for
ST-80 compatibility - to provide a home for ported PD classes,
which depend on the VisualComponent hierarchy.
Notice:
this class was implemented using protocol information
from alpha testers, from reading PD programs and
from the Hopkins/Horan book.
- it may not be complete or compatible to the corresponding ST-80 class.
If you encounter any incompatibilities, please forward a note
describing the incompatibility verbal (i.e. no code) to the ST/X team.
This is still being constructed - not yet finished.
[author:]
Claus Gittinger
[see also:]
GeometricWrapper
"
! !
!VisualComponent class methodsFor:'instance creation'!
new
^ self basicNew initialize
! !
!VisualComponent methodsFor:'accessing'!
container:someContainer
"ignored here"
"Created: 9.5.1996 / 00:48:54 / cg"
!
setParentViewIn:aView
"ignored here - for now"
"Created: 9.5.1996 / 00:19:39 / cg"
! !
!VisualComponent methodsFor:'accessing - dimensions'!
bottom
"return my bottom y coordinate"
^ self bounds bottom
"Modified: 9.5.1996 / 00:13:12 / cg"
"Created: 26.5.1996 / 12:56:12 / cg"
!
bounds
"return my bounds"
^ bounds
"Created: 8.5.1996 / 23:35:19 / cg"
"Modified: 9.5.1996 / 00:12:00 / cg"
! !
!VisualComponent ignoredMethodsFor:'accessing - dimensions'!
bounds:aRectangle
"set my bounds"
bounds := aRectangle
"Created: 8.5.1996 / 23:36:07 / cg"
"Modified: 9.5.1996 / 00:13:12 / cg"
! !
!VisualComponent methodsFor:'accessing - dimensions'!
left
"return my left x coordinate"
^ self bounds left
"Created: 8.5.1996 / 23:36:07 / cg"
"Modified: 26.5.1996 / 12:56:22 / cg"
!
preferredBounds
"return my preferredBounds"
^ 0@0 extent:100@100
"Created: 8.5.1996 / 23:36:29 / cg"
"Modified: 19.7.1996 / 20:06:28 / cg"
!
preferredExtent
^ self preferredBounds extent
"Modified: 9.5.1996 / 00:13:22 / cg"
"Created: 19.7.1996 / 20:06:19 / cg"
!
right
"return my right x coordinate"
^ self bounds right
"Modified: 9.5.1996 / 00:13:12 / cg"
"Created: 26.5.1996 / 12:56:25 / cg"
!
top
"return my top y coordinate"
^ self bounds top
"Modified: 9.5.1996 / 00:13:12 / cg"
"Created: 26.5.1996 / 12:56:15 / cg"
!
viewRectangle
^ self bounds
"Created: 19.7.1996 / 17:24:58 / cg"
! !
!VisualComponent methodsFor:'accessing - look'!
backgroundColor:aColor
"set my backgroundColor"
bgColor := aColor
"Created: 8.5.1996 / 23:47:11 / cg"
"Modified: 9.5.1996 / 00:13:33 / cg"
!
foregroundColor:aColor
"set my foregroundColor"
fgColor := aColor
"Created: 8.5.1996 / 23:47:05 / cg"
"Modified: 9.5.1996 / 00:13:39 / cg"
! !
!VisualComponent methodsFor:'accessing-mvc'!
model
"return nil - generic components have no model"
^ nil
"Created: 5.6.1996 / 14:18:16 / cg"
! !
!VisualComponent methodsFor:'displaying'!
displayOn:aGC x:x y:y
|oldTranslation|
oldTranslation := aGC translation.
aGC translation:(x @ y).
self displayOn:aGC.
aGC translation:oldTranslation
"Created: 13.5.1996 / 10:18:43 / cg"
"Modified: 13.5.1996 / 11:18:24 / cg"
! !
!VisualComponent methodsFor:'event handling'!
buttonPress:button x:x y:y
"button was pressed over me - ignored here"
"Modified: 9.5.1996 / 00:14:08 / cg"
!
buttonRelease:button x:x y:y
"button was released over me - ignored here"
"Created: 8.5.1996 / 23:38:30 / cg"
"Modified: 9.5.1996 / 00:14:04 / cg"
!
containerChangedSize
"Created: 19.7.1996 / 17:32:19 / cg"
!
containerMapped
"Created: 19.7.1996 / 17:39:27 / cg"
!
containerUnmapped
"Created: 19.7.1996 / 17:44:52 / cg"
!
destroy
"Created: 19.7.1996 / 17:25:46 / cg"
!
keyPress:key x:x y:y
"key was pressed over me - ignored here"
"Created: 8.5.1996 / 23:46:03 / cg"
"Modified: 9.5.1996 / 00:14:14 / cg"
!
keyRelease:key x:x y:y
"key was released over me - ignored here"
"Created: 8.5.1996 / 23:46:07 / cg"
"Modified: 9.5.1996 / 00:14:19 / cg"
! !
!VisualComponent methodsFor:'initialization'!
initialize
fgColor := Color black.
bgColor := Color white.
"Created: 8.5.1996 / 23:49:54 / cg"
! !
!VisualComponent methodsFor:'queries'!
heightOn:aGC
"return my height, if displayed on aGC;
I assume that my height is independent of the device, and return
the bounds height"
^ self bounds height
"Modified: 13.5.1996 / 10:15:13 / cg"
!
isBorderedWrapper
^ false
"Created: 5.6.1996 / 14:11:18 / cg"
!
isLayoutWrapper
^ false
"Created: 19.7.1996 / 17:50:59 / cg"
!
isWrapper
^ false
"Created: 5.6.1996 / 01:04:40 / cg"
!
widthOn:aGC
"return my width, if displayed on aGC;
I assume that my width is independent of the device, and return
the bounds width"
^ self bounds width
"Created: 13.5.1996 / 10:14:44 / cg"
"Modified: 13.5.1996 / 10:15:17 / cg"
! !
!VisualComponent methodsFor:'testing'!
containsPoint:aPoint
"return true, if the receiver contains aPoint"
^ self bounds containsPoint:aPoint
"Created: 9.5.1996 / 00:21:44 / cg"
"Modified: 9.5.1996 / 00:22:00 / cg"
!
hasBorder
"return true, if the receiver shows a border"
^ false
"Modified: 9.5.1996 / 00:21:29 / cg"
!
intersects:aRectangle
"return true, if the receivers bounds intersects aRectangle"
^ self bounds intersects:aRectangle
"Created: 9.5.1996 / 00:21:18 / cg"
"Modified: 9.5.1996 / 00:22:04 / cg"
! !
!VisualComponent class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/libview2/Attic/VComponent.st,v 1.13 1997-01-14 17:02:37 cg Exp $'
! !