author | Claus Gittinger <cg@exept.de> |
Sat, 02 Apr 2016 16:33:18 +0200 | |
changeset 4987 | 82bb0a9fecdb |
parent 4985 | 818d298db0df |
child 5011 | 46de83b69b3d |
child 5045 | 50eb267766b2 |
permissions | -rw-r--r-- |
4985 | 1 |
"{ Encoding: utf8 }" |
2 |
||
3650 | 3 |
"{ Package: 'stx:libwidg2' }" |
4 |
||
4985 | 5 |
"{ NameSpace: Smalltalk }" |
6 |
||
3650 | 7 |
Button subclass:#LinkButton |
3670
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
8 |
instanceVariableNames:'labelsAndActions' |
3662 | 9 |
classVariableNames:'DefaultLinkColor' |
3650 | 10 |
poolDictionaries:'' |
11 |
category:'Views-Layout' |
|
12 |
! |
|
13 |
||
14 |
!LinkButton class methodsFor:'documentation'! |
|
15 |
||
16 |
documentation |
|
17 |
" |
|
18 |
Looks like a Label, but behaves like a button with individually clickable text components. |
|
4071 | 19 |
Can be used to create html-page-look-alike links in a view. |
3650 | 20 |
|
21 |
[author:] |
|
22 |
cg (cg@CG-VOSTRO) |
|
23 |
||
24 |
[instance variables:] |
|
25 |
||
26 |
[class variables:] |
|
27 |
||
28 |
[see also:] |
|
29 |
||
30 |
" |
|
31 |
! |
|
32 |
||
33 |
examples |
|
34 |
" |
|
4071 | 35 |
[exBegin] |
3650 | 36 |
|v l| |
37 |
||
38 |
v := StandardSystemView new. |
|
39 |
l := LinkButton in:v. |
|
3670
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
40 |
l label: |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
41 |
(('Hello' actionForAll:[ Transcript showCR:'Hello Clicked']) |
4071 | 42 |
, ' ' |
3670
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
43 |
, ('World' actionForAll:[ Transcript showCR:'World Clicked'])). |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
44 |
|
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
45 |
v open |
4071 | 46 |
[exEnd] |
3670
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
47 |
|
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
48 |
|
4071 | 49 |
[exBegin] |
50 |
|v l| |
|
51 |
||
52 |
v := StandardSystemView new. |
|
53 |
l := LinkButton in:v. |
|
54 |
l label: |
|
55 |
((('Hello' actionForAll:[ Transcript showCR:'Hello Clicked']) colorizeAllWith:(Color blue)) |
|
56 |
, ' ' |
|
57 |
, ('World' actionForAll:[ Transcript showCR:'World Clicked'])). |
|
58 |
||
59 |
v open |
|
60 |
[exEnd] |
|
61 |
||
62 |
||
63 |
[exBegin] |
|
3670
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
64 |
|v l| |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
65 |
|
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
66 |
v := StandardSystemView new. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
67 |
l := LinkButton in:v. |
3650 | 68 |
l labelsAndActions:{ |
3662 | 69 |
'Hello' -> [ Transcript showCR:'Hello Clicked']. |
3650 | 70 |
' ' -> nil. |
3662 | 71 |
'World' -> [ Transcript showCR:'World Clicked']. |
3650 | 72 |
}. |
73 |
l foregroundColor:Color blue. |
|
74 |
v open |
|
4071 | 75 |
[exEnd] |
3668 | 76 |
|
77 |
||
4071 | 78 |
[exBegin] |
3668 | 79 |
|v l| |
80 |
||
81 |
v := StandardSystemView new. |
|
82 |
l := LinkButton in:v. |
|
83 |
l labelsAndActions:{ |
|
84 |
'Hello' -> nil. |
|
85 |
' ' -> nil. |
|
86 |
'World' -> [ Transcript showCR:'World Clicked']. |
|
87 |
}. |
|
88 |
l foregroundColor:Color blue. |
|
89 |
v open |
|
4071 | 90 |
[exEnd] |
4985 | 91 |
Dialog aboutToOpenBoxNotificationSignal handle:[:ex | |
92 |
|lbl| |
|
93 |
||
94 |
lbl := LinkButton label:(('XXX' |
|
95 |
colorizeAllWith:Color blue) |
|
96 |
actionForAll:[ Transcript showCR:'xxx' ]). |
|
97 |
ex box verticalPanel addComponent:lbl. |
|
98 |
] do:[ |
|
99 |
self warn:'Bla bla bla' |
|
100 |
]. |
|
101 |
||
3650 | 102 |
" |
103 |
! ! |
|
104 |
||
3662 | 105 |
!LinkButton class methodsFor:'defaults'! |
106 |
||
107 |
updateStyleCache |
|
108 |
"extract values from the styleSheet and cache them in class variables" |
|
109 |
||
110 |
<resource: #style ( #'linkButton.linkColor' )> |
|
111 |
||
112 |
DefaultLinkColor := StyleSheet colorAt:#'linkButton.linkColor' default:Color blue. |
|
113 |
! ! |
|
114 |
||
3650 | 115 |
!LinkButton methodsFor:'accessing'! |
116 |
||
117 |
labelsAndActions |
|
118 |
"returns the collection of label->action associations. |
|
119 |
For display, the label strings are drawn as one concatenated string (add separating spaces, if you have to). |
|
120 |
When clicked on a string, the corresponding action is called" |
|
121 |
||
122 |
^ labelsAndActions |
|
123 |
! |
|
124 |
||
125 |
labelsAndActions:aCollectionOfAssociations |
|
126 |
"set the collection of label->action associations. |
|
127 |
For display, the label strings are drawn as one concatenated string (add separating spaces, if you have to). |
|
128 |
When clicked on a string, the corresponding action is called" |
|
129 |
||
130 |
labelsAndActions := aCollectionOfAssociations. |
|
131 |
self label:((aCollectionOfAssociations collect:[:assoc | assoc key]) asStringWith:'') |
|
132 |
! ! |
|
133 |
||
134 |
!LinkButton methodsFor:'initialization'! |
|
135 |
||
4677 | 136 |
allViewBackground:something if:condition |
137 |
"set the viewBackground to something, a color, image or form, |
|
138 |
in myself and recursively in all of my subviews" |
|
139 |
||
140 |
self viewBackground:something if:condition. |
|
141 |
self backgroundColor:something. |
|
142 |
! |
|
143 |
||
3650 | 144 |
defaultControllerClass |
145 |
^ LinkButtonController |
|
3662 | 146 |
! |
147 |
||
148 |
initStyle |
|
149 |
super initStyle. |
|
150 |
||
151 |
level := enterLevel := leaveLevel := onLevel := offLevel := 0. |
|
4681 | 152 |
self borderWidth: 0. |
3662 | 153 |
DefaultLinkColor notNil ifTrue:[ |
4508 | 154 |
|color| |
4987 | 155 |
self paint:(color := DefaultLinkColor onDevice:device). |
4508 | 156 |
self foreground:color. |
3662 | 157 |
]. |
4681 | 158 |
enteredFgColor := nil. |
159 |
enteredBgColor := nil. |
|
4071 | 160 |
|
3670
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
161 |
"/ activeFgColor := enteredFgColor := foreground. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
162 |
"/ activeBgColor := enteredBgColor := viewBackground. |
4071 | 163 |
|
164 |
"Modified: / 07-09-2011 / 04:29:29 / cg" |
|
3662 | 165 |
! |
166 |
||
167 |
initialize |
|
168 |
super initialize. |
|
169 |
self enableMotionEvents |
|
170 |
! ! |
|
171 |
||
172 |
!LinkButton methodsFor:'redrawing'! |
|
173 |
||
174 |
actionAt:aPoint |
|
3670
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
175 |
|pressAction emphasis| |
3664 | 176 |
|
4572 | 177 |
pressAction := self pressAction ifNil:[ self releaseAction ]. |
178 |
pressAction isNil ifTrue:[ |
|
179 |
pressAction := self pressChannel ifNil:[ self releaseChannel ]. |
|
180 |
]. |
|
3670
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
181 |
labelsAndActions isNil ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
182 |
"take action from logo, which is normally a text" |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
183 |
|
4985 | 184 |
emphasis := logo emphasisAtPoint:(aPoint - (labelOriginX@labelOriginY)) on:self. |
3670
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
185 |
(emphasis isNil or:[emphasis isSymbol]) ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
186 |
^ pressAction. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
187 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
188 |
emphasis isAssociation ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
189 |
emphasis key == #actionBlock ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
190 |
^ emphasis value. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
191 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
192 |
^ pressAction. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
193 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
194 |
emphasis do:[:eachElement| |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
195 |
eachElement isAssociation ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
196 |
eachElement key == #actionBlock ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
197 |
^ eachElement value. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
198 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
199 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
200 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
201 |
^ pressAction. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
202 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
203 |
|
3662 | 204 |
self labelsAndActionsWithPositionsDo:[:lbl :action :leftX :rightX | |
205 |
(aPoint x between:leftX and:rightX) ifTrue:[ |
|
3664 | 206 |
^ labelsAndActions notNil ifTrue:action ifFalse:pressAction |
3662 | 207 |
]. |
208 |
]. |
|
209 |
^ nil |
|
210 |
! |
|
211 |
||
3670
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
212 |
actionEmphasisIn:aText atPoint:aPoint |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
213 |
"check for a actionBlock emphasis in aString at aPoint. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
214 |
Answer an Array with the whole emphasis and the actionBlock, |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
215 |
or nil" |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
216 |
|
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
217 |
|emphasis| |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
218 |
|
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
219 |
emphasis := aText emphasisAtPoint:aPoint on:self. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
220 |
(emphasis isNil or:[emphasis isSymbol]) ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
221 |
^ #(nil nil). |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
222 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
223 |
emphasis isAssociation ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
224 |
emphasis key == #actionBlock ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
225 |
^ Array with:emphasis with:emphasis value. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
226 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
227 |
^ #(nil nil). |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
228 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
229 |
emphasis detect:[:eachElement| |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
230 |
eachElement isAssociation ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
231 |
eachElement key == #actionBlock ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
232 |
^ Array with:emphasis with:eachElement value. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
233 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
234 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
235 |
] ifNone:[]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
236 |
^ #(nil nil). |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
237 |
! |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
238 |
|
4680 | 239 |
drawFocusFrame |
240 |
"/ intentionally ignored |
|
241 |
^ self |
|
242 |
! |
|
243 |
||
3662 | 244 |
drawStringLogo:aString x:x y:y |
245 |
"redefined to draw the part under the mouse pointer with an underined emphasis" |
|
246 |
||
3670
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
247 |
|str entered mousePoint start len emphasis| |
3662 | 248 |
|
249 |
mousePoint := controller lastMousePoint. |
|
250 |
entered := controller entered. |
|
251 |
||
3670
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
252 |
labelsAndActions isNil ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
253 |
(entered not or:[mousePoint isNil]) ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
254 |
self displayString:aString x:x y:y. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
255 |
^ self. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
256 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
257 |
|
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
258 |
str := aString. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
259 |
emphasis := (self actionEmphasisIn:aString atPoint:mousePoint) first. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
260 |
emphasis notNil ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
261 |
start := 1. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
262 |
aString emphasisCollection runsDo:[:eachLen :eachEmphasis| |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
263 |
len isNil ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
264 |
eachEmphasis == emphasis ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
265 |
len := eachLen. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
266 |
] ifFalse:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
267 |
start := start + eachLen. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
268 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
269 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
270 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
271 |
len notNil ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
272 |
str := str deepCopy. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
273 |
str emphasisFrom:start to:start+len-1 add:#underline. |
4071 | 274 |
"/ str emphasisFrom:start to:start+len-1 add:(#color -> foreground). |
3670
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
275 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
276 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
277 |
self displayString:str x:x y:y. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
278 |
^ self. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
279 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
280 |
|
3662 | 281 |
self labelsAndActionsWithPositionsDo:[:lbl :action :leftX :rightX | |
282 |
|l| |
|
3668 | 283 |
|
3662 | 284 |
l := lbl. |
3668 | 285 |
action notNil ifTrue:[ |
286 |
(entered and:[mousePoint notNil and:[mousePoint x between:leftX and:rightX]]) ifTrue:[ |
|
287 |
l := l allUnderlined |
|
288 |
]. |
|
3662 | 289 |
]. |
290 |
self displayString:l x:leftX y:y. |
|
291 |
]. |
|
4071 | 292 |
|
293 |
"Modified: / 07-09-2011 / 04:47:13 / cg" |
|
3662 | 294 |
! |
295 |
||
4681 | 296 |
is3D |
297 |
^ false. |
|
298 |
! |
|
299 |
||
3662 | 300 |
labelsAndActionsWithPositionsDo:aFourArgBlock |
3664 | 301 |
|leftX rightX w| |
3662 | 302 |
|
303 |
leftX := labelOriginX. |
|
3664 | 304 |
labelsAndActions isNil ifTrue:[ |
4987 | 305 |
w := (self font widthOf:logo on:device). |
3664 | 306 |
rightX := leftX + w-1. |
307 |
aFourArgBlock |
|
308 |
value:logo |
|
309 |
value:self pressAction |
|
310 |
value:leftX |
|
311 |
value:rightX. |
|
312 |
^ self |
|
313 |
]. |
|
314 |
||
3662 | 315 |
labelsAndActions do:[:assoc | |
316 |
|lbl wEach| |
|
317 |
||
318 |
lbl := assoc key. |
|
4987 | 319 |
wEach := (self font widthOf:lbl on:device). |
3662 | 320 |
rightX := leftX + wEach-1. |
321 |
aFourArgBlock |
|
322 |
value:assoc key |
|
323 |
value:assoc value |
|
324 |
value:leftX |
|
325 |
value:rightX. |
|
326 |
||
327 |
leftX := rightX+1. |
|
328 |
]. |
|
329 |
^ nil |
|
3650 | 330 |
! ! |
331 |
||
332 |
!LinkButton class methodsFor:'documentation'! |
|
333 |
||
334 |
version |
|
4985 | 335 |
^ '$Header$' |
4681 | 336 |
! |
337 |
||
338 |
version_CVS |
|
4985 | 339 |
^ '$Header$' |
3650 | 340 |
! ! |
4508 | 341 |