author | tz |
Wed, 25 Feb 1998 22:41:54 +0100 | |
changeset 1455 | 9670fb4c4558 |
parent 1430 | 0940cd4e9d93 |
child 1456 | 5fb4270152e2 |
permissions | -rw-r--r-- |
1 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
59 | 3 |
All Rights Reserved |
1 | 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 |
Button subclass:#ArrowButton |
|
1053
b9f8bf97815c
remember direction; new-creation defaults to #up
Claus Gittinger <cg@exept.de>
parents:
1041
diff
changeset
|
14 |
instanceVariableNames:'arrowStyle direction' |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
15 |
classVariableNames:'DownArrowForm UpArrowForm LeftArrowForm RightArrowForm |
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
16 |
CachedStyle DefaultArrowStyle DefaultBackgroundColor |
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
17 |
DefaultForegroundColor DefaultActiveBackgroundColor |
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
18 |
DefaultActiveForegroundColor DefaultEnteredBackgroundColor |
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
19 |
DefaultEnteredForegroundColor DefaultDisabledForegroundColor |
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
20 |
DefaultArrowButtonActiveLevel DefaultArrowButtonPassiveLevel |
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
21 |
DownArrowFormFile UpArrowFormFile LeftArrowFormFile |
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
22 |
RightArrowFormFile' |
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
23 |
poolDictionaries:'' |
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
24 |
category:'Views-Interactors' |
1 | 25 |
! |
26 |
||
899 | 27 |
!ArrowButton class methodsFor:'documentation'! |
38 | 28 |
|
29 |
copyright |
|
30 |
" |
|
31 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
59 | 32 |
All Rights Reserved |
38 | 33 |
|
34 |
This software is furnished under a license and may be used |
|
35 |
only in accordance with the terms of that license and with the |
|
36 |
inclusion of the above copyright notice. This software may not |
|
37 |
be provided or otherwise made available to, or used by, any |
|
38 |
other person. No title to or ownership of the software is |
|
39 |
hereby transferred. |
|
40 |
" |
|
41 |
! |
|
42 |
||
43 |
documentation |
|
44 |
" |
|
59 | 45 |
ArrowButtons display an arrow as their label; they are mainly |
38 | 46 |
used for scrollbars, but can be useful on their own in some applications. |
59 | 47 |
Beside the contents, their default behavior is to perform their action |
48 |
when pressed - not (as is the default for normal buttons) when released. |
|
38 | 49 |
|
65 | 50 |
Indivdual ArrowButtons can be created by sending one of: |
580 | 51 |
ArrowButton upIn:aView /downIn: / leftIn: or rightIn: |
38 | 52 |
passing the parent view as argument. |
65 | 53 |
|
130 | 54 |
See examples. |
55 |
||
580 | 56 |
|
57 |
[styleSheet parameters:] |
|
58 |
||
59 |
arrowButtonStyle <Symbol> the style of the button; |
|
60 |
#motif, #st80 or nil (default) |
|
61 |
arrowButtonForegroundColor <nil | Color> foregroundColor |
|
62 |
arrowButtonBackgroundColor <nil | Color> backgroundColor |
|
63 |
||
64 |
arrowButtonActiveForegroundColor foregroundColor when pressed |
|
65 |
arrowButtonActiveBackgroundColor backgroundColor when pressed |
|
66 |
||
67 |
arrowButtonEnteredForegroundColor foregroundColor when mouse pointer entered |
|
68 |
arrowButtonEnteredBackgroundColor backgroundColor when mouse pointer entered |
|
69 |
||
585 | 70 |
[author:] |
71 |
Claus Gittinger |
|
72 |
||
580 | 73 |
[See also:] |
74 |
Button Toggle CheckToggle CheckBox |
|
75 |
ScrollBar |
|
130 | 76 |
|
62 | 77 |
" |
78 |
! |
|
1 | 79 |
|
62 | 80 |
examples |
81 |
" |
|
38 | 82 |
example1: |
593 | 83 |
[exBegin] |
84 |
|v p b1 b2 b3 b4| |
|
38 | 85 |
|
593 | 86 |
v := StandardSystemView extent:200@200. |
87 |
p := HorizontalPanelView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:v. |
|
88 |
b1 := ArrowButton upIn:p. |
|
89 |
b2 := ArrowButton downIn:p. |
|
90 |
b3 := ArrowButton leftIn:p. |
|
91 |
b4 := ArrowButton rightIn:p. |
|
38 | 92 |
|
593 | 93 |
b1 action:['whatEver you like here ...']. |
94 |
b2 action:['whatEver you like here ...']. |
|
95 |
b3 action:['whatEver you like here ...']. |
|
96 |
b4 action:['whatEver you like here ...']. |
|
38 | 97 |
|
593 | 98 |
v open |
99 |
[exEnd] |
|
38 | 100 |
|
1 | 101 |
|
38 | 102 |
example2: |
593 | 103 |
[exBegin] |
104 |
|v p b1 b2 b3 b4| |
|
59 | 105 |
|
593 | 106 |
v := StandardSystemView extent:200@200. |
107 |
p := HorizontalPanelView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:v. |
|
108 |
b1 := (ArrowButton upIn:p) extent:30@30. |
|
109 |
b2 := (ArrowButton downIn:p) extent:30@30. |
|
110 |
b3 := (ArrowButton leftIn:p) extent:30@30. |
|
111 |
b4 := (ArrowButton rightIn:p) extent:30@30. |
|
59 | 112 |
|
593 | 113 |
b1 action:['whatEver you like here ...']. |
114 |
b2 action:['whatEver you like here ...']. |
|
115 |
b3 action:['whatEver you like here ...']. |
|
116 |
b4 action:['whatEver you like here ...']. |
|
59 | 117 |
|
593 | 118 |
v open |
119 |
[exEnd] |
|
120 |
||
59 | 121 |
|
122 |
example3: |
|
593 | 123 |
[exBegin] |
124 |
|v p b1 b2 b3 b4| |
|
59 | 125 |
|
593 | 126 |
v := StandardSystemView extent:200@200. |
127 |
p := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:v. |
|
128 |
b1 := (ArrowButton upIn:p) origin:(0.33 @ 0.0) corner:(0.67 @ 0.33). |
|
129 |
b3 := (ArrowButton leftIn:p) origin:(0.0 @ 0.33) corner:(0.33 @ 0.67). |
|
130 |
b4 := (ArrowButton rightIn:p) origin:(0.67 @ 0.33) corner:(1.0 @ 0.67). |
|
131 |
b2 := (ArrowButton downIn:p) origin:(0.33 @ 0.67) corner:(0.67 @ 1.0). |
|
38 | 132 |
|
593 | 133 |
b1 action:['whatEver you like here ...']. |
134 |
b2 action:['whatEver you like here ...']. |
|
135 |
b3 action:['whatEver you like here ...']. |
|
136 |
b4 action:['whatEver you like here ...']. |
|
59 | 137 |
|
593 | 138 |
v open |
139 |
[exEnd] |
|
140 |
||
59 | 141 |
|
65 | 142 |
example4 (not good coding style, to explicitely use a particular style, |
593 | 143 |
just a demonstration how it looks ..): |
144 |
[exBegin] |
|
145 |
|v p b1 b2 b3 b4 oldStyle| |
|
59 | 146 |
|
593 | 147 |
oldStyle := View defaultStyle. |
148 |
View defaultStyle:#motif. |
|
38 | 149 |
|
593 | 150 |
v := StandardSystemView extent:100@100. |
151 |
p := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:v. |
|
59 | 152 |
|
593 | 153 |
b1 := (ArrowButton upIn:p) origin:(0.33 @ 0.0) corner:(0.67 @ 0.33). |
154 |
b3 := (ArrowButton leftIn:p) origin:(0.0 @ 0.33) corner:(0.33 @ 0.67). |
|
155 |
b4 := (ArrowButton rightIn:p) origin:(0.67 @ 0.33) corner:(1.0 @ 0.67). |
|
156 |
b2 := (ArrowButton downIn:p) origin:(0.33 @ 0.67) corner:(0.67 @ 1.0). |
|
38 | 157 |
|
593 | 158 |
b1 action:['whatEver you like here ...']. |
159 |
b2 action:['whatEver you like here ...']. |
|
160 |
b3 action:['whatEver you like here ...']. |
|
161 |
b4 action:['whatEver you like here ...']. |
|
59 | 162 |
|
593 | 163 |
View defaultStyle:oldStyle. |
164 |
v open |
|
165 |
[exEnd] |
|
38 | 166 |
" |
167 |
! ! |
|
1 | 168 |
|
899 | 169 |
!ArrowButton class methodsFor:'instance creation'! |
59 | 170 |
|
205 | 171 |
downIn:aView |
966 | 172 |
"create and return a new down-button in aView" |
173 |
||
205 | 174 |
^ (super in:aView) direction:#down |
966 | 175 |
|
176 |
"Modified: 22.1.1997 / 11:59:08 / cg" |
|
205 | 177 |
! |
59 | 178 |
|
205 | 179 |
leftIn:aView |
966 | 180 |
"create and return a new left-button in aView" |
181 |
||
205 | 182 |
^ (super in:aView) direction:#left |
966 | 183 |
|
184 |
"Modified: 22.1.1997 / 11:59:14 / cg" |
|
59 | 185 |
! |
186 |
||
1053
b9f8bf97815c
remember direction; new-creation defaults to #up
Claus Gittinger <cg@exept.de>
parents:
1041
diff
changeset
|
187 |
new |
b9f8bf97815c
remember direction; new-creation defaults to #up
Claus Gittinger <cg@exept.de>
parents:
1041
diff
changeset
|
188 |
"return a new arrowButton - direction defaults to #up" |
b9f8bf97815c
remember direction; new-creation defaults to #up
Claus Gittinger <cg@exept.de>
parents:
1041
diff
changeset
|
189 |
|
b9f8bf97815c
remember direction; new-creation defaults to #up
Claus Gittinger <cg@exept.de>
parents:
1041
diff
changeset
|
190 |
^ super new direction:#up |
b9f8bf97815c
remember direction; new-creation defaults to #up
Claus Gittinger <cg@exept.de>
parents:
1041
diff
changeset
|
191 |
! |
b9f8bf97815c
remember direction; new-creation defaults to #up
Claus Gittinger <cg@exept.de>
parents:
1041
diff
changeset
|
192 |
|
205 | 193 |
rightIn:aView |
966 | 194 |
"create and return a new right-button in aView" |
195 |
||
205 | 196 |
^ (super in:aView) direction:#right |
966 | 197 |
|
198 |
"Modified: 22.1.1997 / 11:59:21 / cg" |
|
205 | 199 |
! |
6 | 200 |
|
205 | 201 |
upIn:aView |
966 | 202 |
"create and return a new up-button in aView" |
203 |
||
205 | 204 |
^ (super in:aView) direction:#up |
966 | 205 |
|
206 |
"Modified: 22.1.1997 / 11:59:27 / cg" |
|
205 | 207 |
! ! |
38 | 208 |
|
899 | 209 |
!ArrowButton class methodsFor:'defaults'! |
1 | 210 |
|
1455 | 211 |
DownArrowForm |
212 |
||
213 |
^DownArrowForm |
|
214 |
! |
|
215 |
||
216 |
LeftArrowForm |
|
217 |
||
218 |
^LeftArrowForm |
|
219 |
! |
|
220 |
||
221 |
RightArrowForm |
|
222 |
||
223 |
^RightArrowForm |
|
224 |
! |
|
225 |
||
226 |
UpArrowForm |
|
227 |
||
228 |
^UpArrowForm |
|
229 |
! |
|
230 |
||
1005 | 231 |
defaultDownArrowButtonForm |
232 |
"return the default form used for the scrollDown Button |
|
233 |
(if no styleSheet value is defined, and no form can be constructed)" |
|
234 |
||
235 |
<resource: #image> |
|
236 |
||
237 |
^ Form width:16 height:16 |
|
238 |
fromArray:#[2r00000000 2r00000000 |
|
239 |
2r00001111 2r11110000 |
|
240 |
2r00001000 2r00010000 |
|
241 |
2r00001000 2r00010000 |
|
242 |
2r00001000 2r00010000 |
|
243 |
2r00001000 2r00010000 |
|
244 |
2r00001000 2r00010000 |
|
245 |
2r01111000 2r00011110 |
|
246 |
2r01000000 2r00000010 |
|
247 |
2r00100000 2r00000100 |
|
248 |
2r00010000 2r00001000 |
|
249 |
2r00001000 2r00010000 |
|
250 |
2r00000100 2r00100000 |
|
251 |
2r00000010 2r01000000 |
|
252 |
2r00000001 2r10000000 |
|
253 |
2r00000000 2r00000000] |
|
1008 | 254 |
|
255 |
" |
|
256 |
self defaultDownArrowButtonForm |
|
257 |
" |
|
258 |
||
1005 | 259 |
! |
260 |
||
261 |
defaultLeftArrowButtonForm |
|
262 |
"return the default form used for the scrollLeft Button |
|
263 |
(if no styleSheet value is defined, and no form can be constructed)" |
|
264 |
||
265 |
<resource: #image> |
|
266 |
||
267 |
^ Form width:16 height:16 |
|
268 |
fromArray:#[2r00000000 2r00000000 |
|
269 |
2r00000001 2r10000000 |
|
270 |
2r00000010 2r10000000 |
|
271 |
2r00000100 2r10000000 |
|
272 |
2r00001000 2r11111110 |
|
273 |
2r00010000 2r00000010 |
|
274 |
2r00100000 2r00000010 |
|
275 |
2r01000000 2r00000010 |
|
276 |
2r01000000 2r00000010 |
|
277 |
2r00100000 2r00000010 |
|
278 |
2r00010000 2r00000010 |
|
279 |
2r00001000 2r11111110 |
|
280 |
2r00000100 2r10000000 |
|
281 |
2r00000010 2r10000000 |
|
282 |
2r00000001 2r10000000 |
|
283 |
2r00000000 2r00000000] |
|
284 |
||
1008 | 285 |
" |
286 |
self defaultLeftArrowButtonForm |
|
287 |
" |
|
288 |
||
1005 | 289 |
! |
290 |
||
291 |
defaultRightArrowButtonForm |
|
292 |
"return the default form used for the scrollRight Button |
|
293 |
(if no styleSheet value is defined, and no form can be constructed)" |
|
294 |
||
295 |
<resource: #image> |
|
296 |
||
297 |
^ Form width:16 height:16 |
|
298 |
fromArray:#[2r00000000 2r00000000 |
|
299 |
2r00000001 2r10000000 |
|
300 |
2r00000001 2r01000000 |
|
301 |
2r00000001 2r00100000 |
|
302 |
2r01111111 2r00010000 |
|
303 |
2r01000000 2r00001000 |
|
304 |
2r01000000 2r00000100 |
|
305 |
2r01000000 2r00000010 |
|
306 |
2r01000000 2r00000010 |
|
307 |
2r01000000 2r00000100 |
|
308 |
2r01000000 2r00001000 |
|
309 |
2r01111111 2r00010000 |
|
310 |
2r00000001 2r00100000 |
|
311 |
2r00000001 2r01000000 |
|
312 |
2r00000001 2r10000000 |
|
313 |
2r00000000 2r00000000] |
|
314 |
||
1008 | 315 |
" |
316 |
self defaultRightArrowButtonForm |
|
317 |
" |
|
318 |
||
1005 | 319 |
! |
320 |
||
321 |
defaultUpArrowButtonForm |
|
322 |
"return the default form used for the scrollUp Button |
|
323 |
(if no styleSheet value is defined, and no form can be constructed)" |
|
324 |
||
325 |
<resource: #image> |
|
326 |
||
327 |
^ Form width:16 height:16 |
|
328 |
fromArray:#[2r00000000 2r00000000 |
|
329 |
2r00000001 2r10000000 |
|
330 |
2r00000010 2r01000000 |
|
331 |
2r00000100 2r00100000 |
|
332 |
2r00001000 2r00010000 |
|
333 |
2r00010000 2r00001000 |
|
334 |
2r00100000 2r00000100 |
|
335 |
2r01000000 2r00000010 |
|
336 |
2r01111000 2r00011110 |
|
337 |
2r00001000 2r00010000 |
|
338 |
2r00001000 2r00010000 |
|
339 |
2r00001000 2r00010000 |
|
340 |
2r00001000 2r00010000 |
|
341 |
2r00001000 2r00010000 |
|
342 |
2r00001111 2r11110000 |
|
343 |
2r00000000 2r00000000] |
|
344 |
||
1008 | 345 |
" |
346 |
self defaultUpArrowButtonForm |
|
347 |
" |
|
348 |
||
1005 | 349 |
! |
350 |
||
1321 | 351 |
downArrowButtonForm:styleSymbol on:aDevice |
959 | 352 |
"return the form used for the scrollDown Button" |
1 | 353 |
|
1364 | 354 |
<resource: #style (#'arrowButton.downForm')> |
923
a6ee1a239fc0
resource spec updated; cache device form
Claus Gittinger <cg@exept.de>
parents:
901
diff
changeset
|
355 |
|
59 | 356 |
|form| |
38 | 357 |
|
358 |
" |
|
359 |
use cached form, if device is appropriate |
|
360 |
" |
|
1321 | 361 |
CachedStyle ~~ styleSymbol ifTrue:[ |
657 | 362 |
UpArrowForm := DownArrowForm := LeftArrowForm := RightArrowForm := nil |
59 | 363 |
]. |
364 |
||
1321 | 365 |
((form := DownArrowForm) notNil and:[form device == aDevice]) ifTrue:[ |
366 |
^ form |
|
38 | 367 |
]. |
368 |
||
1364 | 369 |
form := DownArrowForm := StyleSheet at:'arrowButton.downForm' default:nil. |
1321 | 370 |
form notNil ifTrue:[^ form]. |
154 | 371 |
|
38 | 372 |
" |
59 | 373 |
special treatment for st80 arrows |
374 |
- they do not really fit into the general (bitmap) scheme ... |
|
375 |
(i.e. they are computed instead of drawn from a bitmap) |
|
38 | 376 |
" |
1321 | 377 |
styleSymbol ~~ #st80 ifTrue:[ |
657 | 378 |
DownArrowFormFile notNil ifTrue:[ |
899 | 379 |
form := Image fromFile:DownArrowFormFile resolution:100 on:aDevice. |
657 | 380 |
form isNil ifTrue:[ |
899 | 381 |
form := Image fromFile:('bitmaps/' , DownArrowFormFile) resolution:100 on:aDevice. |
382 |
form isNil ifTrue:[ |
|
926 | 383 |
'ArrowButton [info]: no bitmapFile: ' infoPrint. DownArrowFormFile infoPrintCR. |
899 | 384 |
] |
657 | 385 |
] |
386 |
] |
|
38 | 387 |
]. |
6 | 388 |
|
38 | 389 |
" |
390 |
form to use as a fallback, if no bitmap file is present |
|
391 |
(actually not really needed - just to show something useful, in |
|
392 |
case of a bad installation) |
|
393 |
" |
|
394 |
form isNil ifTrue:[ |
|
1321 | 395 |
styleSymbol == #st80 ifTrue:[ |
657 | 396 |
form := Form width:9 height:9 depth:1 on:Display. |
270
aa6a36e199e7
be tolerant in case form creation fails
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
397 |
form isNil ifTrue:[^ nil]. |
657 | 398 |
form clear. |
399 |
form lineWidth:2. |
|
400 |
form capStyle:#round. |
|
401 |
form paint:(Color colorId:1). |
|
402 |
form displayLineFromX:0 y:2 toX:4 y:6. |
|
901 | 403 |
form displayLineFromX:4 y:6 toX:8 y:2. |
404 |
form beImmediateForm. |
|
657 | 405 |
] ifFalse:[ |
1317 | 406 |
form := self defaultDownArrowButtonForm onDevice:aDevice. |
270
aa6a36e199e7
be tolerant in case form creation fails
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
407 |
form isNil ifTrue:[^ nil]. |
657 | 408 |
]. |
1 | 409 |
]. |
38 | 410 |
|
411 |
" |
|
412 |
remember form for next use |
|
413 |
" |
|
1321 | 414 |
CachedStyle := styleSymbol. |
415 |
DownArrowForm := form. |
|
38 | 416 |
|
417 |
^ form |
|
657 | 418 |
|
1364 | 419 |
"Modified: / 26.10.1997 / 17:01:54 / cg" |
1 | 420 |
! |
421 |
||
1321 | 422 |
leftArrowButtonForm:styleSymbol on:aDevice |
959 | 423 |
"return the form used for the scrollLeft Button" |
38 | 424 |
|
1364 | 425 |
<resource: #style (#'arrowButton.leftForm')> |
923
a6ee1a239fc0
resource spec updated; cache device form
Claus Gittinger <cg@exept.de>
parents:
901
diff
changeset
|
426 |
|
59 | 427 |
|form| |
38 | 428 |
|
429 |
" |
|
430 |
use cached form, if device is appropriate |
|
431 |
" |
|
1321 | 432 |
CachedStyle ~~ styleSymbol ifTrue:[ |
657 | 433 |
UpArrowForm := DownArrowForm := LeftArrowForm := RightArrowForm := nil |
59 | 434 |
]. |
435 |
||
1321 | 436 |
((form := LeftArrowForm) notNil and:[form device == aDevice]) ifTrue:[ |
437 |
^ form |
|
38 | 438 |
]. |
439 |
||
1364 | 440 |
form := LeftArrowForm := StyleSheet at:'arrowButton.leftForm' default:nil. |
1321 | 441 |
form notNil ifTrue:[^ form]. |
154 | 442 |
|
38 | 443 |
" |
59 | 444 |
special treatment for st80 arrows |
445 |
- they do not really fit into the general (bitmap) scheme ... |
|
446 |
(i.e. they are computed instead of drawn from a bitmap) |
|
38 | 447 |
" |
1321 | 448 |
styleSymbol ~~ #st80 ifTrue:[ |
657 | 449 |
LeftArrowFormFile notNil ifTrue:[ |
899 | 450 |
form := Image fromFile:LeftArrowFormFile resolution:100 on:aDevice. |
657 | 451 |
form isNil ifTrue:[ |
899 | 452 |
form := Image fromFile:'bitmaps/' , LeftArrowFormFile resolution:100 on:aDevice. |
453 |
form isNil ifTrue:[ |
|
926 | 454 |
'ArrowButton [info]: no bitmapFile: ' infoPrint. LeftArrowFormFile infoPrintCR. |
899 | 455 |
] |
657 | 456 |
] |
457 |
] |
|
38 | 458 |
]. |
6 | 459 |
|
38 | 460 |
" |
461 |
form to use as a fallback, if no bitmap file is present |
|
462 |
(actually not really needed - just to show something useful, in |
|
463 |
case of a bad installation) |
|
464 |
" |
|
465 |
form isNil ifTrue:[ |
|
1321 | 466 |
styleSymbol == #st80 ifTrue:[ |
657 | 467 |
form := Form width:9 height:9 depth:1 on:Display. |
270
aa6a36e199e7
be tolerant in case form creation fails
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
468 |
form isNil ifTrue:[^ nil]. |
657 | 469 |
form clear. |
470 |
form lineWidth:2. |
|
471 |
form capStyle:#round. |
|
472 |
form paint:(Color colorId:1). |
|
473 |
form displayLineFromX:6 y:0 toX:2 y:4. |
|
474 |
form displayLineFromX:2 y:4 toX:6 y:8. |
|
901 | 475 |
form beImmediateForm. |
657 | 476 |
] ifFalse:[ |
1317 | 477 |
form := self defaultLeftArrowButtonForm onDevice:aDevice. |
270
aa6a36e199e7
be tolerant in case form creation fails
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
478 |
form isNil ifTrue:[^ nil]. |
657 | 479 |
]. |
1 | 480 |
]. |
38 | 481 |
|
482 |
" |
|
483 |
remember form for next use |
|
484 |
" |
|
1321 | 485 |
CachedStyle := styleSymbol. |
486 |
LeftArrowForm := form. |
|
38 | 487 |
|
488 |
^ form |
|
657 | 489 |
|
1364 | 490 |
"Modified: / 26.10.1997 / 17:01:47 / cg" |
1 | 491 |
! |
492 |
||
1321 | 493 |
rightArrowButtonForm:styleSymbol on:aDevice |
959 | 494 |
"return the form used for the scrollRight Button" |
38 | 495 |
|
1364 | 496 |
<resource: #style (#'arrowButton.rightForm')> |
923
a6ee1a239fc0
resource spec updated; cache device form
Claus Gittinger <cg@exept.de>
parents:
901
diff
changeset
|
497 |
|
59 | 498 |
|form| |
38 | 499 |
|
500 |
" |
|
501 |
use cached form, if device is appropriate |
|
502 |
" |
|
1321 | 503 |
CachedStyle ~~ styleSymbol ifTrue:[ |
657 | 504 |
UpArrowForm := DownArrowForm := LeftArrowForm := RightArrowForm := nil |
59 | 505 |
]. |
506 |
||
1321 | 507 |
((form := RightArrowForm) notNil and:[form device == aDevice]) ifTrue:[ |
508 |
^ form |
|
38 | 509 |
]. |
510 |
||
1364 | 511 |
form := RightArrowForm := StyleSheet at:'arrowButton.rightForm' default:nil. |
1321 | 512 |
form notNil ifTrue:[^ form]. |
154 | 513 |
|
38 | 514 |
" |
59 | 515 |
special treatment for st80 arrows |
516 |
- they do not really fit into the general (bitmap) scheme ... |
|
517 |
(i.e. they are computed instead of drawn from a bitmap) |
|
38 | 518 |
" |
1321 | 519 |
styleSymbol ~~ #st80 ifTrue:[ |
657 | 520 |
RightArrowFormFile notNil ifTrue:[ |
899 | 521 |
form := Image fromFile:RightArrowFormFile resolution:100 on:aDevice. |
657 | 522 |
form isNil ifTrue:[ |
899 | 523 |
form := Image fromFile:'bitmaps/' , RightArrowFormFile resolution:100 on:aDevice. |
524 |
form isNil ifTrue:[ |
|
926 | 525 |
'ArrowButton [info]: no bitmapFile: ' infoPrint. RightArrowFormFile infoPrintCR. |
899 | 526 |
] |
657 | 527 |
] |
528 |
] |
|
38 | 529 |
]. |
6 | 530 |
|
38 | 531 |
" |
532 |
form to use as a fallback, if no bitmap file is present |
|
533 |
(actually not really needed - just to show something useful, in |
|
534 |
case of a bad installation) |
|
535 |
" |
|
536 |
form isNil ifTrue:[ |
|
1321 | 537 |
styleSymbol == #st80 ifTrue:[ |
657 | 538 |
form := Form width:9 height:9 depth:1 on:Display. |
270
aa6a36e199e7
be tolerant in case form creation fails
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
539 |
form isNil ifTrue:[^ nil]. |
657 | 540 |
form clear. |
541 |
form lineWidth:2. |
|
542 |
form capStyle:#round. |
|
543 |
form paint:(Color colorId:1). |
|
544 |
form displayLineFromX:2 y:0 toX:6 y:4. |
|
901 | 545 |
form displayLineFromX:6 y:4 toX:2 y:8. |
546 |
form beImmediateForm. |
|
657 | 547 |
] ifFalse:[ |
1317 | 548 |
form := self defaultRightArrowButtonForm onDevice:aDevice. |
270
aa6a36e199e7
be tolerant in case form creation fails
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
549 |
form isNil ifTrue:[^ nil]. |
657 | 550 |
]. |
1 | 551 |
]. |
38 | 552 |
|
553 |
" |
|
554 |
remember form for next use |
|
555 |
" |
|
1321 | 556 |
CachedStyle := styleSymbol. |
557 |
RightArrowForm := form. |
|
38 | 558 |
|
559 |
^ form |
|
657 | 560 |
|
1364 | 561 |
"Modified: / 26.10.1997 / 17:01:40 / cg" |
1 | 562 |
! |
563 |
||
1321 | 564 |
upArrowButtonForm:styleSymbol on:aDevice |
205 | 565 |
"return the form used for the scrollUp Button" |
566 |
||
1364 | 567 |
<resource: #style (#'arrowButton.upForm')> |
923
a6ee1a239fc0
resource spec updated; cache device form
Claus Gittinger <cg@exept.de>
parents:
901
diff
changeset
|
568 |
|
205 | 569 |
|form| |
570 |
||
571 |
" |
|
572 |
use cached form, if device is appropriate |
|
573 |
" |
|
1321 | 574 |
CachedStyle ~~ styleSymbol ifTrue:[ |
657 | 575 |
UpArrowForm := DownArrowForm := LeftArrowForm := RightArrowForm := nil |
205 | 576 |
]. |
577 |
||
1321 | 578 |
((form := UpArrowForm) notNil and:[form device == aDevice]) ifTrue:[ |
579 |
^ form |
|
205 | 580 |
]. |
581 |
||
1364 | 582 |
form := UpArrowForm := StyleSheet at:'arrowButton.upForm' default:nil. |
1321 | 583 |
form notNil ifTrue:[^ form]. |
205 | 584 |
|
585 |
" |
|
586 |
special treatment for st80 arrows |
|
587 |
- they do not really fit into the general (bitmap) scheme ... |
|
588 |
(i.e. they are computed instead of drawn from a bitmap) |
|
589 |
" |
|
1321 | 590 |
styleSymbol ~~ #st80 ifTrue:[ |
657 | 591 |
UpArrowFormFile notNil ifTrue:[ |
899 | 592 |
form := Image fromFile:UpArrowFormFile resolution:100 on:aDevice. |
657 | 593 |
form isNil ifTrue:[ |
899 | 594 |
form := Image fromFile:'bitmaps/' , UpArrowFormFile resolution:100 on:aDevice. |
595 |
form isNil ifTrue:[ |
|
926 | 596 |
'ArrowButton [info]: no bitmapFile: ' infoPrint. UpArrowFormFile infoPrintCR. |
899 | 597 |
] |
657 | 598 |
] |
599 |
] |
|
205 | 600 |
]. |
601 |
||
602 |
" |
|
603 |
form to use as a fallback, if no bitmap file is present |
|
604 |
(actually not really needed - just to show something useful, in |
|
605 |
case of a bad installation) |
|
606 |
" |
|
607 |
form isNil ifTrue:[ |
|
1321 | 608 |
styleSymbol == #st80 ifTrue:[ |
657 | 609 |
form := Form width:9 height:9 depth:1 on:aDevice. |
270
aa6a36e199e7
be tolerant in case form creation fails
Claus Gittinger <cg@exept.de>
parents:
205
diff
changeset
|
610 |
form isNil ifTrue:[^ nil]. |
657 | 611 |
form clear. |
612 |
form lineWidth:2. |
|
613 |
form capStyle:#round. |
|
614 |
form paint:(Color colorId:1). |
|
615 |
form displayLineFromX:0 y:6 toX:4 y:2. |
|
616 |
form displayLineFromX:4 y:2 toX:8 y:6. |
|
901 | 617 |
form beImmediateForm. |
657 | 618 |
] ifFalse:[ |
1317 | 619 |
form := self defaultUpArrowButtonForm onDevice:aDevice. |
657 | 620 |
form isNil ifTrue:[^ nil]. |
621 |
]. |
|
205 | 622 |
]. |
623 |
||
624 |
" |
|
625 |
remember form for next use |
|
626 |
" |
|
1321 | 627 |
CachedStyle := styleSymbol. |
628 |
UpArrowForm := form. |
|
205 | 629 |
|
630 |
^ form |
|
657 | 631 |
|
1364 | 632 |
"Modified: / 26.10.1997 / 17:01:32 / cg" |
1 | 633 |
! |
634 |
||
205 | 635 |
updateStyleCache |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
636 |
"extract values from the styleSheet and cache them in class variables" |
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
637 |
|
1355 | 638 |
<resource: #style (#'arrowButton.style' |
639 |
#'arrowButton.activeLevel' #'arrowButton.passiveLevel' |
|
640 |
#'arrowButton.backgroundColor' #'arrowButton.foregroundColor' |
|
641 |
#'arrowButton.activeBackgroundColor' #'arrowButton.activeForegroundColor' |
|
642 |
#'arrowButton.enteredBackgroundColor' #'arrowButton.enteredForegroundColor' |
|
643 |
#'arrowButton.disabledForegroundColor' |
|
644 |
#'arrowButton.downForm' #'arrowButton.upForm' |
|
645 |
#'arrowButton.leftForm' #'arrowButton.rightForm' |
|
646 |
#'arrowButton.downFormFile' #'arrowButton.upFormFile' |
|
647 |
#'arrowButton.leftFormFile' #'arrowButton.rightFormFile')> |
|
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
648 |
|
1355 | 649 |
DefaultArrowStyle := StyleSheet at:'arrowButton.style' default:StyleSheet name. |
205 | 650 |
DefaultArrowStyle := DefaultArrowStyle asSymbol. |
651 |
||
1355 | 652 |
DefaultArrowButtonActiveLevel := StyleSheet at:'arrowButton.activeLevel' default:nil. |
653 |
DefaultArrowButtonPassiveLevel := StyleSheet at:'arrowButton.passiveLevel' default:nil. |
|
205 | 654 |
|
1355 | 655 |
DefaultBackgroundColor := StyleSheet colorAt:'arrowButton.backgroundColor'. |
656 |
DefaultForegroundColor := StyleSheet colorAt:'arrowButton.foregroundColor'. |
|
657 |
DefaultActiveBackgroundColor := StyleSheet colorAt:'arrowButton.activeBackgroundColor'. |
|
658 |
DefaultActiveForegroundColor := StyleSheet colorAt:'arrowButton.activeForegroundColor'. |
|
659 |
DefaultEnteredBackgroundColor := StyleSheet colorAt:'arrowButton.enteredBackgroundColor'. |
|
660 |
DefaultEnteredForegroundColor := StyleSheet colorAt:'arrowButton.enteredForegroundColor'. |
|
661 |
DefaultDisabledForegroundColor := StyleSheet colorAt:'arrowButton.disabledForegroundColor'. |
|
205 | 662 |
|
1355 | 663 |
DownArrowForm := StyleSheet at:'arrowButton.downForm' default:nil. |
664 |
UpArrowForm := StyleSheet at:'arrowButton.upForm' default:nil. |
|
665 |
LeftArrowForm := StyleSheet at:'arrowButton.leftForm' default:nil. |
|
666 |
RightArrowForm := StyleSheet at:'arrowButton.rightForm' default:nil. |
|
1 | 667 |
|
205 | 668 |
UpArrowFormFile := DownArrowFormFile := LeftArrowFormFile := RightArrowFormFile := nil. |
669 |
UpArrowForm isNil ifTrue:[ |
|
1355 | 670 |
UpArrowFormFile := StyleSheet at:'arrowButton.upFormFile' default:'ScrollUp.xbm'. |
205 | 671 |
]. |
672 |
DownArrowForm isNil ifTrue:[ |
|
1355 | 673 |
DownArrowFormFile := StyleSheet at:'arrowButton.downFormFile' default:'ScrollDn.xbm'. |
205 | 674 |
]. |
675 |
LeftArrowForm isNil ifTrue:[ |
|
1355 | 676 |
LeftArrowFormFile := StyleSheet at:'arrowButton.leftFormFile' default:'ScrollLt.xbm'. |
205 | 677 |
]. |
678 |
RightArrowForm isNil ifTrue:[ |
|
1355 | 679 |
RightArrowFormFile := StyleSheet at:'arrowButton.rightFormFile' default:'ScrollRt.xbm'. |
205 | 680 |
]. |
681 |
||
682 |
" |
|
683 |
self updateStyleCache |
|
684 |
" |
|
685 |
||
686 |
"Modified: 31.8.1995 / 03:01:14 / claus" |
|
1355 | 687 |
"Modified: 20.10.1997 / 13:50:57 / cg" |
1 | 688 |
! ! |
689 |
||
690 |
!ArrowButton methodsFor:'accessing'! |
|
691 |
||
1053
b9f8bf97815c
remember direction; new-creation defaults to #up
Claus Gittinger <cg@exept.de>
parents:
1041
diff
changeset
|
692 |
direction |
b9f8bf97815c
remember direction; new-creation defaults to #up
Claus Gittinger <cg@exept.de>
parents:
1041
diff
changeset
|
693 |
"return the buttons direction - a symbol" |
b9f8bf97815c
remember direction; new-creation defaults to #up
Claus Gittinger <cg@exept.de>
parents:
1041
diff
changeset
|
694 |
|
b9f8bf97815c
remember direction; new-creation defaults to #up
Claus Gittinger <cg@exept.de>
parents:
1041
diff
changeset
|
695 |
^ direction |
b9f8bf97815c
remember direction; new-creation defaults to #up
Claus Gittinger <cg@exept.de>
parents:
1041
diff
changeset
|
696 |
! |
b9f8bf97815c
remember direction; new-creation defaults to #up
Claus Gittinger <cg@exept.de>
parents:
1041
diff
changeset
|
697 |
|
1 | 698 |
direction:aDirectionSymbol |
966 | 699 |
"create and return a new arrow button in aView" |
700 |
||
6 | 701 |
|form| |
702 |
||
1 | 703 |
aDirectionSymbol == #up ifTrue:[ |
966 | 704 |
form := (self class upArrowButtonForm:arrowStyle on:device). |
1 | 705 |
]. |
706 |
aDirectionSymbol == #down ifTrue:[ |
|
966 | 707 |
form := (self class downArrowButtonForm:arrowStyle on:device). |
1 | 708 |
]. |
709 |
aDirectionSymbol == #left ifTrue:[ |
|
966 | 710 |
form := (self class leftArrowButtonForm:arrowStyle on:device). |
1 | 711 |
]. |
712 |
aDirectionSymbol == #right ifTrue:[ |
|
966 | 713 |
form := (self class rightArrowButtonForm:arrowStyle on:device). |
1 | 714 |
]. |
1053
b9f8bf97815c
remember direction; new-creation defaults to #up
Claus Gittinger <cg@exept.de>
parents:
1041
diff
changeset
|
715 |
direction := aDirectionSymbol. |
6 | 716 |
self form:form |
966 | 717 |
|
1041 | 718 |
"Modified: 24.2.1997 / 21:19:59 / cg" |
1 | 719 |
! ! |
720 |
||
721 |
!ArrowButton methodsFor:'initialization'! |
|
722 |
||
723 |
initStyle |
|
966 | 724 |
"setup viewStyle specifics" |
725 |
||
1 | 726 |
super initStyle. |
59 | 727 |
|
60 | 728 |
DefaultBackgroundColor notNil ifTrue:[ |
966 | 729 |
bgColor := DefaultBackgroundColor on:device |
60 | 730 |
]. |
731 |
DefaultForegroundColor notNil ifTrue:[ |
|
966 | 732 |
fgColor := DefaultForegroundColor on:device |
60 | 733 |
]. |
59 | 734 |
DefaultActiveForegroundColor notNil ifTrue:[ |
966 | 735 |
activeFgColor := DefaultActiveForegroundColor on:device |
59 | 736 |
]. |
737 |
DefaultActiveBackgroundColor notNil ifTrue:[ |
|
966 | 738 |
activeBgColor := DefaultActiveBackgroundColor on:device |
59 | 739 |
]. |
740 |
DefaultEnteredForegroundColor notNil ifTrue:[ |
|
966 | 741 |
enteredFgColor := DefaultEnteredForegroundColor on:device |
59 | 742 |
]. |
743 |
DefaultEnteredBackgroundColor notNil ifTrue:[ |
|
966 | 744 |
enteredBgColor := DefaultEnteredBackgroundColor on:device |
59 | 745 |
]. |
153 | 746 |
DefaultDisabledForegroundColor notNil ifTrue:[ |
966 | 747 |
disabledFgColor := DefaultDisabledForegroundColor on:device |
153 | 748 |
]. |
749 |
||
59 | 750 |
arrowStyle := DefaultArrowStyle. |
751 |
||
128 | 752 |
DefaultArrowButtonActiveLevel notNil ifTrue:[onLevel := DefaultArrowButtonActiveLevel]. |
753 |
DefaultArrowButtonPassiveLevel notNil ifTrue:[offLevel := DefaultArrowButtonPassiveLevel]. |
|
754 |
offLevel ~~ level ifTrue:[self level:offLevel]. |
|
755 |
||
756 |
"/ " |
|
757 |
"/ special treatment for motif arrows |
|
758 |
"/ - they do not really fit into the general (bitmap) scheme ... |
|
759 |
"/ " |
|
760 |
"/ arrowStyle == #motif ifTrue:[ |
|
761 |
"/ onLevel := 0. |
|
762 |
"/ offLevel := 0. |
|
763 |
"/ self level:0. |
|
764 |
"/ ] |
|
966 | 765 |
|
766 |
"Modified: 22.1.1997 / 11:57:00 / cg" |
|
205 | 767 |
! |
768 |
||
769 |
initialize |
|
1105
980fe41d7f0a
assign colorMap AFTER conversion to a device form
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
770 |
|
205 | 771 |
super initialize. |
1105
980fe41d7f0a
assign colorMap AFTER conversion to a device form
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
772 |
hSpace := vSpace := 0. |
205 | 773 |
controller beTriggerOnDown. |
1105
980fe41d7f0a
assign colorMap AFTER conversion to a device form
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
774 |
|
980fe41d7f0a
assign colorMap AFTER conversion to a device form
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
775 |
"Modified: 6.3.1997 / 20:58:49 / cg" |
1 | 776 |
! ! |
777 |
||
6 | 778 |
!ArrowButton methodsFor:'redrawing'! |
779 |
||
780 |
drawWith:fg and:bg |
|
781 |
"this is a q&d hack for motif ..." |
|
782 |
||
1284 | 783 |
|topLeft botRight isString orgX orgY r colors| |
6 | 784 |
|
59 | 785 |
arrowStyle ~~ #motif ifTrue:[ |
765
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
786 |
^ super drawWith:fg and:bg. |
6 | 787 |
]. |
788 |
||
59 | 789 |
" |
790 |
the code below does a lot of bitmap drawing, but allows |
|
791 |
to 3D-ify any logo (it draws it displaced by some pixels |
|
792 |
to the upper left in one-color and displaced to the |
|
60 | 793 |
lower right in the other color). It should be rewritten to |
794 |
cache the result for later drawing operations. |
|
59 | 795 |
" |
6 | 796 |
logo notNil ifTrue:[ |
765
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
797 |
self paint:bg. |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
798 |
self fillRectangleX:0 y:0 width:width height:height. |
6 | 799 |
|
765
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
800 |
shadowColor := shadowColor on:device. |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
801 |
lightColor := lightColor on:device. |
153 | 802 |
|
765
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
803 |
controller pressed ifTrue:[ |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
804 |
topLeft := shadowColor. |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
805 |
botRight := lightColor |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
806 |
] ifFalse:[ |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
807 |
topLeft := lightColor. |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
808 |
botRight := shadowColor |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
809 |
]. |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
810 |
|
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
811 |
isString := logo isString. |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
812 |
|
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
813 |
isString ifFalse:[ |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
814 |
logo depth ~~ 1 ifTrue:[ |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
815 |
"/ allow for deep logos (for motif) |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
816 |
"/ one catch: if the view background is a complex pixmap |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
817 |
"/ we cannot use this as colorMap entry. |
1105
980fe41d7f0a
assign colorMap AFTER conversion to a device form
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
818 |
"/ therefore, compute the average colors and take these |
765
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
819 |
"/ (this looks ok for buttons ...) |
38 | 820 |
|
1137
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
821 |
r := (0@0 corner:10@10). |
1105
980fe41d7f0a
assign colorMap AFTER conversion to a device form
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
822 |
|
1137
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
823 |
colors := (Array with:(bg averageColorIn:r) |
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
824 |
with:(topLeft averageColorIn:r) |
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
825 |
with:(botRight averageColorIn:r) |
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
826 |
with:(fg averageColorIn:r)). |
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
827 |
colors ~= logo colorMap ifTrue:[ |
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
828 |
logo release. |
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
829 |
logo colorMap:colors. |
765
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
830 |
]. |
1137
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
831 |
logo photometric:#palette. |
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
832 |
logo := logo on:device. |
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
833 |
|
765
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
834 |
self displayForm:logo x:labelOriginX y:labelOriginY. |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
835 |
^ self |
1105
980fe41d7f0a
assign colorMap AFTER conversion to a device form
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
836 |
]. |
1430 | 837 |
logo := logo onDevice:device. |
1137
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
838 |
orgX := labelOriginX. |
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
839 |
orgY := labelOriginY. |
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
840 |
] ifTrue:[ |
765
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
841 |
orgY := height - font height // 2 + font ascent. |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
842 |
orgX := width - labelOriginX // 4 - 1. |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
843 |
]. |
1105
980fe41d7f0a
assign colorMap AFTER conversion to a device form
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
844 |
|
765
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
845 |
self paint:topLeft. |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
846 |
#(-1 0 -1) with:#(-1 -1 0) do:[:dX :dY | |
1137
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
847 |
|x y| |
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
848 |
|
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
849 |
x := orgX + dX. |
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
850 |
y := orgY + dY. |
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
851 |
|
765
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
852 |
isString ifTrue:[ |
1137
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
853 |
self displayString:logo x:x y:y. |
765
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
854 |
] ifFalse:[ |
1137
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
855 |
self displayForm:logo x:x y:y. |
765
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
856 |
] |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
857 |
]. |
6 | 858 |
|
765
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
859 |
self paint:botRight. |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
860 |
#(1 1 0) with:#(0 1 1) do:[:dX :dY | |
1137
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
861 |
|x y| |
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
862 |
|
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
863 |
x := orgX + dX. |
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
864 |
y := orgY + dY. |
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
865 |
|
765
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
866 |
isString ifTrue:[ |
1137
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
867 |
self displayString:logo x:x y:y. |
765
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
868 |
] ifFalse:[ |
1137
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
869 |
self displayForm:logo x:x y:y. |
765
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
870 |
] |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
871 |
]. |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
872 |
|
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
873 |
" |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
874 |
finally, the form itself |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
875 |
" |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
876 |
self paint:fg. |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
877 |
isString ifTrue:[ |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
878 |
self displayString:logo x:orgX y:orgY. |
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
879 |
] ifFalse:[ |
1137
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
880 |
self displayForm:logo x:orgX y:orgY. |
765
ea6ecf2a5b30
keep deep device image cached
Claus Gittinger <cg@exept.de>
parents:
657
diff
changeset
|
881 |
] |
6 | 882 |
] |
153 | 883 |
|
884 |
"Modified: 31.8.1995 / 03:03:12 / claus" |
|
1137
5ec9db9453f1
must release cached device image, when topLeft/botRight
Claus Gittinger <cg@exept.de>
parents:
1105
diff
changeset
|
885 |
"Modified: 19.3.1997 / 17:11:22 / cg" |
6 | 886 |
! ! |
205 | 887 |
|
899 | 888 |
!ArrowButton class methodsFor:'documentation'! |
205 | 889 |
|
890 |
version |
|
1455 | 891 |
^ '$Header: /cvs/stx/stx/libwidg/ArrowButton.st,v 1.48 1998-02-25 21:41:54 tz Exp $' |
205 | 892 |
! ! |