3318
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2007 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
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 |
"
|
3251
|
12 |
"{ Package: 'stx:libwidg2' }"
|
|
13 |
|
|
14 |
SimpleView subclass:#FilenameWidgetWithHistory
|
|
15 |
instanceVariableNames:'fileNameEntryField browseButton history'
|
|
16 |
classVariableNames:''
|
|
17 |
poolDictionaries:''
|
|
18 |
category:'Views-Interactors'
|
|
19 |
!
|
|
20 |
|
|
21 |
!FilenameWidgetWithHistory class methodsFor:'documentation'!
|
|
22 |
|
3318
|
23 |
copyright
|
|
24 |
"
|
|
25 |
COPYRIGHT (c) 2007 by eXept Software AG
|
|
26 |
All Rights Reserved
|
|
27 |
|
|
28 |
This software is furnished under a license and may be used
|
|
29 |
only in accordance with the terms of that license and with the
|
|
30 |
inclusion of the above copyright notice. This software may not
|
|
31 |
be provided or otherwise made available to, or used by, any
|
|
32 |
other person. No title to or ownership of the software is
|
|
33 |
hereby transferred.
|
|
34 |
"
|
|
35 |
!
|
|
36 |
|
3251
|
37 |
examples
|
|
38 |
"
|
|
39 |
[exBegin]
|
|
40 |
|top b|
|
|
41 |
|
|
42 |
top := StandardSystemView new.
|
|
43 |
top extent:(300 @ 200).
|
|
44 |
|
|
45 |
b := FilenameWidgetWithHistory in:top.
|
|
46 |
b origin:(0.0 @ 0.0) corner:(1.0 @ 0.0).
|
|
47 |
b bottomInset:(b preferredExtent y negated).
|
|
48 |
|
|
49 |
top open.
|
|
50 |
[exEnd]
|
|
51 |
"
|
|
52 |
! !
|
|
53 |
|
|
54 |
!FilenameWidgetWithHistory methodsFor:'accessing'!
|
|
55 |
|
|
56 |
historyList
|
|
57 |
^ #('a' 'b' 'c')
|
|
58 |
!
|
|
59 |
|
|
60 |
model
|
|
61 |
^ fileNameEntryField model
|
|
62 |
!
|
|
63 |
|
|
64 |
model:aFilenameHolder
|
|
65 |
fileNameEntryField model:aFilenameHolder.
|
|
66 |
! !
|
|
67 |
|
|
68 |
!FilenameWidgetWithHistory methodsFor:'initialization'!
|
|
69 |
|
|
70 |
initialize
|
|
71 |
super initialize.
|
|
72 |
|
|
73 |
fileNameEntryField := FilenameComboBoxView in:self.
|
|
74 |
fileNameEntryField layout:(LayoutFrame
|
|
75 |
leftFraction:0 offset:0
|
|
76 |
rightFraction:1 offset:-22
|
|
77 |
topFraction:0 offset:0
|
|
78 |
bottomFraction:1 offset:0).
|
|
79 |
fileNameEntryField listHolder:(self historyList).
|
|
80 |
|
|
81 |
browseButton := Button in:self.
|
|
82 |
browseButton label:'...'.
|
|
83 |
browseButton action:[self browseForDestinationDirectory].
|
|
84 |
browseButton layout:(LayoutFrame
|
|
85 |
leftFraction:1 offset:-22
|
|
86 |
rightFraction:1 offset:-2
|
|
87 |
topFraction:0 offset:0
|
|
88 |
bottomFraction:1 offset:0).
|
|
89 |
! !
|
|
90 |
|
|
91 |
!FilenameWidgetWithHistory methodsFor:'queries'!
|
|
92 |
|
|
93 |
preferredExtent
|
|
94 |
preferredExtent notNil ifTrue:[
|
|
95 |
^ preferredExtent
|
|
96 |
].
|
|
97 |
|
|
98 |
preferredExtent := (fileNameEntryField preferredExtent x + browseButton preferredExtent x)
|
|
99 |
@
|
|
100 |
(fileNameEntryField preferredExtent y "max: browseButton preferredExtent y").
|
|
101 |
^ preferredExtent
|
|
102 |
! !
|
|
103 |
|
|
104 |
!FilenameWidgetWithHistory methodsFor:'user actions'!
|
|
105 |
|
|
106 |
browseForDestinationDirectory
|
|
107 |
|dir|
|
|
108 |
|
|
109 |
Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
|
|
110 |
|dialog|
|
|
111 |
|
|
112 |
dialog := ex parameter.
|
|
113 |
dialog perform:#browseVisibleHolder with:true ifNotUnderstood:[].
|
|
114 |
ex proceed.
|
|
115 |
] do:[
|
|
116 |
dir := Dialog
|
|
117 |
requestDirectoryName:'Destination Directory'
|
|
118 |
default:(self model value ? '.' asFilename pathName).
|
|
119 |
].
|
|
120 |
dir isEmptyOrNil ifTrue:[ ^ self ].
|
|
121 |
|
|
122 |
self model value:dir.
|
|
123 |
|
|
124 |
"Modified: / 02-10-2006 / 14:45:54 / cg"
|
|
125 |
! !
|
|
126 |
|
|
127 |
!FilenameWidgetWithHistory class methodsFor:'documentation'!
|
|
128 |
|
|
129 |
version
|
3318
|
130 |
^ '$Header: /cvs/stx/stx/libwidg2/FilenameWidgetWithHistory.st,v 1.2 2008-01-22 22:32:16 cg Exp $'
|
3251
|
131 |
! !
|