FileSaveBox.st
author Claus Gittinger <cg@exept.de>
Sat, 20 Jun 2009 10:47:07 +0200
changeset 3901 113dd960ba11
parent 2698 cca702636705
child 4689 a5cb9ae9641f
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
     1
"
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1994 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 37
diff changeset
     3
	      All Rights Reserved
37
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
     4
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    11
"
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    12
2415
188fc1577a8d uppercase labels
Claus Gittinger <cg@exept.de>
parents: 1764
diff changeset
    13
"{ Package: 'stx:libwidg' }"
188fc1577a8d uppercase labels
Claus Gittinger <cg@exept.de>
parents: 1764
diff changeset
    14
37
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    15
FileSelectionBox subclass:#FileSaveBox
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    16
	instanceVariableNames:'appendButton appendAction'
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    17
	classVariableNames:''
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    18
	poolDictionaries:''
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    19
	category:'Views-DialogBoxes'
37
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    20
!
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    21
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    22
!FileSaveBox class methodsFor:'documentation'!
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    23
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    24
copyright
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    25
"
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    26
 COPYRIGHT (c) 1994 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 37
diff changeset
    27
	      All Rights Reserved
37
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    28
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    29
 This software is furnished under a license and may be used
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    30
 only in accordance with the terms of that license and with the
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    32
 be provided or otherwise made available to, or used by, any
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    33
 other person.  No title to or ownership of the software is
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    34
 hereby transferred.
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    35
"
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    36
!
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    37
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    38
documentation
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    39
"
637
2084bbe806dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    40
    Instances of FileSaveBox add an 'append'-button, and an
2084bbe806dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    41
    associated append-action. 
2084bbe806dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    42
    The other behavior is that of a FileSelectionBox.
37
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    43
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    44
    [Instance variables:]
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    45
        appendAction            action to be performed when append is pressed
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    46
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    47
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    48
    [author:]
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    49
        Claus Gittinger
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    50
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    51
    [see also:]
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    52
        DialogBox
648
fcf02d58882e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 637
diff changeset
    53
        EnterBox2 FilenameEnterBox YesNoBox
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    54
        ListSelectionBox FileSelectionBox 
37
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    55
"
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    56
! !
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    57
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    58
!FileSaveBox methodsFor:'accessing'!
37
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    59
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    60
appendAction:aBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    61
    "set the action to be performed when append is pressed"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    62
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    63
    appendAction := aBlock
37
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    64
! !
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    65
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    66
!FileSaveBox methodsFor:'initialization'!
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    67
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    68
initialize
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    69
    super initialize.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    70
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    71
    label := resources string:'Save file dialog'.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    72
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    73
    okButton label:(resources string:'save').
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    74
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    75
    "
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    76
     insert an append-button between abort- and save-buttons
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    77
    "
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    78
    appendButton := Button okButton.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    79
    appendButton isReturnButton:false.
2415
188fc1577a8d uppercase labels
Claus Gittinger <cg@exept.de>
parents: 1764
diff changeset
    80
    appendButton label:(resources string:'Append').
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    81
    appendButton action:[appendButton turnOffWithoutRedraw. self appendPressed].
2698
cca702636705 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
    82
    (Dialog defaultOKButtonAtLeft) ifTrue:[
1762
848075aa087c care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents: 741
diff changeset
    83
        self addButton:appendButton after:okButton.
848075aa087c care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents: 741
diff changeset
    84
    ] ifFalse:[
848075aa087c care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents: 741
diff changeset
    85
        self addButton:appendButton before:okButton.
848075aa087c care for styleSheets right-to-left button order.
Claus Gittinger <cg@exept.de>
parents: 741
diff changeset
    86
    ].
37
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    87
! !
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    88
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    89
!FileSaveBox methodsFor:'user interaction'!
37
8dd71a2e79cd Initial revision
claus
parents:
diff changeset
    90
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    91
appendPressed
637
2084bbe806dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    92
    "append was pressed - evaluate the append-action"
2084bbe806dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    93
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    94
    self hideAndEvaluate:[:string |
637
2084bbe806dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    95
        appendAction notNil ifTrue:[
2084bbe806dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    96
            appendAction value:string 
2084bbe806dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    97
        ]
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    98
    ]
637
2084bbe806dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    99
2084bbe806dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   100
    "Modified: 12.5.1996 / 21:45:52 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   101
! !
59
450ce95a72a4 *** empty log message ***
claus
parents: 37
diff changeset
   102
243
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   103
!FileSaveBox class methodsFor:'documentation'!
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   104
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   105
version
2698
cca702636705 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
   106
    ^ '$Header: /cvs/stx/stx/libwidg/FileSaveBox.st,v 1.16 2003-02-25 14:58:59 cg Exp $'
243
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   107
! !