37
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1994 by Claus Gittinger
|
59
|
3 |
All Rights Reserved
|
37
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
FileSelectionBox subclass:#FileSaveBox
|
77
|
14 |
instanceVariableNames:'appendButton appendAction'
|
59
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Views-DialogBoxes'
|
37
|
18 |
!
|
|
19 |
|
|
20 |
!FileSaveBox class methodsFor:'documentation'!
|
|
21 |
|
|
22 |
copyright
|
|
23 |
"
|
|
24 |
COPYRIGHT (c) 1994 by Claus Gittinger
|
59
|
25 |
All Rights Reserved
|
37
|
26 |
|
|
27 |
This software is furnished under a license and may be used
|
|
28 |
only in accordance with the terms of that license and with the
|
|
29 |
inclusion of the above copyright notice. This software may not
|
|
30 |
be provided or otherwise made available to, or used by, any
|
|
31 |
other person. No title to or ownership of the software is
|
|
32 |
hereby transferred.
|
|
33 |
"
|
|
34 |
!
|
|
35 |
|
|
36 |
documentation
|
|
37 |
"
|
|
38 |
Instances of FileSaveBox add an 'append'-button. The other
|
|
39 |
behavior is that of a FileSelectionBox.
|
|
40 |
|
|
41 |
Instance variables:
|
59
|
42 |
appendAction action to be performed when append is pressed
|
37
|
43 |
"
|
197
|
44 |
!
|
|
45 |
|
|
46 |
version
|
|
47 |
^ '$Header: /cvs/stx/stx/libwidg/FileSaveBox.st,v 1.7 1995-11-23 02:25:15 cg Exp $'
|
37
|
48 |
! !
|
|
49 |
|
197
|
50 |
!FileSaveBox methodsFor:'accessing'!
|
37
|
51 |
|
197
|
52 |
appendAction:aBlock
|
|
53 |
"set the action to be performed when append is pressed"
|
|
54 |
|
|
55 |
appendAction := aBlock
|
37
|
56 |
! !
|
|
57 |
|
|
58 |
!FileSaveBox methodsFor:'initialization'!
|
|
59 |
|
77
|
60 |
focusSequence
|
|
61 |
|a|
|
|
62 |
|
|
63 |
patternField shown ifTrue:[
|
|
64 |
a := Array new:6.
|
|
65 |
a at:1 put:enterField.
|
|
66 |
a at:2 put:patternField.
|
|
67 |
a at:3 put:selectionList.
|
|
68 |
a at:4 put:abortButton.
|
|
69 |
a at:5 put:appendButton.
|
|
70 |
a at:6 put:okButton.
|
|
71 |
^ a
|
|
72 |
].
|
|
73 |
^ Array with:enterField
|
|
74 |
with:selectionList
|
|
75 |
with:abortButton
|
|
76 |
with:appendButton
|
|
77 |
with:okButton
|
197
|
78 |
!
|
|
79 |
|
|
80 |
initialize
|
|
81 |
super initialize.
|
|
82 |
|
|
83 |
label := resources string:'Save file dialog'.
|
|
84 |
|
|
85 |
okButton label:(resources string:'save').
|
|
86 |
|
|
87 |
"
|
|
88 |
insert an append-button between abort- and save-buttons
|
|
89 |
"
|
|
90 |
appendButton := Button okButton.
|
|
91 |
appendButton isReturnButton:false.
|
|
92 |
appendButton label:(resources string:'append').
|
|
93 |
appendButton action:[appendButton turnOffWithoutRedraw. self appendPressed].
|
|
94 |
buttonPanel addSubView:appendButton after:abortButton
|
37
|
95 |
! !
|
|
96 |
|
197
|
97 |
!FileSaveBox methodsFor:'user interaction'!
|
37
|
98 |
|
197
|
99 |
appendPressed
|
|
100 |
self hideAndEvaluate:[:string |
|
|
101 |
appendAction notNil ifTrue:[
|
|
102 |
appendAction value:string
|
|
103 |
]
|
|
104 |
]
|
|
105 |
! !
|
59
|
106 |
|