SimpleDialog.st
author ca
Mon, 17 Feb 1997 19:42:31 +0100
changeset 431 99a2737206a6
parent 429 3311c88f2a0e
child 462 fad336817338
permissions -rw-r--r--
checkin from browser

"
 COPYRIGHT (c) 1996 by eXept Software AG
              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.
"


ApplicationModel subclass:#SimpleDialog
	instanceVariableNames:'accept cancel close escapeIsCancel postBuildBlock postOpenBlock
		preBuildBlock'
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Framework'
!

!SimpleDialog class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1996 by eXept Software AG
              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
"
    Since many ST-80 classes are subclasses of SompleDialog, this class
    is provided here to allow easier porting of ST-80 code.

    It does not (currently) provide much functionality and is NOT
    compatible to the corresponding ST80 class; therefore, manual
    changes have to be made to get those applications to run under ST/X.
    (but at least, this enables you to fileIn that code and have a superclass
     for them)

    However, as time goes by, ST/X applications may be converted to use the
    ApplicationModel / SimpleDialog framework as well.

    Notice: this class was implemented using protocol information
    from alpha testers and PD code - it may not be complete or compatible to
    the corresponding ST-80 class. If you encounter any incompatibilities,
    please forward a note to the ST/X team.


    [author:]
        Claus Gittinger

    [see also:]
        StandardSystemView
        WindowGroup DeviceWorkstation DialogBox
"

! !

!SimpleDialog methodsFor:'accessing'!

accept
    "return the value of the instance variable 'accept' (automatically generated)"

    ^ accept
!

bindings
    ^ builder bindings
!

cancel
    "return the value of the instance variable 'cancel' (automatically generated)"

    ^ cancel
!

closeChannel
    "return the value of the instance variable 'close' (automatically generated)"

    ^ close
!

escapeIsCancel
    "return the value of the instance variable 'escapeIsCancel' (automatically generated)"

    ^ escapeIsCancel!

escapeIsCancel:something
    "set the value of the instance variable 'escapeIsCancel' (automatically generated)"

    escapeIsCancel := something.!

postBuildBlock:something
    "set the value of the instance variable 'postBuildBlock' (automatically generated)"

    postBuildBlock := something.!

postOpenBlock:something
    "set the value of the instance variable 'postOpenBlock' (automatically generated)"

    postOpenBlock := something.!

preBuildBlock:something
    "set the value of the instance variable 'preBuildBlock' (automatically generated)"

    preBuildBlock := something.!

source:anApplication
    builder source:anApplication
! !

!SimpleDialog methodsFor:'events'!

closeAccept
    self accept value:true.
    self requestForWindowClose ifTrue:[
        self closeWindow
    ]
!

closeCancel
    self cancel value:true.
    self requestForWindowClose ifTrue:[
        self closeWindow
    ]
!

closeWindow
    self closeChannel value:true.
    builder window hide
!

requestForWindowClose
    ^ true
! !

!SimpleDialog methodsFor:'initialization'!

initialize
    accept := false asValue.
    close := false asValue.
    cancel := false asValue.
    builder aspectAt:#accept put:accept.
    builder aspectAt:#close put:close.
    builder aspectAt:#cancel put:cancel.
    escapeIsCancel := true.
! !

!SimpleDialog methodsFor:'interface opening'!

allButOpenFrom:aSpec
    "create my views but do not open the main window"

    super allButOpenFrom:aSpec.
    self preOpen
!

openFor:anApplication interface:aSelector
    self source:anApplication.
    ^ self openFrom:(anApplication class interfaceSpecFor:aSelector)

!

openFrom:anInterfaceSpec
    self allButOpenFrom:anInterfaceSpec.
    self openDialog.
    ^ accept value

!

preOpen
    accept onChangeSend:#closeAccept to:self.
    cancel onChangeSend:#closeCancel to:self.

! !

!SimpleDialog methodsFor:'queries'!

defaultWindowType
    "SimpleDialogs come up modal, by default"

    ^ #dialog

    "Modified: 14.2.1997 / 22:17:20 / cg"
! !

!SimpleDialog class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libview2/SimpleDialog.st,v 1.3 1997-02-17 18:42:31 ca Exp $'
! !