"
COPYRIGHT (c) 2007 by eXept Software AG
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.
"
"{ Package: 'stx:libwidg2' }"
SimpleView subclass:#FilenameWidgetWithHistory
instanceVariableNames:'fileNameEntryField browseButton history'
classVariableNames:''
poolDictionaries:''
category:'Views-Interactors'
!
!FilenameWidgetWithHistory class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 2007 by eXept Software AG
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.
"
!
examples
"
[exBegin]
|top b|
top := StandardSystemView new.
top extent:(300 @ 200).
b := FilenameWidgetWithHistory in:top.
b origin:(0.0 @ 0.0) corner:(1.0 @ 0.0).
b bottomInset:(b preferredExtent y negated).
top open.
[exEnd]
"
! !
!FilenameWidgetWithHistory methodsFor:'accessing'!
historyList
^ #('a' 'b' 'c')
!
model
^ fileNameEntryField model
!
model:aFilenameHolder
fileNameEntryField model:aFilenameHolder.
! !
!FilenameWidgetWithHistory methodsFor:'initialization'!
initialize
super initialize.
fileNameEntryField := FilenameComboBoxView in:self.
fileNameEntryField layout:(LayoutFrame
leftFraction:0 offset:0
rightFraction:1 offset:-22
topFraction:0 offset:0
bottomFraction:1 offset:0).
fileNameEntryField listHolder:(self historyList).
browseButton := Button in:self.
browseButton label:'...'.
browseButton action:[self browseForDestinationDirectory].
browseButton layout:(LayoutFrame
leftFraction:1 offset:-22
rightFraction:1 offset:-2
topFraction:0 offset:0
bottomFraction:1 offset:0).
! !
!FilenameWidgetWithHistory methodsFor:'queries'!
preferredExtent
preferredExtent notNil ifTrue:[
^ preferredExtent
].
preferredExtent := (fileNameEntryField preferredExtent x + browseButton preferredExtent x)
@
(fileNameEntryField preferredExtent y "max: browseButton preferredExtent y").
^ preferredExtent
! !
!FilenameWidgetWithHistory methodsFor:'user actions'!
browseForDestinationDirectory
|dir|
Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
|dialog|
dialog := ex parameter.
dialog perform:#browseVisibleHolder with:true ifNotUnderstood:[].
ex proceed.
] do:[
dir := Dialog
requestDirectoryName:'Destination Directory'
default:(self model value ? '.' asFilename pathName).
].
dir isEmptyOrNil ifTrue:[ ^ self ].
self model value:dir.
"Modified: / 02-10-2006 / 14:45:54 / cg"
! !
!FilenameWidgetWithHistory class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/libwidg2/FilenameWidgetWithHistory.st,v 1.2 2008-01-22 22:32:16 cg Exp $'
! !