Button.st
changeset 4173 63a4957ce918
parent 4128 2fd581e2cf68
child 4179 2859d7731149
equal deleted inserted replaced
4172:432d4d3f5717 4173:63a4957ce918
  2103 
  2103 
  2104 drawWith:fg and:bg
  2104 drawWith:fg and:bg
  2105     "redraw myself with fg/bg. Use super to draw the label, add
  2105     "redraw myself with fg/bg. Use super to draw the label, add
  2106      the return-arrow here."
  2106      the return-arrow here."
  2107 
  2107 
  2108     |x y sColor lColor etchFg savLogo shownLogo isEnabled|
  2108     |x y sColor lColor etchFg shownLogo isEnabled|
  2109 
  2109 
  2110     shown ifFalse:[^ self].
  2110     shown ifFalse:[^ self].
  2111 
  2111 
  2112     isEnabled := self enabled.
  2112     isEnabled := self enabled.
  2113     isEnabled ifFalse:[
  2113     isEnabled ifFalse:[
  2114         etchFg := disabledEtchedFgColor.
  2114         etchFg := disabledEtchedFgColor.
  2115     ].
  2115     ].
  2116 
  2116 
  2117     (controller active or:[controller pressed]) ifTrue:[
  2117     false ifTrue:[
  2118         shownLogo := activeLogo ? enteredLogo ? passiveLogo ? logo. 
  2118         "/ that breaks the checkToggle - it MUST be done elsewhere
  2119     ] ifFalse:[
  2119         "/ never ever change the label from within the redraw method !!!!!!
  2120         shownLogo := passiveLogo ? logo.
  2120         (controller active or:[controller pressed]) ifTrue:[
  2121         (enteredLogo notNil and:[controller entered]) ifTrue:[
  2121             shownLogo := activeLogo ? enteredLogo ? passiveLogo ? logo. 
  2122             shownLogo := enteredLogo.
  2122         ] ifFalse:[
       
  2123             shownLogo := passiveLogo ? logo.
       
  2124             (enteredLogo notNil and:[controller entered]) ifTrue:[
       
  2125                 shownLogo := enteredLogo.
       
  2126             ].
  2123         ].
  2127         ].
  2124     ].
  2128         (disabledLogo notNil and:[isEnabled not]) ifTrue:[
  2125     (disabledLogo notNil and:[isEnabled not]) ifTrue:[
  2129             shownLogo := disabledLogo.
  2126         shownLogo := disabledLogo.
  2130         ].
  2127     ].
  2131         shownLogo ~= logo ifTrue:[
  2128     shownLogo ~= logo ifTrue:[
  2132             self label:shownLogo redraw:false.
  2129         self label:shownLogo.
  2133         ].
  2130     ].
  2134     ].
  2131 
  2135 
  2132     self drawWith:fg and:bg clearInside:true etchedFg:etchFg.   "this draws the text/image"
  2136     self drawWith:fg and:bg clearInside:true etchedFg:etchFg.   "this draws the text/image"
  2133 
  2137 
  2134     (isReturnButton and:[shadowForm notNil]) ifTrue:[
  2138     (isReturnButton and:[shadowForm notNil]) ifTrue:[
  2176                 self drawWin95FocusFrame
  2180                 self drawWin95FocusFrame
  2177             ]
  2181             ]
  2178         ].
  2182         ].
  2179     ]
  2183     ]
  2180 
  2184 
  2181     "Modified: / 18.9.1998 / 16:55:38 / cg"
  2185     "Modified: / 13-10-2010 / 12:43:52 / cg"
  2182 !
  2186 !
  2183 
  2187 
  2184 redraw
  2188 redraw
  2185     "redraw the button. 
  2189     "redraw the button. 
  2186      Thats like redrawing a label, but use different colors when pressed
  2190      Thats like redrawing a label, but use different colors when pressed
  2308 ! !
  2312 ! !
  2309 
  2313 
  2310 !Button class methodsFor:'documentation'!
  2314 !Button class methodsFor:'documentation'!
  2311 
  2315 
  2312 version
  2316 version
  2313     ^ '$Header: /cvs/stx/stx/libwidg/Button.st,v 1.149 2009-12-07 14:58:09 cg Exp $'
  2317     ^ '$Header: /cvs/stx/stx/libwidg/Button.st,v 1.150 2010-10-13 10:44:34 cg Exp $'
  2314 !
  2318 !
  2315 
  2319 
  2316 version_CVS
  2320 version_CVS
  2317     ^ '$Header: /cvs/stx/stx/libwidg/Button.st,v 1.149 2009-12-07 14:58:09 cg Exp $'
  2321     ^ '$Header: /cvs/stx/stx/libwidg/Button.st,v 1.150 2010-10-13 10:44:34 cg Exp $'
  2318 ! !
  2322 ! !