Wrapper.st
author Claus Gittinger <cg@exept.de>
Wed, 05 Jun 1996 17:28:29 +0200
changeset 292 60fbf13dfc8c
parent 283 f28c462b9d13
child 321 6421da8810e2
permissions -rw-r--r--
prepare for view-component integration

"
 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.
"



VisualPart subclass:#Wrapper
	instanceVariableNames:'component'
	classVariableNames:''
	poolDictionaries:''
	category:'Graphics-Display Objects'
!

!Wrapper 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 wrapping components

    [author:]
        Claus Gittinger
"

! !

!Wrapper class methodsFor:'instance creation'!

on:aComponent
    ^ self new component:aComponent

    "Created: 8.5.1996 / 23:20:46 / cg"
! !

!Wrapper methodsFor:'accessing'!

component
    "return the wrappers component"

    ^ component

    "Created: 8.5.1996 / 23:17:30 / cg"
    "Modified: 9.5.1996 / 00:19:58 / cg"
!

component:someComponent
    "set the wrappers component"

    component := someComponent.
    component notNil ifTrue:[
        "/ temporary kludge - images are (currently) not
        "/ inheriting from visualComponent ...
"/        (someComponent respondsTo:#container:) ifTrue:[
            someComponent container:self.
"/        ].
        bounds isNil ifTrue:[
            component bounds notNil ifTrue:[
                bounds := component bounds
            ]
        ]
    ]

    "Created: 8.5.1996 / 23:17:46 / cg"
    "Modified: 5.6.1996 / 02:31:40 / cg"
! !

!Wrapper methodsFor:'accessing - bounds'!

bounds:newBounds
    "set my bounds - forwarded to the wrapped object"

    bounds := newBounds.
    component bounds:newBounds

    "Created: 8.5.1996 / 23:18:12 / cg"
    "Modified: 5.6.1996 / 00:51:26 / cg"
!

newBounds:newBounds containingBounds:containingBounds
    self bounds:newBounds

    "Created: 26.5.1996 / 16:50:49 / cg"
!

preferredBounds
    "return my preferredBounds as the components preferredBounds"

    ^ component preferredBounds

    "Created: 8.5.1996 / 23:18:53 / cg"
    "Modified: 9.5.1996 / 00:10:32 / cg"
! !

!Wrapper methodsFor:'displaying'!

displayOn:aGC
    "display myself - forwarded to the wrapped object"

    component displayOn:aGC

    "Created: 8.5.1996 / 23:19:24 / cg"
    "Modified: 9.5.1996 / 00:10:59 / cg"
! !

!Wrapper methodsFor:'queries'!

hasBorder
    ^ false

    "Created: 26.5.1996 / 16:47:37 / cg"
!

isWrapper
    ^ true

    "Created: 5.6.1996 / 01:04:30 / cg"
! !

!Wrapper methodsFor:'testing'!

containsPoint:aPoint
    ^ component containsPoint:aPoint

    "Created: 26.5.1996 / 16:48:00 / cg"
!

intersects:aRectangle
    ^ component intersects:aRectangle

    "Created: 26.5.1996 / 16:48:52 / cg"
! !

!Wrapper methodsFor:'view protocol mimicri'!

realize
    "my container realized itself. Forward this to my component"

    component realize.

    "Created: 4.6.1996 / 21:29:27 / cg"
!

removeSubView:aView
    component := nil

    "Created: 4.6.1996 / 21:39:50 / cg"
! !

!Wrapper class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libview2/Wrapper.st,v 1.6 1996-06-05 15:26:44 cg Exp $'
! !