FileSaveBox.st
author claus
Tue, 29 Aug 1995 18:44:52 +0200
changeset 150 9411bf3927d9
parent 118 3ee5ea99d0e2
child 174 d80a6cc3f9b2
permissions -rw-r--r--
.

"
 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 comment:'
COPYRIGHT (c) 1994 by Claus Gittinger
	      All Rights Reserved

$Header: /cvs/stx/stx/libwidg/FileSaveBox.st,v 1.5 1995-08-29 16:43:47 claus Exp $
'!

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

version
"
$Header: /cvs/stx/stx/libwidg/FileSaveBox.st,v 1.5 1995-08-29 16:43:47 claus Exp $
"
!

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

!FileSaveBox methodsFor:'user interaction'!

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

!FileSaveBox methodsFor:'initialization'!

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
!

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 
! !

!FileSaveBox methodsFor:'accessing'!

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

    appendAction := aBlock
! !