--- a/FileSelectionList.st Wed Jan 10 20:17:31 1996 +0100
+++ b/FileSelectionList.st Sat Jan 13 16:51:50 1996 +0100
@@ -11,12 +11,12 @@
"
SelectionInListView subclass:#FileSelectionList
- instanceVariableNames:'pattern directory timeStamp directoryId directoryContents
- directoryFileTypes fileTypes realAction matchBlock
- stayInDirectory ignoreParentDirectory'
- classVariableNames:''
- poolDictionaries:''
- category:'Views-Text'
+ instanceVariableNames:'pattern directory timeStamp directoryId directoryContents
+ directoryFileTypes fileTypes realAction matchBlock
+ stayInDirectory ignoreParentDirectory markDirectories'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Views-Text'
!
!FileSelectionList class methodsFor:'documentation'!
@@ -208,10 +208,6 @@
list action:[:index | Transcript showCr:'you selected: ' , list selectionValue].
top open
"
-!
-
-version
- ^ '$Header: /cvs/stx/stx/libwidg/FileSelectionList.st,v 1.16 1995-11-23 00:50:10 cg Exp $'
! !
!FileSelectionList methodsFor:'accessing'!
@@ -263,6 +259,13 @@
ignoreParentDirectory := aBoolean
!
+markDirectories:aBoolean
+ "turn on/off marking of directories with an arrow.
+ The default is on"
+
+ markDirectories := aBoolean
+!
+
matchBlock:aBlock
"set the matchBlock - if non-nil, it controls which
names are shown in the list."
@@ -311,15 +314,16 @@
"first, draw chunk of lines"
super redrawFromVisibleLine:startVisLineNr to:endVisLineNr.
+ markDirectories ifFalse:[^ self].
"then draw marks"
startVisLineNr to:endVisLineNr do:[:visLineNr |
- l := self visibleLineToListLine:visLineNr.
- l notNil ifTrue:[
- (fileTypes at:l) == #directory ifTrue:[
- self drawRightArrowInVisibleLine:visLineNr
- ]
- ]
+ l := self visibleLineToListLine:visLineNr.
+ l notNil ifTrue:[
+ (fileTypes at:l) == #directory ifTrue:[
+ self drawRightArrowInVisibleLine:visLineNr
+ ]
+ ]
]
!
@@ -329,11 +333,13 @@
|l|
super redrawVisibleLine:visLineNr.
+ markDirectories ifFalse:[^ self].
+
l := self visibleLineToListLine:visLineNr.
l notNil ifTrue:[
- (fileTypes at:l) == #directory ifTrue:[
- self drawRightArrowInVisibleLine:visLineNr
- ]
+ (fileTypes at:l) == #directory ifTrue:[
+ self drawRightArrowInVisibleLine:visLineNr
+ ]
]
! !
@@ -343,7 +349,7 @@
directory := FileDirectory currentDirectory.
stayInDirectory := false.
ignoreParentDirectory := false.
-
+ markDirectories := true.
super initialize.
pattern := '*'.
@@ -363,36 +369,36 @@
a directory; otherwise directory is changed"
actionBlock := [:lineNr |
- |entry ok|
+ |entry ok|
- self selection isCollection ifFalse:[
- entry := self selectionValue.
- (entry endsWith:' ...') ifTrue:[
- entry := entry copyWithoutLast:4 "copyTo:(entry size - 4)".
- ].
- (stayInDirectory not
- and:[(directory typeOf:entry) == #directory]) ifTrue:[
- ok := false.
- (directory isReadable:entry) ifFalse:[
- self warn:(resources string:'not allowed to read directory %1' with:entry)
- ] ifTrue:[
- (directory isExecutable:entry) ifFalse:[
- self warn:(resources string:'not allowed to change to directory %1' with:entry)
- ] ifTrue:[
- self directory:(directory pathName , Filename separator asString , entry).
- ok := true.
- ]
- ].
- ok ifFalse:[
- self deselect
- ]
+ self selection isCollection ifFalse:[
+ entry := self selectionValue.
+ (entry endsWith:' ...') ifTrue:[
+ entry := entry copyWithoutLast:4 "copyTo:(entry size - 4)".
+ ].
+ (stayInDirectory not
+ and:[(directory typeOf:entry) == #directory]) ifTrue:[
+ ok := false.
+ (directory isReadable:entry) ifFalse:[
+ self warn:(resources string:'not allowed to read directory %1' with:entry)
+ ] ifTrue:[
+ (directory isExecutable:entry) ifFalse:[
+ self warn:(resources string:'not allowed to change to directory %1' with:entry)
+ ] ifTrue:[
+ self directory:(directory pathName , Filename separator asString , entry).
+ ok := true.
+ ]
+ ].
+ ok ifFalse:[
+ self deselect
+ ]
- ] ifFalse:[
- realAction notNil ifTrue:[
- realAction value:lineNr
- ]
- ]
- ]
+ ] ifFalse:[
+ realAction notNil ifTrue:[
+ realAction value:lineNr
+ ]
+ ]
+ ]
]
!
@@ -506,3 +512,8 @@
super realize
! !
+!FileSelectionList class methodsFor:'documentation'!
+
+version
+ ^ '$Header: /cvs/stx/stx/libwidg/FileSelectionList.st,v 1.17 1996-01-13 15:51:50 ca Exp $'
+! !