author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 14 Jun 2019 12:46:37 +0100 | |
branch | jv |
changeset 6069 | bc60050be743 |
parent 2767 | 42ea3925fe0e |
child 5646 | cebc9b5ad138 |
permissions | -rw-r--r-- |
1718 | 1 |
" |
2 |
COPYRIGHT (c) 1997 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 |
" |
|
12 |
||
13 |
||
14 |
||
1981 | 15 |
"{ Package: 'stx:libwidg2' }" |
16 |
||
1299 | 17 |
View subclass:#UpDownButton |
340
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
18 |
instanceVariableNames:'orientation upButton downButton' |
788
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
19 |
classVariableNames:'' |
338 | 20 |
poolDictionaries:'' |
21 |
category:'Views-Interactors' |
|
22 |
! |
|
23 |
||
24 |
!UpDownButton class methodsFor:'documentation'! |
|
25 |
||
1718 | 26 |
copyright |
27 |
" |
|
28 |
COPYRIGHT (c) 1997 eXept Software AG |
|
29 |
All Rights Reserved |
|
30 |
||
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
||
39 |
||
40 |
! |
|
41 |
||
338 | 42 |
documentation |
43 |
" |
|
44 |
an up/down button - simply two buttons in one view. |
|
1436 | 45 |
This is also called SpinButton. |
338 | 46 |
|
47 |
[author:] |
|
48 |
Claus Gittinger |
|
49 |
||
50 |
[see also:] |
|
51 |
ArrowButton |
|
52 |
ComboUpDownView |
|
53 |
" |
|
54 |
! |
|
55 |
||
56 |
examples |
|
57 |
" |
|
58 |
[exBegin] |
|
59 |
|top ud| |
|
60 |
||
61 |
top := StandardSystemView new. |
|
62 |
top extent:(300 @ 200). |
|
63 |
||
64 |
ud := UpDownButton in:top. |
|
65 |
ud origin:(10 @ 10). |
|
66 |
||
67 |
ud upAction:[Transcript showCR:'up']. |
|
68 |
ud downAction:[Transcript showCR:'down']. |
|
69 |
top open. |
|
70 |
[exEnd] |
|
340
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
71 |
|
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
72 |
[exBegin] |
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
73 |
|top ud| |
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
74 |
|
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
75 |
top := StandardSystemView new. |
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
76 |
top extent:(300 @ 200). |
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
77 |
|
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
78 |
ud := UpDownButton in:top. |
1299 | 79 |
ud origin:(10 @ 10). |
80 |
ud model:[:arg| Transcript showCR:arg]. |
|
81 |
top open. |
|
82 |
[exEnd] |
|
83 |
||
84 |
[exBegin] |
|
85 |
|top ud| |
|
86 |
||
87 |
top := StandardSystemView new. |
|
88 |
top extent:(300 @ 200). |
|
89 |
||
90 |
ud := UpDownButton in:top. |
|
340
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
91 |
ud orientation:#horizontal. |
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
92 |
ud origin:(10 @ 10). |
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
93 |
|
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
94 |
ud upAction:[Transcript showCR:'up']. |
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
95 |
ud downAction:[Transcript showCR:'down']. |
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
96 |
top open. |
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
97 |
[exEnd] |
338 | 98 |
" |
99 |
||
100 |
! ! |
|
101 |
||
102 |
!UpDownButton methodsFor:'accessing-behavior'! |
|
103 |
||
104 |
downAction:aBlock |
|
899 | 105 |
"set the down-action" |
788
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
106 |
|
338 | 107 |
downButton action:aBlock |
108 |
! |
|
109 |
||
1299 | 110 |
enabled |
111 |
||
112 |
^ upButton enabled. |
|
113 |
||
114 |
"Created: / 30.3.1999 / 17:01:43 / stefan" |
|
115 |
! |
|
818 | 116 |
|
1299 | 117 |
enabled:aBoolean |
118 |
||
119 |
upButton enabled:aBoolean. |
|
120 |
downButton enabled:aBoolean. |
|
121 |
||
122 |
"Created: / 30.3.1999 / 15:47:11 / stefan" |
|
818 | 123 |
! |
124 |
||
338 | 125 |
upAction:aBlock |
899 | 126 |
"set the up-action" |
788
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
127 |
|
338 | 128 |
upButton action:aBlock |
129 |
! ! |
|
130 |
||
818 | 131 |
!UpDownButton methodsFor:'accessing-channels'! |
132 |
||
133 |
backgroundChannel |
|
899 | 134 |
"return a valueHolder for the background color" |
818 | 135 |
|
899 | 136 |
^ upButton backgroundChannel |
818 | 137 |
! |
138 |
||
139 |
backgroundChannel: aValueHolder |
|
899 | 140 |
"set a valueHolder for the background color" |
818 | 141 |
|
142 |
upButton backgroundChannel: aValueHolder. |
|
143 |
downButton backgroundChannel: aValueHolder |
|
144 |
! |
|
145 |
||
146 |
enableChannel |
|
899 | 147 |
"return a valueHolder for the enabled-state" |
818 | 148 |
|
1299 | 149 |
^ upButton enableChannel |
150 |
||
151 |
"Modified: / 30.3.1999 / 16:56:32 / stefan" |
|
818 | 152 |
! |
153 |
||
154 |
enableChannel: aValueHolder |
|
899 | 155 |
"set a valueHolder for the enabled-state" |
818 | 156 |
|
157 |
upButton enableChannel: aValueHolder. |
|
158 |
downButton enableChannel: aValueHolder |
|
159 |
! |
|
160 |
||
161 |
foregroundChannel |
|
899 | 162 |
"return a valueHolder for the foreground color" |
818 | 163 |
|
899 | 164 |
^ upButton foregroundChannel |
818 | 165 |
! |
166 |
||
167 |
foregroundChannel: aValueHolder |
|
899 | 168 |
"set a valueHolder for the foreground color" |
818 | 169 |
|
170 |
upButton foregroundChannel: aValueHolder. |
|
171 |
downButton foregroundChannel: aValueHolder |
|
1299 | 172 |
! |
173 |
||
174 |
model:aModel |
|
175 |
||
176 |
|m| |
|
177 |
||
178 |
aModel notNil ifTrue:[ |
|
179 |
m := self. |
|
180 |
upButton changeMessage:#changeUp:. |
|
181 |
downButton changeMessage:#changeDown:. |
|
182 |
]. |
|
183 |
upButton model:m. |
|
184 |
downButton model:m. |
|
185 |
^ super model:aModel |
|
186 |
||
187 |
"Modified: / 30.3.1999 / 17:45:59 / stefan" |
|
818 | 188 |
! ! |
189 |
||
190 |
!UpDownButton methodsFor:'accessing-colors'! |
|
191 |
||
192 |
backgroundColor |
|
899 | 193 |
"return the backgroundColor" |
818 | 194 |
|
852 | 195 |
^upButton backgroundColor |
818 | 196 |
|
197 |
! |
|
198 |
||
199 |
backgroundColor:aColor |
|
899 | 200 |
"set the backgroundColor" |
818 | 201 |
|
202 |
aColor ~~ upButton backgroundColor ifTrue:[ |
|
203 |
upButton backgroundColor:aColor. |
|
204 |
downButton backgroundColor:aColor. |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2212
diff
changeset
|
205 |
self invalidateRepairNow:true |
818 | 206 |
] |
912
e4b45ee7df6d
redrawNow, when colors change.
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
207 |
|
e4b45ee7df6d
redrawNow, when colors change.
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
208 |
"Modified: / 6.6.1998 / 19:53:50 / cg" |
818 | 209 |
! |
210 |
||
211 |
foregroundColor |
|
899 | 212 |
"return the foregroundColor" |
818 | 213 |
|
852 | 214 |
^upButton foregroundColor |
818 | 215 |
|
216 |
! |
|
217 |
||
218 |
foregroundColor:aColor |
|
899 | 219 |
"set the foregroundColor" |
818 | 220 |
|
221 |
aColor ~~ upButton foregroundColor ifTrue:[ |
|
222 |
upButton foregroundColor:aColor. |
|
223 |
downButton foregroundColor:aColor. |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2212
diff
changeset
|
224 |
self invalidateRepairNow:true |
818 | 225 |
] |
912
e4b45ee7df6d
redrawNow, when colors change.
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
226 |
|
e4b45ee7df6d
redrawNow, when colors change.
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
227 |
"Modified: / 6.6.1998 / 19:53:44 / cg" |
2212
db7871a125b7
viewBackground setting fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
228 |
! |
db7871a125b7
viewBackground setting fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
229 |
|
db7871a125b7
viewBackground setting fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
230 |
viewBackground:aColor |
db7871a125b7
viewBackground setting fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
231 |
upButton viewBackground:aColor. |
db7871a125b7
viewBackground setting fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
232 |
downButton viewBackground:aColor. |
db7871a125b7
viewBackground setting fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
233 |
super viewBackground:aColor. |
818 | 234 |
! ! |
235 |
||
338 | 236 |
!UpDownButton methodsFor:'accessing-components'! |
237 |
||
238 |
downButton |
|
899 | 239 |
"return the downButton" |
788
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
240 |
|
338 | 241 |
^ downButton |
242 |
! |
|
243 |
||
244 |
upButton |
|
899 | 245 |
"return the upButton" |
788
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
246 |
|
338 | 247 |
^ upButton |
248 |
! ! |
|
249 |
||
340
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
250 |
!UpDownButton methodsFor:'accessing-look'! |
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
251 |
|
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
252 |
orientation |
899 | 253 |
"return the orientation (a symbol)" |
788
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
254 |
|
340
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
255 |
^ orientation |
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
256 |
! |
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
257 |
|
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
258 |
orientation:aSymbol |
899 | 259 |
"set the orientation (#horizontal or #vertical)" |
788
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
260 |
|
340
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
261 |
orientation := aSymbol. |
788
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
262 |
|
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
263 |
self initializeButtonDimensions. |
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
264 |
self initializeButtonForms |
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
265 |
! ! |
340
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
266 |
|
788
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
267 |
!UpDownButton methodsFor:'change & update'! |
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
268 |
|
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
269 |
sizeChanged:how |
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
270 |
|
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
271 |
super sizeChanged:how. |
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
272 |
|
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
273 |
self initializeButtonDimensions |
340
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
274 |
! ! |
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
275 |
|
868 | 276 |
!UpDownButton methodsFor:'event handling'! |
277 |
||
1299 | 278 |
changeDown:aValue |
279 |
"down button was pressed, send to my model" |
|
280 |
||
281 |
self sendChangeMessageWith:#down |
|
282 |
||
283 |
"Modified: / 30.3.1999 / 17:28:50 / stefan" |
|
284 |
! |
|
285 |
||
286 |
changeUp:aValue |
|
287 |
"up button was pressed, send to my model" |
|
288 |
||
289 |
self sendChangeMessageWith:#up |
|
290 |
||
291 |
"Created: / 30.3.1999 / 17:28:26 / stefan" |
|
292 |
! |
|
293 |
||
868 | 294 |
keyPress:aKey x:x y:y |
295 |
"simulate a buttonPress/release" |
|
296 |
||
1985
1e21a6928dfb
stc does not understand + and - in resources.
Stefan Vogel <sv@exept.de>
parents:
1981
diff
changeset
|
297 |
<resource: #keyboard (#CursorRight #CursorUp #CursorLeft #CursorDown)> |
1981 | 298 |
|
299 |
|theButton theController| |
|
868 | 300 |
|
301 |
((aKey == #CursorUp) |
|
302 |
or:[aKey == #CursorRight |
|
303 |
or:[aKey == $+]]) ifTrue:[ |
|
304 |
theButton := upButton |
|
305 |
] ifFalse:[ |
|
306 |
((aKey == #CursorDown) |
|
307 |
or:[aKey == #CursorLeft |
|
308 |
or:[aKey == $-]]) ifTrue:[ |
|
309 |
theButton := downButton |
|
310 |
]. |
|
311 |
]. |
|
312 |
theButton notNil ifTrue:[ |
|
313 |
theController := theButton controller. |
|
314 |
theController pressed:true. |
|
315 |
theController pressed:false. |
|
316 |
^ self |
|
317 |
]. |
|
318 |
^ super keyPress:aKey x:x y:y |
|
319 |
||
320 |
"Created: / 21.4.1998 / 19:48:28 / cg" |
|
321 |
"Modified: / 21.4.1998 / 19:56:28 / cg" |
|
322 |
! ! |
|
323 |
||
1264 | 324 |
!UpDownButton methodsFor:'focus handling'! |
325 |
||
326 |
showFocus:explicit |
|
327 |
"display myself as having-focus" |
|
328 |
||
329 |
(upButton enabled or:[downButton enabled]) ifTrue: [ |
|
330 |
super showFocus:explicit |
|
331 |
] |
|
332 |
! ! |
|
333 |
||
338 | 334 |
!UpDownButton methodsFor:'initialization'! |
335 |
||
336 |
initialize |
|
788
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
337 |
|
340
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
338 |
orientation := #vertical. |
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
339 |
|
338 | 340 |
super initialize. |
341 |
self initializeButtons |
|
340
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
342 |
! |
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
343 |
|
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
344 |
initializeButtonDimensions |
899 | 345 |
|upOrigin downOrigin upCorner downCorner| |
788
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
346 |
|
340
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
347 |
orientation == #vertical ifTrue:[ |
1435
6343d644bf32
oops - up/down was reversed when orientation==horizontal
Claus Gittinger <cg@exept.de>
parents:
1299
diff
changeset
|
348 |
upOrigin := 0@0. |
899 | 349 |
upCorner := (width - 1) @ (height // 2). |
350 |
downOrigin := 0 @ (height // 2 + 1). |
|
351 |
downCorner := (width - 1) @ (height - 1) |
|
340
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
352 |
] ifFalse:[ |
1435
6343d644bf32
oops - up/down was reversed when orientation==horizontal
Claus Gittinger <cg@exept.de>
parents:
1299
diff
changeset
|
353 |
downOrigin := 0@0. |
6343d644bf32
oops - up/down was reversed when orientation==horizontal
Claus Gittinger <cg@exept.de>
parents:
1299
diff
changeset
|
354 |
downCorner := (width // 2) @ (height - 1). |
6343d644bf32
oops - up/down was reversed when orientation==horizontal
Claus Gittinger <cg@exept.de>
parents:
1299
diff
changeset
|
355 |
upOrigin := (width // 2 + 1) @ 0. |
6343d644bf32
oops - up/down was reversed when orientation==horizontal
Claus Gittinger <cg@exept.de>
parents:
1299
diff
changeset
|
356 |
upCorner := (width - 1) @ (height - 1) |
899 | 357 |
]. |
358 |
||
359 |
upButton origin:upOrigin. |
|
360 |
upButton corner:upCorner. |
|
361 |
downButton origin:downOrigin. |
|
362 |
downButton corner:downCorner. |
|
363 |
||
788
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
364 |
! |
340
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
365 |
|
788
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
366 |
initializeButtonForms |
2175
b7388c30badf
always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
367 |
|upLabel downLabel upPref downPref prefW prefH| |
788
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
368 |
|
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
369 |
orientation == #vertical ifTrue:[ |
2175
b7388c30badf
always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
370 |
upLabel := ArrowButton defaultWIN32ArrowButtonFormForDirection:#up onDevice:nil. |
b7388c30badf
always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
371 |
downLabel := ArrowButton defaultWIN32ArrowButtonFormForDirection:#down onDevice:nil. |
788
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
372 |
] ifFalse:[ |
2175
b7388c30badf
always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
373 |
downLabel := ArrowButton defaultWIN32ArrowButtonFormForDirection:#left onDevice:nil. |
b7388c30badf
always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
374 |
upLabel := ArrowButton defaultWIN32ArrowButtonFormForDirection:#right onDevice:nil. |
340
c02e5db9b6f5
added left-right orientation.
Claus Gittinger <cg@exept.de>
parents:
338
diff
changeset
|
375 |
]. |
899 | 376 |
upButton label:upLabel. |
377 |
downButton label:downLabel. |
|
378 |
||
2175
b7388c30badf
always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
379 |
upPref := upButton preferredExtent. |
b7388c30badf
always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
380 |
downPref := downButton preferredExtent. |
b7388c30badf
always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
381 |
|
b7388c30badf
always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
382 |
orientation == #vertical ifTrue:[ |
b7388c30badf
always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
383 |
prefW := upPref x max:(downPref x). |
b7388c30badf
always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
384 |
prefH := upPref y + (downPref y). |
b7388c30badf
always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
385 |
] ifFalse:[ |
b7388c30badf
always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
386 |
prefW := upPref x + (downPref x). |
b7388c30badf
always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
387 |
prefH := upPref y max: (downPref y). |
b7388c30badf
always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
388 |
]. |
b7388c30badf
always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
389 |
|
b7388c30badf
always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents:
1985
diff
changeset
|
390 |
self preferredExtent:prefW@prefH. |
338 | 391 |
! |
392 |
||
393 |
initializeButtons |
|
2767
42ea3925fe0e
u/dButtons form is independent of viewStyle
Claus Gittinger <cg@exept.de>
parents:
2659
diff
changeset
|
394 |
upButton := Button in:self "ArrowButton upIn:self". |
338 | 395 |
upButton autoRepeat:true. |
396 |
||
2767
42ea3925fe0e
u/dButtons form is independent of viewStyle
Claus Gittinger <cg@exept.de>
parents:
2659
diff
changeset
|
397 |
downButton := Button in:self "ArrowButton downIn:self". |
338 | 398 |
downButton autoRepeat:true. |
399 |
||
788
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
400 |
self initializeButtonDimensions. |
826f9374823b
take forms from the ArrowButton + resizing behavior added
tz
parents:
779
diff
changeset
|
401 |
self initializeButtonForms |
338 | 402 |
! ! |
403 |
||
404 |
!UpDownButton class methodsFor:'documentation'! |
|
405 |
||
406 |
version |
|
2767
42ea3925fe0e
u/dButtons form is independent of viewStyle
Claus Gittinger <cg@exept.de>
parents:
2659
diff
changeset
|
407 |
^ '$Header: /cvs/stx/stx/libwidg2/UpDownButton.st,v 1.22 2004-10-26 10:52:24 cg Exp $' |
338 | 408 |
! ! |