LinkButton.st
changeset 4508 5c8959e41aa6
parent 4071 d056c9f9b595
child 4572 612d49704e0f
equal deleted inserted replaced
4507:3235f9b064d5 4508:5c8959e41aa6
    36     l label:
    36     l label:
    37         (('Hello' actionForAll:[ Transcript showCR:'Hello Clicked']) 
    37         (('Hello' actionForAll:[ Transcript showCR:'Hello Clicked']) 
    38         , ' '
    38         , ' '
    39         , ('World' actionForAll:[ Transcript showCR:'World Clicked'])).
    39         , ('World' actionForAll:[ Transcript showCR:'World Clicked'])).
    40 
    40 
    41     l foregroundColor:Color blue.
       
    42     v open
    41     v open
    43                                                                     [exEnd]
    42                                                                     [exEnd]
    44 
    43 
    45 
    44 
    46                                                                     [exBegin]
    45                                                                     [exBegin]
   126 initStyle
   125 initStyle
   127     super initStyle.
   126     super initStyle.
   128 
   127 
   129     level := enterLevel := leaveLevel := onLevel := offLevel := 0.
   128     level := enterLevel := leaveLevel := onLevel := offLevel := 0.
   130     DefaultLinkColor notNil ifTrue:[
   129     DefaultLinkColor notNil ifTrue:[
   131         foreground := DefaultLinkColor onDevice:device.
   130         |color|
       
   131         self paint:(color := DefaultLinkColor onDevice:self graphicsDevice).
       
   132         self foreground:color.
   132     ].
   133     ].
   133     enteredFgColor := nil. "/ Color blue.
   134     enteredFgColor := nil. "/ Color blue.
   134 
   135 
   135 "/    activeFgColor := enteredFgColor := foreground.
   136 "/    activeFgColor := enteredFgColor := foreground.
   136 "/    activeBgColor := enteredBgColor := viewBackground.
   137 "/    activeBgColor := enteredBgColor := viewBackground.
   263 labelsAndActionsWithPositionsDo:aFourArgBlock
   264 labelsAndActionsWithPositionsDo:aFourArgBlock
   264     |leftX rightX w|
   265     |leftX rightX w|
   265 
   266 
   266     leftX := labelOriginX.
   267     leftX := labelOriginX.
   267     labelsAndActions isNil ifTrue:[
   268     labelsAndActions isNil ifTrue:[
   268         w := (self font widthOf:logo on:device).
   269         w := (self font widthOf:logo on:self graphicsDevice).
   269         rightX := leftX + w-1.
   270         rightX := leftX + w-1.
   270         aFourArgBlock 
   271         aFourArgBlock 
   271             value:logo
   272             value:logo
   272             value:self pressAction
   273             value:self pressAction
   273             value:leftX
   274             value:leftX
   277 
   278 
   278     labelsAndActions do:[:assoc | 
   279     labelsAndActions do:[:assoc | 
   279         |lbl wEach|
   280         |lbl wEach|
   280 
   281 
   281         lbl := assoc key.
   282         lbl := assoc key.
   282         wEach := (self font widthOf:lbl on:device).
   283         wEach := (self font widthOf:lbl on:self graphicsDevice).
   283         rightX := leftX + wEach-1.
   284         rightX := leftX + wEach-1.
   284         aFourArgBlock 
   285         aFourArgBlock 
   285             value:assoc key
   286             value:assoc key
   286             value:assoc value
   287             value:assoc value
   287             value:leftX
   288             value:leftX
   293 ! !
   294 ! !
   294 
   295 
   295 !LinkButton class methodsFor:'documentation'!
   296 !LinkButton class methodsFor:'documentation'!
   296 
   297 
   297 version
   298 version
   298     ^ '$Header: /cvs/stx/stx/libwidg2/LinkButton.st,v 1.8 2011-09-07 02:47:27 cg Exp $'
   299     ^ '$Header: /cvs/stx/stx/libwidg2/LinkButton.st,v 1.9 2014-02-18 14:48:35 stefan Exp $'
   299 ! !
   300 ! !
       
   301