LinkButton.st
changeset 5111 ce09771c85a9
parent 5110 dd99c089bf65
child 5115 a12ef0cc7ce0
child 5478 ac5fa8f12f47
equal deleted inserted replaced
5110:dd99c089bf65 5111:ce09771c85a9
   112 ! !
   112 ! !
   113 
   113 
   114 !LinkButton methodsFor:'accessing'!
   114 !LinkButton methodsFor:'accessing'!
   115 
   115 
   116 actionAt:aPoint
   116 actionAt:aPoint
   117     |pressAction emphasis|
   117     |pressAction emphasis pointInLabel|
   118 
   118 
   119     pressAction := self pressAction ifNil:[ self releaseAction ].
   119     pressAction := self pressAction ifNil:[ self releaseAction ].
   120     pressAction isNil ifTrue:[
   120     pressAction isNil ifTrue:[
   121         pressAction := self pressChannel ifNil:[ self releaseChannel ].
   121         pressAction := self pressChannel ifNil:[ self releaseChannel ].
   122     ].
   122     ].
   123     labelsAndActions isNil ifTrue:[
   123     labelsAndActions isNil ifTrue:[
   124         "take action from logo, which is normally a text with an action-emphasis"
   124         "take action from logo, which is normally a text with an action-emphasis"
   125         logo notNil ifTrue:[
   125         logo notNil ifTrue:[
   126             emphasis := logo emphasisAtPoint:(aPoint - (labelOriginX@labelOriginY)) on:self. 
   126             pointInLabel := (aPoint - (labelOriginX@labelOriginY)).
       
   127             logo isStringCollection ifTrue:[
       
   128                 |lineIndex line pointInLine|
       
   129 
       
   130                 lineIndex := (pointInLabel y // self font height) + 1.
       
   131                 line := logo at:lineIndex ifAbsent:nil.
       
   132                 line notNil ifTrue:[
       
   133                     pointInLine := pointInLabel - (0 @ ((lineIndex - 1) * self font height)).
       
   134                     emphasis := line emphasisAtPoint:pointInLine on:self. 
       
   135                 ].    
       
   136             ] ifFalse:[    
       
   137                 emphasis := logo emphasisAtPoint:pointInLabel on:self. 
       
   138             ].
   127             (emphasis isNil or:[emphasis isSymbol]) ifTrue:[
   139             (emphasis isNil or:[emphasis isSymbol]) ifTrue:[
   128                 ^ pressAction.
   140                 ^ pressAction.
   129             ].
   141             ].
   130             emphasis isAssociation ifTrue:[
   142             emphasis isAssociation ifTrue:[
   131                 emphasis key == #actionBlock ifTrue:[
   143                 emphasis key == #actionBlock ifTrue:[