author | Claus Gittinger <cg@exept.de> |
Sat, 22 Mar 1997 18:24:49 +0100 | |
changeset 1154 | bb9a71579a88 |
parent 1123 | 9d691272a9ec |
child 1169 | 982c3fd58d67 |
permissions | -rw-r--r-- |
0 | 1 |
" |
4 | 2 |
COPYRIGHT (c) 1991 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 |
Toggle subclass:#CheckToggle |
|
375
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
14 |
instanceVariableNames:'' |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
15 |
classVariableNames:'DefaultCheckForm DefaultCheckColor DefaultActiveFGColor |
265 | 16 |
DefaultActiveBGColor DefaultFGColor DefaultBGColor |
1123 | 17 |
DefaultActiveLevel DefaultPassiveLevel DefaultBorderWidth |
18 |
LabelOverMargin' |
|
375
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
19 |
poolDictionaries:'' |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
20 |
category:'Views-Interactors' |
0 | 21 |
! |
22 |
||
899 | 23 |
!CheckToggle class methodsFor:'documentation'! |
38 | 24 |
|
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
59 | 28 |
All Rights Reserved |
0 | 29 |
|
38 | 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 |
! |
|
0 | 38 |
|
38 | 39 |
documentation |
40 |
" |
|
41 |
CheckButtons are like Toggles in toggling their state when pressed. |
|
42 |
However, they show an ok-marker if on; nothing if off. |
|
118 | 43 |
CheckButtons are mostly used as part of a checkBox (since normally, |
147 | 44 |
you want to have some label along the check) and often grouped for |
45 |
many-in-many or one-in-many setups. |
|
130 | 46 |
|
585 | 47 |
[StyleSheet values:] |
130 | 48 |
|
585 | 49 |
checkToggleCheckColor <Color> color to draw check-image with. |
50 |
defaults to value of #buttonActiveForegroundColor. |
|
130 | 51 |
|
585 | 52 |
checkToggleActiveBackgroundColor background color to draw active checki-image with |
53 |
checkToggleForegroundColor foreground color to use if off |
|
54 |
checkToggleBackgroundColor background color to use if off |
|
130 | 55 |
|
585 | 56 |
checkToggleBitmapFile <String> name of bitmap file for check-image |
130 | 57 |
|
585 | 58 |
checkToggleStyle <Symbol> default checkForm style. |
59 |
used if above is nil or file not readable |
|
60 |
can be #cross or #check; defaults to #check |
|
130 | 61 |
|
585 | 62 |
checkToggleAvtiveLevel <Number> active level - defaults to value of #buttonPassiveLevel |
63 |
checkTogglePassiveLevel <Number> active level - defaults to value of #buttonPassiveLevel |
|
64 |
checkToggleBorderWidth <Number> borderWidth - defaults buttons default |
|
130 | 65 |
|
139 | 66 |
(if not set in the styleSheet, Toggle values are taken) |
67 |
||
130 | 68 |
See examples. |
69 |
||
585 | 70 |
[author:] |
71 |
Claus Gittinger |
|
72 |
||
73 |
[see also:] |
|
593 | 74 |
CheckBox RadioButton RadioButtonGroup Toggle Button |
75 |
Dialog |
|
76 |
ValueHolder TriggerValue |
|
77 |
Block |
|
118 | 78 |
" |
79 |
! |
|
80 |
||
81 |
examples |
|
82 |
" |
|
83 |
checkToggle alone: |
|
593 | 84 |
[exBegin] |
85 |
|top check| |
|
118 | 86 |
|
593 | 87 |
top := StandardSystemView new. |
88 |
top extent:100@100. |
|
118 | 89 |
|
593 | 90 |
check := CheckToggle in:top. |
91 |
check origin:10@10. |
|
118 | 92 |
|
593 | 93 |
top open |
94 |
[exEnd] |
|
118 | 95 |
|
96 |
||
97 |
give it an action: |
|
593 | 98 |
[exBegin] |
99 |
|top check| |
|
118 | 100 |
|
593 | 101 |
top := StandardSystemView new. |
102 |
top extent:100@100. |
|
118 | 103 |
|
593 | 104 |
check := CheckToggle in:top. |
105 |
check origin:10@10. |
|
655 | 106 |
check action:[:value | Transcript showCR:'changed to: ' , value printString]. |
118 | 107 |
|
593 | 108 |
top open |
109 |
[exEnd] |
|
110 |
||
118 | 111 |
|
112 |
give it a model: |
|
593 | 113 |
[exBegin] |
114 |
|top check model| |
|
118 | 115 |
|
593 | 116 |
model := false asValue. |
118 | 117 |
|
593 | 118 |
top := StandardSystemView new. |
119 |
top extent:100@100. |
|
118 | 120 |
|
593 | 121 |
check := CheckToggle in:top. |
122 |
check origin:10@10. |
|
123 |
check model:model. |
|
118 | 124 |
|
593 | 125 |
top openModal. |
118 | 126 |
|
655 | 127 |
Transcript showCR:'value after closing box: ' , model value printString |
593 | 128 |
[exEnd] |
129 |
||
118 | 130 |
|
131 |
multiple checks on a single model (with different change selectors): |
|
132 |
(using a checkBox here, for the demonstration ...) |
|
147 | 133 |
(this is a typical many-in-many setup) |
593 | 134 |
[exBegin] |
135 |
|top model panel ext1 ext2 |
|
136 |
readFlag writeFlag executeFlag| |
|
118 | 137 |
|
593 | 138 |
readFlag := writeFlag := true. |
139 |
executeFlag := false. |
|
118 | 140 |
|
593 | 141 |
model := Plug new. |
142 |
model respondTo:#read with:[readFlag]. |
|
143 |
model respondTo:#write with:[writeFlag]. |
|
144 |
model respondTo:#execute with:[executeFlag]. |
|
145 |
model respondTo:#read: with:[:val | readFlag := val]. |
|
146 |
model respondTo:#write: with:[:val | writeFlag := val]. |
|
147 |
model respondTo:#execute: with:[:val | executeFlag := val]. |
|
148 |
||
149 |
top := StandardSystemView new. |
|
150 |
top extent:200@200. |
|
151 |
top label:'File permissions:'. |
|
118 | 152 |
|
593 | 153 |
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top. |
154 |
panel horizontalLayout:#leftSpace. |
|
118 | 155 |
|
593 | 156 |
#(read write execute) do:[:sym | |
157 |
|check| |
|
118 | 158 |
|
593 | 159 |
check := CheckBox in:panel. |
160 |
check label:sym. |
|
161 |
check model:model; aspect:sym; changeMessage:(sym , ':') asSymbol. |
|
162 |
]. |
|
118 | 163 |
|
593 | 164 |
top openModal. |
118 | 165 |
|
655 | 166 |
Transcript showCR:'settings after closing box:'. |
167 |
Transcript showCR:' read -> ' , readFlag printString. |
|
168 |
Transcript showCR:' write -> ' , writeFlag printString. |
|
169 |
Transcript showCR:' execute -> ' , executeFlag printString. |
|
593 | 170 |
[exEnd] |
130 | 171 |
|
172 |
||
593 | 173 |
checkToggles in a group - now, they have RadioButton behavior. |
147 | 174 |
(this is a typical one-in-many setup) |
593 | 175 |
[exBegin] |
176 |
|top panel check1 check2 check3 grp| |
|
130 | 177 |
|
593 | 178 |
top := StandardSystemView new. |
179 |
top extent:200@300. |
|
130 | 180 |
|
593 | 181 |
panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top. |
130 | 182 |
|
593 | 183 |
check1 := CheckToggle in:panel. |
184 |
check2 := CheckToggle in:panel. |
|
185 |
check3 := CheckToggle in:panel. |
|
130 | 186 |
|
593 | 187 |
grp := RadioButtonGroup new. |
188 |
grp add:check1. |
|
189 |
grp add:check2. |
|
190 |
grp add:check3. |
|
130 | 191 |
|
593 | 192 |
top open |
193 |
[exEnd] |
|
146 | 194 |
|
195 |
||
196 |
Channel operation |
|
197 |
----------------- |
|
198 |
||
199 |
enabling other toggles via a toggle |
|
593 | 200 |
[exBegin] |
201 |
|top panel t enableChannel| |
|
146 | 202 |
|
593 | 203 |
top := StandardSystemView new. |
204 |
top extent:(400 @ 200). |
|
146 | 205 |
|
593 | 206 |
panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top. |
146 | 207 |
|
593 | 208 |
enableChannel := false asValue. |
146 | 209 |
|
593 | 210 |
1 to:10 do:[:i | |
211 |
t := CheckToggle in:panel. |
|
212 |
t enableChannel:enableChannel. |
|
213 |
]. |
|
146 | 214 |
|
593 | 215 |
t := Toggle in:panel. |
216 |
t activeLogo:'enabled'; passiveLogo:'disabled'. |
|
217 |
t pressChannel:enableChannel. |
|
146 | 218 |
|
593 | 219 |
top open |
220 |
[exEnd] |
|
38 | 221 |
" |
222 |
! ! |
|
0 | 223 |
|
899 | 224 |
!CheckToggle class methodsFor:'defaults'! |
0 | 225 |
|
205 | 226 |
checkFormOn:aDevice |
227 |
"return the form used when checkToggle is turned on. |
|
228 |
Provided as public entry, to allow other views |
|
229 |
to share the same check-image." |
|
230 |
||
231 |
^ DefaultCheckForm on:aDevice. |
|
232 |
! |
|
233 |
||
128 | 234 |
updateStyleCache |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
375
diff
changeset
|
235 |
"extract values from the styleSheet and cache them in class variables" |
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
375
diff
changeset
|
236 |
|
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
375
diff
changeset
|
237 |
<resource: #style (#checkToggleCheckColor |
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
375
diff
changeset
|
238 |
#checkToggleBackgroundColor #checkToggleForegroundColor |
836 | 239 |
#checkToggleActiveBackgroundColor #checkToggleActiveForegroundColor |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
375
diff
changeset
|
240 |
#checkToggleActiveLevel #checkTogglePassiveLevel |
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
375
diff
changeset
|
241 |
#checkToggleBorderWidth |
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
375
diff
changeset
|
242 |
#checkToggleBitmapFile |
1123 | 243 |
#checkToggleLabelOverMargin |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
375
diff
changeset
|
244 |
#checkToggleStyle)> |
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
375
diff
changeset
|
245 |
|
375
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
246 |
|checkFileName bits checkStyle| |
0 | 247 |
|
130 | 248 |
DefaultCheckColor := StyleSheet colorAt:'checkToggleCheckColor'. |
139 | 249 |
DefaultFGColor := StyleSheet colorAt:'checkToggleForegroundColor'. |
130 | 250 |
DefaultBGColor := StyleSheet colorAt:'checkToggleBackgroundColor'. |
139 | 251 |
DefaultActiveFGColor := StyleSheet colorAt:'checkToggleActiveForegroundColor'. |
130 | 252 |
DefaultActiveBGColor := StyleSheet colorAt:'checkToggleActiveBackgroundColor'. |
253 |
DefaultActiveLevel := StyleSheet at:'checkToggleActiveLevel'. |
|
254 |
DefaultPassiveLevel := StyleSheet at:'checkTogglePassiveLevel'. |
|
255 |
DefaultBorderWidth := StyleSheet at:'checkToggleBorderWidth'. |
|
1123 | 256 |
LabelOverMargin := StyleSheet at:'checkToggleLabelOverMargin' default:false. |
130 | 257 |
|
136 | 258 |
DefaultCheckForm := nil. |
128 | 259 |
checkFileName := StyleSheet at:'checkToggleBitmapFile' default:'CheckOn.xbm'. |
260 |
checkFileName notNil ifTrue:[ |
|
899 | 261 |
DefaultCheckForm := Image fromFile:checkFileName |
262 |
resolution:100 |
|
263 |
on:Display. |
|
264 |
DefaultCheckForm isNil ifTrue:[ |
|
265 |
DefaultCheckForm := Image fromFile:'bitmaps/' , checkFileName |
|
266 |
resolution:100 |
|
267 |
on:Display. |
|
268 |
] |
|
130 | 269 |
]. |
270 |
DefaultCheckForm isNil ifTrue:[ |
|
375
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
271 |
checkStyle := StyleSheet at:'checkToggleStyle' default:#check. |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
272 |
checkStyle == #cross ifTrue:[ |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
273 |
bits := #[2r10000000 2r00000001 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
274 |
2r01000000 2r00000010 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
275 |
2r00100000 2r00000100 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
276 |
2r00010000 2r00001000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
277 |
2r00001000 2r00010000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
278 |
2r00000100 2r00100000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
279 |
2r00000010 2r01000000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
280 |
2r00000001 2r10000000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
281 |
2r00000001 2r10000000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
282 |
2r00000010 2r01000000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
283 |
2r00000100 2r00100000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
284 |
2r00001000 2r00010000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
285 |
2r00010000 2r00001000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
286 |
2r00100000 2r00000100 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
287 |
2r01000000 2r00000010 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
288 |
2r10000000 2r00000001] |
128 | 289 |
|
375
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
290 |
] ifFalse:[ |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
291 |
checkStyle == #fatcross ifTrue:[ |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
292 |
bits := #[2r11000000 2r00000011 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
293 |
2r11100000 2r00000111 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
294 |
2r01110000 2r00001110 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
295 |
2r00111000 2r00011100 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
296 |
2r00011100 2r00111000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
297 |
2r00001110 2r01110000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
298 |
2r00000111 2r11100000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
299 |
2r00000011 2r11000000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
300 |
2r00000011 2r11000000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
301 |
2r00000111 2r11100000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
302 |
2r00001110 2r01110000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
303 |
2r00011100 2r00111000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
304 |
2r00111000 2r00011100 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
305 |
2r01110000 2r00001110 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
306 |
2r11100000 2r00000111 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
307 |
2r11000000 2r00000011] |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
308 |
] ifFalse:[ |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
309 |
bits := #[2r00000000 2r00000000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
310 |
2r00000000 2r00000010 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
311 |
2r00000000 2r00000010 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
312 |
2r00000000 2r00000100 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
313 |
2r00000000 2r00000100 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
314 |
2r00000000 2r00001000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
315 |
2r00000000 2r00001000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
316 |
2r00000000 2r00010000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
317 |
2r01000000 2r00110000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
318 |
2r00100000 2r01100000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
319 |
2r00011000 2r01100000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
320 |
2r00001110 2r11000000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
321 |
2r00000111 2r11000000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
322 |
2r00000011 2r10000000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
323 |
2r00000001 2r10000000 |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
324 |
2r00000000 2r00000000] |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
325 |
] |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
326 |
]. |
6656f7e8ae20
added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
327 |
DefaultCheckForm := Form width:16 height:16 fromArray:bits on:Display |
128 | 328 |
] |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
375
diff
changeset
|
329 |
|
1001 | 330 |
" |
331 |
self updateStyleCache |
|
332 |
" |
|
1123 | 333 |
|
334 |
"Modified: 7.3.1997 / 21:15:13 / cg" |
|
0 | 335 |
! ! |
336 |
||
337 |
!CheckToggle methodsFor:'initialization'! |
|
338 |
||
18 | 339 |
initStyle |
967 | 340 |
"setup viewStyle specifics" |
341 |
||
18 | 342 |
super initStyle. |
343 |
||
128 | 344 |
onLevel := offLevel. |
130 | 345 |
DefaultActiveLevel notNil ifTrue:[onLevel := DefaultActiveLevel]. |
136 | 346 |
DefaultPassiveLevel notNil ifTrue:[offLevel := DefaultPassiveLevel]. |
130 | 347 |
|
128 | 348 |
activeLogo := DefaultCheckForm on:device. |
349 |
passiveLogo := nil. |
|
350 |
||
139 | 351 |
DefaultActiveFGColor notNil ifTrue:[self activeForegroundColor:DefaultActiveFGColor]. |
130 | 352 |
DefaultCheckColor notNil ifTrue:[self activeForegroundColor:DefaultCheckColor]. |
353 |
DefaultActiveBGColor notNil ifTrue:[self activeBackgroundColor:DefaultActiveBGColor]. |
|
139 | 354 |
DefaultFGColor notNil ifTrue:[self foregroundColor:DefaultFGColor]. |
130 | 355 |
DefaultBGColor notNil ifTrue:[self backgroundColor:DefaultBGColor]. |
356 |
||
128 | 357 |
showLamp := false. |
130 | 358 |
|
359 |
DefaultBorderWidth notNil ifTrue:[self borderWidth:DefaultBorderWidth]. |
|
360 |
||
361 |
offLevel ~~ level ifTrue:[self level:offLevel]. |
|
967 | 362 |
|
363 |
"Modified: 22.1.1997 / 11:57:05 / cg" |
|
205 | 364 |
! |
365 |
||
366 |
initialize |
|
367 |
super initialize. |
|
368 |
passiveLogo := nil. |
|
1023 | 369 |
self label:activeLogo "/ to let me compute some defaultExtent |
370 |
||
371 |
"Modified: 18.2.1997 / 14:03:39 / cg" |
|
0 | 372 |
! ! |
373 |
||
1123 | 374 |
!CheckToggle methodsFor:'queries'! |
375 |
||
376 |
preferredExtent |
|
377 |
"/ If I have an explicit preferredExtent .. |
|
378 |
||
379 |
|pref| |
|
380 |
||
381 |
preferredExtent notNil ifTrue:[ |
|
382 |
^ preferredExtent |
|
383 |
]. |
|
384 |
||
385 |
pref := super preferredExtent. |
|
386 |
LabelOverMargin ifTrue:[ |
|
387 |
pref := pref - (margin*2) |
|
388 |
]. |
|
389 |
||
390 |
^ pref |
|
391 |
||
392 |
"Modified: 7.3.1997 / 17:52:53 / cg" |
|
393 |
! ! |
|
394 |
||
0 | 395 |
!CheckToggle methodsFor:'redrawing'! |
396 |
||
133 | 397 |
drawWith:fg and:bg |
265 | 398 |
controller pressed ifTrue:[ |
59 | 399 |
logo := activeLogo. |
0 | 400 |
] ifFalse:[ |
164 | 401 |
logo := passiveLogo. |
133 | 402 |
]. |
403 |
super drawWith:fg and:bg |
|
164 | 404 |
|
405 |
"Modified: 22.9.1995 / 15:45:02 / claus" |
|
1123 | 406 |
! |
407 |
||
408 |
edgeDrawn:which |
|
1154 | 409 |
"redraw my logo if it overlaps the edge" |
410 |
||
1123 | 411 |
LabelOverMargin ifTrue:[ |
412 |
(logo notNil and:[logo isImageOrForm]) ifTrue:[ |
|
413 |
self paint:fgColor on:bgColor. |
|
414 |
self clippingRectangle:nil. |
|
415 |
self displayForm:logo x:labelOriginX y:labelOriginY. |
|
416 |
self clippingRectangle:innerClipRect |
|
417 |
] |
|
418 |
]. |
|
419 |
||
1154 | 420 |
"Modified: 22.3.1997 / 18:23:50 / cg" |
0 | 421 |
! ! |
205 | 422 |
|
899 | 423 |
!CheckToggle class methodsFor:'documentation'! |
205 | 424 |
|
425 |
version |
|
1154 | 426 |
^ '$Header: /cvs/stx/stx/libwidg/CheckToggle.st,v 1.33 1997-03-22 17:24:49 cg Exp $' |
205 | 427 |
! ! |