author | ca |
Wed, 18 Jul 2007 15:48:19 +0200 | |
changeset 3238 | c3834ec3a914 |
parent 3236 | 4e8b01660a5c |
child 3247 | 5037a80ce9fe |
permissions | -rw-r--r-- |
1301
93a3ec8c339c
OOPS - stefan what happened to your checkin (garbage)
Claus Gittinger <cg@exept.de>
parents:
1294
diff
changeset
|
1 |
" |
332 | 2 |
COPYRIGHT (c) 1996 by eXept Software AG / Claus Gittinger |
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 |
" |
|
1884
bf33562ea53b
use rootWindowId (save a message send)
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
12 |
"{ Package: 'stx:libwidg2' }" |
bf33562ea53b
use rootWindowId (save a message send)
Claus Gittinger <cg@exept.de>
parents:
1696
diff
changeset
|
13 |
|
129 | 14 |
View subclass:#ComboView |
2892 | 15 |
instanceVariableNames:'field pullDownButton list listHolder listMsg action resizableMenu' |
2950 | 16 |
classVariableNames:'DefaultButtonForm ComboButtonForms' |
1306
56e90a9e5da1
renambe #enableStateChange to #enableStateChanged
Claus Gittinger <cg@exept.de>
parents:
1301
diff
changeset
|
17 |
poolDictionaries:'' |
56e90a9e5da1
renambe #enableStateChange to #enableStateChanged
Claus Gittinger <cg@exept.de>
parents:
1301
diff
changeset
|
18 |
category:'Views-Interactors' |
129 | 19 |
! |
20 |
||
263
865b7d99d3f5
added an example for a menu-pull-hook
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
21 |
!ComboView class methodsFor:'documentation'! |
129 | 22 |
|
332 | 23 |
copyright |
24 |
" |
|
25 |
COPYRIGHT (c) 1996 by eXept Software AG / Claus Gittinger |
|
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 |
||
37 |
! |
|
38 |
||
129 | 39 |
documentation |
40 |
" |
|
41 |
A ComboView combines some field (typically an enterField or Label) |
|
42 |
with a drop down list of default inputs; |
|
43 |
ComboView is abstract, providing protocol common to ComboBoxView and |
|
44 |
ComboListView. See documentation & examples there. |
|
274
92b51554b1d7
allow form to be specified by styleSheet
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
45 |
|
92b51554b1d7
allow form to be specified by styleSheet
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
46 |
[author:] |
92b51554b1d7
allow form to be specified by styleSheet
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
47 |
Claus Gittinger |
92b51554b1d7
allow form to be specified by styleSheet
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
48 |
|
92b51554b1d7
allow form to be specified by styleSheet
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
49 |
[see also:] |
92b51554b1d7
allow form to be specified by styleSheet
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
50 |
PopUpList |
1281 | 51 |
ComboListView ComboBoxView ExtendedComboBox |
274
92b51554b1d7
allow form to be specified by styleSheet
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
52 |
PullDownMenu Label EntryField |
129 | 53 |
" |
54 |
! |
|
55 |
||
56 |
examples |
|
57 |
" |
|
308 | 58 |
see examples in ComboListView and ComboBoxView |
129 | 59 |
" |
60 |
! ! |
|
61 |
||
263
865b7d99d3f5
added an example for a menu-pull-hook
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
62 |
!ComboView class methodsFor:'defaults'! |
129 | 63 |
|
64 |
buttonForm |
|
282 | 65 |
"return the pull-buttons image" |
66 |
||
1344
100e4d309847
support for disabled-image in pull-button
Claus Gittinger <cg@exept.de>
parents:
1334
diff
changeset
|
67 |
<resource: #style (#'comboView.downForm' |
100e4d309847
support for disabled-image in pull-button
Claus Gittinger <cg@exept.de>
parents:
1334
diff
changeset
|
68 |
#'comboView.downFormFile')> |
274
92b51554b1d7
allow form to be specified by styleSheet
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
69 |
|
276
8f90ed6c37bc
allow either fileName or form to be given by styleSheet
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
70 |
|fileName form| |
129 | 71 |
|
525 | 72 |
DefaultButtonForm notNil ifTrue:[ |
73 |
^ DefaultButtonForm |
|
74 |
]. |
|
75 |
||
1334 | 76 |
form := StyleSheet at:#'comboView.downForm'. |
274
92b51554b1d7
allow form to be specified by styleSheet
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
77 |
form isNil ifTrue:[ |
1334 | 78 |
fileName := StyleSheet at:#'comboView.downFormFile' "default:'ComboDn.14.xbm'". |
1622
ea4d9baf568f
try bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
1560
diff
changeset
|
79 |
fileName notNil ifTrue:[ |
1633 | 80 |
form := Smalltalk imageFromFileNamed:fileName forClass:self. |
2174
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
81 |
form isNil ifTrue:[ |
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
82 |
form := Smalltalk imageFromFileNamed:fileName inPackage:'stx:libwidg'. |
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
83 |
] |
1622
ea4d9baf568f
try bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
1560
diff
changeset
|
84 |
]. |
274
92b51554b1d7
allow form to be specified by styleSheet
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
85 |
]. |
92b51554b1d7
allow form to be specified by styleSheet
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
86 |
form isNil ifTrue:[ |
605 | 87 |
form := Form width:12 height:12 |
274
92b51554b1d7
allow form to be specified by styleSheet
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
88 |
fromArray:#[2r00000000 2r00000000 |
605 | 89 |
"/ 2r00001111 2r00000000 |
90 |
"/ 2r00001111 2r00000000 |
|
91 |
2r00001111 2r00000000 |
|
92 |
2r00001111 2r00000000 |
|
93 |
2r00001111 2r00000000 |
|
94 |
2r01111111 2r11100000 |
|
95 |
2r00111111 2r11000000 |
|
96 |
2r00011111 2r10000000 |
|
97 |
2r00001111 2r00000000 |
|
98 |
2r00000110 2r00000000 |
|
274
92b51554b1d7
allow form to be specified by styleSheet
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
99 |
2r00000000 2r00000000 |
605 | 100 |
2r01111111 2r11100000 |
274
92b51554b1d7
allow form to be specified by styleSheet
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
101 |
2r00000000 2r00000000] |
3231
5dd5dd610d50
Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents:
2950
diff
changeset
|
102 |
onDevice:Display. |
274
92b51554b1d7
allow form to be specified by styleSheet
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
103 |
]. |
92b51554b1d7
allow form to be specified by styleSheet
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
104 |
form notNil ifTrue:[ |
525 | 105 |
form := DefaultButtonForm := form onDevice:Display. |
106 |
^ form |
|
274
92b51554b1d7
allow form to be specified by styleSheet
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
107 |
]. |
92b51554b1d7
allow form to be specified by styleSheet
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
108 |
^ nil |
92b51554b1d7
allow form to be specified by styleSheet
Claus Gittinger <cg@exept.de>
parents:
269
diff
changeset
|
109 |
|
1344
100e4d309847
support for disabled-image in pull-button
Claus Gittinger <cg@exept.de>
parents:
1334
diff
changeset
|
110 |
"Modified: / 28.4.1999 / 12:49:42 / cg" |
304 | 111 |
! |
112 |
||
2174
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
113 |
comboButtonFor:anInstance |
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
114 |
<resource: #style (#'comboView.disabledDownForm' |
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
115 |
#'comboView.disabledDownFormFile' |
2176 | 116 |
#'comboView.activeDownFormFile' |
117 |
#'comboView.button.activeForegroundColor' |
|
118 |
#'comboView.button.activeBackgroundColor' |
|
2174
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
119 |
#'comboView.button.activeLevel' |
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
120 |
#'comboView.button.passiveLevel' )> |
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
121 |
|
2176 | 122 |
|pullDownButton fn logo disabledLogo activeLogo enteredLogo lvl clr| |
2174
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
123 |
|
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
124 |
pullDownButton := ComboBoxButton in:anInstance. |
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
125 |
pullDownButton controller beTriggerOnDown. |
2785
3c705bdd5792
Do not use obsolete message #logo:
Stefan Vogel <sv@exept.de>
parents:
2750
diff
changeset
|
126 |
pullDownButton label:(logo := self buttonForm). |
2174
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
127 |
|
2950 | 128 |
ComboButtonForms isNil ifTrue:[ |
129 |
ComboButtonForms := IdentityDictionary new. |
|
130 |
]. |
|
131 |
||
132 |
disabledLogo := ComboButtonForms at:disabledLogo ifAbsentPut:[|logo| |
|
133 |
logo := StyleSheet at:#'comboView.disabledDownForm'. |
|
134 |
||
135 |
logo isNil ifTrue:[ |
|
136 |
fn := StyleSheet at:#'comboView.disabledDownFormFile'. |
|
137 |
fn notNil ifTrue:[ |
|
138 |
logo := Smalltalk imageFromFileNamed:fn forClass:self. |
|
139 |
logo isNil ifTrue:[ |
|
140 |
logo := Smalltalk imageFromFileNamed:fn inPackage:'stx:libwidg'. |
|
141 |
] |
|
2176 | 142 |
] |
2950 | 143 |
]. |
144 |
logo |
|
2174
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
145 |
]. |
2950 | 146 |
|
147 |
activeLogo := ComboButtonForms at:#activeLogo ifAbsentPut:[|logo| |
|
148 |
logo := StyleSheet at:#'comboView.activeDownForm'. |
|
149 |
||
150 |
logo isNil ifTrue:[ |
|
151 |
fn := StyleSheet at:#'comboView.activeDownFormFile'. |
|
152 |
fn notNil ifTrue:[ |
|
153 |
logo := Smalltalk imageFromFileNamed:fn forClass:self. |
|
154 |
logo isNil ifTrue:[ |
|
155 |
logo := Smalltalk imageFromFileNamed:fn inPackage:'stx:libwidg'. |
|
156 |
] |
|
157 |
] |
|
158 |
]. |
|
159 |
logo |
|
160 |
]. |
|
161 |
||
162 |
enteredLogo := ComboButtonForms at:#enteredLogo ifAbsentPut:[|logo| |
|
163 |
logo := StyleSheet at:#'comboView.enteredDownForm'. |
|
164 |
||
165 |
logo isNil ifTrue:[ |
|
166 |
fn := StyleSheet at:#'comboView.enteredDownFormFile'. |
|
167 |
fn notNil ifTrue:[ |
|
168 |
logo := Smalltalk imageFromFileNamed:fn forClass:self. |
|
169 |
logo isNil ifTrue:[ |
|
170 |
logo := Smalltalk imageFromFileNamed:fn inPackage:'stx:libwidg'. |
|
171 |
] |
|
172 |
] |
|
173 |
]. |
|
174 |
logo |
|
175 |
]. |
|
176 |
||
2176 | 177 |
disabledLogo notNil ifTrue:[ |
178 |
pullDownButton passiveLogo:logo. |
|
179 |
pullDownButton activeLogo:logo. |
|
180 |
pullDownButton disabledLogo:disabledLogo. |
|
2174
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
181 |
]. |
2950 | 182 |
|
2174
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
183 |
pullDownButton showLamp:false. |
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
184 |
|
2176 | 185 |
activeLogo notNil ifTrue:[ |
186 |
pullDownButton activeLogo:activeLogo. |
|
187 |
pullDownButton passiveLogo:logo. |
|
2785
3c705bdd5792
Do not use obsolete message #logo:
Stefan Vogel <sv@exept.de>
parents:
2750
diff
changeset
|
188 |
pullDownButton label:logo. |
2176 | 189 |
]. |
190 |
||
191 |
enteredLogo notNil ifTrue:[ |
|
192 |
pullDownButton enteredLogo:enteredLogo. |
|
193 |
]. |
|
194 |
||
2174
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
195 |
(lvl := StyleSheet at:#'comboView.button.activeLevel') notNil ifTrue:[ |
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
196 |
pullDownButton activeLevel:lvl |
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
197 |
]. |
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
198 |
(lvl := StyleSheet at:#'comboView.button.passiveLevel') notNil ifTrue:[ |
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
199 |
pullDownButton passiveLevel:lvl |
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
200 |
]. |
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
201 |
|
2176 | 202 |
(clr := StyleSheet colorAt:#'comboView.button.activeForegroundColor') notNil ifTrue:[ |
203 |
pullDownButton activeForegroundColor:clr |
|
204 |
]. |
|
205 |
(clr := StyleSheet colorAt:#'comboView.button.activeBackgroundColor') notNil ifTrue:[ |
|
206 |
pullDownButton activeBackgroundColor:clr |
|
207 |
]. |
|
208 |
||
2174
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
209 |
pullDownButton activeLevel == pullDownButton passiveLevel ifTrue:[ |
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
210 |
pullDownButton activeLevel:0. |
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
211 |
]. |
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
212 |
^ pullDownButton. |
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
213 |
! |
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
214 |
|
415 | 215 |
defaultFont |
216 |
"/ for now - should come from the styleSheet |
|
217 |
||
218 |
^ SelectionInListView defaultFont. |
|
219 |
||
220 |
"Created: 4.6.1997 / 15:44:17 / cg" |
|
221 |
! |
|
222 |
||
304 | 223 |
defaultListMessage |
224 |
^ #list |
|
225 |
||
226 |
"Created: 26.2.1997 / 19:34:50 / cg" |
|
605 | 227 |
! |
228 |
||
229 |
updateStyleCache |
|
2950 | 230 |
DefaultButtonForm := ComboButtonForms := nil. |
605 | 231 |
|
232 |
"Created: / 3.11.1997 / 15:28:48 / cg" |
|
304 | 233 |
! ! |
234 |
||
235 |
!ComboView methodsFor:'accessing-behavior'! |
|
236 |
||
237 |
action:aBlock |
|
238 |
"specify, a block, which is evaluated when the lists selection changes. |
|
239 |
This is an additional hook - normally, you would communicate with the model |
|
240 |
alone" |
|
241 |
||
242 |
action := aBlock. |
|
243 |
||
244 |
"Created: 26.7.1996 / 17:44:18 / cg" |
|
245 |
"Modified: 26.2.1997 / 19:37:18 / cg" |
|
411 | 246 |
! |
247 |
||
248 |
enabled |
|
2892 | 249 |
"return true, if is enabled" |
250 |
||
1207 | 251 |
enableChannel isNil ifTrue:[^ true]. |
1294 | 252 |
^ enableChannel value |
253 |
! |
|
254 |
||
255 |
enabled:aBoolean |
|
256 |
"enable/disable components" |
|
257 |
||
258 |
self enableChannel value:aBoolean. |
|
259 |
||
260 |
"Modified: / 30.3.1999 / 14:56:18 / stefan" |
|
2892 | 261 |
! |
262 |
||
263 |
resizableMenu |
|
264 |
"return true, if the menu is to be resizable. |
|
265 |
This feature is as yet unimplemented." |
|
266 |
||
267 |
^ resizableMenu ? false |
|
268 |
! |
|
269 |
||
270 |
resizableMenu:aBoolean |
|
271 |
"enable/disable, if the menu is to be resizable. |
|
272 |
This feature is as yet unimplemented." |
|
273 |
||
274 |
resizableMenu := aBoolean |
|
411 | 275 |
! ! |
276 |
||
277 |
!ComboView methodsFor:'accessing-channels'! |
|
278 |
||
279 |
enableChannel |
|
2892 | 280 |
"return a valueHolder for enable/disable" |
281 |
||
1207 | 282 |
enableChannel isNil ifTrue:[ |
1294 | 283 |
self enableChannel:(true asValue). |
411 | 284 |
]. |
1207 | 285 |
^ enableChannel |
411 | 286 |
|
1294 | 287 |
"Modified: / 30.3.1999 / 16:20:25 / stefan" |
129 | 288 |
! ! |
289 |
||
290 |
!ComboView methodsFor:'accessing-components'! |
|
291 |
||
1560 | 292 |
field |
293 |
"return the field (input or label) component. |
|
294 |
For knowledgable users only." |
|
295 |
||
296 |
^ field |
|
297 |
||
298 |
"Created: / 26.9.1999 / 13:33:15 / cg" |
|
299 |
! |
|
300 |
||
129 | 301 |
menuButton |
302 |
"return the menuButton component" |
|
303 |
||
304 |
^ pullDownButton |
|
305 |
||
306 |
"Created: 28.2.1996 / 15:03:14 / cg" |
|
307 |
! ! |
|
308 |
||
309 |
!ComboView methodsFor:'accessing-contents'! |
|
310 |
||
181 | 311 |
contents |
304 | 312 |
"get the contents of my field" |
313 |
||
181 | 314 |
^ field model value |
315 |
||
316 |
"Created: 14.5.1996 / 13:05:16 / cg" |
|
304 | 317 |
"Modified: 26.2.1997 / 16:55:43 / cg" |
181 | 318 |
! |
319 |
||
320 |
contents:something |
|
304 | 321 |
"set the contents of my field; questionable" |
322 |
||
214 | 323 |
|m| |
324 |
||
325 |
(m := field model) notNil ifTrue:[ |
|
304 | 326 |
m value:something |
214 | 327 |
] |
181 | 328 |
|
329 |
"Created: 14.5.1996 / 13:05:33 / cg" |
|
304 | 330 |
"Modified: 26.2.1997 / 16:56:08 / cg" |
181 | 331 |
! |
332 |
||
889
7879fffb4810
oops #list returned wrong list
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
333 |
list |
7879fffb4810
oops #list returned wrong list
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
334 |
"return the list" |
7879fffb4810
oops #list returned wrong list
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
335 |
|
7879fffb4810
oops #list returned wrong list
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
336 |
^ list |
7879fffb4810
oops #list returned wrong list
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
337 |
|
7879fffb4810
oops #list returned wrong list
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
338 |
"Created: / 18.5.1998 / 18:58:08 / cg" |
7879fffb4810
oops #list returned wrong list
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
339 |
! |
7879fffb4810
oops #list returned wrong list
Claus Gittinger <cg@exept.de>
parents:
869
diff
changeset
|
340 |
|
129 | 341 |
list:aList |
304 | 342 |
"set the list explicitely; used internally or |
343 |
to be send from the outside if no model/listHolder is used." |
|
344 |
||
129 | 345 |
list := aList. |
2477 | 346 |
(list isNil or:[list isSequenceable]) ifFalse:[ |
2474 | 347 |
self error:'Need an ordered collection' mayProceed:true. |
348 |
]. |
|
1306
56e90a9e5da1
renambe #enableStateChange to #enableStateChanged
Claus Gittinger <cg@exept.de>
parents:
1301
diff
changeset
|
349 |
self enableStateChanged. |
1294 | 350 |
|
351 |
"Modified: / 30.3.1999 / 14:17:38 / stefan" |
|
129 | 352 |
! ! |
353 |
||
853 | 354 |
!ComboView methodsFor:'accessing-look'! |
355 |
||
356 |
backgroundColor |
|
357 |
||
358 |
^field backgroundColor |
|
359 |
! |
|
360 |
||
361 |
backgroundColor:aColor |
|
362 |
||
363 |
field backgroundColor:aColor |
|
364 |
! |
|
365 |
||
366 |
font:aFont |
|
367 |
||
368 |
super font:aFont. |
|
1183
667132091c2f
ComboBox's inputField ought to use its default font.
Claus Gittinger <cg@exept.de>
parents:
1126
diff
changeset
|
369 |
self setFieldsFont:aFont. |
853 | 370 |
! |
371 |
||
372 |
foregroundColor |
|
373 |
||
374 |
^field foregroundColor |
|
375 |
! |
|
376 |
||
377 |
foregroundColor:aColor |
|
378 |
||
379 |
field foregroundColor:aColor |
|
380 |
! ! |
|
381 |
||
214 | 382 |
!ComboView methodsFor:'accessing-mvc'! |
383 |
||
277
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
384 |
listHolder:aValueHolder |
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
385 |
"set the listHolder. |
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
386 |
If not set, the list is supposed to be set explicitely" |
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
387 |
|
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
388 |
listHolder notNil ifTrue:[ |
304 | 389 |
listHolder removeDependent:self. |
277
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
390 |
]. |
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
391 |
listHolder := aValueHolder. |
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
392 |
listHolder notNil ifTrue:[ |
304 | 393 |
aValueHolder addDependent:self. |
277
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
394 |
]. |
304 | 395 |
realized ifTrue:[ |
396 |
self getListFromModel. |
|
397 |
] |
|
277
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
398 |
|
304 | 399 |
"Modified: 26.2.1997 / 19:32:09 / cg" |
277
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
400 |
! |
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
401 |
|
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
402 |
listMessage:aSymbol |
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
403 |
"define the message selector sent to the model, to fetch |
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
404 |
the list. If not defined, #list is used" |
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
405 |
|
304 | 406 |
listMsg := aSymbol |
277
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
407 |
|
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
408 |
"Created: 14.2.1997 / 19:16:52 / cg" |
304 | 409 |
"Modified: 26.2.1997 / 19:33:09 / cg" |
277
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
410 |
! |
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
411 |
|
214 | 412 |
model:aModel |
304 | 413 |
"set the model, which is supposed to provide the boxes value. |
414 |
If a listMessage was defined, it is also responsible for providing |
|
415 |
the list" |
|
416 |
||
214 | 417 |
super model:aModel. |
418 |
||
314
6ff49c930c71
fetch models value when a model is assigned;
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
419 |
self getListFromModel. |
6ff49c930c71
fetch models value when a model is assigned;
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
420 |
self getValueFromModel. |
304 | 421 |
|
314
6ff49c930c71
fetch models value when a model is assigned;
Claus Gittinger <cg@exept.de>
parents:
312
diff
changeset
|
422 |
"Modified: 28.2.1997 / 19:08:45 / cg" |
310 | 423 |
! ! |
424 |
||
425 |
!ComboView methodsFor:'change & update'! |
|
214 | 426 |
|
427 |
update:something with:aParameter from:changedObject |
|
1207 | 428 |
|
214 | 429 |
changedObject == model ifTrue:[ |
310 | 430 |
listHolder isNil ifTrue:[ |
431 |
self getListFromModel. |
|
432 |
]. |
|
433 |
self getValueFromModel. |
|
434 |
^ self |
|
214 | 435 |
]. |
310 | 436 |
changedObject == listHolder ifTrue:[ |
437 |
self getListFromModel. |
|
438 |
^ self |
|
439 |
]. |
|
440 |
||
214 | 441 |
super update:something with:aParameter from:changedObject |
442 |
||
1294 | 443 |
"Created: / 15.7.1996 / 12:26:49 / cg" |
444 |
"Modified: / 28.2.1997 / 13:48:51 / cg" |
|
445 |
"Modified: / 30.3.1999 / 14:17:55 / stefan" |
|
214 | 446 |
! ! |
447 |
||
869
a1838cce9641
popup menu on space or return
Claus Gittinger <cg@exept.de>
parents:
853
diff
changeset
|
448 |
!ComboView methodsFor:'event handling'! |
a1838cce9641
popup menu on space or return
Claus Gittinger <cg@exept.de>
parents:
853
diff
changeset
|
449 |
|
1306
56e90a9e5da1
renambe #enableStateChange to #enableStateChanged
Claus Gittinger <cg@exept.de>
parents:
1301
diff
changeset
|
450 |
enableStateChanged |
1294 | 451 |
"the enable state has changed - pass this to my field and pullDownButton" |
452 |
||
453 |
|msg| |
|
454 |
||
455 |
(enableChannel isNil or:[enableChannel value]) ifTrue:[ |
|
456 |
msg := #enable |
|
457 |
] ifFalse:[ |
|
458 |
msg := #disable |
|
459 |
]. |
|
460 |
field perform:msg ifNotUnderstood:nil. |
|
461 |
||
462 |
(list size == 0) ifTrue:[ |
|
463 |
msg := #disable |
|
464 |
]. |
|
465 |
pullDownButton perform:msg ifNotUnderstood:nil. |
|
466 |
||
467 |
"Modified: / 22.2.1999 / 00:47:46 / cg" |
|
468 |
"Modified: / 30.3.1999 / 14:17:10 / stefan" |
|
469 |
! |
|
470 |
||
869
a1838cce9641
popup menu on space or return
Claus Gittinger <cg@exept.de>
parents:
853
diff
changeset
|
471 |
keyPress:key x:x y:y |
2868 | 472 |
"pull the menu on space and return keys" |
473 |
||
2025 | 474 |
<resource: #keyboard (#Return)> |
475 |
||
2868 | 476 |
(key == Character space or:[key == #Return]) ifTrue:[ |
869
a1838cce9641
popup menu on space or return
Claus Gittinger <cg@exept.de>
parents:
853
diff
changeset
|
477 |
self pullMenu. |
a1838cce9641
popup menu on space or return
Claus Gittinger <cg@exept.de>
parents:
853
diff
changeset
|
478 |
^ self. |
a1838cce9641
popup menu on space or return
Claus Gittinger <cg@exept.de>
parents:
853
diff
changeset
|
479 |
]. |
a1838cce9641
popup menu on space or return
Claus Gittinger <cg@exept.de>
parents:
853
diff
changeset
|
480 |
|
a1838cce9641
popup menu on space or return
Claus Gittinger <cg@exept.de>
parents:
853
diff
changeset
|
481 |
^ super keyPress:key x:x y:y |
a1838cce9641
popup menu on space or return
Claus Gittinger <cg@exept.de>
parents:
853
diff
changeset
|
482 |
|
a1838cce9641
popup menu on space or return
Claus Gittinger <cg@exept.de>
parents:
853
diff
changeset
|
483 |
"Modified: / 21.4.1998 / 20:10:05 / cg" |
3236 | 484 |
! |
485 |
||
486 |
processEvent:anEvent |
|
487 |
|evView point x y| |
|
488 |
||
489 |
anEvent isButtonPressEvent ifFalse:[ |
|
490 |
^ false |
|
491 |
]. |
|
492 |
(field isNil or:[field shown not]) ifTrue:[ |
|
493 |
^ false |
|
494 |
]. |
|
495 |
(field isKeyboardConsumer and:[field isEnabled]) ifTrue:[ |
|
496 |
^ false |
|
497 |
]. |
|
498 |
evView := anEvent view. |
|
499 |
evView isNil ifTrue:[^ false]. |
|
500 |
||
501 |
point := Point x:(anEvent x) y:(anEvent y). |
|
502 |
||
503 |
evView ~~ field ifTrue:[ |
|
504 |
(evView isSameOrComponentOf:field) ifFalse:[ |
|
505 |
^ false |
|
506 |
]. |
|
507 |
point := device translatePoint:point fromView:evView toView:field. |
|
508 |
]. |
|
509 |
x := point x. |
|
510 |
(x between:0 and:field width) ifFalse:[^ false]. |
|
511 |
||
512 |
y := point y. |
|
513 |
(y between:0 and:field height) ifFalse:[^ false]. |
|
514 |
||
515 |
self pullMenu. |
|
516 |
^ true |
|
869
a1838cce9641
popup menu on space or return
Claus Gittinger <cg@exept.de>
parents:
853
diff
changeset
|
517 |
! ! |
a1838cce9641
popup menu on space or return
Claus Gittinger <cg@exept.de>
parents:
853
diff
changeset
|
518 |
|
2499 | 519 |
!ComboView methodsFor:'initialization & release'! |
129 | 520 |
|
3236 | 521 |
destroy |
522 |
|wgrp| |
|
523 |
||
524 |
(wgrp := self windowGroup) notNil ifTrue:[ |
|
525 |
wgrp removePreEventHook:self. |
|
526 |
]. |
|
527 |
super destroy. |
|
528 |
! |
|
529 |
||
129 | 530 |
initialize |
2750 | 531 |
|prefExt leftInset rightInset prefWidth halfSpacing nm lvl| |
129 | 532 |
|
533 |
super initialize. |
|
308 | 534 |
|
304 | 535 |
listMsg := self class defaultListMessage. |
536 |
aspectMsg := self class defaultAspectMessage. |
|
537 |
changeMsg := self class defaultChangeMessage. |
|
129 | 538 |
|
539 |
self initializeField. |
|
431 | 540 |
field origin:0@0 corner:1.0@1.0. |
2136 | 541 |
self shadowColor:(field shadowColor). |
129 | 542 |
|
331 | 543 |
self initializeButton. |
2174
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
544 |
pullDownButton pressAction:[self pullMenu]. |
280 | 545 |
prefExt := pullDownButton preferredExtent. |
546 |
prefWidth := prefExt x. |
|
547 |
||
129 | 548 |
pullDownButton origin:1.0@0.0 corner:1.0@1.0. |
217 | 549 |
styleSheet is3D ifTrue:[ |
280 | 550 |
halfSpacing := ViewSpacing // 2. |
551 |
leftInset := rightInset := prefWidth + halfSpacing. |
|
2750 | 552 |
(lvl := styleSheet at:#'comboView.level' default:nil) notNil ifTrue:[ |
553 |
self level:lvl. |
|
319 | 554 |
field level:0. |
555 |
field rightInset:margin. |
|
556 |
] ifFalse:[ |
|
557 |
pullDownButton rightInset:halfSpacing. |
|
558 |
field leftInset:halfSpacing |
|
559 |
]. |
|
217 | 560 |
] ifFalse:[ |
280 | 561 |
leftInset := prefWidth + pullDownButton borderWidth. |
562 |
rightInset := prefWidth. |
|
217 | 563 |
]. |
1125 | 564 |
|
1696
f1bae6d68ffe
eliminated styleSheet name = win95 queries
Claus Gittinger <cg@exept.de>
parents:
1633
diff
changeset
|
565 |
nm := styleSheet name. |
2750 | 566 |
(nm = #win95 or:[nm = #win98 or:[nm = #winXP or:[nm = #st80]]]) ifTrue:[ |
1125 | 567 |
field level:0. |
2750 | 568 |
lvl isNil ifTrue:[self level:-1]. |
1125 | 569 |
pullDownButton rightInset:0. |
1696
f1bae6d68ffe
eliminated styleSheet name = win95 queries
Claus Gittinger <cg@exept.de>
parents:
1633
diff
changeset
|
570 |
nm ~= #st80 ifTrue:[ |
1125 | 571 |
leftInset := (ArrowButton new preferredExtent x). |
1126 | 572 |
rightInset := leftInset. |
1125 | 573 |
]. |
574 |
field origin:0.0@0.0. |
|
2750 | 575 |
field leftInset:0. |
1125 | 576 |
"/ field topInset:1; bottomInset:1. |
2750 | 577 |
"/ nm = #winXP ifTrue:[ |
578 |
"/ self borderWidth:1. |
|
579 |
"/ self borderColor:(Color blue lightened). |
|
580 |
"/ ]. |
|
1125 | 581 |
]. |
1126 | 582 |
field rightInset:rightInset. |
280 | 583 |
pullDownButton leftInset:leftInset negated. |
129 | 584 |
|
247 | 585 |
self initialHeight:field preferredExtent y + ViewSpacing. |
129 | 586 |
" |
587 |
|b| |
|
588 |
||
589 |
b := ComboBoxView new. |
|
590 |
b list:#('hello' 'world' 'this' 'is' 'st/x'). |
|
591 |
b open |
|
592 |
" |
|
593 |
||
1125 | 594 |
"Created: / 28.2.1996 / 15:03:17 / cg" |
595 |
"Modified: / 8.9.1998 / 20:33:22 / cg" |
|
331 | 596 |
! |
597 |
||
598 |
initializeButton |
|
2174
ab242e29da64
button init code made publicly available
Claus Gittinger <cg@exept.de>
parents:
2157
diff
changeset
|
599 |
pullDownButton := self class comboButtonFor:self. |
331 | 600 |
pullDownButton disable. |
601 |
! |
|
602 |
||
603 |
initializeField |
|
604 |
self subclassResponsibility |
|
605 |
||
606 |
"Created: 29.3.1997 / 11:17:14 / cg" |
|
2157 | 607 |
! |
608 |
||
3236 | 609 |
realize |
3238 | 610 |
|pullMenuIfClickedOnField wgrp| |
3236 | 611 |
|
612 |
super realize. |
|
613 |
||
614 |
pullMenuIfClickedOnField := styleSheet at:#'comboView.pullMenuIfClickedOnField' |
|
615 |
default:[ OperatingSystem isMSWINDOWSlike ]. |
|
616 |
||
617 |
pullMenuIfClickedOnField == true ifTrue:[ |
|
3238 | 618 |
wgrp := self windowGroup. |
619 |
wgrp notNil ifTrue:[ wgrp addPreEventHook:self ]. |
|
3236 | 620 |
]. |
621 |
! |
|
622 |
||
2157 | 623 |
release |
624 |
listHolder notNil ifTrue:[ |
|
625 |
listHolder removeDependent:self. |
|
626 |
listHolder := nil. |
|
627 |
]. |
|
628 |
super release |
|
129 | 629 |
! ! |
630 |
||
2406 | 631 |
!ComboView methodsFor:'menu interaction'! |
632 |
||
633 |
createPullDownMenuForList:aList |
|
634 |
"pull the menu - triggered from the button" |
|
635 |
||
636 |
|menu index| |
|
637 |
||
638 |
menu := MenuPanel labels:aList. |
|
639 |
||
640 |
index := 1. |
|
641 |
||
642 |
menu do:[:el | |
|
643 |
el value:#select: argument:index. |
|
644 |
index := index + 1. |
|
645 |
]. |
|
646 |
menu receiver:self. |
|
647 |
menu font:font. |
|
648 |
menu preferredWidth:(self width). |
|
649 |
||
650 |
^ menu |
|
651 |
! |
|
652 |
||
653 |
pullMenu |
|
654 |
"pull the menu - triggered from the button" |
|
655 |
||
656 |
|menu origin| |
|
657 |
||
658 |
self getListFromModel. |
|
659 |
||
660 |
list notEmptyOrNil ifTrue:[ |
|
661 |
menu := self createPullDownMenuForList:list. |
|
662 |
origin := device translatePoint:(0 @ self height) fromView:self toView:nil. |
|
663 |
menu showAt:origin. |
|
664 |
]. |
|
665 |
||
666 |
pullDownButton turnOff. |
|
667 |
||
668 |
"Created: / 10.10.2001 / 14:47:25 / cg" |
|
669 |
"Modified: / 10.10.2001 / 15:04:44 / cg" |
|
670 |
! |
|
671 |
||
672 |
select:anIndex |
|
673 |
"sent from the popped menu, when an item was selected" |
|
674 |
||
675 |
self subclassResponsibility |
|
676 |
||
677 |
"Modified: 27.2.1997 / 15:19:07 / cg" |
|
678 |
! ! |
|
679 |
||
129 | 680 |
!ComboView methodsFor:'message delegation'! |
681 |
||
682 |
doesNotUnderstand:aMessage |
|
683 |
(field respondsTo:aMessage selector) ifTrue:[ |
|
1207 | 684 |
^ aMessage sendTo:field |
129 | 685 |
]. |
686 |
^ super doesNotUnderstand:aMessage |
|
687 |
||
688 |
"Created: 28.2.1996 / 15:03:17 / cg" |
|
689 |
"Modified: 28.2.1996 / 15:06:09 / cg" |
|
166 | 690 |
! |
691 |
||
2300 | 692 |
flash |
693 |
field flash |
|
694 |
! |
|
695 |
||
166 | 696 |
respondsTo:aSymbol |
697 |
^ (field respondsTo:aSymbol) or:[super respondsTo:aSymbol] |
|
698 |
||
699 |
"Created: 2.5.1996 / 16:57:34 / stefan" |
|
129 | 700 |
! ! |
701 |
||
214 | 702 |
!ComboView methodsFor:'private'! |
703 |
||
704 |
getListFromModel |
|
277
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
705 |
"fetch the list - either from the listHolder, or |
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
706 |
from the model. If no listMessage was defined, fetch it |
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
707 |
using #list." |
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
708 |
|
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
709 |
listHolder notNil ifTrue:[ |
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
710 |
self list:listHolder value |
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
711 |
] ifFalse:[ |
304 | 712 |
(model notNil and:[listMsg notNil]) ifTrue:[ |
713 |
(model respondsTo:listMsg) ifTrue:[ |
|
714 |
self list:(model perform:listMsg) |
|
277
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
715 |
] |
44eadbccc2b7
added support for a separate listHolder
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
716 |
] |
214 | 717 |
]. |
718 |
||
719 |
"Created: 15.7.1996 / 12:22:56 / cg" |
|
304 | 720 |
"Modified: 26.2.1997 / 19:40:58 / cg" |
214 | 721 |
! |
722 |
||
723 |
getValueFromModel |
|
724 |
||
725 |
"Modified: 15.7.1996 / 12:28:59 / cg" |
|
1183
667132091c2f
ComboBox's inputField ought to use its default font.
Claus Gittinger <cg@exept.de>
parents:
1126
diff
changeset
|
726 |
! |
667132091c2f
ComboBox's inputField ought to use its default font.
Claus Gittinger <cg@exept.de>
parents:
1126
diff
changeset
|
727 |
|
1210
55f2c4209f94
oops - only pull-button is disabled with empty list;
Claus Gittinger <cg@exept.de>
parents:
1207
diff
changeset
|
728 |
setFieldsFont:aFont |
55f2c4209f94
oops - only pull-button is disabled with empty list;
Claus Gittinger <cg@exept.de>
parents:
1207
diff
changeset
|
729 |
field font:aFont. |
214 | 730 |
! ! |
731 |
||
129 | 732 |
!ComboView methodsFor:'queries'! |
733 |
||
734 |
preferredExtent |
|
285 | 735 |
"compute & return the boxes preferredExtent from the components' preferrences" |
736 |
||
683 | 737 |
|fieldPref buttonPref m menuPrefX menuPrefY w h| |
129 | 738 |
|
312 | 739 |
"/ If I have an explicit preferredExtent .. |
740 |
||
741 |
preferredExtent notNil ifTrue:[ |
|
742 |
^ preferredExtent |
|
743 |
]. |
|
744 |
||
129 | 745 |
list isNil ifTrue:[ |
308 | 746 |
self getListFromModel |
747 |
]. |
|
748 |
||
749 |
list isNil ifTrue:[ |
|
683 | 750 |
menuPrefX := menuPrefY := 0 |
129 | 751 |
] ifFalse:[ |
1544 | 752 |
m := (MenuView onDevice:device ? Screen current) labels:list. |
302
8af5f51ce7a5
preferredExtent is sum of menu + button
Claus Gittinger <cg@exept.de>
parents:
285
diff
changeset
|
753 |
menuPrefX := m preferredExtent x. |
1348 | 754 |
|
755 |
"/ the menuView returns rubbish ... |
|
756 |
"/ menuPrefY := (m preferredExtentForLines:1 cols:10) y |
|
757 |
||
758 |
"/ any non-strings ? |
|
759 |
menuPrefY := list |
|
760 |
inject:('X' heightOn:self) |
|
761 |
into:[:max :el | el isString ifTrue:[ |
|
762 |
max |
|
763 |
] ifFalse:[ |
|
764 |
max max:(el heightOn:self) |
|
765 |
] |
|
766 |
]. |
|
129 | 767 |
]. |
768 |
||
302
8af5f51ce7a5
preferredExtent is sum of menu + button
Claus Gittinger <cg@exept.de>
parents:
285
diff
changeset
|
769 |
fieldPref := field preferredExtent. |
8af5f51ce7a5
preferredExtent is sum of menu + button
Claus Gittinger <cg@exept.de>
parents:
285
diff
changeset
|
770 |
buttonPref := pullDownButton preferredExtent. |
8af5f51ce7a5
preferredExtent is sum of menu + button
Claus Gittinger <cg@exept.de>
parents:
285
diff
changeset
|
771 |
|
319 | 772 |
w := ((fieldPref x max:menuPrefX) max:50) + buttonPref x. |
773 |
w := w + margin + margin. |
|
683 | 774 |
h := (fieldPref y max:buttonPref y) max:menuPrefY. |
319 | 775 |
h := h + margin + margin. |
776 |
^ w @ h |
|
129 | 777 |
|
1348 | 778 |
"Created: / 28.2.1996 / 15:03:17 / cg" |
779 |
"Modified: / 29.4.1999 / 11:27:54 / cg" |
|
129 | 780 |
! ! |
781 |
||
263
865b7d99d3f5
added an example for a menu-pull-hook
Claus Gittinger <cg@exept.de>
parents:
247
diff
changeset
|
782 |
!ComboView class methodsFor:'documentation'! |
129 | 783 |
|
784 |
version |
|
3238 | 785 |
^ '$Header: /cvs/stx/stx/libwidg2/ComboView.st,v 1.83 2007-07-18 13:48:19 ca Exp $' |
129 | 786 |
! ! |