"
COPYRIGHT (c) 1995 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.
"
WindowBuilder subclass:#UIBuilder
instanceVariableNames:'view currentMenuSelector menuAspect spec specStack composite
lastComponent compositeView'
classVariableNames:'Verbose'
poolDictionaries:''
category:'Interface-Support-UI'
!
!UIBuilder class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1995 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
"
this class will (eventually) allow parsing windowSpecs as
created by ST-80's UIPainter, and thereby allow to run applications
built with this tool.
It was created to allow execution of PD applications which were
written using that tool (and more and more are appearing ...).
The class is not completed yet and certainly not bug free.
Also, it is not quaranteed that all winSpecs are understood.
Notice:
this class was implemented using protocol information
from alpha testers, literature and by read public domain code
- 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.
[author:]
Claus Gittinger
"
!
examples
"
examples to be added.
"
!
history
"Created: 3.3.1997 / 19:33:13 / cg"
! !
!UIBuilder class methodsFor:'initialization'!
initialize
Verbose := false "/ debugging flag
! !
!UIBuilder methodsFor:'accessing'!
menuAspect
^ menuAspect
! !
!UIBuilder methodsFor:'building'!
add:aSpec
|collectedComponents|
composite notNil ifTrue:[
(collectedComponents := composite collection) isNil ifTrue:[
composite collection:(collectedComponents := OrderedCollection new).
].
collectedComponents add:aSpec.
view := aSpec buildViewWithLayoutFor:self in:compositeView.
] ifFalse:[
spec isNil ifTrue:[
spec := FullSpec new.
].
(aSpec isMemberOf:WindowSpec) ifTrue:[
spec window:aSpec
] ifFalse:[
((aSpec isMemberOf:ComponentSpec)
or:[(aSpec isMemberOf:SpecCollection)]) ifTrue:[
spec component:aSpec.
window isNil ifTrue:[
window := windowView := View new.
].
aSpec buildViewWithLayoutFor:self in:window.
"/ builder window displayBox
composite := aSpec.
compositeView := window.
] ifFalse:[
spec component isNil ifTrue:[
spec component:SpecCollection new.
spec component collection:OrderedCollection new.
composite := spec component.
window isNil ifTrue:[
window := windowView := View new.
].
compositeView := window.
].
spec component collection add:aSpec.
view := aSpec buildViewWithLayoutFor:self in:compositeView.
].
]
].
lastComponent := view.
^ view
"Modified: 3.3.1997 / 22:03:02 / cg"
!
buildFromSpec:aSpecOrSpecArray
|m spec|
window notNil ifTrue:[
^ self buildFromSpec:aSpecOrSpecArray in:window
].
spec := UISpecification from:aSpecOrSpecArray.
window := spec buildViewFor:self.
"/ menuAspect notNil ifTrue:[
"/ m := self componentAt:menuAspect.
"/ m notNil ifTrue:[
"/ m := m value.
"/ m notNil ifTrue:[
"/ m receiver:application.
"/ window add:m.
"/ view topInset:(m heightIncludingBorder).
"/ ]
"/ ]
"/ ].
^ window
"Modified: 5.9.1995 / 21:43:29 / claus"
"Modified: 3.3.1997 / 18:43:50 / cg"
!
buildFromSpec:aSpecArray in:aView
|m spec|
spec := UISpecification from:aSpecArray.
^ spec buildViewFor:self in:aView.
"Modified: 3.3.1997 / 18:44:02 / cg"
!
doFinalHookup
"Created: 14.2.1997 / 14:52:27 / cg"
!
endComposite
|entry|
(specStack notNil and:[specStack notEmpty]) ifTrue:[
entry := specStack removeLast.
composite := entry key.
compositeView := entry value.
].
^ composite
"Created: 3.3.1997 / 17:17:43 / cg"
"Modified: 6.3.1997 / 16:18:05 / cg"
!
endCompositeLayout:layout
composite compositeSpec:(CompositeSpec new layout:layout).
compositeView layout:layout.
self endComposite
"Modified: 3.3.1997 / 20:54:35 / cg"
!
endCompositeLayout:layout properties:props
self endCompositeLayout:layout
"Created: 3.3.1997 / 22:15:17 / cg"
!
newComposite
|newComposite|
specStack isNil ifTrue:[
specStack := OrderedCollection new
].
specStack addLast:(composite->compositeView).
newComposite := CompositeSpecCollection new.
newComposite compositeSpec:(CompositeSpec new).
compositeView := self add:newComposite.
composite := newComposite.
^ compositeView
"Created: 3.3.1997 / 17:15:36 / cg"
"Modified: 3.3.1997 / 18:55:13 / cg"
!
wrapper
^ view
"Created: 3.3.1997 / 18:28:31 / cg"
"Modified: 3.3.1997 / 18:44:12 / cg"
! !
!UIBuilder methodsFor:'initialization'!
setupWindowFor:aView
|ext|
window notNil ifTrue:[
ext := window extent.
((window isMemberOf:View)
or:[window isMemberOf:SimpleView]) ifTrue:[
windowView ~~ window ifTrue:[
windowView isNil ifTrue:[
self halt
]
].
aView addSubView:window.
].
].
window := aView.
aView container isNil ifTrue:[
spec notNil ifTrue:[
spec window setupView:window for:self
]
].
"Modified: 3.3.1997 / 22:05:37 / cg"
! !
!UIBuilder class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/libview2/UIBuilder.st,v 1.23 1997-03-06 15:18:25 cg Exp $'
! !
UIBuilder initialize!