FilenameWidgetWithHistory.st
author Claus Gittinger <cg@exept.de>
Wed, 12 Nov 2008 14:11:36 +0100
changeset 3593 f11c5a41d4a9
parent 3590 c3c778e11564
child 3594 8bdad6d9c51a
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3318
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
     1
"
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
     2
 COPYRIGHT (c) 2007 by eXept Software AG
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
     3
              All Rights Reserved
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
     4
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
     5
 This software is furnished under a license and may be used
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
     6
 only in accordance with the terms of that license and with the
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
     8
 be provided or otherwise made available to, or used by, any
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
     9
 other person.  No title to or ownership of the software is
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    10
 hereby transferred.
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    11
"
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libwidg2' }"
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
SimpleView subclass:#FilenameWidgetWithHistory
3590
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    15
	instanceVariableNames:'fileNameEntryField browseButton history directoriesOnly filesOnly
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    16
		dialogTitle'
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	classVariableNames:''
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	poolDictionaries:''
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	category:'Views-Interactors'
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
!
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
!FilenameWidgetWithHistory class methodsFor:'documentation'!
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
3318
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    24
copyright
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    25
"
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    26
 COPYRIGHT (c) 2007 by eXept Software AG
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    27
              All Rights Reserved
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    28
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    29
 This software is furnished under a license and may be used
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    30
 only in accordance with the terms of that license and with the
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    32
 be provided or otherwise made available to, or used by, any
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    33
 other person.  No title to or ownership of the software is
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    34
 hereby transferred.
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    35
"
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    36
!
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    37
3471
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    38
documentation
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    39
"
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    40
    A Filename InputField with history-list and a browse-button, which opens a file dialog.
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    41
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    42
    [author:]
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    43
        Claus Gittinger
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    44
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    45
    [see also:]
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    46
        ComboBoxView
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    47
        FilenameEditField
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    48
        FilenameComboBoxView
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    49
"
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    50
!
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    51
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
examples
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
"
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
                                                                        [exBegin]
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
     |top b|
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
     top := StandardSystemView new.
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
     top extent:(300 @ 200).
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
     b := FilenameWidgetWithHistory in:top.
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
     b origin:(0.0 @ 0.0) corner:(1.0 @ 0.0).
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
     b bottomInset:(b preferredExtent y negated).
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
     top open.
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
                                                                        [exEnd]
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
"
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
! !
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
!FilenameWidgetWithHistory methodsFor:'accessing'!
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
3590
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    71
dialogTitle:something
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    72
    "set the dialogs title"
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    73
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    74
    dialogTitle := something.
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    75
!
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    76
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    77
directoriesOnly:aBoolean
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    78
    "if true, directories are selectable only.
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    79
     If both filesOnly and directoriesOnly are false, which is the default, 
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    80
     anything is selectable."
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    81
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    82
    directoriesOnly := aBoolean.
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    83
    directoriesOnly ifTrue:[
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    84
        filesOnly := false.
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    85
    ].
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    86
    fileNameEntryField notNil ifTrue:[
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    87
        fileNameEntryField directoriesOnly:aBoolean
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    88
    ].
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    89
!
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    90
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    91
filesOnly:aBoolean
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    92
    "if true, files are selectable only.
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    93
     If both filesOnly and directoriesOnly are false, which is the default, 
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    94
     anything is selectable."
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    95
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    96
    filesOnly := aBoolean.
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    97
    filesOnly ifTrue:[
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    98
        directoriesOnly := false.
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    99
    ].
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   100
    fileNameEntryField notNil ifTrue:[
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   101
        fileNameEntryField filesOnly:aBoolean
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   102
    ].
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   103
!
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   104
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
historyList
3474
cde8a45f74f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3473
diff changeset
   106
    history isNil ifTrue:[
cde8a45f74f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3473
diff changeset
   107
        history := nil asValue
cde8a45f74f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3473
diff changeset
   108
    ].
cde8a45f74f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3473
diff changeset
   109
    ^ history
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
!
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
3593
f11c5a41d4a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3590
diff changeset
   112
historyList:aList
f11c5a41d4a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3590
diff changeset
   113
    "set the history - useful when two or more such fields shall share a common history"
f11c5a41d4a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3590
diff changeset
   114
f11c5a41d4a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3590
diff changeset
   115
    history := aList
f11c5a41d4a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3590
diff changeset
   116
!
f11c5a41d4a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3590
diff changeset
   117
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
model
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
    ^ fileNameEntryField model
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
!
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
model:aFilenameHolder
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
    fileNameEntryField model:aFilenameHolder.
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
! !
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
3546
b3269a9dec19 +enableChannel
Claus Gittinger <cg@exept.de>
parents: 3474
diff changeset
   126
!FilenameWidgetWithHistory methodsFor:'accessing-channels'!
b3269a9dec19 +enableChannel
Claus Gittinger <cg@exept.de>
parents: 3474
diff changeset
   127
b3269a9dec19 +enableChannel
Claus Gittinger <cg@exept.de>
parents: 3474
diff changeset
   128
enableChannel:aValueHolder
b3269a9dec19 +enableChannel
Claus Gittinger <cg@exept.de>
parents: 3474
diff changeset
   129
    fileNameEntryField enableChannel:aValueHolder.
b3269a9dec19 +enableChannel
Claus Gittinger <cg@exept.de>
parents: 3474
diff changeset
   130
    browseButton enableChannel:aValueHolder.
b3269a9dec19 +enableChannel
Claus Gittinger <cg@exept.de>
parents: 3474
diff changeset
   131
! !
b3269a9dec19 +enableChannel
Claus Gittinger <cg@exept.de>
parents: 3474
diff changeset
   132
b3269a9dec19 +enableChannel
Claus Gittinger <cg@exept.de>
parents: 3474
diff changeset
   133
!FilenameWidgetWithHistory methodsFor:'accessing-editField attributes'!
3472
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   134
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   135
acceptIfUnchanged:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   136
    fileNameEntryField acceptIfUnchanged:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   137
!
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   138
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   139
acceptOnLeave:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   140
    fileNameEntryField acceptOnLeave:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   141
!
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   142
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   143
acceptOnLostFocus:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   144
    fileNameEntryField acceptOnLostFocus:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   145
!
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   146
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   147
acceptOnPointerLeave:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   148
    fileNameEntryField acceptOnPointerLeave:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   149
!
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   150
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   151
acceptOnReturn:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   152
    fileNameEntryField acceptOnReturn:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   153
!
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   154
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   155
acceptOnTab:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   156
    fileNameEntryField acceptOnTab:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   157
!
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   158
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   159
contents:aString
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   160
    fileNameEntryField contents:aString
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   161
!
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   162
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   163
immediateAccept:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   164
    fileNameEntryField immediateAccept:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   165
!
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   166
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   167
maxChars:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   168
    fileNameEntryField maxChars:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   169
!
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   170
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   171
readOnly:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   172
    fileNameEntryField readOnly:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   173
! !
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   174
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
!FilenameWidgetWithHistory methodsFor:'initialization'!
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
initialize
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
    super initialize.
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
3590
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   180
    directoriesOnly := filesOnly := false.
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   181
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
    fileNameEntryField := FilenameComboBoxView in:self.
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
    fileNameEntryField layout:(LayoutFrame
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
                                  leftFraction:0 offset:0 
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
                                  rightFraction:1 offset:-22 
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
                                  topFraction:0 offset:0 
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
                                  bottomFraction:1 offset:0).
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
    fileNameEntryField listHolder:(self historyList).
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
    browseButton := Button in:self.
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
    browseButton label:'...'.
3590
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   192
    browseButton action:[ self browseForFileOrDirectory ].
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
    browseButton layout:(LayoutFrame
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
                                  leftFraction:1 offset:-22 
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
                                  rightFraction:1 offset:-2 
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
                                  topFraction:0 offset:0 
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
                                  bottomFraction:1 offset:0).
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
! !
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
!FilenameWidgetWithHistory methodsFor:'queries'!
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
preferredExtent
3568
2f293d1e2eef changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3546
diff changeset
   203
    "/ If I have an explicit preferredExtent..
2f293d1e2eef changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3546
diff changeset
   204
    explicitExtent notNil ifTrue:[
2f293d1e2eef changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3546
diff changeset
   205
        ^ explicitExtent
2f293d1e2eef changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3546
diff changeset
   206
    ].
2f293d1e2eef changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3546
diff changeset
   207
2f293d1e2eef changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3546
diff changeset
   208
    "/ If I have a cached preferredExtent value..
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
    preferredExtent notNil ifTrue:[
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
        ^ preferredExtent
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
    ].
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
3427
9927e4970fce added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
   213
    preferredExtent := (fileNameEntryField preferredWidth + browseButton preferredWidth)
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
                       @
3427
9927e4970fce added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
   215
                       (fileNameEntryField preferredHeight "max: browseButton preferredExtent y").
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
    ^ preferredExtent
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
! !
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
!FilenameWidgetWithHistory methodsFor:'user actions'!
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
browseForDestinationDirectory
3590
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   222
    <resource: #obsolete>
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   223
    self obsoleteMethodWarning.
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   224
    self browseForFileOrDirectory
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   225
!
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   226
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   227
browseForFileOrDirectory
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
    |dir|
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
    Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
        |dialog|
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
        dialog := ex parameter.
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
        dialog perform:#browseVisibleHolder with:true ifNotUnderstood:[].
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
        ex proceed.
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
    ] do:[
3590
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   237
        |title|
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   238
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   239
        title := dialogTitle notNil 
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   240
                    ifTrue:[ dialogTitle ]
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   241
                    ifFalse:[ 
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   242
                        directoriesOnly 
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   243
                            ifTrue:[ resources string:'Select Directory' ]
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   244
                            ifFalse:[ 
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   245
                                filesOnly
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   246
                                    ifTrue:[ resources string:'Select File' ]
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   247
                                    ifFalse:[ resources string:'Select Path' ]]].
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   248
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
        dir := Dialog 
3590
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   250
                requestFileName:title
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
                default:(self model value ? '.' asFilename pathName).
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
    ].
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
    dir isEmptyOrNil ifTrue:[ ^ self ].
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
    self model value:dir.
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
    "Modified: / 02-10-2006 / 14:45:54 / cg"
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
! !
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
!FilenameWidgetWithHistory class methodsFor:'documentation'!
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
version
3593
f11c5a41d4a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3590
diff changeset
   263
    ^ '$Header: /cvs/stx/stx/libwidg2/FilenameWidgetWithHistory.st,v 1.11 2008-11-12 13:11:36 cg Exp $'
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
! !