author | Claus Gittinger <cg@exept.de> |
Fri, 23 Apr 1999 14:28:11 +0200 | |
changeset 1324 | fef218a2297b |
parent 1297 | c7ece249c083 |
child 1481 | f3760f102bd9 |
permissions | -rw-r--r-- |
44 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
49 | 3 |
All Rights Reserved |
44 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
||
14 |
HorizontalPanelView subclass:#CheckBox |
|
112
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
15 |
instanceVariableNames:'toggleView labelView labelForegroundColor |
817 | 16 |
disabledLabelForegroundColor foregroundChannel backgroundChannel' |
320
bf5e928d027a
option to place the toggle at the right.
Claus Gittinger <cg@exept.de>
parents:
318
diff
changeset
|
17 |
classVariableNames:'DefaultLabelForegroundColor DefaultDisabledLabelForegroundColor |
bf5e928d027a
option to place the toggle at the right.
Claus Gittinger <cg@exept.de>
parents:
318
diff
changeset
|
18 |
CheckToggleLeft' |
112
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
19 |
poolDictionaries:'' |
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
20 |
category:'Views-Interactors' |
44 | 21 |
! |
22 |
||
273
01541272ce8d
resource spec updated; cache device form
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
23 |
!CheckBox class methodsFor:'documentation'! |
44 | 24 |
|
100 | 25 |
copyright |
26 |
" |
|
27 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
||
44 | 38 |
! |
39 |
||
40 |
documentation |
|
41 |
" |
|
313 | 42 |
CheckBoxes consist of a checkToggle and a label; |
43 |
if used without a model, its action block is evaluated |
|
44 |
when toggled (see Toggle for more information). |
|
45 |
Otherwise, a valueHolder on a boolean is the preferred model |
|
46 |
(other models are possible - this may required different aspect |
|
47 |
and/or changeMessage settings; make certain to set those before |
|
48 |
a model is assigned, since the toggle fetches the value when |
|
49 |
a new model is assigned.) |
|
155 | 50 |
|
51 |
[author:] |
|
313 | 52 |
Claus Gittinger |
155 | 53 |
|
54 |
[see also:] |
|
313 | 55 |
Button CheckToggle |
56 |
DialogBox |
|
57 |
ValueHolder |
|
44 | 58 |
" |
59 |
! |
|
60 |
||
61 |
examples |
|
62 |
" |
|
188 | 63 |
no-op checkBox without a label: |
313 | 64 |
[exBegin] |
188 | 65 |
|b| |
66 |
||
67 |
b := CheckBox new. |
|
68 |
b open |
|
313 | 69 |
[exEnd] |
188 | 70 |
|
71 |
||
44 | 72 |
no-op checkBox: |
313 | 73 |
[exBegin] |
44 | 74 |
|b| |
75 |
||
76 |
b := CheckBox new. |
|
77 |
b label:'foo'. |
|
78 |
b open |
|
313 | 79 |
[exEnd] |
80 |
||
81 |
||
82 |
combined instance creation & label setup: |
|
83 |
[exBegin] |
|
84 |
|b| |
|
85 |
||
86 |
b := CheckBox label:'foo'. |
|
87 |
b open |
|
88 |
[exEnd] |
|
44 | 89 |
|
90 |
||
56 | 91 |
no-op checkBox, disabled: |
313 | 92 |
[exBegin] |
56 | 93 |
|b| |
94 |
||
313 | 95 |
b := CheckBox label:'foo'. |
56 | 96 |
b disable. |
97 |
b open |
|
313 | 98 |
[exEnd] |
56 | 99 |
|
100 |
||
101 |
changing colors |
|
102 |
(a demo only: it is no good style to fight the styleSheet): |
|
313 | 103 |
[exBegin] |
44 | 104 |
|panel b| |
105 |
||
106 |
panel := VerticalPanelView new. |
|
107 |
||
313 | 108 |
b := CheckBox label:'foo' in:panel. |
44 | 109 |
|
313 | 110 |
b := CheckBox label:'bar' in:panel. |
44 | 111 |
b labelView foregroundColor:Color red. |
112 |
||
313 | 113 |
b := CheckBox label:'baz' in:panel. |
44 | 114 |
b toggleView activeForegroundColor:Color blue. |
115 |
||
116 |
panel open |
|
313 | 117 |
[exEnd] |
44 | 118 |
|
119 |
||
120 |
using action-blocks: |
|
313 | 121 |
[exBegin] |
49 | 122 |
|b| |
44 | 123 |
|
313 | 124 |
b := CheckBox label:'check'. |
184 | 125 |
b action:[:value | Transcript show:'set to: '; showCR:value]. |
44 | 126 |
b open. |
313 | 127 |
[exEnd] |
44 | 128 |
|
129 |
||
49 | 130 |
with a model (default ST-80 behavior, sending #value: to the model): |
131 |
(see changing value in the inspector) |
|
313 | 132 |
[exBegin] |
133 |
|b model| |
|
134 |
||
135 |
model := ValueHolder newBoolean. |
|
136 |
||
137 |
b := CheckBox label:'check'. |
|
138 |
b model:model. |
|
139 |
b open. |
|
140 |
model inspect. |
|
141 |
[exEnd] |
|
142 |
||
143 |
||
144 |
combined instance creation & model setup: |
|
145 |
[exBegin] |
|
49 | 146 |
|b model| |
147 |
||
148 |
model := ValueHolder newBoolean. |
|
149 |
||
313 | 150 |
b := CheckBox label:'check' model:model . |
49 | 151 |
b open. |
152 |
model inspect. |
|
313 | 153 |
[exEnd] |
49 | 154 |
|
56 | 155 |
|
313 | 156 |
with a model and different aspect & changeSelector |
157 |
setting the aspect to nil suppresses fetching the value from the model. |
|
49 | 158 |
(using a plug here, for demonstration only): |
313 | 159 |
[exBegin] |
44 | 160 |
|b model| |
161 |
||
162 |
model := Plug new. |
|
184 | 163 |
model respondTo:#changeCheck: with:[:arg | Transcript showCR:'change to ' , arg printString]. |
313 | 164 |
model respondTo:#value with:[false]. |
44 | 165 |
|
313 | 166 |
b := CheckBox label:'check'. |
167 |
b aspectMessage:nil; model:model; changeMessage:#changeCheck:. |
|
44 | 168 |
b open. |
313 | 169 |
[exEnd] |
44 | 170 |
|
56 | 171 |
|
313 | 172 |
with an enableChannel |
173 |
[exBegin] |
|
115
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
174 |
|b enaToggle enaHolder| |
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
175 |
|
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
176 |
enaHolder := true asValue. |
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
177 |
|
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
178 |
enaToggle := Toggle label:'enable'. |
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
179 |
enaToggle model:enaHolder. |
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
180 |
enaToggle open. |
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
181 |
|
313 | 182 |
b := CheckBox label:'check'. |
184 | 183 |
b action:[:value | Transcript show:'set to: '; showCR:value]. |
115
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
184 |
b enableChannel:enaHolder. |
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
185 |
b open. |
313 | 186 |
[exEnd] |
115
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
187 |
|
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
188 |
|
56 | 189 |
with models, one checkBox disabling the others: |
313 | 190 |
[exBegin] |
56 | 191 |
|dialog translator enableChannel val1 val2 val3 eBox box1 box2 box3| |
192 |
||
193 |
translator := Plug new. |
|
194 |
translator respondTo:#enableDisable |
|
313 | 195 |
with:[ |
196 |
enableChannel value |
|
197 |
ifTrue:[ |
|
198 |
box1 enable. |
|
199 |
box2 enable. |
|
200 |
box3 enable. |
|
201 |
] |
|
202 |
ifFalse:[ |
|
203 |
box1 disable. |
|
204 |
box2 disable. |
|
205 |
box3 disable. |
|
206 |
] |
|
207 |
]. |
|
56 | 208 |
|
209 |
enableChannel := true asValue. |
|
210 |
enableChannel onChangeSend:#enableDisable to:translator. |
|
211 |
val1 := true asValue. |
|
212 |
val2 := false asValue. |
|
213 |
val3 := true asValue. |
|
214 |
||
215 |
dialog := Dialog new. |
|
216 |
dialog addCheckBox:'enable' on:enableChannel. |
|
217 |
dialog addVerticalSpace. |
|
218 |
dialog leftIndent:30. |
|
219 |
box1 := dialog addCheckBox:'value1' on:val1. |
|
220 |
dialog addVerticalSpace. |
|
221 |
box2 := dialog addCheckBox:'value2' on:val2. |
|
222 |
dialog addVerticalSpace. |
|
223 |
box3 := dialog addCheckBox:'value3' on:val3. |
|
224 |
dialog addVerticalSpace. |
|
225 |
dialog addOkButton. |
|
226 |
||
227 |
dialog open. |
|
313 | 228 |
[exEnd] |
56 | 229 |
|
230 |
||
49 | 231 |
multiple checkBoxes on a single model (using different aspects) |
313 | 232 |
[exBegin] |
79 | 233 |
|top panel b model value1 value2| |
49 | 234 |
|
235 |
value1 := true. |
|
236 |
value2 := false. |
|
237 |
model := Plug new. |
|
238 |
model respondTo:#value1 with:[value1]. |
|
239 |
model respondTo:#value1: with:[:val | value1 := val]. |
|
240 |
model respondTo:#value2 with:[value2]. |
|
241 |
model respondTo:#value2: with:[:val | value2 := val]. |
|
242 |
||
243 |
top := DialogBox new. |
|
244 |
top extent:200@300. |
|
245 |
||
246 |
panel := VerticalPanelView new. |
|
247 |
||
248 |
b := CheckBox in:panel. |
|
249 |
b label:'check1'. |
|
313 | 250 |
b aspect:#value1; model:model; changeMessage:#value1:. |
49 | 251 |
|
252 |
b := CheckBox in:panel. |
|
253 |
b label:'check2'. |
|
313 | 254 |
b aspect:#value2; model:model; changeMessage:#value2:. |
49 | 255 |
|
256 |
top addComponent:panel. |
|
257 |
top addAbortButton; addOkButton. |
|
258 |
top openModal. |
|
259 |
||
79 | 260 |
top accepted ifTrue:[ |
313 | 261 |
Transcript show:'value1: '; showCR:model value1. |
262 |
Transcript show:'value2: '; showCR:model value2. |
|
49 | 263 |
] |
313 | 264 |
[exEnd] |
44 | 265 |
" |
266 |
! ! |
|
267 |
||
273
01541272ce8d
resource spec updated; cache device form
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
268 |
!CheckBox class methodsFor:'instance creation'! |
62 | 269 |
|
76 | 270 |
label:aStringOrImage model:aModel |
271 |
"create & return a new checkBox, on aModel (typically a ValueHolder), |
|
272 |
with aStringOrImage as label." |
|
273 |
||
313 | 274 |
^ (self model:aModel) label:aStringOrImage |
76 | 275 |
|
276 |
"Created: 17.9.1995 / 14:20:58 / claus" |
|
313 | 277 |
"Modified: 28.2.1997 / 19:23:59 / cg" |
56 | 278 |
! ! |
279 |
||
273
01541272ce8d
resource spec updated; cache device form
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
280 |
!CheckBox class methodsFor:'defaults'! |
112
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
281 |
|
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
282 |
updateStyleCache |
134
049f033265f9
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
119
diff
changeset
|
283 |
"extract values from the styleSheet and cache them in class variables" |
049f033265f9
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
119
diff
changeset
|
284 |
|
566 | 285 |
<resource: #style (#'checkBox.labelForegroundColor' |
286 |
#'checkBox.disabledLabelForegroundColor' |
|
287 |
#'checkBox.toggleLeft')> |
|
134
049f033265f9
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
119
diff
changeset
|
288 |
|
830 | 289 |
DefaultFont := StyleSheet fontAt:'label.font'. |
290 |
DefaultLabelForegroundColor := StyleSheet colorAt:'checkBox.labelForegroundColor'. |
|
566 | 291 |
DefaultDisabledLabelForegroundColor := StyleSheet colorAt:'checkBox.disabledLabelForegroundColor'. |
830 | 292 |
CheckToggleLeft := StyleSheet at:'checkBox.toggleLeft' default:true |
112
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
293 |
|
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
294 |
" |
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
295 |
self updateStyleCache |
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
296 |
" |
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
297 |
|
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
298 |
"Created: 14.12.1995 / 14:47:22 / cg" |
566 | 299 |
"Modified: 20.10.1997 / 13:51:30 / cg" |
112
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
300 |
! ! |
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
301 |
|
100 | 302 |
!CheckBox methodsFor:'accessing-behavior'! |
303 |
||
304 |
action:aBlock |
|
155 | 305 |
"set the actionBlock; forwarded to the toggle" |
100 | 306 |
|
307 |
toggleView action:aBlock |
|
155 | 308 |
|
309 |
"Modified: 25.4.1996 / 16:31:19 / cg" |
|
100 | 310 |
! |
311 |
||
299 | 312 |
enabled |
313 |
"return true, if the checkBox is enabled. |
|
314 |
forwarded to toggle" |
|
315 |
||
316 |
^ toggleView enabled. |
|
317 |
! |
|
318 |
||
1297 | 319 |
enabled:aBoolean |
320 |
"enable/diable the checkBox; forwarded to toggle & change labels color" |
|
321 |
||
322 |
|clr| |
|
323 |
||
324 |
toggleView enabled:aBoolean. |
|
325 |
||
326 |
aBoolean ifTrue:[ |
|
327 |
clr := labelForegroundColor. |
|
328 |
clr isNil ifTrue:[ clr := labelView foregroundColor ]. |
|
329 |
] ifFalse:[ |
|
330 |
clr := disabledLabelForegroundColor. |
|
331 |
clr isNil ifTrue:[ clr := toggleView disabledForegroundColor ]. |
|
332 |
]. |
|
333 |
labelView foregroundColor:clr. |
|
334 |
||
335 |
"Modified: / 25.4.1996 / 16:31:40 / cg" |
|
336 |
"Created: / 30.3.1999 / 14:54:48 / stefan" |
|
337 |
! |
|
338 |
||
100 | 339 |
pressAction:aBlock |
155 | 340 |
"set the pressAction; forwarded to the toggle" |
341 |
||
100 | 342 |
toggleView pressAction:aBlock. |
343 |
||
344 |
"Created: 22.9.1995 / 15:54:04 / claus" |
|
155 | 345 |
"Modified: 25.4.1996 / 16:31:52 / cg" |
100 | 346 |
! |
347 |
||
348 |
releaseAction:aBlock |
|
155 | 349 |
"set the releaseAction; forwarded to the toggle" |
350 |
||
100 | 351 |
toggleView releaseAction:aBlock. |
352 |
||
353 |
"Created: 22.9.1995 / 15:54:11 / claus" |
|
155 | 354 |
"Modified: 25.4.1996 / 16:32:00 / cg" |
78 | 355 |
! ! |
356 |
||
115
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
357 |
!CheckBox methodsFor:'accessing-channels'! |
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
358 |
|
817 | 359 |
backgroundChannel |
360 |
||
361 |
^labelView backgroundChannel |
|
362 |
! |
|
363 |
||
364 |
backgroundChannel:aChannel |
|
365 |
||
366 |
labelView backgroundChannel: (backgroundChannel := aChannel). |
|
367 |
aChannel onChangeSend:#value to: [self enableStateChanged] |
|
368 |
! |
|
369 |
||
164 | 370 |
enableChannel |
371 |
"return a valueHolder for enable/disable" |
|
372 |
||
373 |
^ toggleView enableChannel |
|
374 |
||
375 |
"Created: 30.4.1996 / 15:11:13 / cg" |
|
376 |
! |
|
377 |
||
115
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
378 |
enableChannel:aChannel |
155 | 379 |
"set the enableChannel" |
380 |
||
119
913df6ba1ccc
immediately change fg color when enableChannel is set
Claus Gittinger <cg@exept.de>
parents:
115
diff
changeset
|
381 |
|wasEnabled| |
913df6ba1ccc
immediately change fg color when enableChannel is set
Claus Gittinger <cg@exept.de>
parents:
115
diff
changeset
|
382 |
|
913df6ba1ccc
immediately change fg color when enableChannel is set
Claus Gittinger <cg@exept.de>
parents:
115
diff
changeset
|
383 |
wasEnabled := toggleView enabled. |
115
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
384 |
toggleView enableChannel:aChannel. |
817 | 385 |
aChannel onChangeSend:#value to: [self enableStateChanged]. |
386 |
||
119
913df6ba1ccc
immediately change fg color when enableChannel is set
Claus Gittinger <cg@exept.de>
parents:
115
diff
changeset
|
387 |
aChannel value ~~ wasEnabled ifTrue:[ |
817 | 388 |
self enableStateChanged |
119
913df6ba1ccc
immediately change fg color when enableChannel is set
Claus Gittinger <cg@exept.de>
parents:
115
diff
changeset
|
389 |
] |
817 | 390 |
! |
115
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
391 |
|
817 | 392 |
foregroundChannel |
393 |
||
394 |
^labelView foregroundChannel |
|
395 |
! |
|
396 |
||
397 |
foregroundChannel:aChannel |
|
398 |
||
399 |
labelView foregroundChannel: (foregroundChannel := aChannel). |
|
400 |
aChannel onChangeSend:#value to: [self enableStateChanged] |
|
401 |
||
402 |
! |
|
403 |
||
404 |
labelChannel |
|
405 |
||
406 |
^labelView labelChannel |
|
407 |
! |
|
408 |
||
409 |
labelChannel:aChannel |
|
410 |
||
411 |
labelView labelChannel: aChannel |
|
412 |
||
413 |
! ! |
|
414 |
||
415 |
!CheckBox methodsFor:'accessing-colors'! |
|
416 |
||
851 | 417 |
backgroundColor |
418 |
"get backgroundColor of the label view" |
|
419 |
||
420 |
^labelView backgroundColor |
|
421 |
! |
|
422 |
||
817 | 423 |
backgroundColor: backgroundColor |
851 | 424 |
"set backgroundColor only for the label view" |
817 | 425 |
|
903
77a51b230754
viewBackground setting must change mine too
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
426 |
labelView backgroundColor: backgroundColor. |
817 | 427 |
! |
428 |
||
851 | 429 |
foregroundColor |
430 |
"get foregroundColor of the label view" |
|
431 |
||
432 |
^labelView foregroundColor |
|
433 |
! |
|
434 |
||
817 | 435 |
foregroundColor: foregroundColor |
851 | 436 |
"set foregroundColor only for the label view" |
817 | 437 |
|
438 |
labelView foregroundColor: (labelForegroundColor := foregroundColor). |
|
439 |
foregroundChannel notNil ifTrue: [foregroundChannel value: foregroundColor] |
|
903
77a51b230754
viewBackground setting must change mine too
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
440 |
! |
77a51b230754
viewBackground setting must change mine too
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
441 |
|
77a51b230754
viewBackground setting must change mine too
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
442 |
viewBackground: backgroundColor |
77a51b230754
viewBackground setting must change mine too
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
443 |
"set backgroundColor" |
77a51b230754
viewBackground setting must change mine too
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
444 |
|
77a51b230754
viewBackground setting must change mine too
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
445 |
labelView backgroundColor: backgroundColor. |
77a51b230754
viewBackground setting must change mine too
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
446 |
super viewBackground: backgroundColor |
817 | 447 |
! ! |
448 |
||
449 |
!CheckBox methodsFor:'accessing-components'! |
|
450 |
||
451 |
labelView |
|
452 |
"return the labelView; allows manipulation of the |
|
453 |
labels attributes (colors etc.)" |
|
454 |
||
455 |
^ labelView |
|
456 |
! |
|
457 |
||
458 |
toggleView |
|
459 |
"return the toggleView; allows manipulation of the |
|
460 |
toggles attributes (colors etc.)" |
|
461 |
||
462 |
^ toggleView |
|
115
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
463 |
! ! |
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
464 |
|
56 | 465 |
!CheckBox methodsFor:'accessing-look'! |
44 | 466 |
|
100 | 467 |
activeLogo:anImageOrString |
155 | 468 |
"set the activeLogo; forwarded to the toggle" |
469 |
||
100 | 470 |
toggleView activeLogo:anImageOrString |
56 | 471 |
|
100 | 472 |
"Created: 22.9.1995 / 15:44:08 / claus" |
155 | 473 |
"Modified: 25.4.1996 / 16:32:50 / cg" |
100 | 474 |
! |
475 |
||
114 | 476 |
disabledLabelForegroundColor |
185 | 477 |
"set the disabledLabelForegroundColor; forwarded to the toggle" |
478 |
||
114 | 479 |
disabledLabelForegroundColor isNil ifTrue:[ ^ toggleView disabledForegroundColor ]. |
480 |
^ disabledLabelForegroundColor |
|
481 |
||
482 |
"Created: 16.12.1995 / 19:47:45 / cg" |
|
185 | 483 |
"Modified: 22.5.1996 / 13:16:55 / cg" |
114 | 484 |
! |
485 |
||
100 | 486 |
font |
185 | 487 |
"return the font. Forward from label" |
100 | 488 |
|
489 |
^ labelView font |
|
185 | 490 |
|
491 |
"Modified: 22.5.1996 / 13:17:07 / cg" |
|
49 | 492 |
! |
44 | 493 |
|
56 | 494 |
font:aFont |
185 | 495 |
"set the font. Forward to the label & resize myself. |
496 |
CAVEAT: with the addition of Text objects, |
|
268 | 497 |
this method is going to be obsoleted by a textStyle |
498 |
method, which allows specific control over |
|
499 |
normalFont/boldFont/italicFont parameters." |
|
55 | 500 |
|
56 | 501 |
labelView font:aFont. |
502 |
labelView forceResize. |
|
79 | 503 |
self layoutChanged. |
504 |
self resize. |
|
185 | 505 |
|
506 |
"Modified: 22.5.1996 / 13:17:28 / cg" |
|
49 | 507 |
! |
508 |
||
56 | 509 |
label |
155 | 510 |
"return the labels logo" |
56 | 511 |
|
512 |
^ labelView label |
|
155 | 513 |
|
514 |
"Modified: 25.4.1996 / 16:33:08 / cg" |
|
79 | 515 |
! |
516 |
||
100 | 517 |
label:aString |
155 | 518 |
"set the logo; forward to label & resize" |
79 | 519 |
|
100 | 520 |
labelView label:aString. |
521 |
labelView forceResize. |
|
522 |
self layoutChanged. |
|
523 |
self resize. |
|
155 | 524 |
|
525 |
"Modified: 25.4.1996 / 16:33:14 / cg" |
|
79 | 526 |
! |
527 |
||
114 | 528 |
labelForegroundColor |
155 | 529 |
"return the labels foregroundColor" |
530 |
||
817 | 531 |
labelForegroundColor isNil ifTrue:[ ^ labelView foregroundColor ]. |
114 | 532 |
^ labelForegroundColor |
533 |
||
534 |
"Created: 16.12.1995 / 19:47:20 / cg" |
|
155 | 535 |
"Modified: 25.4.1996 / 16:33:26 / cg" |
114 | 536 |
! |
537 |
||
79 | 538 |
passiveLogo:anImageOrString |
155 | 539 |
"set the passiveLogo; forwarded to the toggle" |
540 |
||
79 | 541 |
toggleView passiveLogo:anImageOrString |
542 |
||
543 |
"Created: 22.9.1995 / 15:44:14 / claus" |
|
155 | 544 |
"Modified: 25.4.1996 / 16:33:41 / cg" |
56 | 545 |
! ! |
546 |
||
100 | 547 |
!CheckBox methodsFor:'accessing-mvc'! |
63 | 548 |
|
100 | 549 |
aspectMessage:aspectSymbol |
155 | 550 |
"set the aspectMessage; forward to label & toggle" |
100 | 551 |
|
313 | 552 |
labelView aspectMessage:aspectSymbol. "/ in case the label updates its logo from the model |
100 | 553 |
toggleView aspectMessage:aspectSymbol |
155 | 554 |
|
313 | 555 |
"Modified: 28.2.1997 / 19:50:53 / cg" |
100 | 556 |
! |
63 | 557 |
|
100 | 558 |
changeMessage:aChangeSelector |
155 | 559 |
"set the changeMessage; forward to toggle" |
100 | 560 |
|
561 |
toggleView changeMessage:aChangeSelector |
|
155 | 562 |
|
563 |
"Modified: 25.4.1996 / 16:33:55 / cg" |
|
100 | 564 |
! |
565 |
||
566 |
model:aModel |
|
155 | 567 |
"set the model; forward to label & toggle" |
100 | 568 |
|
569 |
labelView model:aModel. |
|
570 |
toggleView model:aModel |
|
155 | 571 |
|
572 |
"Modified: 25.4.1996 / 16:34:00 / cg" |
|
63 | 573 |
! ! |
574 |
||
100 | 575 |
!CheckBox methodsFor:'accessing-state'! |
55 | 576 |
|
100 | 577 |
isOn |
155 | 578 |
"return true, if the check is on; false otherwise" |
579 |
||
100 | 580 |
^ toggleView isOn |
155 | 581 |
|
582 |
"Modified: 25.4.1996 / 16:34:15 / cg" |
|
159 | 583 |
! |
584 |
||
585 |
turnOff |
|
586 |
"turn the check off; forwarded to the toggle" |
|
587 |
||
588 |
toggleView turnOff |
|
589 |
||
590 |
"Modified: 25.4.1996 / 16:32:14 / cg" |
|
591 |
! |
|
592 |
||
593 |
turnOn |
|
594 |
"turn the check on; forwarded to the toggle" |
|
595 |
||
596 |
toggleView turnOn |
|
597 |
||
598 |
"Modified: 25.4.1996 / 16:32:21 / cg" |
|
44 | 599 |
! ! |
600 |
||
115
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
601 |
!CheckBox methodsFor:'change & update'! |
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
602 |
|
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
603 |
enableStateChanged |
318 | 604 |
"handle changes on the enableChannel, change labels color." |
155 | 605 |
|
119
913df6ba1ccc
immediately change fg color when enableChannel is set
Claus Gittinger <cg@exept.de>
parents:
115
diff
changeset
|
606 |
|clr| |
913df6ba1ccc
immediately change fg color when enableChannel is set
Claus Gittinger <cg@exept.de>
parents:
115
diff
changeset
|
607 |
|
1276 | 608 |
self enabled ifTrue:[ |
820 | 609 |
(foregroundChannel notNil and: [foregroundChannel value notNil]) |
610 |
ifTrue: [labelView foregroundChannel: foregroundChannel] |
|
611 |
ifFalse: [labelView foregroundColor: labelForegroundColor ? Color black]. |
|
817 | 612 |
labelForegroundColor := labelView foregroundColor |
1276 | 613 |
] ifFalse:[ |
817 | 614 |
labelView foregroundChannel: nil |
615 |
]. |
|
616 |
||
115
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
617 |
toggleView enabled ifTrue:[ |
817 | 618 |
clr := self labelForegroundColor. |
115
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
619 |
] ifFalse:[ |
318 | 620 |
clr := self disabledLabelForegroundColor |
817 | 621 |
]. |
622 |
labelView foregroundColor:clr. |
|
115
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
623 |
|
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
624 |
! ! |
0147e9d06caa
added support for enableChannel
Claus Gittinger <cg@exept.de>
parents:
114
diff
changeset
|
625 |
|
209
448124e85ccd
keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents:
192
diff
changeset
|
626 |
!CheckBox methodsFor:'event handling'! |
448124e85ccd
keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents:
192
diff
changeset
|
627 |
|
341 | 628 |
invalidate |
484 | 629 |
super invalidate. |
341 | 630 |
toggleView invalidate. |
631 |
labelView invalidate |
|
632 |
||
633 |
"Created: 1.4.1997 / 13:22:09 / cg" |
|
484 | 634 |
"Modified: 6.8.1997 / 18:20:12 / cg" |
341 | 635 |
! |
636 |
||
209
448124e85ccd
keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents:
192
diff
changeset
|
637 |
keyPress:aKey x:x y:y |
448124e85ccd
keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents:
192
diff
changeset
|
638 |
aKey == Character space ifTrue:[ |
268 | 639 |
self hasFocus ifTrue:[ |
640 |
^ toggleView toggle |
|
641 |
] |
|
209
448124e85ccd
keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents:
192
diff
changeset
|
642 |
]. |
448124e85ccd
keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents:
192
diff
changeset
|
643 |
super keyPress:aKey x:x y:y |
448124e85ccd
keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents:
192
diff
changeset
|
644 |
|
448124e85ccd
keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents:
192
diff
changeset
|
645 |
"Created: 10.7.1996 / 11:24:16 / cg" |
448124e85ccd
keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents:
192
diff
changeset
|
646 |
"Modified: 10.7.1996 / 11:54:52 / cg" |
448124e85ccd
keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents:
192
diff
changeset
|
647 |
! ! |
448124e85ccd
keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents:
192
diff
changeset
|
648 |
|
1265 | 649 |
!CheckBox methodsFor:'focus handling'! |
1138
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
650 |
|
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
651 |
showFocus:explicit |
1265 | 652 |
"the button got the keyboard focus |
653 |
(either explicit, via tabbing; or implicit, by pointer movement) |
|
654 |
- change any display attributes as req'd." |
|
655 |
||
1138
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
656 |
styleSheet name == #win95 ifTrue:[ |
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
657 |
labelView hasFocus:true. |
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
658 |
labelView invalidate. |
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
659 |
] ifFalse:[ |
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
660 |
^ super showFocus:explicit |
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
661 |
] |
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
662 |
|
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
663 |
"Created: / 17.9.1998 / 14:11:49 / cg" |
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
664 |
"Modified: / 17.9.1998 / 14:19:33 / cg" |
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
665 |
! |
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
666 |
|
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
667 |
showNoFocus:explicit |
1265 | 668 |
"the button lost the keyboard focus |
669 |
(either explicit, via tabbing; or implicit, by pointer movement) |
|
670 |
- change any display attributes as req'd." |
|
671 |
||
1138
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
672 |
styleSheet name == #win95 ifTrue:[ |
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
673 |
labelView hasFocus:false. |
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
674 |
labelView invalidate. |
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
675 |
] ifFalse:[ |
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
676 |
^ super showNoFocus:explicit |
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
677 |
] |
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
678 |
|
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
679 |
"Created: / 17.9.1998 / 14:11:49 / cg" |
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
680 |
"Modified: / 17.9.1998 / 14:19:22 / cg" |
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
681 |
! ! |
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
682 |
|
1324 | 683 |
!CheckBox methodsFor:'initialize / release'! |
44 | 684 |
|
218
9b155a06f6e6
handle input to my label (allow clicking on it)
Claus Gittinger <cg@exept.de>
parents:
216
diff
changeset
|
685 |
defaultControllerClass |
9b155a06f6e6
handle input to my label (allow clicking on it)
Claus Gittinger <cg@exept.de>
parents:
216
diff
changeset
|
686 |
^ ToggleController |
9b155a06f6e6
handle input to my label (allow clicking on it)
Claus Gittinger <cg@exept.de>
parents:
216
diff
changeset
|
687 |
|
9b155a06f6e6
handle input to my label (allow clicking on it)
Claus Gittinger <cg@exept.de>
parents:
216
diff
changeset
|
688 |
"Created: 18.7.1996 / 11:57:01 / cg" |
9b155a06f6e6
handle input to my label (allow clicking on it)
Claus Gittinger <cg@exept.de>
parents:
216
diff
changeset
|
689 |
! |
9b155a06f6e6
handle input to my label (allow clicking on it)
Claus Gittinger <cg@exept.de>
parents:
216
diff
changeset
|
690 |
|
757 | 691 |
destroy |
692 |
"release dependencies" |
|
693 |
||
694 |
|channel| |
|
695 |
||
696 |
toggleView notNil ifTrue:[ |
|
697 |
(channel := toggleView enableChannel) notNil ifTrue:[ |
|
698 |
channel retractInterestsFor:self |
|
699 |
] |
|
700 |
]. |
|
701 |
super destroy |
|
702 |
||
703 |
! |
|
704 |
||
112
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
705 |
initStyle |
284 | 706 |
"setup viewStyle specifics" |
707 |
||
112
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
708 |
super initStyle. |
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
709 |
|
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
710 |
DefaultLabelForegroundColor notNil ifTrue:[ |
284 | 711 |
labelForegroundColor := DefaultLabelForegroundColor on:device. |
112
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
712 |
]. |
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
713 |
DefaultDisabledLabelForegroundColor notNil ifTrue:[ |
284 | 714 |
disabledLabelForegroundColor := DefaultDisabledLabelForegroundColor on:device. |
112
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
715 |
]. |
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
716 |
|
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
717 |
"Created: 14.12.1995 / 14:50:03 / cg" |
284 | 718 |
"Modified: 22.1.1997 / 11:57:03 / cg" |
817 | 719 |
|
112
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
720 |
! |
bb2cb6c553d2
allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents:
100
diff
changeset
|
721 |
|
44 | 722 |
initialize |
273
01541272ce8d
resource spec updated; cache device form
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
723 |
<resource: #style (#name)> |
01541272ce8d
resource spec updated; cache device form
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
724 |
|
56 | 725 |
super initialize. |
44 | 726 |
|
56 | 727 |
borderWidth := 0. |
44 | 728 |
|
49 | 729 |
hLayout := #fixLeftSpace. |
44 | 730 |
vLayout := #center. |
731 |
||
320
bf5e928d027a
option to place the toggle at the right.
Claus Gittinger <cg@exept.de>
parents:
318
diff
changeset
|
732 |
CheckToggleLeft ~~ false ifTrue:[ |
bf5e928d027a
option to place the toggle at the right.
Claus Gittinger <cg@exept.de>
parents:
318
diff
changeset
|
733 |
"/ toggle first ... |
bf5e928d027a
option to place the toggle at the right.
Claus Gittinger <cg@exept.de>
parents:
318
diff
changeset
|
734 |
toggleView := CheckToggle in:self. |
bf5e928d027a
option to place the toggle at the right.
Claus Gittinger <cg@exept.de>
parents:
318
diff
changeset
|
735 |
]. |
44 | 736 |
|
1138
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
737 |
labelView := CheckLabel in:self. |
282 | 738 |
"/ a kludge |
188 | 739 |
styleSheet name ~~ #motif ifTrue:[ |
273
01541272ce8d
resource spec updated; cache device form
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
740 |
labelView label:'check'; borderWidth:0. |
188 | 741 |
]. |
44 | 742 |
labelView forceResize. |
743 |
labelView adjust:#left. |
|
246 | 744 |
self initialHeight:labelView preferredExtent y + ViewSpacing. |
55 | 745 |
|
320
bf5e928d027a
option to place the toggle at the right.
Claus Gittinger <cg@exept.de>
parents:
318
diff
changeset
|
746 |
CheckToggleLeft == false ifTrue:[ |
bf5e928d027a
option to place the toggle at the right.
Claus Gittinger <cg@exept.de>
parents:
318
diff
changeset
|
747 |
"/ toggle last ... |
bf5e928d027a
option to place the toggle at the right.
Claus Gittinger <cg@exept.de>
parents:
318
diff
changeset
|
748 |
toggleView := CheckToggle in:self. |
bf5e928d027a
option to place the toggle at the right.
Claus Gittinger <cg@exept.de>
parents:
318
diff
changeset
|
749 |
]. |
bf5e928d027a
option to place the toggle at the right.
Claus Gittinger <cg@exept.de>
parents:
318
diff
changeset
|
750 |
|
527 | 751 |
(StyleSheet at:'checkBoxStyle' default:StyleSheet name) == #motif ifTrue:[ |
752 |
toggleView activeLogo:nil. |
|
753 |
toggleView passiveLogo:nil. |
|
754 |
toggleView activeLevel:-2. |
|
755 |
toggleView passiveLevel:2. |
|
756 |
toggleView extent:10@10. |
|
757 |
toggleView sizeFixed:true. |
|
758 |
]. |
|
759 |
||
317
0f8f00dc025a
both components have the same controller
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
760 |
"/ my controller handles both components |
218
9b155a06f6e6
handle input to my label (allow clicking on it)
Claus Gittinger <cg@exept.de>
parents:
216
diff
changeset
|
761 |
labelView setController:controller. |
317
0f8f00dc025a
both components have the same controller
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
762 |
toggleView setController:controller. |
218
9b155a06f6e6
handle input to my label (allow clicking on it)
Claus Gittinger <cg@exept.de>
parents:
216
diff
changeset
|
763 |
|
579
ba6e90f651d8
pass down background changes to my components
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
764 |
"/ the label can be clicked as well |
ba6e90f651d8
pass down background changes to my components
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
765 |
labelView cursor:Cursor hand. |
ba6e90f651d8
pass down background changes to my components
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
766 |
self cursor:Cursor hand. |
ba6e90f651d8
pass down background changes to my components
Claus Gittinger <cg@exept.de>
parents:
566
diff
changeset
|
767 |
|
56 | 768 |
" |
769 |
all of my input goes to the toggle |
|
209
448124e85ccd
keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents:
192
diff
changeset
|
770 |
disabled - normally there is already an outer delegate |
56 | 771 |
" |
209
448124e85ccd
keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents:
192
diff
changeset
|
772 |
"/ self delegate:(KeyboardForwarder toView:toggleView). |
44 | 773 |
|
774 |
" |
|
775 |
|b| |
|
776 |
||
777 |
b := CheckBox new. |
|
778 |
b label:'foo'. |
|
779 |
b open |
|
780 |
" |
|
188 | 781 |
|
1138
14dc9f6791d2
use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
782 |
"Modified: / 17.9.1998 / 14:18:18 / cg" |
44 | 783 |
! ! |
100 | 784 |
|
785 |
!CheckBox methodsFor:'private'! |
|
786 |
||
787 |
sendChangeMessageWith:aValue |
|
788 |
"redefined to have mimic changes being sent from the toggle |
|
789 |
instead of myself" |
|
790 |
||
791 |
toggleView sendChangeMessageWith:aValue |
|
792 |
! ! |
|
793 |
||
794 |
!CheckBox methodsFor:'queries'! |
|
795 |
||
796 |
preferredExtent |
|
155 | 797 |
"compute & return the boxes preferredExtent from the components' sizes" |
153 | 798 |
|
100 | 799 |
|prefCheck prefLabel bw2| |
800 |
||
223 | 801 |
"/ If I have an explicit preferredExtent .. |
802 |
||
192
e060e80f8e24
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
188
diff
changeset
|
803 |
preferredExtent notNil ifTrue:[ |
268 | 804 |
^ preferredExtent |
192
e060e80f8e24
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
188
diff
changeset
|
805 |
]. |
e060e80f8e24
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
188
diff
changeset
|
806 |
|
213
9c8f9be0956d
care for a nil LabelView when computing the preferredExtent
Claus Gittinger <cg@exept.de>
parents:
209
diff
changeset
|
807 |
(labelView isNil or:[labelView label isEmpty]) ifTrue:[ |
268 | 808 |
^ super preferredExtent |
188 | 809 |
]. |
153 | 810 |
^ super preferredExtent + (10@0). |
811 |
||
100 | 812 |
"/ prefCheck := toggleView preferredExtent. |
813 |
"/ prefLabel := labelView preferredExtent. |
|
814 |
"/ bw2 := borderWidth * 2. |
|
815 |
"/ ^ (prefCheck x + prefLabel x + (3 * ViewSpacing)) @ ((prefCheck y max:prefLabel y) + bw2 + 2) |
|
153 | 816 |
|
223 | 817 |
"Modified: 19.7.1996 / 20:43:47 / cg" |
100 | 818 |
! ! |
819 |
||
382
ea14fe927a8b
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
820 |
!CheckBox methodsFor:'queries - internal'! |
ea14fe927a8b
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
821 |
|
ea14fe927a8b
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
822 |
nativeWindowType |
ea14fe927a8b
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
823 |
"return a symbol describing my native window type |
ea14fe927a8b
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
824 |
(may be used internally by the device as a native window creation hint)" |
ea14fe927a8b
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
825 |
|
ea14fe927a8b
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
826 |
^ #CheckBox |
ea14fe927a8b
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
827 |
|
ea14fe927a8b
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
828 |
"Created: 2.5.1997 / 14:41:00 / cg" |
ea14fe927a8b
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
829 |
! ! |
ea14fe927a8b
preps for native window support
Claus Gittinger <cg@exept.de>
parents:
341
diff
changeset
|
830 |
|
273
01541272ce8d
resource spec updated; cache device form
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
831 |
!CheckBox class methodsFor:'documentation'! |
100 | 832 |
|
833 |
version |
|
1324 | 834 |
^ '$Header: /cvs/stx/stx/libwidg2/CheckBox.st,v 1.60 1999-04-23 12:28:11 cg Exp $' |
100 | 835 |
! ! |