SubCanvas.st
author Claus Gittinger <cg@exept.de>
Thu, 06 Mar 1997 16:16:38 +0100
changeset 496 60a1effff295
child 501 017ec26a38c5
permissions -rw-r--r--
intitial checkin

View subclass:#SubCanvas
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Views-Basic'
!


!SubCanvas methodsFor:'accessing'!

releaseAllComponents

    "Modified: 6.3.1997 / 15:53:31 / cg"
! !

!SubCanvas methodsFor:'rebuilding'!

client:anApplicationModel
    "release existing components and generate new components from
     the applications windowSpec."

    ^ self client:anApplicationModel spec:#windowSpec

    "Created: 6.3.1997 / 15:53:23 / cg"
    "Modified: 6.3.1997 / 15:59:55 / cg"
!

client:anApplicationModel spec:aWindowSpec
    "release existing components and generate new components from
     the applications windowSpec."

    |b newBuilder|

    "/ If the application already has a builder, create a subBilder;
    "/ otherwise a new one

    ((anApplicationModel respondsTo:#builder)
      and:[(b := anApplicationModel builder) notNil]) ifTrue:[
          newBuilder := b newSubBuilder
    ] ifFalse:[
        newBuilder := UIBuilder new
    ].
    ^ self client:anApplicationModel spec:aWindowSpec builder:newBuilder

    "Created: 6.3.1997 / 15:53:25 / cg"
    "Modified: 6.3.1997 / 15:59:44 / cg"
!

client:anApplicationModel spec:aWindowSpecOrSpecSymbol builder:aBuilder
    "release existing components and generate new components from
     the given windowSpec, using the given builder."

    |window oldContainer  spec |

    anApplicationModel isNil ifTrue:[
        ^ self releaseAllComponents
    ].

    (window := aBuilder window isNil) ifTrue:[
        aBuilder setWindow:self topComponent
    ].

    aBuilder keyboardProcessor:window keyboardProcessor.

    self releaseAllComponents.

    aBuilder newComposite.

    spec := aWindowSpecOrSpecSymbol.
    spec isSymbol ifTrue:[
        spec := anApplicationModel class interfaceSpecFor:spec
    ].

    anApplicationModel buildInSubCanvas:(spec component) withBuilder:aBuilder.

    aBuilder endComposite.
    self isOpen ifTrue:[
        self bounds:(self bounds).
        self changedPreferredBounds:nil.
        self invalidate
    ].
    ^ aBuilder

    "Modified: 6.3.1997 / 16:04:58 / cg"
! !

!SubCanvas class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libview2/Attic/SubCanvas.st,v 1.1 1997-03-06 15:16:38 cg Exp $'
! !