FileSaveBox.st
author Claus Gittinger <cg@exept.de>
Thu, 23 Nov 1995 03:26:58 +0100
changeset 197 00927189c882
parent 174 d80a6cc3f9b2
child 243 5c411425097d
permissions -rw-r--r--
checkin from browser

"
 COPYRIGHT (c) 1994 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.
"

FileSelectionBox subclass:#FileSaveBox
	 instanceVariableNames:'appendButton appendAction'
	 classVariableNames:''
	 poolDictionaries:''
	 category:'Views-DialogBoxes'
!

!FileSaveBox class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1994 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
"
    Instances of FileSaveBox add an 'append'-button. The other
    behavior is that of a FileSelectionBox.

    Instance variables:
	appendAction            action to be performed when append is pressed
"
!

version
    ^ '$Header: /cvs/stx/stx/libwidg/FileSaveBox.st,v 1.7 1995-11-23 02:25:15 cg Exp $'
! !

!FileSaveBox methodsFor:'accessing'!

appendAction:aBlock
    "set the action to be performed when append is pressed"

    appendAction := aBlock
! !

!FileSaveBox methodsFor:'initialization'!

focusSequence
    |a|

    patternField shown ifTrue:[
	a := Array new:6.
	a at:1 put:enterField.
	a at:2 put:patternField.
	a at:3 put:selectionList.
	a at:4 put:abortButton.
	a at:5 put:appendButton.
	a at:6 put:okButton.
	^ a
    ].
    ^ Array with:enterField 
	    with:selectionList
	    with:abortButton 
	    with:appendButton 
	    with:okButton 
!

initialize
    super initialize.

    label := resources string:'Save file dialog'.

    okButton label:(resources string:'save').

    "
     insert an append-button between abort- and save-buttons
    "
    appendButton := Button okButton.
    appendButton isReturnButton:false.
    appendButton label:(resources string:'append').
    appendButton action:[appendButton turnOffWithoutRedraw. self appendPressed].
    buttonPanel addSubView:appendButton after:abortButton
! !

!FileSaveBox methodsFor:'user interaction'!

appendPressed
    self hideAndEvaluate:[:string |
	appendAction notNil ifTrue:[
	    appendAction value:string 
	]
    ]
! !