LinkButton.st
changeset 3668 e1888e938d68
parent 3666 4a4e9dae4017
child 3670 ccfd04be9736
equal deleted inserted replaced
3667:acb358ca4b0b 3668:e1888e938d68
    32 
    32 
    33     v := StandardSystemView new.
    33     v := StandardSystemView new.
    34     l := LinkButton in:v.
    34     l := LinkButton in:v.
    35     l labelsAndActions:{ 
    35     l labelsAndActions:{ 
    36                         'Hello' -> [ Transcript showCR:'Hello Clicked'].
    36                         'Hello' -> [ Transcript showCR:'Hello Clicked'].
       
    37                         ' ' -> nil.
       
    38                         'World' -> [ Transcript showCR:'World Clicked'].
       
    39                        }.
       
    40     l foregroundColor:Color blue.
       
    41     v open
       
    42 
       
    43 
       
    44     |v l|
       
    45 
       
    46     v := StandardSystemView new.
       
    47     l := LinkButton in:v.
       
    48     l labelsAndActions:{ 
       
    49                         'Hello' -> nil.
    37                         ' ' -> nil.
    50                         ' ' -> nil.
    38                         'World' -> [ Transcript showCR:'World Clicked'].
    51                         'World' -> [ Transcript showCR:'World Clicked'].
    39                        }.
    52                        }.
    40     l foregroundColor:Color blue.
    53     l foregroundColor:Color blue.
    41     v open
    54     v open
    88     activeBgColor := enteredBgColor := viewBackground.
   101     activeBgColor := enteredBgColor := viewBackground.
    89 !
   102 !
    90 
   103 
    91 initialize
   104 initialize
    92     super initialize.
   105     super initialize.
    93     adjust := #left.
   106     "/ adjust := #left.
    94     self enableMotionEvents
   107     self enableMotionEvents
    95 ! !
   108 ! !
    96 
   109 
    97 !LinkButton methodsFor:'redrawing'!
   110 !LinkButton methodsFor:'redrawing'!
    98 
   111 
   116     mousePoint := controller lastMousePoint.
   129     mousePoint := controller lastMousePoint.
   117     entered := controller entered.
   130     entered := controller entered.
   118 
   131 
   119     self labelsAndActionsWithPositionsDo:[:lbl :action :leftX :rightX |
   132     self labelsAndActionsWithPositionsDo:[:lbl :action :leftX :rightX |
   120         |l|
   133         |l|
       
   134 
   121         l := lbl.
   135         l := lbl.
   122         (entered and:[mousePoint notNil and:[mousePoint x between:leftX and:rightX]]) ifTrue:[
   136         action notNil ifTrue:[
   123             l := l allUnderlined
   137             (entered and:[mousePoint notNil and:[mousePoint x between:leftX and:rightX]]) ifTrue:[
       
   138                 l := l allUnderlined
       
   139             ].
   124         ].
   140         ].
   125         self displayString:l x:leftX y:y.
   141         self displayString:l x:leftX y:y.
   126     ].
   142     ].
   127 !
   143 !
   128 
   144 
   159 ! !
   175 ! !
   160 
   176 
   161 !LinkButton class methodsFor:'documentation'!
   177 !LinkButton class methodsFor:'documentation'!
   162 
   178 
   163 version
   179 version
   164     ^ '$Header: /cvs/stx/stx/libwidg2/LinkButton.st,v 1.4 2009-03-13 13:57:48 stefan Exp $'
   180     ^ '$Header: /cvs/stx/stx/libwidg2/LinkButton.st,v 1.5 2009-03-13 18:15:27 cg Exp $'
   165 ! !
   181 ! !