WindowBuilder.st
author Claus Gittinger <cg@exept.de>
Fri, 17 Jan 1997 20:53:59 +0100
changeset 372 6d7718f3d298
parent 223 b65dc250db8d
child 374 5be095a54715
permissions -rw-r--r--
more ST-80 compatibility stuff

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

Object subclass:#WindowBuilder
	instanceVariableNames:'window application bindings focusSequence namedComponents'
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Support-UI'
!

!WindowBuilder 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
"
    a no-op class, for systems which do not use the UIBuilder.
    Concrete subclasses know how to create a view (with components) from
    some interface spec. Currently, an experimantal version of UIBuilder exists,
    and more may be added in the future (for example, to parse different UI
    specs - thinking of motifs UIL specs etc).

    [author:]
        Claus Gittinger
"
! !

!WindowBuilder methodsFor:'accessing'!

application
    "return the application (an ApplicationModel),
     for which the view is built.
     This one is supposed to provide the aspects, menus etc."

    ^ application

    "Modified: 17.1.1997 / 19:04:40 / cg"
!

application:anApplicationModel
    "set the application (an ApplicationModel),
     for which the view is built.
     This one is supposed to provide the aspects, menus etc."

    application := anApplicationModel

    "Modified: 17.1.1997 / 19:04:47 / cg"
!

aspectAt:aSymbol
    bindings isNil ifTrue:[^ nil].
    ^ bindings at:aSymbol ifAbsent:nil

    "Modified: 17.1.1997 / 19:28:32 / cg"
!

aspectAt:aSymbol put:aModel
    bindings isNil ifTrue:[
        bindings := IdentityDictionary new
    ].
    ^ bindings at:aSymbol put:aModel

    "Modified: 17.1.1997 / 19:28:37 / cg"
!

bindings
    ^ bindings
!

bindings:aDictionary
    bindings := aDictionary
!

componentAt:name
    bindings isNil ifTrue:[^ nil].
    ^ bindings at:name ifAbsent:nil
!

componentAt:name put:aComponent
    bindings isNil ifTrue:[
	bindings := IdentityDictionary new.
    ].
    bindings at:name put:aComponent
!

focusSequence 
    ^ focusSequence
!

namedComponents
    ^ bindings
!

source
    "same as #application, for ST-80 compatibility"

    ^ application

    "Created: 17.1.1997 / 19:03:51 / cg"
!

source:anApplicationModel
    "same as #application:, for ST-80 compatibility"

    application := anApplicationModel

    "Modified: 17.1.1997 / 19:03:57 / cg"
!

window
    "return the top window (view), for which an interface
     is (being) built"

    ^ window

    "Modified: 17.1.1997 / 19:30:00 / cg"
!

window:aView
    "set the top window (view), for which an interface
     is (being) built"

    window := aView

    "Modified: 17.1.1997 / 19:30:22 / cg"
!

windowGroup
self halt.
    ^ window windowGroup

    "Modified: 17.1.1997 / 19:30:26 / cg"
! !

!WindowBuilder methodsFor:'building'!

buildFromSpec:aSpec
    ^ self subclassResponsibility
! !

!WindowBuilder methodsFor:'spec creation callbacks'!

createdComponent:aView forSpec:spec

    "Modified: 5.9.1995 / 21:42:54 / claus"
! !

!WindowBuilder methodsFor:'startup'!

closeRequest
    window destroy

    "Modified: 17.1.1997 / 19:30:32 / cg"
!

open
    "open my topView, as previously created"

    self 
        openWithExtent:nil
        andType:(application defaultWindowType)

    "Modified: 17.1.1997 / 19:59:22 / cg"
!

openDialog
    "open my topView, as previously created as a modal view,
     blocking interaction to the currently active view."

    self 
        openWithExtent:nil 
        andType:#dialog

    "Modified: 17.1.1997 / 19:59:29 / cg"
!

openDialogWithExtent:ext
    "open my topView, as previously created as a modal view,
     blocking interaction to the currently active view."

    self 
        openWithExtent:ext 
        andType:#dialog

    "Modified: 17.1.1997 / 19:59:36 / cg"
!

openPopUpIn:aRectangle
    "open my topView, as previously created as a popUp view,
     blocking interaction to the currently active view."

    self 
        openWithExtent:nil 
        andType:#popUp

    "Modified: 17.1.1997 / 19:59:29 / cg"
    "Created: 17.1.1997 / 20:01:24 / cg"
!

openWithExtent:aPoint
    "open my topView, as previously created, but override
     the extent."

    self 
        openWithExtent:aPoint 
        andType:(application defaultWindowType)

    "Modified: 17.1.1997 / 19:58:48 / cg"
!

openWithExtent:ext andType:type
    "open my window, as previously created. The type argument
     may be #dialog or #normal, and specifies if the view should
     be opened as a modal view, blocking interaction to the currently 
     active view, or as a normal view."

    ext notNil ifTrue:[
        window extent:ext
    ].

    type == #dialog ifTrue:[
        window openModal.
        ^ self
    ].

    type == #normal ifTrue:[
        window open.
        ^ self
    ].

    type == #popUp ifTrue:[
"/        window openAsPopUp.  "/ not yet implemented
        window openModal.
        ^ self
    ].

    "
     if ST-80 supports more types - these may be added later
    "
    self halt:'unimplemented'

    "Modified: 17.1.1997 / 20:02:01 / cg"
! !

!WindowBuilder class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.14 1997-01-17 19:53:40 cg Exp $'
! !