author | Claus Gittinger <cg@exept.de> |
Wed, 09 Sep 1998 21:07:09 +0200 | |
changeset 1669 | 8c48fac7e961 |
parent 1665 | 085d9d2f0f1c |
child 1681 | 7ce428bea95f |
permissions | -rw-r--r-- |
0 | 1 |
" |
4 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
59 | 3 |
All Rights Reserved |
0 | 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 |
Label subclass:#Button |
|
264 | 14 |
instanceVariableNames:'activeLogo passiveLogo disabledLogo focusLogo onLevel offLevel |
15 |
disabledFgColor activeFgColor activeBgColor enteredFgColor |
|
16 |
enteredBgColor isReturnButton shadowForm lightForm formColor |
|
17 |
formShadowColor formLightColor edgeStyle halfShadowColor |
|
1206
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
18 |
halfLightColor defaultable enterLevel leaveLevel' |
420 | 19 |
classVariableNames:'ReturnForm ReturnLightForm ReturnShadowForm DefaultActiveLevel |
20 |
DefaultPassiveLevel DefaultEdgeStyle DefaultBorderWidth |
|
21 |
DefaultForegroundColor DefaultBackgroundColor |
|
264 | 22 |
DefaultDisabledForegroundColor DefaultDisabledBackgroundColor |
23 |
DefaultEnteredForegroundColor DefaultEnteredBackgroundColor |
|
24 |
DefaultActiveForegroundColor DefaultActiveBackgroundColor |
|
25 |
DefaultReturnButtonHasImage DefaultReturnButtonHasBorder |
|
26 |
DefaultShadowColor DefaultLightColor DefaultHalfShadowColor |
|
27 |
DefaultHalfLightColor' |
|
28 |
poolDictionaries:'' |
|
29 |
category:'Views-Interactors' |
|
0 | 30 |
! |
31 |
||
850 | 32 |
!Button class methodsFor:'documentation'! |
0 | 33 |
|
205 | 34 |
actionBlocksVersusModelChanges |
35 |
" |
|
36 |
You may ask yourself, why ST/X supports two different ways |
|
37 |
to trigger a buttons action (also true for sliders, selectionInListViews, |
|
38 |
toggles etc.) and when to use which mechanism. |
|
39 |
||
40 |
There are two reasons: |
|
41 |
1) history - historically, ST/X used only actionBlocks |
|
42 |
Basically, these provide the most general functionality |
|
43 |
(you can of course send change-messages from those blocks) |
|
44 |
||
45 |
Change-message notification was added later, to make porting |
|
46 |
of existing applications easier. |
|
47 |
||
48 |
2) for many (simple) applications, it is often easier, to simply |
|
49 |
define an action block. This is especially true, if the button |
|
50 |
triggers some action (such as ok-/abort-buttons) and does NOT |
|
51 |
change some models internal value. |
|
52 |
(other smalltalks provide extra adapter-models for this, |
|
53 |
in which you can set actionBlocks in much the same way). |
|
54 |
||
55 |
In general: |
|
56 |
use model-change-messages, iff multiple views are possibly open |
|
57 |
on the same domain model, and changes can occur from multiple |
|
58 |
places. Or if a change has to be forwarded to multiple other objects |
|
59 |
(possible not foreseen). |
|
60 |
||
61 |
For simplicity, better use actionBlocks for trigger-like actions |
|
62 |
(such as closing a view, ok/abort etc.) iff there is only a single |
|
258
ae4b8f1a6738
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
244
diff
changeset
|
63 |
entity which is interested in that button press. |
205 | 64 |
" |
65 |
! |
|
66 |
||
35 | 67 |
copyright |
68 |
" |
|
69 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
59 | 70 |
All Rights Reserved |
35 | 71 |
|
72 |
This software is furnished under a license and may be used |
|
73 |
only in accordance with the terms of that license and with the |
|
74 |
inclusion of the above copyright notice. This software may not |
|
75 |
be provided or otherwise made available to, or used by, any |
|
76 |
other person. No title to or ownership of the software is |
|
77 |
hereby transferred. |
|
78 |
" |
|
79 |
! |
|
80 |
||
0 | 81 |
documentation |
82 |
" |
|
83 |
Buttons are Labels which do something when pressed/released. |
|
113 | 84 |
Since they inherit from Label, read the documentation on Labels to |
85 |
see how color, layout, font, image or labelString are changed. |
|
86 |
||
133 | 87 |
Buttons (and also instances of subclasses, such as toggles, checkToggles |
88 |
and radioButtons) perform some action when pressed, and optionally when |
|
89 |
released. Due to historic reasons, ST/X buttons support two mechanisms: |
|
90 |
||
113 | 91 |
Actionblock operation: |
133 | 92 |
the button has an actionBlock (actually, it has two: a pressAction and |
93 |
a releaseAction) which is evaluated, when the button is pressed. |
|
94 |
The user of a button can set these action blocks via the #action:, |
|
95 |
#pressAction: or #releaseAction: messages. |
|
113 | 96 |
|
97 |
Model-View interaction: |
|
133 | 98 |
buttons with a model will send change-messages to the model and also react |
99 |
to changes in the model. |
|
100 |
You have to define the buttons labelMessage and an aspectSymbol. |
|
101 |
When changed, the model should send 'self changed:<aspect>' if it wants the |
|
102 |
label to change and return a string from the labelSymbol-message. |
|
118 | 103 |
By default, the labelMsg is nil, therefore no update of the label is done. |
104 |
(this behavior is inherited from label, see documentation there) |
|
105 |
||
133 | 106 |
When pressed, the button sends a changeMessage to the model. |
118 | 107 |
If the changeMsg is for a one-argument message, the current |
113 | 108 |
press-state is passed as argument (i.e. true if pressed, false if released). |
118 | 109 |
By default, the change-Message is #value: (for ST-80 compatibility). |
113 | 110 |
|
585 | 111 |
button model:aModel. |
112 |
button aspect:aspectSymbol. |
|
113 |
button change:changeSymbol. |
|
114 |
button labelMessage:labelSymbol. |
|
113 | 115 |
|
585 | 116 |
model sends #changed:aspectSymbol |
117 |
---> button will redraw its label from value returned by model>>labelSymbol |
|
113 | 118 |
|
585 | 119 |
button changes state: |
120 |
---> button sends changeSymbol / changeSymbol:state to the model |
|
113 | 121 |
|
118 | 122 |
By default (as inherited), the labelMsg is nil; therefore, buttons |
123 |
do not try to aquire a new labelString from the model. |
|
124 |
If you want this behavior, you must set labelMsg and aspectMsg |
|
125 |
as appropriate. |
|
0 | 126 |
|
133 | 127 |
See examples. |
128 |
||
129 |
||
585 | 130 |
[Instance variables:] |
0 | 131 |
|
59 | 132 |
activeLogo <StringOrImage> logo to show when active (pressed) |
133 |
passiveLogo <StringOrImage> logo to show when passive (released) |
|
585 | 134 |
default is nil for both, so the normal logo is used |
135 |
(see superclass: Label) |
|
35 | 136 |
onLevel <Integer> level when pressed (3D only) (default: depends on style) |
137 |
offLevel <Integer> level when released (3D only) (default: depends on style) |
|
138 |
disabledFgColor <Color> color used to draw logo when disabled (default: depends on style) |
|
139 |
activeFgColor <Color> color to draw logo when pressed (default: depends on style) |
|
140 |
activeBgColor <Color> bg color when pressed (default: depends on style) |
|
141 |
enteredFgColor <Color> fg color to draw logo when cursor entered (default: depends on style) |
|
142 |
enteredBgColor <Color> bg color when cursor entered (default: depends on style) |
|
0 | 143 |
|
35 | 144 |
isReturnButton <Boolean> true if this button is also activated by the |
585 | 145 |
return key - if true, it will draw a return-bitmap |
146 |
in addition to the logo (default: false) |
|
35 | 147 |
|
1051 | 148 |
defaultable <Boolean> true, if this button can become a returnButton. |
149 |
(computes its default extent differently) |
|
150 |
||
59 | 151 |
shadowForm <Form> form to display in addition to buttons label (returnbutton only) |
152 |
lightForm <Form> light part of shadowForm (returnbutton only) |
|
153 |
||
154 |
formColor <Color> color to draw form with (returnbutton only) |
|
155 |
formShadowColor <Color> color for shadowing the form (3D only & return) |
|
35 | 156 |
formLightColor <Color> color for lighting the form (3D only) |
157 |
||
62 | 158 |
|
585 | 159 |
[styleSheet parameters:] |
62 | 160 |
|
161 |
buttonActiveLevel <Integer> level when on (ignored in 2D styles) |
|
162 |
buttonPassiveLevel <Integer> level when off (ignored in 2D styles) |
|
74 | 163 |
buttonBorderWidth <Integer> default borderwidth |
62 | 164 |
buttonEdgeStyle <Symbol> style of edges (currently #soft or nil) |
165 |
buttonFont <Font> font to use for textual labels |
|
166 |
buttonForegroundColor <Color> color to draw foreground pixels (i.e. the string) |
|
167 |
buttonBackgroundColor <Color> color to draw background pixels |
|
168 |
buttonDisabledForegroundColor <Color> same when disabled |
|
169 |
buttonDisabledBackgroundColor <Color> same when disabled |
|
170 |
buttonEnteredForegroundColor <Color> same when mouse pointer is in |
|
171 |
buttonEnteredBackgroundColor <Color> same when mouse pointer is in |
|
172 |
buttonActiveForegroundColor <Color> same when button is active |
|
173 |
buttonActiveBackgroundColor <Color> same when button is active |
|
174 |
buttonShadowColor <Color> shadow color for edgaes (ignored in 2D styles) |
|
175 |
buttonLightColor <Color> light color for edgaes (ignored in 2D styles) |
|
176 |
buttonHalfShadowColor <Color> half shadow color; for soft edges only |
|
177 |
buttonHalfLightColor <Color> half light color; for soft edges only |
|
178 |
||
179 |
buttonReturnButtonHasImage <Boolean> if true, return-buttons draw a return-key image |
|
180 |
buttonReturnButtonHasBorder <Boolean> if true, return-buttons show a border |
|
130 | 181 |
|
585 | 182 |
[author:] |
183 |
Claus Gittinger |
|
184 |
||
185 |
[see also:] |
|
186 |
Toggle CheckToggle CheckBox |
|
593 | 187 |
Dialog |
188 |
ValueHolder TriggerValue |
|
189 |
Block |
|
133 | 190 |
" |
191 |
! |
|
192 |
||
62 | 193 |
examples |
194 |
" |
|
195 |
You dont have to normally care for all the internals |
|
420 | 196 |
(they allow many variations though). |
197 |
For buttons with a stringLabel, the typical use is: |
|
35 | 198 |
|
420 | 199 |
b := Button label:'some logo' in:aView. |
200 |
b action:[ .. things to do, when pressed ... ] |
|
35 | 201 |
|
420 | 202 |
and for bitmap/image buttons its: |
62 | 203 |
|
420 | 204 |
b := Button label:someImage in:aView. |
205 |
b action:[ .. things to do, when pressed ... ] |
|
62 | 206 |
|
420 | 207 |
|
62 | 208 |
|
133 | 209 |
Of course, you can also setup things the ST-80 way, in first |
210 |
creating the button and later add it to some superview: |
|
211 |
||
420 | 212 |
b := Button new. |
213 |
b label:someImage. |
|
214 |
b action:[ .. things to do, when pressed ... ] |
|
215 |
... |
|
216 |
aSuperView add:b in:<frameRectangle>. |
|
118 | 217 |
|
420 | 218 |
|
219 |
Although you can specify most of the look of a button, |
|
133 | 220 |
you should use the defaults in most applications. |
88 | 221 |
As you specify more things in your program, |
222 |
the styleSheet settings are more and more ignored. |
|
223 |
Also, even though it might look fancy, colorful |
|
224 |
button panels are usually not a good GUI design; |
|
225 |
they will attract the users attention - possibly to things |
|
226 |
which are not worth it. |
|
420 | 227 |
Finally, if you use fancy colors, always think of those poor users |
133 | 228 |
without color displays - the styleSheet allows those people to adjust things, |
130 | 229 |
while hard-coded colors cannot be fixed without changing the code. |
88 | 230 |
|
420 | 231 |
a simple button with default settings and no action: |
133 | 232 |
(you may want to try it with different viewStyle settings in effect): |
593 | 233 |
[exBegin] |
420 | 234 |
|top b| |
235 |
||
236 |
top := StandardSystemView new. |
|
237 |
top extent:100@100. |
|
88 | 238 |
|
420 | 239 |
b := Button in:top. |
240 |
b label:'hello'. |
|
241 |
||
242 |
top open. |
|
593 | 243 |
[exEnd] |
420 | 244 |
|
88 | 245 |
|
593 | 246 |
give it some action (watch the transcript): |
247 |
[exBegin] |
|
420 | 248 |
|top b| |
249 |
||
250 |
top := StandardSystemView new. |
|
251 |
top extent:100@100. |
|
252 |
||
253 |
b := Button in:top. |
|
254 |
b label:'hello'. |
|
255 |
b action:[Transcript flash]. |
|
256 |
||
257 |
top open. |
|
593 | 258 |
[exEnd] |
88 | 259 |
|
260 |
||
113 | 261 |
there is also a combined instance creation message: |
593 | 262 |
[exBegin] |
420 | 263 |
|top b| |
113 | 264 |
|
420 | 265 |
top := StandardSystemView new. |
266 |
top extent:100@100. |
|
113 | 267 |
|
420 | 268 |
b := Button label:'hello' action:[Transcript flash] in:top. |
269 |
||
270 |
top open. |
|
593 | 271 |
[exEnd] |
113 | 272 |
|
273 |
||
133 | 274 |
a return button |
275 |
(in dialogs, you should setup things to have the return-key perform |
|
276 |
the ok action, and mark the corresponding button as being a returnButton): |
|
593 | 277 |
[exBegin] |
420 | 278 |
|top b| |
279 |
||
280 |
top := StandardSystemView new. |
|
281 |
top extent:100@100. |
|
282 |
||
283 |
b := Button label:'hello' action:[Transcript flash] in:top. |
|
284 |
b beReturnButton. |
|
285 |
top open. |
|
593 | 286 |
[exEnd] |
420 | 287 |
|
288 |
||
289 |
||
290 |
multiple buttons in a panel: |
|
593 | 291 |
[exBegin] |
420 | 292 |
|top panel b1 b2 b3| |
293 |
||
294 |
top := StandardSystemView new. |
|
295 |
top extent:300@100. |
|
296 |
||
297 |
panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
133 | 298 |
|
420 | 299 |
b1 := Button label:'one' in:panel. |
300 |
b2 := Button label:'two' in:panel. |
|
301 |
b3 := Button label:'three' action:[Transcript flash] in:panel. |
|
302 |
||
303 |
top open. |
|
593 | 304 |
[exEnd] |
420 | 305 |
|
133 | 306 |
|
307 |
||
308 |
enabling/disabling buttons via explicit messages: |
|
593 | 309 |
[exBegin] |
420 | 310 |
|top panel b1 b2 b3| |
311 |
||
312 |
top := StandardSystemView new. |
|
313 |
top extent:300@100. |
|
314 |
panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
133 | 315 |
|
420 | 316 |
b1 := Button label:'enable' action:[b3 enable] in:panel. |
317 |
b2 := Button label:'disable' action:[b3 disable] in:panel. |
|
318 |
b3 := Button label:'flash' action:[Transcript flash] in:panel. |
|
319 |
top open. |
|
593 | 320 |
[exEnd] |
133 | 321 |
|
322 |
||
323 |
||
324 |
enabling/disabling buttons via implicit value change of a valueHolder: |
|
420 | 325 |
The two views are only indirectly coupled (via the valueHolder); |
326 |
not knowing about each other. |
|
593 | 327 |
[exBegin] |
420 | 328 |
|top panel ena t b1 b2 b3 check| |
133 | 329 |
|
420 | 330 |
top := StandardSystemView new. |
331 |
top extent:300@100. |
|
332 |
||
333 |
panel := HorizontalPanelView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
133 | 334 |
|
420 | 335 |
ena := false asValue. |
133 | 336 |
|
420 | 337 |
t := Toggle label:'enable' in:panel. |
338 |
t model:ena. |
|
133 | 339 |
|
420 | 340 |
b1 := Button label:'button1' in:panel. |
341 |
b1 controller enableChannel:ena. |
|
133 | 342 |
|
420 | 343 |
b2 := Button label:'button2' in:panel. |
344 |
b2 controller enableChannel:ena. |
|
133 | 345 |
|
420 | 346 |
b3 := Button label:'button3' in:panel. |
347 |
b3 controller enableChannel:ena. |
|
133 | 348 |
|
420 | 349 |
top open. |
133 | 350 |
|
420 | 351 |
check := CheckBox model:ena. |
352 |
check label:'also enable'. |
|
353 |
check extent:(check preferredExtent + (5@5)). |
|
354 |
check open |
|
593 | 355 |
[exEnd] |
133 | 356 |
|
357 |
||
358 |
||
88 | 359 |
changing colors: |
593 | 360 |
[exBegin] |
420 | 361 |
|top b| |
88 | 362 |
|
420 | 363 |
top := StandardSystemView new. |
364 |
top extent:100@100. |
|
88 | 365 |
|
420 | 366 |
b := Button label:'hello' in:top. |
367 |
b action:[Transcript flash]. |
|
368 |
b activeForegroundColor:(Color white). |
|
369 |
b activeBackgroundColor:(Color red). |
|
370 |
||
371 |
top open. |
|
593 | 372 |
[exEnd] |
88 | 373 |
|
374 |
||
375 |
changing more colors: |
|
593 | 376 |
[exBegin] |
420 | 377 |
|top b| |
88 | 378 |
|
420 | 379 |
top := StandardSystemView new. |
380 |
top extent:100@100. |
|
88 | 381 |
|
420 | 382 |
b := Button label:'hello' in:top. |
383 |
b action:[Transcript flash]. |
|
384 |
b enteredForegroundColor:(Color red). |
|
385 |
b enteredBackgroundColor:(b backgroundColor). |
|
386 |
b activeForegroundColor:(Color white). |
|
387 |
b activeBackgroundColor:(Color red). |
|
388 |
||
389 |
top open. |
|
593 | 390 |
[exEnd] |
88 | 391 |
|
392 |
||
113 | 393 |
button with an image and different colors: |
593 | 394 |
[exBegin] |
420 | 395 |
|top b| |
88 | 396 |
|
420 | 397 |
top := StandardSystemView new. |
398 |
top extent:100@100. |
|
88 | 399 |
|
420 | 400 |
b := Button in:top. |
401 |
b label:(Image fromFile:'bitmaps/SBrowser.xbm'). |
|
402 |
b action:[Transcript flash]. |
|
403 |
b enteredForegroundColor:(Color green darkened). |
|
404 |
b enteredBackgroundColor:(b backgroundColor). |
|
405 |
b activeForegroundColor:(Color white). |
|
406 |
b activeBackgroundColor:(Color red). |
|
407 |
||
408 |
top open. |
|
593 | 409 |
[exEnd] |
88 | 410 |
|
411 |
||
118 | 412 |
changing the image when pressed: |
593 | 413 |
[exBegin] |
420 | 414 |
|top b| |
88 | 415 |
|
420 | 416 |
top := StandardSystemView new. |
417 |
top extent:100@100. |
|
62 | 418 |
|
420 | 419 |
b := Button in:top. |
420 |
b passiveLogo:(Image fromFile:'bitmaps/SBrowser.xbm'). |
|
421 |
b activeLogo:(Image fromFile:'bitmaps/CBrowser.xbm'). |
|
422 |
b action:[Transcript flash]. |
|
423 |
b enteredForegroundColor:(Color red). |
|
424 |
b enteredBackgroundColor:(b backgroundColor). |
|
425 |
b activeForegroundColor:(Color white). |
|
426 |
b activeBackgroundColor:(Color red). |
|
427 |
||
428 |
top open. |
|
593 | 429 |
[exEnd] |
88 | 430 |
|
431 |
||
113 | 432 |
well, even that is possible (but you should NEVER do it): |
593 | 433 |
[exBegin] |
420 | 434 |
|top b| |
88 | 435 |
|
420 | 436 |
top := StandardSystemView new. |
437 |
top extent:100@100. |
|
88 | 438 |
|
420 | 439 |
b := Button in:top. |
440 |
b passiveLogo:(Image fromFile:'bitmaps/SmalltalkX.xbm'). |
|
1153 | 441 |
b activeLogo:'start'. |
420 | 442 |
b action:[Transcript flash]. |
443 |
b enteredForegroundColor:(Color red). |
|
444 |
b enteredBackgroundColor:(b backgroundColor). |
|
445 |
b activeForegroundColor:(Color white). |
|
446 |
b activeBackgroundColor:(Color red). |
|
447 |
top open. |
|
593 | 448 |
[exEnd] |
88 | 449 |
|
450 |
||
451 |
more playing with colors: |
|
593 | 452 |
[exBegin] |
420 | 453 |
|top b| |
88 | 454 |
|
420 | 455 |
top := StandardSystemView new. |
456 |
top extent:100@100. |
|
88 | 457 |
|
420 | 458 |
b := Button in:top. |
459 |
b logo:(Image fromFile:'bitmaps/SmalltalkX.xbm'). |
|
460 |
b action:[Transcript flash]. |
|
461 |
b foregroundColor:(Color red:0 green:80 blue:20) darkened. |
|
462 |
b backgroundColor:(Color grey:10). |
|
463 |
b enteredForegroundColor:(Color red). |
|
464 |
b activeForegroundColor:(Color red). |
|
465 |
b activeBackgroundColor:(Color grey:10). |
|
466 |
top open. |
|
593 | 467 |
[exEnd] |
130 | 468 |
|
469 |
||
470 |
more playing with colors: |
|
593 | 471 |
[exBegin] |
420 | 472 |
|top b| |
130 | 473 |
|
420 | 474 |
top := StandardSystemView new. |
475 |
top extent:100@100. |
|
130 | 476 |
|
420 | 477 |
b := Button in:top. |
478 |
b logo:(Image fromFile:'bitmaps/SmalltalkX.xbm'). |
|
479 |
b action:[Transcript flash]. |
|
480 |
b foregroundColor:(Color red:0 green:80 blue:20) darkened. |
|
481 |
b backgroundColor:(Color grey:10). |
|
482 |
b enteredBackgroundColor:(Color grey:20). |
|
483 |
b activeForegroundColor:(Color red). |
|
484 |
b activeBackgroundColor:(Color grey:20). |
|
485 |
top open. |
|
593 | 486 |
[exEnd] |
88 | 487 |
|
488 |
||
113 | 489 |
fire on press (buttons in scrollbars do this, while normal buttons |
133 | 490 |
fire on release). |
491 |
To give the user a chance to change her mind |
|
492 |
and leave the button without action, you should not change the default |
|
493 |
behavior and NOT use triggerOnDown-buttons in most applications: |
|
593 | 494 |
[exBegin] |
420 | 495 |
|top b| |
88 | 496 |
|
420 | 497 |
top := StandardSystemView new. |
498 |
top extent:100@100. |
|
88 | 499 |
|
420 | 500 |
b := Button label:'hello' in:top. |
501 |
b controller beTriggerOnDown. |
|
502 |
b action:[Transcript flash]. |
|
503 |
top open. |
|
593 | 504 |
[exEnd] |
62 | 505 |
|
506 |
||
507 |
To implement fun buttons (for games, show-demos etc.), you can |
|
508 |
access all internal parameters (and not take the viewStyle defaults) |
|
509 |
as in: |
|
593 | 510 |
[exBegin] |
420 | 511 |
|b granite light shadow| |
62 | 512 |
|
420 | 513 |
b := Button label:'a nice one ?'. |
514 |
granite := Image fromFile:'bitmaps/granite_small.tiff'. |
|
515 |
light := granite lightened. |
|
516 |
shadow := granite darkened darkened. |
|
517 |
b backgroundColor:granite. |
|
518 |
b foregroundColor:Color white. |
|
519 |
b shadowColor:shadow. |
|
520 |
b lightColor:light. |
|
521 |
b enteredBackgroundColor:light. |
|
522 |
b enteredForegroundColor:Color black. |
|
523 |
b activeLevel:-3; passiveLevel:5. |
|
524 |
b extent:(200 @ 50). |
|
525 |
b open |
|
593 | 526 |
[exEnd] |
62 | 527 |
|
528 |
However, in your application, you may want to read those bitmaps only once |
|
529 |
during startup and cache them for later reuse in some class variable |
|
530 |
(reading, lightning & darkening of images is a bit slow) |
|
88 | 531 |
|
113 | 532 |
|
118 | 533 |
ST/X Buttons allow simulation of the ST-80 MVC way of interacting. |
534 |
To do so, instead (or in addition) to defining actionBlocks, set the |
|
127 | 535 |
buttons model to have this be informed (in addition): |
118 | 536 |
|
537 |
Model-View interaction (ST-80 style): |
|
538 |
(have a look at the models values in the inspector, as the toggles change) |
|
593 | 539 |
[exBegin] |
420 | 540 |
|bool1 bool2 b1 b2 panel top| |
118 | 541 |
|
420 | 542 |
bool1 := ValueHolder newBoolean. |
543 |
bool2 := ValueHolder newBoolean value:true. |
|
118 | 544 |
|
420 | 545 |
top := StandardSystemView new. |
546 |
top extent:200@100. |
|
118 | 547 |
|
420 | 548 |
panel := HorizontalPanelView |
549 |
origin:0.0 @ 0.0 corner:1.0 @ 50 in:top. |
|
118 | 550 |
|
420 | 551 |
b1 := Toggle label:'eat me' in:panel. |
552 |
b1 model:bool1. |
|
118 | 553 |
|
420 | 554 |
b2 := Toggle label:'drink me' in:panel. |
555 |
b2 model:bool2. |
|
118 | 556 |
|
420 | 557 |
top open. |
558 |
bool1 inspect. |
|
559 |
bool2 inspect. |
|
593 | 560 |
[exEnd] |
118 | 561 |
|
133 | 562 |
|
118 | 563 |
Using a PluggableAdaptor (ST-80 style): |
564 |
(notice, that this is almost what ST/X buttons did originally, |
|
127 | 565 |
therefore, you may want use actionBlocks right away ...) |
593 | 566 |
[exBegin] |
420 | 567 |
|adaptor1 adaptor2 b1 b2 panel top| |
118 | 568 |
|
420 | 569 |
adaptor1 := PluggableAdaptor new |
570 |
getBlock:[:m | false] |
|
655 | 571 |
putBlock:[:m :v | Transcript showCR:'eat'] |
420 | 572 |
updateBlock:nil. |
573 |
adaptor2 := PluggableAdaptor new |
|
574 |
getBlock:[:m | false] |
|
655 | 575 |
putBlock:[:m :v | Transcript showCR:'drink'] |
420 | 576 |
updateBlock:nil. |
118 | 577 |
|
420 | 578 |
top := StandardSystemView new. |
579 |
top extent:200@100. |
|
118 | 580 |
|
420 | 581 |
panel := HorizontalPanelView |
582 |
origin:0.0 @ 0.0 corner:1.0 @ 50 in:top. |
|
118 | 583 |
|
420 | 584 |
b1 := Button label:'eat me' in:panel. |
585 |
b1 model:adaptor1. |
|
118 | 586 |
|
420 | 587 |
b2 := Button label:'drink me' in:panel. |
588 |
b2 model:adaptor2. |
|
118 | 589 |
|
420 | 590 |
top open. |
593 | 591 |
[exEnd] |
118 | 592 |
|
593 |
||
594 |
as a reminder, the corresponding ST/X setup is: |
|
593 | 595 |
[exBegin] |
420 | 596 |
|b1 b2 panel top| |
118 | 597 |
|
420 | 598 |
top := StandardSystemView new. |
599 |
top extent:200@100. |
|
118 | 600 |
|
420 | 601 |
panel := HorizontalPanelView |
602 |
origin:0.0 @ 0.0 corner:1.0 @ 50 in:top. |
|
118 | 603 |
|
420 | 604 |
b1 := Button label:'eat me' in:panel. |
655 | 605 |
b1 action:[Transcript showCR:'eat']. |
118 | 606 |
|
420 | 607 |
b2 := Button label:'drink me' in:panel. |
655 | 608 |
b2 action:[Transcript showCR:'drink']. |
118 | 609 |
|
420 | 610 |
top open. |
593 | 611 |
[exEnd] |
118 | 612 |
|
613 |
||
130 | 614 |
accessing multiple aspects of a complex model |
615 |
(using a plug here to simulate that model ...) |
|
133 | 616 |
(Notice, the next example shall demonstrate multiple aspects; |
617 |
for this kind of functionality, you'd better use actionBlocks in |
|
618 |
real applications) |
|
593 | 619 |
[exBegin] |
420 | 620 |
|myModel b1 b2 panel top| |
113 | 621 |
|
420 | 622 |
myModel := Plug new. |
623 |
myModel respondTo:#grow with:[top extent:200@300]. |
|
624 |
myModel respondTo:#shrink with:[top extent:200@100]. |
|
113 | 625 |
|
420 | 626 |
top := StandardSystemView new. |
627 |
top extent:200@100. |
|
113 | 628 |
|
420 | 629 |
panel := HorizontalPanelView |
630 |
origin:0.0 @ 0.0 |
|
631 |
corner:1.0 @ 50 |
|
632 |
in:top. |
|
113 | 633 |
|
420 | 634 |
b1 := Button label:'eat me' in:panel. |
635 |
b1 model:myModel; change:#grow. |
|
113 | 636 |
|
420 | 637 |
b2 := Button label:'drink me' in:panel. |
638 |
b2 model:myModel; change:#shrink. |
|
113 | 639 |
|
420 | 640 |
top open. |
593 | 641 |
[exEnd] |
118 | 642 |
|
113 | 643 |
|
130 | 644 |
aquiring the label from the model |
645 |
(this functionality is inherited from Label) |
|
593 | 646 |
[exBegin] |
420 | 647 |
|myModel b1 b2 b3 panel top currentLabel| |
130 | 648 |
|
420 | 649 |
currentLabel := 'foo'. |
130 | 650 |
|
420 | 651 |
myModel := Plug new. |
652 |
myModel respondTo:#getLabel with:[currentLabel]. |
|
653 |
myModel respondTo:#b0Pressed with:[]. |
|
654 |
myModel respondTo:#b1Pressed with:[currentLabel := 'bar'. |
|
655 |
myModel changed:#labelAspect]. |
|
656 |
myModel respondTo:#b2Pressed with:[currentLabel := 'foo'. |
|
657 |
myModel changed:#labelAspect]. |
|
130 | 658 |
|
420 | 659 |
top := StandardSystemView new. |
660 |
top extent:300@100. |
|
130 | 661 |
|
420 | 662 |
panel := HorizontalPanelView |
663 |
origin:0.0 @ 0.0 |
|
664 |
corner:1.0 @ 50 |
|
665 |
in:top. |
|
130 | 666 |
|
420 | 667 |
b1 := Button label:'press me' in:panel. |
668 |
b1 model:myModel; change:#b0Pressed; |
|
669 |
labelMessage:#getLabel; aspect:#labelAspect. |
|
130 | 670 |
|
420 | 671 |
b2 := Button label:'press for bar' in:panel. |
672 |
b2 model:myModel; change:#b1Pressed. |
|
130 | 673 |
|
420 | 674 |
b3 := Button label:'press for foo' in:panel. |
675 |
b3 model:myModel; change:#b2Pressed. |
|
130 | 676 |
|
420 | 677 |
top open. |
593 | 678 |
[exEnd] |
130 | 679 |
|
133 | 680 |
|
681 |
the same, using actionBlocks: |
|
420 | 682 |
(notice, that we must disable changeMessages from the first button). |
593 | 683 |
[exBegin] |
420 | 684 |
|myModel b1 b2 b3 panel top currentLabel| |
685 |
||
686 |
currentLabel := 'foo'. |
|
133 | 687 |
|
420 | 688 |
myModel := Plug new. |
689 |
myModel respondTo:#getLabel with:[currentLabel]. |
|
690 |
||
691 |
top := StandardSystemView new. |
|
692 |
top extent:300@100. |
|
133 | 693 |
|
420 | 694 |
panel := HorizontalPanelView origin:0.0 @ 0.0 corner:1.0 @ 50 in:top. |
695 |
||
696 |
b1 := Button label:'press me' in:panel. |
|
655 | 697 |
b1 model:myModel; action:[Transcript showCR:'pressed']; |
420 | 698 |
labelMessage:#getLabel; aspect:#labelAspect; change:nil. |
133 | 699 |
|
420 | 700 |
b2 := Button label:'press for bar' in:panel. |
701 |
b2 action:[currentLabel := 'bar'. myModel changed:#labelAspect]. |
|
133 | 702 |
|
420 | 703 |
b3 := Button label:'press for foo' in:panel. |
704 |
b3 action:[currentLabel := 'foo'. myModel changed:#labelAspect]. |
|
133 | 705 |
|
420 | 706 |
top open. |
593 | 707 |
[exEnd] |
420 | 708 |
|
709 |
||
710 |
the same, using a labelChannel: |
|
593 | 711 |
[exBegin] |
420 | 712 |
|b1 b2 b3 panel top labelHolder| |
713 |
||
714 |
labelHolder := 'press me' asValue. |
|
715 |
||
716 |
top := StandardSystemView new. |
|
717 |
top extent:350@100. |
|
133 | 718 |
|
420 | 719 |
panel := HorizontalPanelView origin:0.0 @ 0.0 corner:1.0 @ 50 in:top. |
720 |
||
721 |
b1 := Button label:'none yet ' in:panel. |
|
722 |
b1 labelChannel:labelHolder. |
|
655 | 723 |
b1 action:[Transcript showCR:'pressed']. |
420 | 724 |
b1 sizeFixed:true. |
133 | 725 |
|
420 | 726 |
b2 := Button label:'press for bar' in:panel. |
727 |
b2 action:[ labelHolder value:'bar' ]. |
|
133 | 728 |
|
420 | 729 |
b3 := Button label:'press for foo' in:panel. |
730 |
b3 action:[ labelHolder value:'foo' ]. |
|
731 |
||
732 |
top open. |
|
593 | 733 |
[exEnd] |
133 | 734 |
|
88 | 735 |
see 'doc/coding-examples' and 'doc/misc/quick_view_intro.doc' |
736 |
for more variations on this theme. |
|
0 | 737 |
" |
738 |
! ! |
|
739 |
||
850 | 740 |
!Button class methodsFor:'instance creation'! |
205 | 741 |
|
742 |
abortButton |
|
743 |
"since abort-buttons are very common, here is a convenient |
|
744 |
method to create one ..." |
|
745 |
||
746 |
|aButton| |
|
0 | 747 |
|
366
27bf7d05650b
renamed abort-button to cancel
Claus Gittinger <cg@exept.de>
parents:
346
diff
changeset
|
748 |
aButton := Button label:(self classResources at:'cancel'). |
205 | 749 |
aButton cursor:(Cursor thumbsDown). |
750 |
^ aButton |
|
366
27bf7d05650b
renamed abort-button to cancel
Claus Gittinger <cg@exept.de>
parents:
346
diff
changeset
|
751 |
|
27bf7d05650b
renamed abort-button to cancel
Claus Gittinger <cg@exept.de>
parents:
346
diff
changeset
|
752 |
"Modified: 20.2.1996 / 20:20:16 / cg" |
205 | 753 |
! |
754 |
||
755 |
abortButtonIn:aView |
|
756 |
"since abort-buttons are very common, here is a convenient |
|
757 |
method to create one ..." |
|
758 |
||
759 |
|b| |
|
60 | 760 |
|
205 | 761 |
aView addSubView:(b := self abortButton). |
762 |
^ b |
|
763 |
! |
|
764 |
||
765 |
form:aForm action:aBlock in:aView |
|
766 |
"create and return a new Button with icon-label, aForm |
|
767 |
and pressAction, aBlock. Button is placed into aView. |
|
768 |
OBSOLETE: this is for backward compatibility; |
|
769 |
you can now pass an image or form in the #label:action:in: message." |
|
770 |
||
771 |
^ ((self in:aView) form:aForm) action:aBlock |
|
772 |
! |
|
773 |
||
774 |
label:aLabel action:aBlock |
|
775 |
"create and return a new Button with text-label, aString |
|
776 |
and pressAction, aBlock." |
|
777 |
||
778 |
^ (self label:aLabel) action:aBlock |
|
779 |
! |
|
780 |
||
781 |
label:aLabel action:aBlock in:aView |
|
782 |
"create and return a new Button with text-label, aString |
|
783 |
and pressAction, aBlock. Button is placed into aView." |
|
60 | 784 |
|
205 | 785 |
^ ((self in:aView) label:aLabel) action:aBlock |
786 |
! |
|
787 |
||
788 |
okButton |
|
789 |
"since ok-buttons are very common, here is a convenient |
|
790 |
method to create one ..." |
|
791 |
||
792 |
|aButton| |
|
793 |
||
794 |
aButton := Button label:(self classResources at:'ok'). |
|
795 |
aButton cursor:(Cursor thumbsUp). |
|
219 | 796 |
aButton beReturnButton. |
205 | 797 |
^ aButton |
59 | 798 |
! |
799 |
||
205 | 800 |
okButtonIn:aView |
801 |
"since ok-buttons are very common, here is a convenient |
|
802 |
method to create one ..." |
|
803 |
||
804 |
|b| |
|
805 |
||
806 |
aView addSubView:(b := self okButton). |
|
807 |
^ b |
|
1196
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
808 |
! ! |
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
809 |
|
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
810 |
!Button class methodsFor:'ST-80 instance creation'! |
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
811 |
|
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
812 |
switch |
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
813 |
"ST-80 compatibility: create & return a new radioButton" |
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
814 |
|
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
815 |
^ RadioButton new. |
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
816 |
|
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
817 |
"Created: 18.4.1997 / 20:19:09 / cg" |
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
818 |
"Modified: 18.4.1997 / 20:28:10 / cg" |
205 | 819 |
! |
820 |
||
821 |
toggle |
|
822 |
"ST-80 compatibility: create & return a new toggle." |
|
823 |
||
824 |
^ Toggle new |
|
825 |
||
826 |
" |
|
827 |
Button toggle label:'press me'; |
|
828 |
model:((PluggableAdaptor on:(Point new)) |
|
829 |
getSelector:#x putSelector:#x:) |
|
830 |
" |
|
831 |
"this is the same as" |
|
832 |
" |
|
833 |
Toggle new label:'press me'; |
|
834 |
model:((PluggableAdaptor on:(Point new)) |
|
835 |
getSelector:#x putSelector:#x:) |
|
836 |
" |
|
1196
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
837 |
! |
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
838 |
|
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
839 |
trigger |
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
840 |
"ST-80 compatibility: create & return a new button, which |
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
841 |
triggers on press." |
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
842 |
|
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
843 |
|b| |
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
844 |
|
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
845 |
b := Button new. |
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
846 |
b controller beTriggerOnDown. |
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
847 |
^ b |
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
848 |
|
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
849 |
"Created: 18.4.1997 / 19:55:57 / cg" |
42a10a56d284
added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1170
diff
changeset
|
850 |
"Modified: 18.4.1997 / 19:56:52 / cg" |
205 | 851 |
! ! |
852 |
||
850 | 853 |
!Button class methodsFor:'defaults'! |
205 | 854 |
|
1595 | 855 |
defaultDisabledForegroundColor |
856 |
^ DefaultDisabledForegroundColor |
|
857 |
||
858 |
"Created: / 20.6.1998 / 15:18:28 / cg" |
|
859 |
! |
|
860 |
||
0 | 861 |
returnFormOn:aDevice |
862 |
"return the form used for the return arrow in non-3D; |
|
863 |
cache the one for Display for the next round." |
|
864 |
||
865 |
|f| |
|
866 |
||
781
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
867 |
(ReturnForm notNil and:[aDevice == ReturnForm graphicsDevice]) ifTrue:[ |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
868 |
^ ReturnForm |
0 | 869 |
]. |
899 | 870 |
f := Image fromFile:'bitmaps/Return.xbm' resolution:100 on:aDevice. |
0 | 871 |
f isNil ifTrue:[ |
1387 | 872 |
f := Form width:24 height:14 fromArray:#[2r00000000 2r00000000 2r00000000 |
781
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
873 |
2r00000000 2r00000000 2r00000000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
874 |
2r00000000 2r00000011 2r11100000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
875 |
2r00000001 2r10000011 2r11100000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
876 |
2r00000011 2r10000011 2r11100000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
877 |
2r00000111 2r11111111 2r11100000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
878 |
2r00001111 2r11111111 2r11100000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
879 |
2r00011111 2r11111111 2r11100000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
880 |
2r00001111 2r11111111 2r11100000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
881 |
2r00000111 2r11111111 2r11100000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
882 |
2r00000011 2r10000000 2r00000000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
883 |
2r00000001 2r10000000 2r00000000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
884 |
2r00000000 2r00000000 2r00000000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
885 |
2r00000000 2r00000000 2r00000000] |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
886 |
on:aDevice |
0 | 887 |
]. |
35 | 888 |
ReturnForm := f. |
0 | 889 |
^ f |
781
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
890 |
|
1387 | 891 |
"Modified: / 3.11.1997 / 09:12:37 / cg" |
0 | 892 |
! |
893 |
||
205 | 894 |
returnLightFormOn:aDevice |
895 |
"return the form used for the return arrow light pixels (3D only); |
|
896 |
cache the one for Display for the next round" |
|
897 |
||
898 |
|f| |
|
899 |
||
781
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
900 |
(ReturnLightForm notNil and:[aDevice == ReturnLightForm graphicsDevice]) ifTrue:[ |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
901 |
^ ReturnLightForm |
205 | 902 |
]. |
899 | 903 |
f := Image fromFile:'bitmaps/ReturnLight.xbm' resolution:100 on:aDevice. |
205 | 904 |
f isNil ifTrue:[ |
1387 | 905 |
f := Form width:24 height:14 fromArray:#[2r00000000 2r00000000 2r00000000 |
781
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
906 |
2r00000000 2r00000000 2r00000000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
907 |
2r00000000 2r00000000 2r00000000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
908 |
2r00000000 2r00000000 2r00100000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
909 |
2r00000000 2r00000000 2r00100000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
910 |
2r00000000 2r00000000 2r00100000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
911 |
2r00000000 2r00000000 2r00100000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
912 |
2r00000000 2r00000000 2r00100000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
913 |
2r00000000 2r00000000 2r00100000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
914 |
2r00000000 2r11111111 2r11100000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
915 |
2r00000000 2r10000000 2r00000000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
916 |
2r00000000 2r10000000 2r00000000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
917 |
2r00000000 2r00000000 2r00000000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
918 |
2r00000000 2r00000000 2r00000000] |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
919 |
on:aDevice |
205 | 920 |
]. |
921 |
ReturnLightForm := f. |
|
922 |
^ f |
|
781
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
923 |
|
1387 | 924 |
"Modified: / 3.11.1997 / 09:12:23 / cg" |
205 | 925 |
! |
926 |
||
0 | 927 |
returnShadowFormOn:aDevice |
928 |
"return the form used for the return arrow shadow pixels (3D only); |
|
929 |
cache the one for Display for the next round." |
|
930 |
||
931 |
|f| |
|
932 |
||
781
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
933 |
(ReturnShadowForm notNil and:[aDevice == ReturnShadowForm graphicsDevice]) ifTrue:[ |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
934 |
^ ReturnShadowForm |
0 | 935 |
]. |
899 | 936 |
f := Image fromFile:'bitmaps/ReturnShadow.xbm' resolution:100 on:aDevice. |
0 | 937 |
f isNil ifTrue:[ |
1387 | 938 |
f := Form width:24 height:14 fromArray:#[2r00000000 2r00000000 2r00000000 |
781
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
939 |
2r00000000 2r00000000 2r00000000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
940 |
2r00000000 2r00000011 2r11100000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
941 |
2r00000001 2r10000010 2r00000000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
942 |
2r00000010 2r10000010 2r00000000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
943 |
2r00000100 2r11111110 2r00000000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
944 |
2r00001000 2r00000000 2r00000000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
945 |
2r00010000 2r00000000 2r00000000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
946 |
2r00001000 2r00000000 2r00000000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
947 |
2r00000100 2r00000000 2r00000000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
948 |
2r00000010 2r00000000 2r00000000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
949 |
2r00000001 2r00000000 2r00000000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
950 |
2r00000000 2r00000000 2r00000000 |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
951 |
2r00000000 2r00000000 2r00000000] |
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
952 |
on:aDevice |
0 | 953 |
]. |
35 | 954 |
ReturnShadowForm := f. |
0 | 955 |
^ f |
781
51741bd620ab
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
761
diff
changeset
|
956 |
|
1387 | 957 |
"Modified: / 3.11.1997 / 09:12:11 / cg" |
0 | 958 |
! |
959 |
||
205 | 960 |
updateStyleCache |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
961 |
"extract values from the styleSheet and cache them in class variables" |
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
962 |
|
1355 | 963 |
<resource: #style (#'button.edgeStyle' #'button.font' #'button.borderWidth' |
964 |
#'button.activeLevel' #'button.passiveLevel' |
|
965 |
#'button.backgroundColor' #'button.foregroundColor' |
|
966 |
#'button.activeBackgroundColor' #'button.activeForegroundColor' |
|
967 |
#'button.enteredBackgroundColor' #'button.enteredForegroundColor' |
|
968 |
#'button.disabledForegroundColor' #'button.disabledBackgroundColor' |
|
969 |
#'button.returnButtonHasImage' |
|
970 |
#'button.returnButtonHasBorder' |
|
971 |
#'button.shadowColor' #'button.lightColor' |
|
972 |
#'button.halfShadowColor' #'button.halfLightColor')> |
|
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
973 |
|
205 | 974 |
|defaultLevel| |
0 | 975 |
|
205 | 976 |
StyleSheet is3D ifTrue:[ |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
977 |
defaultLevel := 1. |
205 | 978 |
] ifFalse:[ |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
979 |
defaultLevel := 0 |
0 | 980 |
]. |
1355 | 981 |
DefaultActiveLevel := StyleSheet at:'button.activeLevel' default:(defaultLevel negated). |
982 |
DefaultPassiveLevel := StyleSheet at:'button.passiveLevel' default:defaultLevel. |
|
983 |
||
984 |
DefaultEdgeStyle := StyleSheet at:'button.edgeStyle'. |
|
985 |
DefaultFont := StyleSheet fontAt:'button.font'. |
|
986 |
DefaultBorderWidth := StyleSheet at:'button.borderWidth'. |
|
987 |
DefaultForegroundColor := StyleSheet colorAt:'button.foregroundColor'. |
|
988 |
DefaultBackgroundColor := StyleSheet colorAt:'button.backgroundColor'. |
|
989 |
DefaultDisabledForegroundColor := StyleSheet colorAt:'button.disabledForegroundColor' default:Color gray. |
|
990 |
DefaultDisabledBackgroundColor := StyleSheet colorAt:'button.disabledBackgroundColor'. |
|
991 |
DefaultEnteredForegroundColor := StyleSheet colorAt:'button.enteredForegroundColor'. |
|
992 |
DefaultEnteredBackgroundColor := StyleSheet colorAt:'button.enteredBackgroundColor'. |
|
993 |
DefaultActiveForegroundColor := StyleSheet colorAt:'button.activeForegroundColor'. |
|
994 |
DefaultActiveBackgroundColor := StyleSheet colorAt:'button.activeBackgroundColor'. |
|
995 |
DefaultReturnButtonHasImage := StyleSheet at:'button.returnButtonHasImage' default:true. |
|
996 |
DefaultReturnButtonHasBorder := StyleSheet at:'button.returnButtonHasBorder' default:false. |
|
997 |
DefaultShadowColor := StyleSheet colorAt:'button.shadowColor'. |
|
998 |
DefaultLightColor := StyleSheet colorAt:'button.lightColor'. |
|
999 |
DefaultHalfShadowColor := StyleSheet colorAt:'button.halfShadowColor'. |
|
1000 |
DefaultHalfLightColor := StyleSheet colorAt:'button.halfLightColor'. |
|
1001 |
||
1002 |
"Modified: 20.10.1997 / 13:49:41 / cg" |
|
0 | 1003 |
! ! |
1004 |
||
205 | 1005 |
!Button methodsFor:'accessing-behavior'! |
1006 |
||
1007 |
action:aBlock |
|
1008 |
"convenient method: depending on the setting of controllers triggerOnDown flag, |
|
1009 |
either set the press-action and clear any release-action or |
|
1010 |
vice versa, set the release-action and clear the press-action." |
|
1011 |
||
315
dbfd0ae75b57
check for nil-controller (dont die if fBrowser is closed while command is being executed)
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1012 |
controller notNil ifTrue:[controller action:aBlock] |
205 | 1013 |
! |
1014 |
||
1015 |
autoRepeat |
|
346 | 1016 |
"turn on autorepeat OBSOLETE; use #autoRepeat:" |
205 | 1017 |
|
1018 |
controller autoRepeat |
|
346 | 1019 |
|
1020 |
"Modified: 9.2.1996 / 22:42:37 / cg" |
|
205 | 1021 |
! |
1022 |
||
1023 |
autoRepeat:aBoolean |
|
1024 |
"turn on/off autorepeat" |
|
1025 |
||
1026 |
controller autoRepeat:aBoolean |
|
1027 |
||
1028 |
"Modified: 5.9.1995 / 22:06:13 / claus" |
|
1029 |
! |
|
1030 |
||
1031 |
disable |
|
1032 |
"disable the button" |
|
1033 |
||
1034 |
controller disable. |
|
1035 |
! |
|
1036 |
||
1037 |
enable |
|
1038 |
"enable the button" |
|
1039 |
||
1040 |
controller enable |
|
1041 |
! |
|
1042 |
||
264 | 1043 |
enabled |
1044 |
"return true if the button is enabled" |
|
1045 |
||
1046 |
^ controller enabled |
|
1047 |
||
1048 |
"Created: 17.12.1995 / 16:12:26 / cg" |
|
1049 |
! |
|
1050 |
||
205 | 1051 |
pressAction |
1052 |
"return the pressAction; thats the block which gets evaluated |
|
1053 |
when the button is pressed (if non-nil)" |
|
1054 |
||
1055 |
^ controller pressAction |
|
1056 |
! |
|
0 | 1057 |
|
205 | 1058 |
pressAction:aBlock |
1059 |
"define the action to be performed on press" |
|
1060 |
||
1061 |
controller pressAction:aBlock |
|
1062 |
! |
|
1063 |
||
867 | 1064 |
releaseAction |
1065 |
"return the releaseAction; thats the block which gets evaluated |
|
1066 |
when the button is relreased (if non-nil)" |
|
1067 |
||
1068 |
^ controller releaseAction |
|
1069 |
! |
|
1070 |
||
1071 |
releaseAction:aBlock |
|
1072 |
"define the action to be performed on release" |
|
1073 |
||
1074 |
controller releaseAction:aBlock |
|
1075 |
! ! |
|
1076 |
||
1077 |
!Button methodsFor:'accessing-channels'! |
|
1078 |
||
1079 |
enableChannel |
|
1080 |
"return a valueHolder for enable/disable" |
|
1081 |
||
1644
c2b849ce4552
care for non-existing controller when accessing channels.
Claus Gittinger <cg@exept.de>
parents:
1630
diff
changeset
|
1082 |
controller isNil ifTrue:[^ nil]. |
867 | 1083 |
^ controller enableChannel |
1084 |
||
1644
c2b849ce4552
care for non-existing controller when accessing channels.
Claus Gittinger <cg@exept.de>
parents:
1630
diff
changeset
|
1085 |
"Modified: / 13.8.1998 / 12:04:46 / cg" |
867 | 1086 |
! |
1087 |
||
1088 |
enableChannel:aValueHolderForBoolean |
|
1089 |
"set the valueHolder used for enable/disable" |
|
1090 |
||
1091 |
controller enableChannel:aValueHolderForBoolean |
|
1092 |
! |
|
1093 |
||
205 | 1094 |
pressChannel |
1095 |
"return the pressChannel" |
|
1096 |
||
1644
c2b849ce4552
care for non-existing controller when accessing channels.
Claus Gittinger <cg@exept.de>
parents:
1630
diff
changeset
|
1097 |
controller isNil ifTrue:[^ nil]. |
205 | 1098 |
^ controller pressChannel |
1099 |
||
1644
c2b849ce4552
care for non-existing controller when accessing channels.
Claus Gittinger <cg@exept.de>
parents:
1630
diff
changeset
|
1100 |
"Modified: / 7.9.1995 / 18:16:20 / claus" |
c2b849ce4552
care for non-existing controller when accessing channels.
Claus Gittinger <cg@exept.de>
parents:
1630
diff
changeset
|
1101 |
"Modified: / 13.8.1998 / 12:04:51 / cg" |
205 | 1102 |
! |
1103 |
||
1104 |
pressChannel:aBlock |
|
1105 |
"set the pressChannel" |
|
1106 |
||
1107 |
controller pressChannel:aBlock |
|
1108 |
||
1109 |
"Modified: 7.9.1995 / 18:05:14 / claus" |
|
1110 |
! |
|
1111 |
||
1112 |
releaseChannel |
|
1113 |
"return the releaseChannel" |
|
1114 |
||
1644
c2b849ce4552
care for non-existing controller when accessing channels.
Claus Gittinger <cg@exept.de>
parents:
1630
diff
changeset
|
1115 |
controller isNil ifTrue:[^ nil]. |
205 | 1116 |
^ controller releaseChannel |
1117 |
||
1644
c2b849ce4552
care for non-existing controller when accessing channels.
Claus Gittinger <cg@exept.de>
parents:
1630
diff
changeset
|
1118 |
"Modified: / 7.9.1995 / 18:15:24 / claus" |
c2b849ce4552
care for non-existing controller when accessing channels.
Claus Gittinger <cg@exept.de>
parents:
1630
diff
changeset
|
1119 |
"Modified: / 13.8.1998 / 12:04:55 / cg" |
205 | 1120 |
! |
1121 |
||
1122 |
releaseChannel:aBlock |
|
1123 |
"set the releaseChannel" |
|
1124 |
||
1125 |
controller releaseChannel:aBlock |
|
1126 |
||
1127 |
"Modified: 7.9.1995 / 18:05:21 / claus" |
|
1128 |
! ! |
|
1129 |
||
1130 |
!Button methodsFor:'accessing-look'! |
|
1131 |
||
1132 |
activeBackgroundColor |
|
1133 |
"return the background color to be used when pressed" |
|
1134 |
||
1135 |
^ activeBgColor |
|
164 | 1136 |
! |
1137 |
||
205 | 1138 |
activeBackgroundColor:aColor |
1139 |
"set the background color to be used when pressed" |
|
1140 |
||
1141 |
activeBgColor := aColor. |
|
1142 |
self redrawIfPressed |
|
1143 |
! |
|
1144 |
||
1145 |
activeForegroundColor |
|
1146 |
"return the foreground color to be used when pressed" |
|
1147 |
||
1148 |
^ activeFgColor |
|
1149 |
! |
|
1150 |
||
1151 |
activeForegroundColor:aColor |
|
1152 |
"set the foreground color to be used when pressed" |
|
1153 |
||
1154 |
activeFgColor := aColor. |
|
1155 |
self redrawIfPressed |
|
1156 |
! |
|
1157 |
||
1158 |
activeForegroundColor:fgColor backgroundColor:bgColor |
|
1159 |
"set both fg and bg colors to be used when pressed" |
|
1160 |
||
1161 |
activeFgColor := fgColor. |
|
1162 |
activeBgColor := bgColor. |
|
1163 |
self redrawIfPressed |
|
1164 |
! |
|
0 | 1165 |
|
205 | 1166 |
activeLevel |
1167 |
"return the level of the button when pressed" |
|
1168 |
||
1169 |
^ onLevel |
|
1170 |
! |
|
1171 |
||
1172 |
activeLevel:aNumber |
|
1173 |
"set the level of the button when pressed (i.e. how deep)" |
|
1174 |
||
1630 | 1175 |
onLevel ~~ aNumber ifTrue:[ |
1176 |
onLevel := aNumber. |
|
1177 |
(controller notNil |
|
1178 |
and:[controller pressed]) ifTrue:[ |
|
1179 |
self level:onLevel. |
|
1180 |
margin := onLevel abs max:offLevel abs. |
|
1181 |
shown ifTrue:[ |
|
1182 |
self invalidate. "/ redraw |
|
1183 |
] |
|
992 | 1184 |
] |
1630 | 1185 |
]. |
1186 |
||
1187 |
"Modified: / 30.7.1998 / 22:29:01 / cg" |
|
205 | 1188 |
! |
1189 |
||
1190 |
activeLogo:anImageOrString |
|
1191 |
"define the logo to be displayed while active - |
|
1192 |
this is optional; the default is to display the same |
|
1193 |
(logo) in both pressed and released states." |
|
1194 |
||
1195 |
activeLogo := anImageOrString. |
|
1196 |
controller pressed ifTrue:[ |
|
1197 |
self logo:anImageOrString |
|
1198 |
] |
|
0 | 1199 |
! |
1200 |
||
205 | 1201 |
beImageButton |
1202 |
"make mySelf an image button - that is turn off all levelChanges |
|
1203 |
and logo spacing. This should be sent for buttons which use both |
|
1204 |
passive and active logos, and the 3D effect comes from the bitmaps |
|
1205 |
(i.e. windows buttons)." |
|
1206 |
||
1207 |
self |
|
711
c830bb66598b
use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents:
707
diff
changeset
|
1208 |
extent:(labelWidth @ labelHeight); |
c830bb66598b
use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents:
707
diff
changeset
|
1209 |
sizeFixed:true; |
c830bb66598b
use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents:
707
diff
changeset
|
1210 |
borderWidth:0; |
c830bb66598b
use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents:
707
diff
changeset
|
1211 |
activeLevel:0; |
c830bb66598b
use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents:
707
diff
changeset
|
1212 |
passiveLevel:0; |
c830bb66598b
use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents:
707
diff
changeset
|
1213 |
horizontalSpace:0; |
c830bb66598b
use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents:
707
diff
changeset
|
1214 |
verticalSpace:0; |
c830bb66598b
use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents:
707
diff
changeset
|
1215 |
newLayout. |
205 | 1216 |
|
1217 |
"Created: 17.9.1995 / 20:41:47 / claus" |
|
1218 |
"Modified: 19.9.1995 / 16:34:08 / claus" |
|
711
c830bb66598b
use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents:
707
diff
changeset
|
1219 |
"Modified: 28.5.1996 / 22:04:14 / cg" |
205 | 1220 |
! |
1221 |
||
244 | 1222 |
beReturnButton |
1051 | 1223 |
"show show a return-key image after the label. |
1224 |
Same as 'isReturnButton:true' for ST-80 compatibility." |
|
244 | 1225 |
|
1226 |
self isReturnButton:true |
|
1227 |
! |
|
1228 |
||
205 | 1229 |
beRoundRadioButton |
1230 |
"setup myself for a round radioButton look. |
|
1231 |
this is a private method; do not use it. It is going to move into the |
|
1232 |
RadioButton class." |
|
0 | 1233 |
|
205 | 1234 |
self activeLogo:(Icon constantNamed:'RadioOn'). |
1235 |
self passiveLogo:(Icon constantNamed:'RadioOff'). |
|
1236 |
self activeLevel:0; |
|
1237 |
passiveLevel:0; |
|
1238 |
activeBackgroundColor:bgColor; |
|
1239 |
activeForegroundColor:fgColor; |
|
1240 |
borderWidth:0; |
|
1241 |
enteredBackgroundColor:bgColor. |
|
1242 |
self computeLabelSize. |
|
1243 |
self beImageButton. |
|
1244 |
||
1245 |
"Created: 22.9.1995 / 15:48:05 / claus" |
|
1246 |
"Modified: 22.9.1995 / 17:07:46 / claus" |
|
1247 |
! |
|
1248 |
||
1093
cb7b2c99f5cc
care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents:
1092
diff
changeset
|
1249 |
defaultable |
cb7b2c99f5cc
care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents:
1092
diff
changeset
|
1250 |
"return true, if the receiver is defaultable" |
cb7b2c99f5cc
care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents:
1092
diff
changeset
|
1251 |
|
cb7b2c99f5cc
care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents:
1092
diff
changeset
|
1252 |
^ defaultable |
cb7b2c99f5cc
care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents:
1092
diff
changeset
|
1253 |
! |
cb7b2c99f5cc
care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents:
1092
diff
changeset
|
1254 |
|
1051 | 1255 |
defaultable:aBoolean |
1256 |
"set/clear the defaultable attribute. If defaultable, |
|
1257 |
the preferredExtent is computed to include any additional |
|
1258 |
space required when the receiver is a returnButton." |
|
1259 |
||
1260 |
defaultable ~~ aBoolean ifTrue:[ |
|
1261 |
defaultable := aBoolean. |
|
1262 |
self newLayout |
|
1263 |
] |
|
1264 |
! |
|
1265 |
||
205 | 1266 |
disabledForegroundColor |
1267 |
"return the foreground color used when the button is disabled" |
|
1268 |
||
1269 |
^ disabledFgColor |
|
1270 |
! |
|
1271 |
||
1272 |
disabledLogo:anImageOrString |
|
1273 |
"define the logo to be displayed while active - |
|
1274 |
this is optional; the default is to display the same |
|
1275 |
(logo) in both pressed and released states." |
|
1276 |
||
1277 |
disabledLogo := anImageOrString. |
|
1278 |
controller enabled ifFalse:[ |
|
1279 |
self logo:anImageOrString |
|
1280 |
] |
|
1281 |
||
1282 |
"Created: 17.9.1995 / 19:50:17 / claus" |
|
1283 |
"Modified: 17.9.1995 / 19:50:34 / claus" |
|
59 | 1284 |
! |
1285 |
||
205 | 1286 |
edgeStyle:aSymbol |
1287 |
"set the edgestyle - currently only #soft or nil" |
|
1288 |
||
1289 |
edgeStyle := aSymbol |
|
1290 |
! |
|
1291 |
||
1206
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1292 |
enterLevel |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1293 |
"return the level to be used when the mouse |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1294 |
pointer enters the button area" |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1295 |
|
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1296 |
^ enterLevel |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1297 |
|
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1298 |
"Created: 26.4.1997 / 20:48:53 / cg" |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1299 |
"Modified: 26.4.1997 / 20:49:29 / cg" |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1300 |
! |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1301 |
|
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1302 |
enterLevel:aNumber |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1303 |
"set the level to be used when the mouse |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1304 |
pointer enters the button area" |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1305 |
|
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1306 |
enterLevel := aNumber |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1307 |
|
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1308 |
"Created: 26.4.1997 / 20:49:10 / cg" |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1309 |
"Modified: 26.4.1997 / 20:49:35 / cg" |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1310 |
! |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1311 |
|
205 | 1312 |
enteredBackgroundColor |
1313 |
"return the background color to be used when the mouse |
|
1314 |
pointer enters the button area" |
|
1315 |
||
1316 |
^ enteredBgColor |
|
1317 |
! |
|
1318 |
||
1319 |
enteredBackgroundColor:aColor |
|
1320 |
"set the background color to be used when the mouse |
|
1321 |
pointer enters the button area" |
|
1322 |
||
1323 |
enteredBgColor := aColor |
|
1324 |
! |
|
1325 |
||
1326 |
enteredForegroundColor |
|
1327 |
"return the foreground color to be used when the mouse |
|
1328 |
pointer enters the button area" |
|
1329 |
||
1330 |
^ enteredFgColor |
|
1331 |
! |
|
1332 |
||
1333 |
enteredForegroundColor:aColor |
|
1334 |
"set the foreground color to be used when the mouse |
|
1335 |
pointer enters the button area" |
|
59 | 1336 |
|
205 | 1337 |
enteredFgColor := aColor |
1338 |
! |
|
1339 |
||
1340 |
focusLogo:anImageOrString |
|
1341 |
"define the logo to be displayed while active - |
|
1342 |
this is optional; the default is to display the same |
|
1343 |
(logo) in both pressed and released states." |
|
1344 |
||
1345 |
focusLogo := anImageOrString. |
|
1346 |
||
1347 |
"Created: 17.9.1995 / 19:50:17 / claus" |
|
1348 |
"Modified: 17.9.1995 / 20:00:43 / claus" |
|
1349 |
! |
|
59 | 1350 |
|
205 | 1351 |
isReturnButton:aBoolean |
1352 |
"show/dont show a return-key image after the label" |
|
1353 |
||
1354 |
isReturnButton ~~ aBoolean ifTrue:[ |
|
1355 |
DefaultReturnButtonHasBorder ifTrue:[ |
|
1356 |
self borderWidth:(aBoolean ifTrue:[1] ifFalse:[0]) |
|
1357 |
]. |
|
1358 |
isReturnButton := aBoolean. |
|
1359 |
self newLayout |
|
1360 |
] |
|
1361 |
! |
|
1362 |
||
1206
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1363 |
leaveLevel |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1364 |
"return the level to be used when the mouse |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1365 |
pointer leaves the button area" |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1366 |
|
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1367 |
^ leaveLevel |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1368 |
|
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1369 |
"Created: 26.4.1997 / 20:48:26 / cg" |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1370 |
"Modified: 26.4.1997 / 20:49:47 / cg" |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1371 |
! |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1372 |
|
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1373 |
leaveLevel:aNumber |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1374 |
"set the level to be used when the mouse |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1375 |
pointer leaves the button area" |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1376 |
|
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1377 |
leaveLevel := aNumber |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1378 |
|
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1379 |
"Created: 26.4.1997 / 20:49:22 / cg" |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1380 |
"Modified: 26.4.1997 / 20:49:53 / cg" |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1381 |
! |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
1382 |
|
1094 | 1383 |
loseDefault |
1384 |
"ST-80 compatibility - clear isReturnButton attribute" |
|
1385 |
||
1386 |
self isReturnButton:false |
|
1387 |
||
1388 |
"Created: 3.3.1997 / 16:20:47 / cg" |
|
1389 |
"Modified: 3.3.1997 / 18:12:06 / cg" |
|
1390 |
! |
|
1391 |
||
205 | 1392 |
offLevel |
1393 |
"return the level of the button when released. |
|
1394 |
Historic leftover; use #passiveLevel." |
|
1395 |
||
1396 |
^ offLevel |
|
59 | 1397 |
! |
1398 |
||
205 | 1399 |
offLevel:aNumber |
1400 |
"set the level of the button when released (i.e. how deep). |
|
1401 |
Historic leftover; use #passiveLevel:." |
|
1402 |
||
1403 |
^ self passiveLevel:aNumber |
|
1404 |
! |
|
1405 |
||
1406 |
onLevel |
|
1407 |
"return the level of the button when pressed. |
|
1408 |
Historic leftover; use #activeLevel." |
|
1409 |
||
1410 |
^ onLevel |
|
1411 |
! |
|
1412 |
||
1413 |
onLevel:aNumber |
|
1414 |
"set the level of the button when pressed (i.e. how deep). |
|
1415 |
Historic leftover; use #activeLevel:." |
|
1416 |
||
1417 |
^ self activeLevel:aNumber |
|
1418 |
! |
|
1419 |
||
1420 |
passiveLevel |
|
1421 |
"return the level of the button when released" |
|
1422 |
||
1423 |
^ offLevel |
|
1424 |
! |
|
1425 |
||
1426 |
passiveLevel:aNumber |
|
1427 |
"set the level of the button when not pressed (i.e. how high)" |
|
118 | 1428 |
|
1630 | 1429 |
offLevel ~~ aNumber ifTrue:[ |
1430 |
offLevel := aNumber. |
|
1431 |
(controller notNil |
|
1432 |
and:[controller pressed not]) ifTrue:[ |
|
1433 |
self level:offLevel. |
|
1434 |
margin := onLevel abs max:offLevel abs. |
|
1435 |
shown ifTrue:[ |
|
1436 |
self invalidate. |
|
1437 |
] |
|
992 | 1438 |
] |
205 | 1439 |
] |
711
c830bb66598b
use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents:
707
diff
changeset
|
1440 |
|
1630 | 1441 |
"Modified: / 30.7.1998 / 22:29:17 / cg" |
205 | 1442 |
! |
1443 |
||
1444 |
passiveLogo:anImageOrString |
|
1445 |
"define the logo to be displayed while inactive - |
|
1446 |
this is optional; the default is to display the same |
|
1447 |
(logo) in both pressed and released states." |
|
118 | 1448 |
|
205 | 1449 |
passiveLogo := anImageOrString. |
1450 |
controller pressed ifFalse:[ |
|
1451 |
self logo:anImageOrString |
|
1452 |
] |
|
1094 | 1453 |
! |
1454 |
||
1455 |
takeDefault |
|
1456 |
"ST-80 compatibility - set isReturnButton attribute" |
|
1457 |
||
1458 |
self isReturnButton:true |
|
1459 |
||
1460 |
"Created: 3.3.1997 / 16:20:52 / cg" |
|
1461 |
"Modified: 3.3.1997 / 18:11:58 / cg" |
|
1223
840e31e3f140
care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1462 |
! |
840e31e3f140
care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1463 |
|
840e31e3f140
care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1464 |
viewBackground:something |
840e31e3f140
care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1465 |
super viewBackground:something. |
840e31e3f140
care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1466 |
something isColor ifTrue:[ |
840e31e3f140
care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1467 |
device hasGrayscales ifTrue:[ |
840e31e3f140
care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1468 |
halfLightColor notNil ifTrue:[ |
840e31e3f140
care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1469 |
halfLightColor := something lightened "on:device". |
840e31e3f140
care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1470 |
]. |
840e31e3f140
care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1471 |
halfShadowColor notNil ifTrue:[ |
840e31e3f140
care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1472 |
halfShadowColor := something darkened "on:device". |
840e31e3f140
care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1473 |
] |
840e31e3f140
care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1474 |
] |
840e31e3f140
care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1475 |
]. |
840e31e3f140
care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1476 |
|
840e31e3f140
care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1477 |
"Modified: 3.5.1997 / 10:37:24 / cg" |
205 | 1478 |
! ! |
1479 |
||
1480 |
!Button methodsFor:'changing state'! |
|
1481 |
||
1482 |
toggle |
|
1483 |
"toggle and perform the action" |
|
1484 |
||
1485 |
controller toggle |
|
1486 |
! |
|
1487 |
||
1488 |
toggleNoAction |
|
1489 |
"toggle, but do NOT perform any action - can be used to change a toggle |
|
1490 |
under program control (i.e. turn one toggle off from another one)" |
|
1491 |
||
1492 |
controller toggleNoAction |
|
118 | 1493 |
! |
1494 |
||
205 | 1495 |
turnOff |
1496 |
"turn the button off (if not already off) do NOT perform actions/change notifications" |
|
1497 |
||
328
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1498 |
(controller notNil and:[controller pressed]) ifTrue:[ |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1499 |
offLevel ~~ level ifTrue:[ |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1500 |
self level:offLevel. |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1501 |
]. |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1502 |
(passiveLogo notNil and:[passiveLogo ~~ logo]) ifTrue:[ |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1503 |
self logo:passiveLogo |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1504 |
]. |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1505 |
controller setPressed:false. |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1506 |
controller active:false. |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1507 |
level := offLevel. |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1508 |
margin := level abs. |
992 | 1509 |
shown ifTrue:[ |
1510 |
self invalidate |
|
1511 |
] |
|
205 | 1512 |
] |
328
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1513 |
|
992 | 1514 |
"Modified: 8.2.1997 / 15:21:44 / cg" |
205 | 1515 |
! |
1516 |
||
1517 |
turnOffWithAction |
|
1518 |
"turn the button off (if not already off) and perform any action/change notification" |
|
118 | 1519 |
|
328
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1520 |
(controller notNil and:[controller pressed]) ifTrue:[ |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1521 |
offLevel ~~ level ifTrue:[ |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1522 |
self level:offLevel. |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1523 |
]. |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1524 |
(passiveLogo notNil and:[passiveLogo ~~ logo]) ifTrue:[ |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1525 |
self logo:passiveLogo |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1526 |
]. |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1527 |
self turnOffWithoutRedraw. |
992 | 1528 |
shown ifTrue:[ |
1529 |
self invalidate |
|
1530 |
] |
|
205 | 1531 |
] |
118 | 1532 |
|
205 | 1533 |
"Created: 15.11.1995 / 16:55:37 / cg" |
992 | 1534 |
"Modified: 8.2.1997 / 15:21:53 / cg" |
205 | 1535 |
! |
1536 |
||
1537 |
turnOffWithoutRedraw |
|
1538 |
"turn the button off - no redraw but perform any action/change notification" |
|
1539 |
||
328
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1540 |
controller notNil ifTrue:[ |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1541 |
controller pressed:false. |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1542 |
controller active:false. |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1543 |
]. |
205 | 1544 |
|
1545 |
"do not use super level:offLevel |
|
1546 |
- because that one does redraw the edges. |
|
1547 |
Sure, this is no good coding style" |
|
1548 |
||
1549 |
level := offLevel. |
|
1550 |
margin := level abs |
|
328
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1551 |
|
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1552 |
"Modified: 8.2.1996 / 15:28:53 / cg" |
118 | 1553 |
! |
1554 |
||
205 | 1555 |
turnOn |
1556 |
"turn the button on (if not already on) - do NOT perform any action/notification" |
|
1557 |
||
328
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1558 |
(controller notNil and:[controller pressed not]) ifTrue:[ |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1559 |
onLevel ~~ level ifTrue:[ |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1560 |
self level:onLevel. |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1561 |
]. |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1562 |
(activeLogo notNil and:[activeLogo ~~ logo]) ifTrue:[ |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1563 |
self logo:activeLogo |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1564 |
]. |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1565 |
controller setPressed:true. |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1566 |
level := onLevel. |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1567 |
margin := level abs. |
205 | 1568 |
|
992 | 1569 |
shown ifTrue:[ |
1570 |
self invalidate |
|
1571 |
] |
|
205 | 1572 |
] |
59 | 1573 |
|
205 | 1574 |
"Created: 14.11.1995 / 22:00:45 / cg" |
992 | 1575 |
"Modified: 8.2.1997 / 15:22:01 / cg" |
205 | 1576 |
! |
1577 |
||
1578 |
turnOnWithAction |
|
1579 |
"turn the button on (if not already on) and perform any change actions/notifications" |
|
118 | 1580 |
|
328
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1581 |
(controller notNil and:[controller pressed not]) ifTrue:[ |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1582 |
onLevel ~~ level ifTrue:[ |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1583 |
self level:onLevel. |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1584 |
]. |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1585 |
(activeLogo notNil and:[activeLogo ~~ logo]) ifTrue:[ |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1586 |
self logo:activeLogo |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1587 |
]. |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1588 |
self turnOnWithoutRedraw. |
992 | 1589 |
shown ifTrue:[ |
1590 |
self invalidate |
|
1591 |
] |
|
205 | 1592 |
] |
1593 |
||
1594 |
"Created: 15.11.1995 / 16:55:56 / cg" |
|
992 | 1595 |
"Modified: 8.2.1997 / 15:22:09 / cg" |
118 | 1596 |
! |
1597 |
||
205 | 1598 |
turnOnWithoutRedraw |
1599 |
"turn the button on - no redraw but perform any change actions/notifications" |
|
1600 |
||
328
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1601 |
controller notNil ifTrue:[ |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1602 |
controller pressed:true. |
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1603 |
]. |
118 | 1604 |
|
205 | 1605 |
"do not use super level:offLevel |
1606 |
- because that one does redraw the edges. |
|
1607 |
Sure, this is no good coding style" |
|
1608 |
||
1609 |
level := onLevel. |
|
1610 |
margin := level abs |
|
328
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1611 |
|
6c4daccc6fb5
check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
1612 |
"Modified: 8.2.1996 / 15:29:23 / cg" |
205 | 1613 |
! ! |
1614 |
||
1615 |
!Button methodsFor:'focus change'! |
|
59 | 1616 |
|
309
b5c9d68e95e1
new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
1617 |
showFocus:explicit |
205 | 1618 |
focusLogo notNil ifTrue:[ |
1170 | 1619 |
controller enabled ifTrue:[ |
1620 |
logo := focusLogo. |
|
1621 |
^ self redraw |
|
1622 |
] |
|
205 | 1623 |
]. |
309
b5c9d68e95e1
new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
1624 |
super showFocus:explicit |
205 | 1625 |
|
1626 |
"Created: 17.9.1995 / 19:58:50 / claus" |
|
1170 | 1627 |
"Modified: 1.4.1997 / 13:26:33 / cg" |
205 | 1628 |
! |
1629 |
||
309
b5c9d68e95e1
new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
1630 |
showNoFocus:explicit |
205 | 1631 |
focusLogo notNil ifTrue:[ |
1170 | 1632 |
disabledLogo notNil ifTrue:[ |
1633 |
controller enabled ifTrue:[ |
|
1634 |
logo := passiveLogo. |
|
1635 |
] ifFalse:[ |
|
1636 |
logo := disabledLogo. |
|
1637 |
]. |
|
1638 |
] ifFalse:[ |
|
1639 |
logo := passiveLogo |
|
1640 |
]. |
|
1641 |
^ self redraw |
|
205 | 1642 |
]. |
309
b5c9d68e95e1
new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
1643 |
super showNoFocus:explicit |
205 | 1644 |
|
1645 |
"Created: 17.9.1995 / 20:00:06 / claus" |
|
1646 |
"Modified: 17.9.1995 / 20:26:32 / claus" |
|
1170 | 1647 |
"Modified: 1.4.1997 / 13:26:35 / cg" |
0 | 1648 |
! ! |
1649 |
||
1650 |
!Button methodsFor:'initialization'! |
|
1651 |
||
205 | 1652 |
defaultControllerClass |
1653 |
^ ButtonController |
|
1654 |
! |
|
1655 |
||
931 | 1656 |
fetchDeviceResources |
1657 |
"fetch device colors, to avoid reallocation at redraw time" |
|
1658 |
||
1659 |
super fetchDeviceResources. |
|
1660 |
||
1661 |
disabledFgColor notNil ifTrue:[disabledFgColor := disabledFgColor on:device]. |
|
1662 |
activeFgColor notNil ifTrue:[activeFgColor := activeFgColor on:device]. |
|
1663 |
activeBgColor notNil ifTrue:[activeBgColor := activeBgColor on:device]. |
|
1664 |
enteredFgColor notNil ifTrue:[enteredFgColor := enteredFgColor on:device]. |
|
1665 |
enteredBgColor notNil ifTrue:[enteredBgColor := enteredBgColor on:device]. |
|
1666 |
||
1667 |
formColor notNil ifTrue:[formColor := formColor on:device]. |
|
1668 |
formLightColor notNil ifTrue:[formLightColor := formLightColor on:device]. |
|
945 | 1669 |
formShadowColor notNil ifTrue:[formShadowColor := formShadowColor on:device]. |
931 | 1670 |
halfShadowColor notNil ifTrue:[halfShadowColor := halfShadowColor on:device]. |
1671 |
halfLightColor notNil ifTrue:[halfLightColor := halfLightColor on:device]. |
|
1672 |
||
945 | 1673 |
"Modified: 15.2.1997 / 17:14:16 / cg" |
931 | 1674 |
! |
1675 |
||
205 | 1676 |
initCursor |
1677 |
"set up a hand cursor" |
|
0 | 1678 |
|
205 | 1679 |
cursor := Cursor hand |
1680 |
! |
|
1681 |
||
1682 |
initEvents |
|
1683 |
super initEvents. |
|
1684 |
self enableEnterLeaveEvents |
|
0 | 1685 |
! |
1686 |
||
1687 |
initStyle |
|
959 | 1688 |
"setup viewStyle specifics" |
1689 |
||
761 | 1690 |
<resource: #style (#name)> |
1691 |
||
59 | 1692 |
|hasGreyscales nm| |
1693 |
||
1694 |
super initStyle. |
|
1695 |
||
392
81343306d796
eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
1696 |
"/ DefaultFont notNil ifTrue:[font := DefaultFont on:device]. |
81343306d796
eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents:
366
diff
changeset
|
1697 |
|
74 | 1698 |
DefaultBorderWidth notNil ifTrue:[borderWidth := DefaultBorderWidth]. |
934 | 1699 |
DefaultForegroundColor notNil ifTrue:[fgColor := DefaultForegroundColor]. |
1700 |
DefaultBackgroundColor notNil ifTrue:[bgColor := DefaultBackgroundColor]. |
|
59 | 1701 |
|
62 | 1702 |
edgeStyle := DefaultEdgeStyle. |
59 | 1703 |
onLevel := DefaultActiveLevel. |
1704 |
offLevel := DefaultPassiveLevel. |
|
1705 |
||
1706 |
DefaultDisabledForegroundColor notNil ifTrue:[ |
|
934 | 1707 |
disabledFgColor := DefaultDisabledForegroundColor |
59 | 1708 |
] ifFalse:[ |
705 | 1709 |
disabledFgColor := fgColor |
59 | 1710 |
]. |
1711 |
||
934 | 1712 |
DefaultEnteredForegroundColor notNil ifTrue:[enteredFgColor := DefaultEnteredForegroundColor]. |
1713 |
DefaultEnteredBackgroundColor notNil ifTrue:[enteredBgColor := DefaultEnteredBackgroundColor]. |
|
1714 |
DefaultActiveForegroundColor notNil ifTrue:[activeFgColor := DefaultActiveForegroundColor]. |
|
1715 |
DefaultActiveBackgroundColor notNil ifTrue:[activeBgColor := DefaultActiveBackgroundColor]. |
|
59 | 1716 |
|
934 | 1717 |
DefaultShadowColor notNil ifTrue:[shadowColor := DefaultShadowColor]. |
1718 |
DefaultLightColor notNil ifTrue:[lightColor := DefaultLightColor]. |
|
59 | 1719 |
|
62 | 1720 |
shadowColor isNil ifTrue:[ |
705 | 1721 |
shadowColor := Black. |
62 | 1722 |
]. |
1723 |
lightColor isNil ifTrue:[ |
|
705 | 1724 |
lightColor := White. |
62 | 1725 |
]. |
59 | 1726 |
|
707 | 1727 |
hasGreyscales := device hasGrayscales. |
1651 | 1728 |
(edgeStyle == #soft or:[edgeStyle == #softWin95]) ifTrue:[ |
934 | 1729 |
DefaultHalfShadowColor notNil ifTrue:[halfShadowColor := DefaultHalfShadowColor]. |
1730 |
DefaultHalfLightColor notNil ifTrue:[halfLightColor := DefaultHalfLightColor]. |
|
62 | 1731 |
|
705 | 1732 |
halfShadowColor isNil ifTrue:[ |
62 | 1733 |
"/ hasGreyscales ifTrue:[ |
1734 |
"/ halfShadowColor := Color darkGrey |
|
1735 |
"/ ] ifFalse:[ |
|
1736 |
"/ halfShadowColor := shadowColor |
|
1737 |
"/ ] |
|
705 | 1738 |
halfShadowColor := shadowColor lightened |
1739 |
] |
|
59 | 1740 |
]. |
1741 |
||
62 | 1742 |
" |
1743 |
actually, the stuf below should not be needed |
|
1744 |
- the styleSheet should provide values for nonGreyscale displays too |
|
1745 |
" |
|
130 | 1746 |
nm := styleSheet name. |
62 | 1747 |
(nm == #iris) ifTrue:[ |
705 | 1748 |
hasGreyscales ifTrue:[ |
1749 |
DefaultEnteredBackgroundColor isNil ifTrue:[ |
|
1750 |
enteredBgColor := bgColor lightened "Color lightGray". |
|
1751 |
]. |
|
1752 |
DefaultActiveBackgroundColor isNil ifTrue:[ |
|
1753 |
activeBgColor := enteredBgColor. |
|
1754 |
]. |
|
1755 |
DefaultActiveForegroundColor isNil ifTrue:[ |
|
1756 |
activeFgColor := enteredFgColor. |
|
1757 |
]. |
|
1758 |
] ifFalse:[ |
|
1759 |
DefaultEnteredBackgroundColor isNil ifTrue:[ |
|
1760 |
enteredBgColor := Color veryLightGray. |
|
1761 |
]. |
|
1762 |
DefaultActiveBackgroundColor isNil ifTrue:[ |
|
1763 |
activeBgColor := Black. |
|
1764 |
]. |
|
1765 |
DefaultActiveForegroundColor isNil ifTrue:[ |
|
1766 |
activeFgColor := White. |
|
1767 |
]. |
|
1768 |
]. |
|
62 | 1769 |
] ifFalse:[ |
705 | 1770 |
nm == #motif ifTrue:[ |
1771 |
lightColor isNil ifTrue:[ |
|
1772 |
lightColor := bgColor lightened |
|
1773 |
]. |
|
62 | 1774 |
"/ hasGreyscales ifTrue:[ |
1775 |
"/ lightColor := Color lightGrey |
|
1776 |
"/ ] |
|
705 | 1777 |
] ifFalse:[ |
1778 |
nm == #st80 ifTrue:[ |
|
1779 |
hasGreyscales ifTrue:[ |
|
1780 |
DefaultActiveForegroundColor isNil ifTrue:[ |
|
1781 |
activeFgColor := fgColor. |
|
1782 |
]. |
|
1783 |
DefaultActiveBackgroundColor isNil ifTrue:[ |
|
1784 |
activeBgColor := bgColor darkened. |
|
1785 |
]. |
|
1786 |
] ifFalse:[ |
|
1787 |
DefaultActiveForegroundColor isNil ifTrue:[ |
|
1788 |
activeFgColor := White. |
|
1789 |
]. |
|
1790 |
DefaultActiveBackgroundColor isNil ifTrue:[ |
|
1791 |
activeBgColor := Black |
|
1792 |
] |
|
1793 |
] |
|
1794 |
] |
|
1795 |
] |
|
59 | 1796 |
]. |
1797 |
||
1798 |
offLevel ~~ level ifTrue:[ |
|
705 | 1799 |
self level:offLevel. |
1800 |
margin := (onLevel abs) max:(offLevel abs). |
|
59 | 1801 |
]. |
1802 |
||
1803 |
DefaultReturnButtonHasImage ifTrue:[ |
|
705 | 1804 |
(styleSheet is3D and:[hasGreyscales]) ifTrue:[ |
1805 |
shadowForm := self class returnShadowFormOn:device. |
|
1806 |
lightForm := self class returnLightFormOn:device. |
|
1807 |
formColor := viewBackground. |
|
1808 |
formShadowColor := shadowColor. |
|
1809 |
formLightColor := lightColor |
|
1810 |
] ifFalse:[ |
|
1811 |
shadowForm := self class returnFormOn:device. |
|
1812 |
formColor := Black |
|
1813 |
]. |
|
59 | 1814 |
]. |
705 | 1815 |
|
1651 | 1816 |
"Modified: / 20.8.1998 / 12:07:37 / cg" |
59 | 1817 |
! |
1818 |
||
205 | 1819 |
initialize |
1820 |
super initialize. |
|
0 | 1821 |
|
1051 | 1822 |
isReturnButton := defaultable := false. |
0 | 1823 |
! |
1824 |
||
1825 |
reinitialize |
|
1826 |
super reinitialize. |
|
77 | 1827 |
controller notNil ifTrue:[ |
1828 |
controller active:false. |
|
1829 |
controller entered:false. |
|
1830 |
] |
|
205 | 1831 |
! ! |
1832 |
||
1833 |
!Button methodsFor:'private'! |
|
1834 |
||
1835 |
computeLabelOrigin |
|
1836 |
"compute the origin of the text - if I am a returnButton, |
|
1837 |
shift it somwehat to the right (we have already allocated the |
|
1838 |
real estate, since computeLabelSize returned some extra space |
|
1839 |
before)." |
|
1840 |
||
1841 |
super computeLabelOrigin. |
|
1093
cb7b2c99f5cc
care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents:
1092
diff
changeset
|
1842 |
shadowForm notNil ifTrue:[ |
cb7b2c99f5cc
care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents:
1092
diff
changeset
|
1843 |
isReturnButton ifTrue:[ |
cb7b2c99f5cc
care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents:
1092
diff
changeset
|
1844 |
labelOriginX := labelOriginX + hSpace + hSpace. |
cb7b2c99f5cc
care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents:
1092
diff
changeset
|
1845 |
]. |
cb7b2c99f5cc
care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents:
1092
diff
changeset
|
1846 |
|
cb7b2c99f5cc
care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents:
1092
diff
changeset
|
1847 |
defaultable ifTrue:[ |
cb7b2c99f5cc
care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents:
1092
diff
changeset
|
1848 |
labelOriginX < margin ifTrue:[ |
cb7b2c99f5cc
care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents:
1092
diff
changeset
|
1849 |
labelOriginX := margin |
cb7b2c99f5cc
care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents:
1092
diff
changeset
|
1850 |
] |
cb7b2c99f5cc
care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents:
1092
diff
changeset
|
1851 |
] |
1663
c6cc4fe918ea
nicer 3D effect (shift label down-right) when pressed.
Claus Gittinger <cg@exept.de>
parents:
1651
diff
changeset
|
1852 |
]. |
1669 | 1853 |
"/ self class == Button ifTrue:[ |
1854 |
"/ labelOriginY := labelOriginY + 1. |
|
1855 |
"/ labelOriginX := labelOriginX + 1. |
|
1856 |
"/ ] |
|
1857 |
||
1858 |
"Modified: / 9.9.1998 / 20:22:01 / cg" |
|
205 | 1859 |
! |
1860 |
||
1861 |
computeLabelSize |
|
1051 | 1862 |
"compute the extent needed to hold the label (plus the return form)" |
205 | 1863 |
|
1864 |
super computeLabelSize. |
|
1051 | 1865 |
((isReturnButton or:[defaultable]) and:[shadowForm notNil]) ifTrue:[ |
1387 | 1866 |
labelWidth := labelWidth + (hSpace * 2) + shadowForm width. |
1867 |
labelHeight := labelHeight max: (shadowForm height "+ vSpace") |
|
205 | 1868 |
] |
1387 | 1869 |
|
1870 |
"Modified: / 3.11.1997 / 09:15:52 / cg" |
|
0 | 1871 |
! ! |
1872 |
||
62 | 1873 |
!Button methodsFor:'queries'! |
0 | 1874 |
|
1875 |
is3D |
|
850 | 1876 |
"return true, if the receiver is a 3D style view" |
761 | 1877 |
|
850 | 1878 |
<resource: #style (#name)> |
0 | 1879 |
|
130 | 1880 |
styleSheet name == #mswindows ifTrue:[^ true]. |
0 | 1881 |
^ super is3D |
761 | 1882 |
|
850 | 1883 |
"Modified: 22.10.1996 / 18:26:41 / cg" |
0 | 1884 |
! |
1885 |
||
127 | 1886 |
isOn |
1887 |
"return true, if this button is currently pressed" |
|
1888 |
||
1889 |
^ controller pressed |
|
155 | 1890 |
! |
1891 |
||
205 | 1892 |
isReturnButton |
1893 |
"return true, if this is a return button" |
|
0 | 1894 |
|
205 | 1895 |
^ isReturnButton |
156 | 1896 |
! |
1897 |
||
1370 | 1898 |
isTriggerOnDown |
1899 |
"return true, if I fire on press (instead of fire-on-release)" |
|
1900 |
||
1901 |
^ controller isTriggerOnDown |
|
1902 |
||
1903 |
"Created: / 31.10.1997 / 19:33:56 / cg" |
|
1904 |
"Modified: / 31.10.1997 / 19:34:34 / cg" |
|
1905 |
! |
|
1906 |
||
130 | 1907 |
preferredExtent |
1908 |
"return my preferred extent - this is the minimum size I would like to have" |
|
35 | 1909 |
|
1021
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1910 |
|extraH extraV oldLogo wActive hActive wPassive hPassive |
1664
0f66226e84dc
oops - only shift label for buttons (not for checkToggles)
Claus Gittinger <cg@exept.de>
parents:
1663
diff
changeset
|
1911 |
wMax hMax anyLogo ext| |
35 | 1912 |
|
800 | 1913 |
"/ If I have an explicit preferredExtent .. |
1914 |
||
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1915 |
preferredExtent notNil ifTrue:[ |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1916 |
^ preferredExtent |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1917 |
]. |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1918 |
|
1021
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1919 |
"/ compute the max-extent of both passive- and activeLogos |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1920 |
"/ (if any) |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1921 |
|
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1922 |
wActive := wPassive := labelWidth. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1923 |
hActive := hPassive := labelHeight. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1924 |
oldLogo := logo. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1925 |
anyLogo := false. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1926 |
|
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1927 |
(activeLogo notNil and:[activeLogo ~~ logo]) ifTrue:[ |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1928 |
logo := activeLogo. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1929 |
self computeLabelSize. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1930 |
wActive := labelWidth. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1931 |
hActive := labelHeight. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1932 |
anyLogo := true. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1933 |
]. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1934 |
(passiveLogo notNil and:[passiveLogo ~~ logo]) ifTrue:[ |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1935 |
logo := passiveLogo. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1936 |
self computeLabelSize. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1937 |
wPassive := labelWidth. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1938 |
hPassive := labelHeight. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1939 |
anyLogo := true. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1940 |
]. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1941 |
oldLogo ~~ logo ifTrue:[ |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1942 |
logo := oldLogo. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1943 |
self computeLabelSize. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1944 |
]. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1945 |
|
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1946 |
wMax := wActive max:wPassive. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1947 |
hMax := hActive max:hPassive. |
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1948 |
|
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1949 |
anyLogo ifTrue:[ |
131 | 1950 |
" |
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1951 |
extraH := extraV := (onLevel abs max:offLevel abs) + ViewSpacing * 2. |
131 | 1952 |
" |
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1953 |
extraH := extraV := (onLevel abs max:offLevel abs). |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1954 |
extraH := (extraH + hSpace * 2). |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1955 |
extraV := (extraV + vSpace * 2). |
131 | 1956 |
|
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1957 |
self is3D ifFalse:[ |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1958 |
"add space for a frame around" |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1959 |
extraH := extraH + 2. extraV := extraV + 2. |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
711
diff
changeset
|
1960 |
]. |
1021
73ec8663c4cb
care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents:
992
diff
changeset
|
1961 |
|
1664
0f66226e84dc
oops - only shift label for buttons (not for checkToggles)
Claus Gittinger <cg@exept.de>
parents:
1663
diff
changeset
|
1962 |
ext := (wMax + extraH) @ (hMax + extraV) |
0f66226e84dc
oops - only shift label for buttons (not for checkToggles)
Claus Gittinger <cg@exept.de>
parents:
1663
diff
changeset
|
1963 |
] ifFalse:[ |
0f66226e84dc
oops - only shift label for buttons (not for checkToggles)
Claus Gittinger <cg@exept.de>
parents:
1663
diff
changeset
|
1964 |
ext := super preferredExtent |
35 | 1965 |
]. |
1669 | 1966 |
"/ (self class == Button) ifTrue:[ |
1967 |
"/ self is3D ifTrue:[ |
|
1968 |
"/ ext := ext + (1@1) |
|
1969 |
"/ ] |
|
1970 |
"/ ]. |
|
1664
0f66226e84dc
oops - only shift label for buttons (not for checkToggles)
Claus Gittinger <cg@exept.de>
parents:
1663
diff
changeset
|
1971 |
^ ext |
1663
c6cc4fe918ea
nicer 3D effect (shift label down-right) when pressed.
Claus Gittinger <cg@exept.de>
parents:
1651
diff
changeset
|
1972 |
|
1669 | 1973 |
"Modified: / 9.9.1998 / 20:21:29 / cg" |
0 | 1974 |
! |
1975 |
||
205 | 1976 |
specClass |
1370 | 1977 |
"redefined, since the name of my specClass is nonStandard (i.e. not ButtonSpec)" |
1978 |
||
205 | 1979 |
self class == Button ifTrue:[^ ActionButtonSpec]. |
1050 | 1980 |
^ super specClass |
1981 |
||
1370 | 1982 |
"Modified: / 31.10.1997 / 19:49:07 / cg" |
162 | 1983 |
! ! |
1984 |
||
0 | 1985 |
!Button methodsFor:'redrawing'! |
1986 |
||
205 | 1987 |
drawBottomEdge |
1988 |
"draw bottom 3D edge into window frame" |
|
1989 |
||
1990 |
self drawBottomEdgeLevel:level |
|
1991 |
shadow:shadowColor |
|
1992 |
light:lightColor |
|
1993 |
halfShadow:halfShadowColor |
|
1994 |
halfLight:halfLightColor |
|
1995 |
style:edgeStyle. |
|
133 | 1996 |
! |
1997 |
||
62 | 1998 |
drawEdges |
1999 |
"draw all of my 3D edges" |
|
2000 |
||
2001 |
self drawEdgesForX:0 y:0 width:width height:height level:level |
|
2002 |
shadow:shadowColor |
|
2003 |
light:lightColor |
|
2004 |
halfShadow:halfShadowColor |
|
2005 |
halfLight:halfLightColor |
|
2006 |
style:edgeStyle |
|
2007 |
! |
|
2008 |
||
2009 |
drawLeftEdge |
|
2010 |
"draw left 3D edge into window frame" |
|
2011 |
||
2012 |
self drawLeftEdgeLevel:level |
|
2013 |
shadow:shadowColor |
|
2014 |
light:lightColor |
|
2015 |
halfShadow:halfShadowColor |
|
2016 |
halfLight:halfLightColor |
|
2017 |
style:edgeStyle. |
|
2018 |
! |
|
2019 |
||
2020 |
drawRightEdge |
|
2021 |
"draw right 3D edge into window frame" |
|
2022 |
||
2023 |
self drawRightEdgeLevel:level |
|
2024 |
shadow:shadowColor |
|
2025 |
light:lightColor |
|
2026 |
halfShadow:halfShadowColor |
|
2027 |
halfLight:halfLightColor |
|
2028 |
style:edgeStyle. |
|
2029 |
! |
|
2030 |
||
2031 |
drawTopEdge |
|
2032 |
"draw top 3D edge into window frame" |
|
2033 |
||
2034 |
self drawTopEdgeLevel:level |
|
2035 |
shadow:shadowColor |
|
2036 |
light:lightColor |
|
2037 |
halfShadow:halfShadowColor |
|
2038 |
halfLight:halfLightColor |
|
2039 |
style:edgeStyle. |
|
2040 |
! |
|
2041 |
||
0 | 2042 |
drawWith:fg and:bg |
2043 |
"redraw myself with fg/bg. Use super to draw the label, add |
|
2044 |
the return-arrow here." |
|
2045 |
||
18 | 2046 |
|x y sColor lColor| |
0 | 2047 |
|
59 | 2048 |
shown ifFalse:[^ self]. |
0 | 2049 |
super drawWith:fg and:bg. "this draws the text" |
2050 |
||
59 | 2051 |
(isReturnButton and:[shadowForm notNil]) ifTrue:[ |
932
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2052 |
y := (height - shadowForm height) // 2. |
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2053 |
x := width - shadowForm width - (hSpace // 2). |
59 | 2054 |
|
1665 | 2055 |
(self class == Button and:[level < 0]) ifTrue:[ |
2056 |
x := x + 1. |
|
2057 |
y := y + 1 |
|
1663
c6cc4fe918ea
nicer 3D effect (shift label down-right) when pressed.
Claus Gittinger <cg@exept.de>
parents:
1651
diff
changeset
|
2058 |
]. |
c6cc4fe918ea
nicer 3D effect (shift label down-right) when pressed.
Claus Gittinger <cg@exept.de>
parents:
1651
diff
changeset
|
2059 |
|
932
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2060 |
formShadowColor isNil ifTrue:[ |
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2061 |
self paint:fg on:bg. |
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2062 |
self displayOpaqueForm:shadowForm x:x y:y. |
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2063 |
^ self |
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2064 |
]. |
0 | 2065 |
|
932
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2066 |
" |
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2067 |
drawing form in 3d-style (i.e. with shadow and light) |
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2068 |
" |
955 | 2069 |
(formShadowColor isColor and:[formShadowColor isDithered not |
2070 |
and:[formLightColor isColor and:[formLightColor isDithered not |
|
2071 |
and:[formColor isColor and:[formColor isDithered not]]]]]) |
|
932
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2072 |
ifTrue:[ |
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2073 |
sColor := formShadowColor. |
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2074 |
lColor := formLightColor. |
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2075 |
] ifFalse:[ |
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2076 |
sColor := device blackColor. |
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2077 |
lColor := device whiteColor. |
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2078 |
]. |
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2079 |
self foreground:sColor. |
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2080 |
self displayForm:shadowForm x:x y:y. |
35 | 2081 |
|
932
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2082 |
lightForm notNil ifTrue:[ |
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2083 |
self foreground:lColor. |
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2084 |
self displayForm:lightForm x:x y:y. |
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2085 |
]. |
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2086 |
self paint:fg. |
0 | 2087 |
] |
932
43879de4e75d
use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2088 |
|
1663
c6cc4fe918ea
nicer 3D effect (shift label down-right) when pressed.
Claus Gittinger <cg@exept.de>
parents:
1651
diff
changeset
|
2089 |
"Modified: / 8.9.1998 / 20:50:23 / cg" |
0 | 2090 |
! |
2091 |
||
1170 | 2092 |
redraw |
82 | 2093 |
"redraw the button. |
2094 |
Thats like redrawing a label, but use different colors when pressed |
|
2095 |
or entered." |
|
0 | 2096 |
|
1206
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
2097 |
|fg bg entered noFrame lvl| |
0 | 2098 |
|
62 | 2099 |
shown ifFalse:[^ self]. |
35 | 2100 |
|
1092 | 2101 |
disabledLogo notNil ifTrue:[ |
2102 |
controller enabled ifFalse:[ |
|
2103 |
logo := disabledLogo. |
|
2104 |
] ifTrue:[ |
|
2105 |
controller active ifTrue:[ |
|
2106 |
logo := activeLogo |
|
2107 |
] ifFalse:[ |
|
2108 |
logo := passiveLogo |
|
2109 |
]. |
|
2110 |
]. |
|
2111 |
]. |
|
2112 |
||
265 | 2113 |
noFrame := true. |
62 | 2114 |
fg := fgColor. |
2115 |
bg := bgColor. |
|
77 | 2116 |
controller enabled ifFalse:[ |
1092 | 2117 |
fg := disabledFgColor |
62 | 2118 |
] ifTrue:[ |
1092 | 2119 |
entered := controller entered. |
2120 |
entered ifTrue:[ |
|
2121 |
enteredFgColor notNil ifTrue:[fg := enteredFgColor]. |
|
1206
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
2122 |
enteredBgColor notNil ifTrue:[bg := enteredBgColor]. |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
2123 |
lvl := enterLevel. |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
2124 |
] ifFalse:[ |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
2125 |
lvl := leaveLevel |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
2126 |
]. |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
2127 |
(enterLevel notNil and:[leaveLevel notNil]) ifTrue:[ |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
2128 |
offLevel ~~ lvl ifTrue:[ |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
2129 |
offLevel := lvl. |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
2130 |
offLevel ~~ level ifTrue:[ |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
2131 |
self level:offLevel |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
2132 |
] |
003498bf0349
added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents:
1196
diff
changeset
|
2133 |
] |
1092 | 2134 |
]. |
2135 |
(controller pressed and:[entered or:[controller isTriggerOnDown]]) ifTrue:[ |
|
1387 | 2136 |
noFrame := self is3D "false". |
1092 | 2137 |
activeFgColor isNil ifTrue:[ |
2138 |
onLevel == offLevel ifTrue:[ |
|
2139 |
fg := bgColor |
|
2140 |
] |
|
2141 |
] ifFalse:[ |
|
2142 |
fg := activeFgColor. |
|
2143 |
]. |
|
2144 |
activeBgColor isNil ifTrue:[ |
|
2145 |
onLevel == offLevel ifTrue:[ |
|
2146 |
bg := fgColor |
|
2147 |
] |
|
2148 |
] ifFalse:[ |
|
2149 |
bg := activeBgColor |
|
2150 |
]. |
|
232 | 2151 |
|
1092 | 2152 |
self is3D ifFalse:[ |
2153 |
noFrame := (fgColor = fg) and:[bgColor = bg]. |
|
2154 |
]. |
|
2155 |
]. |
|
62 | 2156 |
]. |
265 | 2157 |
self drawWith:fg and:bg. |
2158 |
noFrame ifFalse:[ |
|
1092 | 2159 |
" |
2160 |
draw a rectangle around (2D styles only) |
|
2161 |
" |
|
2162 |
self paint:fg. |
|
2163 |
self displayRectangleX:0 y:0 width:width height:height. |
|
2164 |
^ self |
|
265 | 2165 |
]. |
2166 |
||
1387 | 2167 |
"Modified: / 3.11.1997 / 11:56:02 / cg" |
205 | 2168 |
! |
2169 |
||
2170 |
redrawIfPressed |
|
2171 |
"redraw the button, but only if visible and currently being pressed" |
|
2172 |
||
2173 |
shown ifTrue:[ |
|
1170 | 2174 |
controller pressed ifTrue:[ |
2175 |
self redraw |
|
2176 |
] |
|
205 | 2177 |
] |
1170 | 2178 |
|
2179 |
"Modified: 1.4.1997 / 13:26:27 / cg" |
|
205 | 2180 |
! |
2181 |
||
2182 |
redrawX:x y:y width:w height:h |
|
1170 | 2183 |
self redraw. |
2184 |
||
2185 |
"Modified: 1.4.1997 / 13:26:31 / cg" |
|
205 | 2186 |
! |
2187 |
||
2188 |
showActive |
|
2189 |
"redraw myself as active (i.e. busy)" |
|
162 | 2190 |
|
205 | 2191 |
onLevel ~~ level ifTrue:[ |
711
c830bb66598b
use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents:
707
diff
changeset
|
2192 |
self level:onLevel. |
205 | 2193 |
]. |
2194 |
(activeLogo notNil and:[activeLogo ~~ logo]) ifTrue:[ |
|
711
c830bb66598b
use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents:
707
diff
changeset
|
2195 |
self logo:activeLogo |
162 | 2196 |
]. |
711
c830bb66598b
use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents:
707
diff
changeset
|
2197 |
self invalidate |
c830bb66598b
use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents:
707
diff
changeset
|
2198 |
|
c830bb66598b
use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents:
707
diff
changeset
|
2199 |
"Modified: 26.5.1996 / 18:08:52 / cg" |
205 | 2200 |
! |
2201 |
||
2202 |
showPassive |
|
2203 |
"redraw myself as passive" |
|
162 | 2204 |
|
205 | 2205 |
offLevel ~~ level ifTrue:[ |
711
c830bb66598b
use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents:
707
diff
changeset
|
2206 |
self level:offLevel. |
205 | 2207 |
]. |
2208 |
(passiveLogo notNil and:[passiveLogo ~~ logo]) ifTrue:[ |
|
711
c830bb66598b
use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents:
707
diff
changeset
|
2209 |
self logo:passiveLogo |
205 | 2210 |
]. |
711
c830bb66598b
use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents:
707
diff
changeset
|
2211 |
self invalidate. |
c830bb66598b
use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents:
707
diff
changeset
|
2212 |
|
c830bb66598b
use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents:
707
diff
changeset
|
2213 |
"Modified: 26.5.1996 / 18:08:56 / cg" |
0 | 2214 |
! ! |
205 | 2215 |
|
850 | 2216 |
!Button class methodsFor:'documentation'! |
205 | 2217 |
|
2218 |
version |
|
1669 | 2219 |
^ '$Header: /cvs/stx/stx/libwidg/Button.st,v 1.99 1998-09-09 19:07:09 cg Exp $' |
205 | 2220 |
! ! |