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