author | Claus Gittinger <cg@exept.de> |
Tue, 02 Dec 2014 19:35:56 +0100 | |
changeset 4681 | b97620c35200 |
parent 4680 | 6c266588d588 |
child 4770 | 6634b540fea2 |
child 4985 | 818d298db0df |
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 |
||
4677 | 121 |
allViewBackground:something if:condition |
122 |
"set the viewBackground to something, a color, image or form, |
|
123 |
in myself and recursively in all of my subviews" |
|
124 |
||
125 |
self viewBackground:something if:condition. |
|
126 |
self backgroundColor:something. |
|
127 |
! |
|
128 |
||
3650 | 129 |
defaultControllerClass |
130 |
^ LinkButtonController |
|
3662 | 131 |
! |
132 |
||
133 |
initStyle |
|
134 |
super initStyle. |
|
135 |
||
136 |
level := enterLevel := leaveLevel := onLevel := offLevel := 0. |
|
4681 | 137 |
self borderWidth: 0. |
3662 | 138 |
DefaultLinkColor notNil ifTrue:[ |
4508 | 139 |
|color| |
140 |
self paint:(color := DefaultLinkColor onDevice:self graphicsDevice). |
|
141 |
self foreground:color. |
|
3662 | 142 |
]. |
4681 | 143 |
enteredFgColor := nil. |
144 |
enteredBgColor := nil. |
|
4071 | 145 |
|
3670
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
146 |
"/ activeFgColor := enteredFgColor := foreground. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
147 |
"/ activeBgColor := enteredBgColor := viewBackground. |
4071 | 148 |
|
149 |
"Modified: / 07-09-2011 / 04:29:29 / cg" |
|
3662 | 150 |
! |
151 |
||
152 |
initialize |
|
153 |
super initialize. |
|
154 |
self enableMotionEvents |
|
155 |
! ! |
|
156 |
||
157 |
!LinkButton methodsFor:'redrawing'! |
|
158 |
||
159 |
actionAt:aPoint |
|
3670
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
160 |
|pressAction emphasis| |
3664 | 161 |
|
4572 | 162 |
pressAction := self pressAction ifNil:[ self releaseAction ]. |
163 |
pressAction isNil ifTrue:[ |
|
164 |
pressAction := self pressChannel ifNil:[ self releaseChannel ]. |
|
165 |
]. |
|
3670
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
166 |
labelsAndActions isNil ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
167 |
"take action from logo, which is normally a text" |
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 := logo emphasisAtPoint:aPoint on:self. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
170 |
(emphasis isNil or:[emphasis isSymbol]) ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
171 |
^ pressAction. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
172 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
173 |
emphasis isAssociation ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
174 |
emphasis key == #actionBlock ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
175 |
^ emphasis value. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
176 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
177 |
^ pressAction. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
178 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
179 |
emphasis do:[:eachElement| |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
180 |
eachElement isAssociation ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
181 |
eachElement key == #actionBlock ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
182 |
^ eachElement value. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
183 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
184 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
185 |
]. |
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 |
|
3662 | 189 |
self labelsAndActionsWithPositionsDo:[:lbl :action :leftX :rightX | |
190 |
(aPoint x between:leftX and:rightX) ifTrue:[ |
|
3664 | 191 |
^ labelsAndActions notNil ifTrue:action ifFalse:pressAction |
3662 | 192 |
]. |
193 |
]. |
|
194 |
^ nil |
|
195 |
! |
|
196 |
||
3670
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
197 |
actionEmphasisIn:aText atPoint:aPoint |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
198 |
"check for a actionBlock emphasis in aString at aPoint. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
199 |
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
|
200 |
or nil" |
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 |
|emphasis| |
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 := aText emphasisAtPoint:aPoint on:self. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
205 |
(emphasis isNil or:[emphasis isSymbol]) ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
206 |
^ #(nil nil). |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
207 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
208 |
emphasis isAssociation ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
209 |
emphasis key == #actionBlock ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
210 |
^ Array with:emphasis with:emphasis value. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
211 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
212 |
^ #(nil nil). |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
213 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
214 |
emphasis detect:[:eachElement| |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
215 |
eachElement isAssociation ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
216 |
eachElement key == #actionBlock ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
217 |
^ Array with:emphasis with:eachElement value. |
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 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
220 |
] ifNone:[]. |
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 |
|
4680 | 224 |
drawFocusFrame |
225 |
"/ intentionally ignored |
|
226 |
^ self |
|
227 |
! |
|
228 |
||
3662 | 229 |
drawStringLogo:aString x:x y:y |
230 |
"redefined to draw the part under the mouse pointer with an underined emphasis" |
|
231 |
||
3670
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
232 |
|str entered mousePoint start len emphasis| |
3662 | 233 |
|
234 |
mousePoint := controller lastMousePoint. |
|
235 |
entered := controller entered. |
|
236 |
||
3670
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
237 |
labelsAndActions isNil ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
238 |
(entered not or:[mousePoint isNil]) ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
239 |
self displayString:aString x:x y:y. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
240 |
^ self. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
241 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
242 |
|
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
243 |
str := aString. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
244 |
emphasis := (self actionEmphasisIn:aString atPoint:mousePoint) first. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
245 |
emphasis notNil ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
246 |
start := 1. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
247 |
aString emphasisCollection runsDo:[:eachLen :eachEmphasis| |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
248 |
len isNil ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
249 |
eachEmphasis == emphasis ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
250 |
len := eachLen. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
251 |
] ifFalse:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
252 |
start := start + eachLen. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
253 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
254 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
255 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
256 |
len notNil ifTrue:[ |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
257 |
str := str deepCopy. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
258 |
str emphasisFrom:start to:start+len-1 add:#underline. |
4071 | 259 |
"/ 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
|
260 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
261 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
262 |
self displayString:str x:x y:y. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
263 |
^ self. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
264 |
]. |
ccfd04be9736
Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents:
3668
diff
changeset
|
265 |
|
3662 | 266 |
self labelsAndActionsWithPositionsDo:[:lbl :action :leftX :rightX | |
267 |
|l| |
|
3668 | 268 |
|
3662 | 269 |
l := lbl. |
3668 | 270 |
action notNil ifTrue:[ |
271 |
(entered and:[mousePoint notNil and:[mousePoint x between:leftX and:rightX]]) ifTrue:[ |
|
272 |
l := l allUnderlined |
|
273 |
]. |
|
3662 | 274 |
]. |
275 |
self displayString:l x:leftX y:y. |
|
276 |
]. |
|
4071 | 277 |
|
278 |
"Modified: / 07-09-2011 / 04:47:13 / cg" |
|
3662 | 279 |
! |
280 |
||
4681 | 281 |
is3D |
282 |
^ false. |
|
283 |
! |
|
284 |
||
3662 | 285 |
labelsAndActionsWithPositionsDo:aFourArgBlock |
3664 | 286 |
|leftX rightX w| |
3662 | 287 |
|
288 |
leftX := labelOriginX. |
|
3664 | 289 |
labelsAndActions isNil ifTrue:[ |
4508 | 290 |
w := (self font widthOf:logo on:self graphicsDevice). |
3664 | 291 |
rightX := leftX + w-1. |
292 |
aFourArgBlock |
|
293 |
value:logo |
|
294 |
value:self pressAction |
|
295 |
value:leftX |
|
296 |
value:rightX. |
|
297 |
^ self |
|
298 |
]. |
|
299 |
||
3662 | 300 |
labelsAndActions do:[:assoc | |
301 |
|lbl wEach| |
|
302 |
||
303 |
lbl := assoc key. |
|
4508 | 304 |
wEach := (self font widthOf:lbl on:self graphicsDevice). |
3662 | 305 |
rightX := leftX + wEach-1. |
306 |
aFourArgBlock |
|
307 |
value:assoc key |
|
308 |
value:assoc value |
|
309 |
value:leftX |
|
310 |
value:rightX. |
|
311 |
||
312 |
leftX := rightX+1. |
|
313 |
]. |
|
314 |
^ nil |
|
3650 | 315 |
! ! |
316 |
||
317 |
!LinkButton class methodsFor:'documentation'! |
|
318 |
||
319 |
version |
|
4681 | 320 |
^ '$Header: /cvs/stx/stx/libwidg2/LinkButton.st,v 1.13 2014-12-02 18:35:56 cg Exp $' |
321 |
! |
|
322 |
||
323 |
version_CVS |
|
324 |
^ '$Header: /cvs/stx/stx/libwidg2/LinkButton.st,v 1.13 2014-12-02 18:35:56 cg Exp $' |
|
3650 | 325 |
! ! |
4508 | 326 |