equal
deleted
inserted
replaced
19 |
19 |
20 ListSelectionBox comment:' |
20 ListSelectionBox comment:' |
21 COPYRIGHT (c) 1990 by Claus Gittinger |
21 COPYRIGHT (c) 1990 by Claus Gittinger |
22 All Rights Reserved |
22 All Rights Reserved |
23 |
23 |
24 $Header: /cvs/stx/stx/libwidg/ListSelectionBox.st,v 1.11 1995-05-07 00:16:17 claus Exp $ |
24 $Header: /cvs/stx/stx/libwidg/ListSelectionBox.st,v 1.12 1995-05-09 01:55:56 claus Exp $ |
25 '! |
25 '! |
26 |
26 |
27 !ListSelectionBox class methodsFor:'documentation'! |
27 !ListSelectionBox class methodsFor:'documentation'! |
28 |
28 |
29 copyright |
29 copyright |
40 " |
40 " |
41 ! |
41 ! |
42 |
42 |
43 version |
43 version |
44 " |
44 " |
45 $Header: /cvs/stx/stx/libwidg/ListSelectionBox.st,v 1.11 1995-05-07 00:16:17 claus Exp $ |
45 $Header: /cvs/stx/stx/libwidg/ListSelectionBox.st,v 1.12 1995-05-09 01:55:56 claus Exp $ |
46 " |
46 " |
47 ! |
47 ! |
48 |
48 |
49 documentation |
49 documentation |
50 " |
50 " |
109 ! ! |
109 ! ! |
110 |
110 |
111 !ListSelectionBox methodsFor:'initialization'! |
111 !ListSelectionBox methodsFor:'initialization'! |
112 |
112 |
113 initialize |
113 initialize |
114 |space2 v| |
114 |space2 halfSpace v| |
115 |
115 |
116 super initialize. |
116 super initialize. |
117 |
117 |
118 label := 'Select or enter'. |
118 label := 'Select or enter'. |
119 |
119 |
120 "need more space than an enterBox" |
120 "need more space than an enterBox" |
121 |
121 |
122 "self height:(height + (font height * 5)). " |
122 "self height:(height + (font height * 5)). " |
123 |
123 |
124 space2 := 2 * ViewSpacing. |
124 space2 := 2 * ViewSpacing. |
|
125 halfSpace := ViewSpacing // 2. |
125 |
126 |
126 v := ScrollableView for:(self class listViewType) in:self. |
127 v := ScrollableView for:(self class listViewType) in:self. |
127 |
128 |
128 "kludge: see note in EnterBox" |
129 "kludge: see note in EnterBox" |
129 v origin:(0.0 |
130 "/ v origin:(0.0 |
130 @ |
131 "/ @ |
131 (enterField origin y + enterField height + ViewSpacing)). |
132 "/ (enterField origin y + enterField height + ViewSpacing)). |
132 v extent:(1.0 |
133 "/ v extent:(1.0 |
133 @ |
134 "/ @ |
134 (height |
135 "/ (height |
135 - ViewSpacing - labelField heightIncludingBorder |
136 "/ - ViewSpacing - labelField heightIncludingBorder |
136 - ViewSpacing - enterField heightIncludingBorder |
137 "/ - ViewSpacing - enterField heightIncludingBorder |
137 - buttonPanel heightIncludingBorder - ViewSpacing |
138 "/ - buttonPanel heightIncludingBorder - ViewSpacing |
138 - space2) |
139 "/ - space2) |
139 ). |
140 "/ ). |
140 v origin:[0.0 |
141 v origin:[0.0 |
141 @ |
142 @ |
142 (enterField origin y + enterField height + ViewSpacing)] |
143 (enterField origin y + enterField height + ViewSpacing)] |
143 extent:[1.0 |
144 extent:[1.0 |
144 @ |
145 @ |
146 - ViewSpacing - labelField heightIncludingBorder |
147 - ViewSpacing - labelField heightIncludingBorder |
147 - ViewSpacing - enterField heightIncludingBorder |
148 - ViewSpacing - enterField heightIncludingBorder |
148 - buttonPanel heightIncludingBorder - ViewSpacing |
149 - buttonPanel heightIncludingBorder - ViewSpacing |
149 - space2) |
150 - space2) |
150 ]. |
151 ]. |
151 v leftInset:ViewSpacing//2; rightInset:ViewSpacing//2. |
152 v leftInset:halfSpace; rightInset:halfSpace. |
152 |
153 |
153 selectionList := v scrolledView. |
154 selectionList := v scrolledView. |
154 |
155 |
155 "self updateList." |
156 "self updateList." |
156 |
157 |
186 |
187 |
187 !ListSelectionBox methodsFor:'queries'! |
188 !ListSelectionBox methodsFor:'queries'! |
188 |
189 |
189 preferedExtent |
190 preferedExtent |
190 "return my prefered extent - thats the minimum size |
191 "return my prefered extent - thats the minimum size |
191 to make everything visible" |
192 I like to have, to make everything visible" |
192 |
193 |
193 |wWanted hWanted| |
194 |wWanted hWanted| |
|
195 |
194 |
196 |
195 wWanted := labelField width + ViewSpacing + ViewSpacing. |
197 wWanted := labelField width + ViewSpacing + ViewSpacing. |
196 (wWanted > width) ifFalse:[ |
198 (wWanted > width) ifFalse:[ |
197 wWanted := width |
199 wWanted := width |
198 ]. |
200 ]. |
|
201 |
199 hWanted := ViewSpacing + labelField height + |
202 hWanted := ViewSpacing + labelField height + |
200 ViewSpacing + enterField height + |
203 ViewSpacing + enterField height + |
201 ViewSpacing + selectionList height + |
204 ViewSpacing + selectionList height + |
202 ViewSpacing + buttonPanel preferedExtent y + |
205 ViewSpacing + buttonPanel preferedExtent y + |
203 ViewSpacing. |
206 ViewSpacing - (ViewSpacing * 2). |
204 |
207 |
205 (hWanted < height) ifTrue:[ |
208 (hWanted < height) ifTrue:[ |
206 hWanted := height |
209 hWanted := height |
207 ]. |
210 ]. |
208 ^ (wWanted @ hWanted) |
211 ^ (wWanted @ hWanted) |