author | Claus Gittinger <cg@exept.de> |
Thu, 25 Apr 1996 19:26:41 +0200 | |
changeset 585 | 8f395aba0173 |
parent 582 | e151eeae2c9a |
child 602 | 382d6e06cf1a |
permissions | -rw-r--r-- |
76 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by 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 |
" |
|
12 |
||
13 |
Controller subclass:#ButtonController |
|
262 | 14 |
instanceVariableNames:'enableChannel pressChannel releaseChannel pressed active entered |
220
635d3f583f61
fast repeat if shift is pressed
Claus Gittinger <cg@exept.de>
parents:
203
diff
changeset
|
15 |
isTriggerOnDown autoRepeat repeatBlock initialDelay repeatDelay |
635d3f583f61
fast repeat if shift is pressed
Claus Gittinger <cg@exept.de>
parents:
203
diff
changeset
|
16 |
pressActionBlock releaseActionBlock isToggle' |
262 | 17 |
classVariableNames:'' |
18 |
poolDictionaries:'' |
|
19 |
category:'Interface-Support-Controllers' |
|
76 | 20 |
! |
21 |
||
22 |
!ButtonController class methodsFor:'documentation'! |
|
23 |
||
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
37 |
||
38 |
documentation |
|
39 |
" |
|
40 |
ButtonControllers are used with buttons and handle all user interaction. |
|
41 |
These are automatically created when a Button is created, therefore no manual |
|
42 |
action is required for creation. |
|
133 | 43 |
In normal applications, you dont have to care for the controller; |
44 |
access to the controllers behavior is possible via messages to the button. |
|
125 | 45 |
(setting actions, controlling autorepeat etc.) |
76 | 46 |
|
133 | 47 |
See examples in the Button class. |
48 |
||
582 | 49 |
[Instance variables:] |
76 | 50 |
|
133 | 51 |
enableChannel <ValueHolder pressing is allowed (default: true) |
582 | 52 |
on Boolean> |
125 | 53 |
|
76 | 54 |
pressed <Boolean> true if currently pressed (read-only) |
125 | 55 |
|
76 | 56 |
entered <Boolean> true if the cursor is currently in this view |
125 | 57 |
|
118 | 58 |
isTriggerOnDown <Boolean> controls if the action should be executed on |
582 | 59 |
press or on release (default: on release). |
125 | 60 |
|
61 |
isToggle <Boolean> controls if the button should show toggle |
|
582 | 62 |
behavior (as opposed to one-shot behavior) |
125 | 63 |
|
76 | 64 |
pressActionBlock <Block> block to evaluate when pressed (default: noop) |
125 | 65 |
|
76 | 66 |
releaseActionBlock <Block> block to evaluate when released (default: noop) |
125 | 67 |
|
76 | 68 |
autoRepeat <Boolean> auto-repeats when pressed long enough (default: false) |
125 | 69 |
|
76 | 70 |
initialDelay <Number> seconds till first auto-repeat (default: 0.2) |
125 | 71 |
|
76 | 72 |
repeatDelay <Number> seconds of repeat intervall (default: 0.025) |
125 | 73 |
|
76 | 74 |
repeatBlock <Block> block evaluated for auto-repeat (internal) |
125 | 75 |
|
76 | 76 |
active <Boolean> true during action evaluation (internal) |
582 | 77 |
|
78 |
[author:] |
|
79 |
Claus Gittinger |
|
76 | 80 |
" |
81 |
! ! |
|
82 |
||
83 |
!ButtonController class methodsFor:'defaults'! |
|
84 |
||
85 |
defaultInitialDelay |
|
86 |
"when autorepeat is enabled, and button is not released, |
|
87 |
start repeating after initialDelay seconds" |
|
88 |
||
89 |
^ 0.2 |
|
200 | 90 |
! |
91 |
||
92 |
defaultRepeatDelay |
|
93 |
"when autorepeat is enabled, and button is not released, |
|
94 |
repeat every repeatDelay seconds" |
|
95 |
||
96 |
^ 0.025 |
|
76 | 97 |
! ! |
98 |
||
200 | 99 |
!ButtonController methodsFor:'accessing-behavior'! |
100 |
||
101 |
action:aBlock |
|
102 |
"convenient method: depending on the setting the triggerOnDown flag, |
|
347 | 103 |
either set the press-action & clear any release-action or |
200 | 104 |
vice versa, set the release-action and clear the press-action." |
76 | 105 |
|
200 | 106 |
isTriggerOnDown ifTrue:[ |
347 | 107 |
releaseActionBlock := nil. |
108 |
pressActionBlock := aBlock |
|
200 | 109 |
] ifFalse:[ |
347 | 110 |
releaseActionBlock := aBlock. |
111 |
pressActionBlock := nil |
|
200 | 112 |
] |
347 | 113 |
|
114 |
"Modified: 9.2.1996 / 22:41:22 / cg" |
|
200 | 115 |
! |
118 | 116 |
|
200 | 117 |
autoRepeat |
347 | 118 |
"turn on autorepeat. OBSOLETE; use #autoRepeat:" |
200 | 119 |
|
347 | 120 |
self autoRepeat:true. |
121 |
||
122 |
"Modified: 9.2.1996 / 22:42:46 / cg" |
|
118 | 123 |
! |
124 |
||
200 | 125 |
autoRepeat:aBoolean |
126 |
"turn on/off autorepeat" |
|
127 |
||
128 |
autoRepeat := aBoolean. |
|
129 |
repeatBlock := [self repeat] |
|
121 | 130 |
|
200 | 131 |
"Modified: 5.9.1995 / 22:06:00 / claus" |
132 |
! |
|
133 |
||
134 |
beToggle |
|
135 |
"make the receiver act like a toggle" |
|
136 |
||
137 |
isTriggerOnDown := true. |
|
138 |
isToggle := true |
|
121 | 139 |
! |
76 | 140 |
|
200 | 141 |
beTriggerOnDown |
142 |
"make the receiver act on button press" |
|
143 |
||
144 |
isTriggerOnDown := true |
|
145 |
! |
|
146 |
||
147 |
beTriggerOnUp |
|
148 |
"make the receiver act on button release" |
|
121 | 149 |
|
200 | 150 |
isTriggerOnDown := false |
151 |
! |
|
152 |
||
153 |
disable |
|
154 |
"disable the button" |
|
155 |
||
156 |
enableChannel value ifTrue:[ |
|
157 |
enableChannel value:false. |
|
158 |
"/ view redraw - not needed; I listen to enableChannel |
|
159 |
] |
|
121 | 160 |
! |
161 |
||
200 | 162 |
enable |
163 |
"enable the button" |
|
121 | 164 |
|
200 | 165 |
enableChannel value ifFalse:[ |
166 |
enableChannel value:true. |
|
167 |
"/ view redraw - not needed; I listen to enableChannel |
|
168 |
] |
|
76 | 169 |
! |
170 |
||
200 | 171 |
isTriggerOnDown |
172 |
"return true, if I trigger on press |
|
173 |
(in contrast to triggering on up, which is the default)" |
|
174 |
||
175 |
^ isTriggerOnDown |
|
176 |
! |
|
177 |
||
178 |
pressAction |
|
179 |
"return the pressAction; thats the block which gets evaluated |
|
180 |
when the button is pressed (if non-nil)" |
|
181 |
||
182 |
^ pressActionBlock |
|
183 |
! |
|
184 |
||
185 |
pressAction:aBlock |
|
186 |
"define the action to be performed on press" |
|
187 |
||
188 |
pressActionBlock := aBlock |
|
128 | 189 |
! |
190 |
||
200 | 191 |
releaseAction |
192 |
"return the releaseAction; thats the block which gets evaluated |
|
193 |
when the button is relreased (if non-nil)" |
|
194 |
||
195 |
^ releaseActionBlock |
|
196 |
! |
|
197 |
||
198 |
releaseAction:aBlock |
|
199 |
"define the action to be performed on release" |
|
200 |
||
201 |
releaseActionBlock := aBlock |
|
128 | 202 |
! |
203 |
||
200 | 204 |
triggerOnDown:aBoolean |
205 |
"set/clear the flag which controls if the action block is to be evaluated |
|
206 |
on press or on release. |
|
207 |
(see also ST-80 compatibility methods beTriggerOn*)" |
|
208 |
||
209 |
isTriggerOnDown := aBoolean |
|
128 | 210 |
! ! |
211 |
||
145 | 212 |
!ButtonController methodsFor:'accessing-channels'! |
213 |
||
214 |
enableChannel |
|
215 |
"return the valueHolder which holdes the enable |
|
216 |
boolean value" |
|
217 |
||
218 |
^ enableChannel |
|
219 |
! |
|
220 |
||
221 |
enableChannel:aValueHolder |
|
222 |
"set the valueHolder, which holds the enable boolean value" |
|
223 |
||
162 | 224 |
|wasEnabled| |
225 |
||
145 | 226 |
enableChannel notNil ifTrue:[ |
162 | 227 |
wasEnabled := enableChannel value. |
258
ae4b8f1a6738
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
220
diff
changeset
|
228 |
enableChannel retractInterestsFor:self. |
162 | 229 |
] ifFalse:[ |
230 |
wasEnabled := true |
|
145 | 231 |
]. |
232 |
enableChannel := aValueHolder. |
|
233 |
aValueHolder onChangeSend:#enableStateChange to:self. |
|
162 | 234 |
enableChannel value ~~ wasEnabled ifTrue:[ |
235 |
self enableStateChange |
|
145 | 236 |
] |
162 | 237 |
|
238 |
"Modified: 17.9.1995 / 19:41:18 / claus" |
|
145 | 239 |
! |
240 |
||
241 |
pressChannel:aChannel |
|
242 |
pressChannel := aChannel |
|
243 |
! |
|
244 |
||
245 |
releaseChannel:aChannel |
|
246 |
releaseChannel := aChannel |
|
247 |
! ! |
|
248 |
||
200 | 249 |
!ButtonController methodsFor:'accessing-state'! |
76 | 250 |
|
200 | 251 |
active |
252 |
"return true, if I am active; |
|
253 |
that is: currently performing my action. |
|
254 |
This query can be used to avoid multiple redraws." |
|
76 | 255 |
|
200 | 256 |
^ active |
128 | 257 |
! |
258 |
||
200 | 259 |
active:aBoolean |
260 |
active := aBoolean |
|
76 | 261 |
! |
262 |
||
200 | 263 |
enabled |
264 |
"return true, if I am enabled" |
|
128 | 265 |
|
200 | 266 |
^ enableChannel value |
76 | 267 |
! |
268 |
||
200 | 269 |
entered |
270 |
"return true, if the mouse pointer is currently in my view" |
|
155 | 271 |
|
200 | 272 |
^ entered |
273 |
! |
|
155 | 274 |
|
200 | 275 |
entered:aBoolean |
276 |
entered := aBoolean |
|
155 | 277 |
! |
278 |
||
200 | 279 |
pressed |
280 |
"return true, if I am pressed" |
|
76 | 281 |
|
200 | 282 |
^ pressed |
76 | 283 |
! |
284 |
||
200 | 285 |
pressed:aBoolean |
286 |
pressed ~~ aBoolean ifTrue:[ |
|
287 |
pressed := aBoolean. |
|
288 |
self performAction. |
|
118 | 289 |
]. |
290 |
! |
|
291 |
||
200 | 292 |
setPressed:aBoolean |
293 |
pressed := aBoolean. |
|
121 | 294 |
|
200 | 295 |
"Created: 14.11.1995 / 21:37:08 / cg" |
266 | 296 |
! |
297 |
||
298 |
toggle |
|
299 |
"toggle and perform the action" |
|
300 |
||
301 |
enableChannel value ifTrue:[ |
|
302 |
self toggleNoAction. |
|
303 |
self performAction. |
|
304 |
view changed:#toggle with:pressed |
|
305 |
] |
|
306 |
! |
|
307 |
||
308 |
toggleNoAction |
|
309 |
"toggle, but do NOT perform any action" |
|
310 |
||
311 |
pressed ifTrue:[ |
|
312 |
view turnOff. |
|
313 |
pressed := false. |
|
314 |
] ifFalse:[ |
|
315 |
view turnOn. |
|
316 |
pressed := true. |
|
317 |
]. |
|
76 | 318 |
! ! |
319 |
||
320 |
!ButtonController methodsFor:'event handling'! |
|
321 |
||
200 | 322 |
buttonMultiPress:button x:x y:y |
323 |
^ self buttonPress:button x:x y:y |
|
324 |
! |
|
325 |
||
76 | 326 |
buttonPress:button x:x y:y |
327 |
(button == 1 or:[button == #select]) ifFalse:[ |
|
266 | 328 |
^ super buttonPress:button x:x y:y |
76 | 329 |
]. |
330 |
||
133 | 331 |
enableChannel value ifTrue:[ |
266 | 332 |
isToggle ifTrue:[ |
333 |
self toggle. |
|
334 |
^ self |
|
335 |
]. |
|
118 | 336 |
|
266 | 337 |
pressed ifFalse:[ |
338 |
pressed := true. |
|
339 |
view showActive. |
|
76 | 340 |
|
266 | 341 |
(pressActionBlock notNil or:[model notNil]) ifTrue:[ |
342 |
" |
|
343 |
force output - so that button is drawn correctly in case |
|
344 |
of any long-computation (at high priority) |
|
345 |
" |
|
346 |
view flush. |
|
347 |
]. |
|
76 | 348 |
|
266 | 349 |
self performAction. |
76 | 350 |
|
266 | 351 |
autoRepeat ifTrue:[ |
352 |
Processor addTimedBlock:repeatBlock afterSeconds:initialDelay |
|
353 |
] |
|
354 |
] |
|
76 | 355 |
] |
262 | 356 |
|
357 |
"Modified: 16.12.1995 / 17:31:55 / cg" |
|
76 | 358 |
! |
359 |
||
360 |
buttonRelease:button x:x y:y |
|
361 |
"button was released - if enabled, perform releaseaction" |
|
362 |
||
363 |
(button == 1 or:[button == #select]) ifFalse:[ |
|
266 | 364 |
^ super buttonRelease:button x:x y:y |
76 | 365 |
]. |
118 | 366 |
|
367 |
isToggle ifTrue:[ |
|
266 | 368 |
^ self |
118 | 369 |
]. |
370 |
||
76 | 371 |
pressed ifTrue:[ |
266 | 372 |
autoRepeat ifTrue:[ |
373 |
Processor removeTimedBlock:repeatBlock |
|
374 |
]. |
|
375 |
pressed := false. |
|
376 |
view showPassive. |
|
76 | 377 |
|
266 | 378 |
enableChannel value ifTrue:[ |
379 |
" |
|
380 |
only perform action if released within myself |
|
381 |
" |
|
382 |
((x >= 0) |
|
383 |
and:[x <= view width |
|
384 |
and:[y >= 0 |
|
385 |
and:[y <= view height]]]) ifTrue:[ |
|
386 |
(releaseActionBlock notNil or:[model notNil]) ifTrue:[ |
|
387 |
" |
|
388 |
force output - so that button is drawn correctly in case |
|
389 |
of any long-computation (at high priority) |
|
390 |
" |
|
391 |
view flush. |
|
392 |
]. |
|
76 | 393 |
|
266 | 394 |
self performAction. |
395 |
] |
|
396 |
] |
|
76 | 397 |
] |
262 | 398 |
|
399 |
"Modified: 16.12.1995 / 17:32:09 / cg" |
|
76 | 400 |
! |
401 |
||
200 | 402 |
enableStateChange |
403 |
"this is sent, whenever the enable value has changed" |
|
76 | 404 |
|
200 | 405 |
view notNil ifTrue:[view enableStateChangeRedraw] |
406 |
||
407 |
"Modified: 17.9.1995 / 19:55:52 / claus" |
|
76 | 408 |
! |
409 |
||
200 | 410 |
keyPress:key x:x y:y |
411 |
"trigger on Return and space, if I am the focusView of my group |
|
412 |
(i.e. if I got an explicit focus)" |
|
121 | 413 |
|
349
e4382398fc59
ignore Return key - its meant to close a box
Claus Gittinger <cg@exept.de>
parents:
347
diff
changeset
|
414 |
key == Character space ifTrue:[ |
e4382398fc59
ignore Return key - its meant to close a box
Claus Gittinger <cg@exept.de>
parents:
347
diff
changeset
|
415 |
view hasFocus ifTrue:[ |
e4382398fc59
ignore Return key - its meant to close a box
Claus Gittinger <cg@exept.de>
parents:
347
diff
changeset
|
416 |
"just simulate a buttonPress/release here." |
e4382398fc59
ignore Return key - its meant to close a box
Claus Gittinger <cg@exept.de>
parents:
347
diff
changeset
|
417 |
self buttonPress:1 x:0 y:0. |
e4382398fc59
ignore Return key - its meant to close a box
Claus Gittinger <cg@exept.de>
parents:
347
diff
changeset
|
418 |
self buttonRelease:1 x:0 y:0. |
e4382398fc59
ignore Return key - its meant to close a box
Claus Gittinger <cg@exept.de>
parents:
347
diff
changeset
|
419 |
^ self. |
e4382398fc59
ignore Return key - its meant to close a box
Claus Gittinger <cg@exept.de>
parents:
347
diff
changeset
|
420 |
] |
200 | 421 |
]. |
422 |
view keyPress:key x:x y:y |
|
349
e4382398fc59
ignore Return key - its meant to close a box
Claus Gittinger <cg@exept.de>
parents:
347
diff
changeset
|
423 |
|
e4382398fc59
ignore Return key - its meant to close a box
Claus Gittinger <cg@exept.de>
parents:
347
diff
changeset
|
424 |
"Modified: 9.2.1996 / 23:11:58 / cg" |
121 | 425 |
! |
426 |
||
427 |
performAction |
|
146 | 428 |
|action value| |
133 | 429 |
|
430 |
isToggle ifTrue:[ |
|
431 |
value := pressed |
|
432 |
] ifFalse:[ |
|
433 |
value := true |
|
434 |
]. |
|
76 | 435 |
|
125 | 436 |
" |
145 | 437 |
ST/X style actionBlock evaluation & channel notification ... |
125 | 438 |
" |
76 | 439 |
pressed ifTrue:[ |
145 | 440 |
action := pressActionBlock. |
121 | 441 |
] ifFalse:[ |
145 | 442 |
action := releaseActionBlock. |
121 | 443 |
]. |
125 | 444 |
action notNil ifTrue:[ |
445 |
active := true. |
|
446 |
action numArgs == 0 ifTrue:[ |
|
447 |
action value |
|
448 |
] ifFalse:[ |
|
133 | 449 |
action value:value |
125 | 450 |
]. |
451 |
active := false. |
|
452 |
]. |
|
146 | 453 |
pressChannel notNil ifTrue:[ |
454 |
pressChannel value:pressed |
|
455 |
]. |
|
456 |
releaseChannel notNil ifTrue:[ |
|
457 |
releaseChannel value:pressed not |
|
145 | 458 |
]. |
76 | 459 |
|
125 | 460 |
" |
461 |
ST-80 style model notification ... |
|
462 |
" |
|
121 | 463 |
(isToggle |
464 |
or:[(isTriggerOnDown and:[pressed]) |
|
465 |
or:[isTriggerOnDown not and:[pressed not]]]) ifTrue:[ |
|
125 | 466 |
"the ST-80 way of doing things" |
467 |
view notNil ifTrue:[ |
|
468 |
active := true. |
|
133 | 469 |
view sendChangeMessageWith:value. |
125 | 470 |
active := false. |
471 |
]. |
|
121 | 472 |
]. |
76 | 473 |
! |
474 |
||
200 | 475 |
pointerEnter:state x:x y:y |
476 |
"mouse pointer entered my view. |
|
477 |
Redraw with enteredColors if they differ from the normal colors" |
|
478 |
||
479 |
entered := true. |
|
480 |
enableChannel value ifTrue:[ |
|
481 |
pressed ifTrue:[ |
|
482 |
" |
|
483 |
reentered after a leave with mouse-button down; |
|
484 |
restart autorepeating and/or if I am a button with |
|
485 |
triggerOnDown, show active again. |
|
486 |
" |
|
487 |
autoRepeat ifTrue:[ |
|
488 |
Processor addTimedBlock:repeatBlock afterSeconds:initialDelay |
|
489 |
]. |
|
490 |
isTriggerOnDown ifFalse:[ |
|
491 |
view showActive. |
|
492 |
] |
|
493 |
] ifFalse:[ |
|
494 |
view redraw |
|
495 |
] |
|
496 |
] |
|
76 | 497 |
! |
498 |
||
200 | 499 |
pointerLeave:state |
500 |
"mouse pointer left my view. |
|
501 |
Redraw with normal colors if they differ from enteredColors" |
|
76 | 502 |
|
200 | 503 |
entered := false. |
504 |
pressed ifTrue:[ |
|
505 |
" |
|
506 |
leave with mouse-button down; |
|
507 |
stop autorepeating and/or if I am a button with |
|
508 |
action on release, show passive |
|
509 |
" |
|
510 |
autoRepeat ifTrue:[ |
|
511 |
Processor removeTimedBlock:repeatBlock |
|
512 |
]. |
|
513 |
isTriggerOnDown ifFalse:[ |
|
514 |
view showPassive. |
|
76 | 515 |
] |
200 | 516 |
] ifFalse:[ |
517 |
enableChannel value ifTrue:[ |
|
518 |
view redraw |
|
519 |
] |
|
520 |
] |
|
76 | 521 |
! |
522 |
||
121 | 523 |
repeat |
524 |
"this is sent from the autorepeat-block, when the button has been pressed long |
|
525 |
enough; it simulates a release-press, by evaluating both release |
|
526 |
and press actions." |
|
76 | 527 |
|
220
635d3f583f61
fast repeat if shift is pressed
Claus Gittinger <cg@exept.de>
parents:
203
diff
changeset
|
528 |
|dly| |
635d3f583f61
fast repeat if shift is pressed
Claus Gittinger <cg@exept.de>
parents:
203
diff
changeset
|
529 |
|
76 | 530 |
pressed ifTrue:[ |
417
3f48ca2beb7d
use device shiftDown - NOT sensor shiftDown
Claus Gittinger <cg@exept.de>
parents:
349
diff
changeset
|
531 |
enableChannel value ifTrue:[ |
3f48ca2beb7d
use device shiftDown - NOT sensor shiftDown
Claus Gittinger <cg@exept.de>
parents:
349
diff
changeset
|
532 |
active ifFalse:[ |
3f48ca2beb7d
use device shiftDown - NOT sensor shiftDown
Claus Gittinger <cg@exept.de>
parents:
349
diff
changeset
|
533 |
self performAction. |
155 | 534 |
"/ active := true. |
535 |
"/ releaseActionBlock notNil ifTrue:[releaseActionBlock value]. |
|
536 |
"/ pressActionBlock notNil ifTrue:[pressActionBlock value]. |
|
537 |
"/ active := false. |
|
121 | 538 |
|
417
3f48ca2beb7d
use device shiftDown - NOT sensor shiftDown
Claus Gittinger <cg@exept.de>
parents:
349
diff
changeset
|
539 |
autoRepeat ifTrue:[ |
3f48ca2beb7d
use device shiftDown - NOT sensor shiftDown
Claus Gittinger <cg@exept.de>
parents:
349
diff
changeset
|
540 |
view device shiftDown ifTrue:[ |
3f48ca2beb7d
use device shiftDown - NOT sensor shiftDown
Claus Gittinger <cg@exept.de>
parents:
349
diff
changeset
|
541 |
dly := repeatDelay / 4. |
3f48ca2beb7d
use device shiftDown - NOT sensor shiftDown
Claus Gittinger <cg@exept.de>
parents:
349
diff
changeset
|
542 |
] ifFalse:[ |
3f48ca2beb7d
use device shiftDown - NOT sensor shiftDown
Claus Gittinger <cg@exept.de>
parents:
349
diff
changeset
|
543 |
dly := repeatDelay |
3f48ca2beb7d
use device shiftDown - NOT sensor shiftDown
Claus Gittinger <cg@exept.de>
parents:
349
diff
changeset
|
544 |
]. |
3f48ca2beb7d
use device shiftDown - NOT sensor shiftDown
Claus Gittinger <cg@exept.de>
parents:
349
diff
changeset
|
545 |
Processor addTimedBlock:repeatBlock afterSeconds:dly |
3f48ca2beb7d
use device shiftDown - NOT sensor shiftDown
Claus Gittinger <cg@exept.de>
parents:
349
diff
changeset
|
546 |
] |
3f48ca2beb7d
use device shiftDown - NOT sensor shiftDown
Claus Gittinger <cg@exept.de>
parents:
349
diff
changeset
|
547 |
] |
3f48ca2beb7d
use device shiftDown - NOT sensor shiftDown
Claus Gittinger <cg@exept.de>
parents:
349
diff
changeset
|
548 |
] |
76 | 549 |
] |
417
3f48ca2beb7d
use device shiftDown - NOT sensor shiftDown
Claus Gittinger <cg@exept.de>
parents:
349
diff
changeset
|
550 |
|
3f48ca2beb7d
use device shiftDown - NOT sensor shiftDown
Claus Gittinger <cg@exept.de>
parents:
349
diff
changeset
|
551 |
"Modified: 27.2.1996 / 14:48:13 / cg" |
76 | 552 |
! ! |
121 | 553 |
|
554 |
!ButtonController methodsFor:'initialization'! |
|
555 |
||
556 |
initialize |
|
557 |
super initialize. |
|
558 |
||
266 | 559 |
enableChannel := true asValue. |
560 |
enableChannel onChangeSend:#enableStateChange to:self. |
|
133 | 561 |
|
121 | 562 |
active := false. |
563 |
pressed := false. |
|
564 |
entered := false. |
|
565 |
autoRepeat := false. |
|
566 |
initialDelay := self class defaultInitialDelay. |
|
567 |
repeatDelay := self class defaultRepeatDelay. |
|
568 |
isTriggerOnDown := false. |
|
569 |
isToggle := false. |
|
570 |
! ! |
|
200 | 571 |
|
203 | 572 |
!ButtonController class methodsFor:'documentation'! |
573 |
||
574 |
version |
|
582 | 575 |
^ '$Header: /cvs/stx/stx/libwidg/Attic/ButtonC.st,v 1.31 1996-04-25 16:35:55 cg Exp $' |
203 | 576 |
! ! |